From d6b22c772d202e1beb0e1f440bead7e92b40c48f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 16 Feb 2017 19:24:41 +0800 Subject: [PATCH 1/9] REPORT-1899 --- .../adapters/layout/FRBodyLayoutAdapter.java | 298 ++++++++++-------- .../layout/FRTabFitLayoutAdapter.java | 120 +++---- 2 files changed, 227 insertions(+), 191 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java index 313c08b02..dc1fb7d36 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java @@ -2,6 +2,7 @@ package com.fr.design.designer.beans.adapters.layout; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.PaddingMargin; @@ -17,7 +18,7 @@ import java.util.*; * 所以把公共的方法挪动这边父类里来 * Created by zhouping on 2016/8/18. */ -public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ +public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { protected static final int COMP_TOP = 1; protected static final int COMP_BOTTOM = 2; protected static final int COMP_LEFT = 3; @@ -49,6 +50,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ protected int minHeight = 0; protected int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 protected PaddingMargin margin; // 布局容器边距 + /** * 在添加组件状态时,当鼠标移动到某个容器上方时,如果该容器有布局管理器,则会调用该布局 * 管理适配器的accept来决定当前位置是否可以放置,并提供特殊的标识,比如红色区域标识。比 @@ -76,9 +78,10 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ /** * 交叉点区域时,能否对应位置放入组件 + * * @param comp 待放置组件 - * @param x x - * @param y y + * @param x x + * @param y y * @return 能否放入 */ protected boolean canAcceptWhileCrossPoint(Component comp, int x, int y) { @@ -95,7 +98,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ min = isNotDefaultArea ? min : minWidth * 2; } else if (ComparatorUtils.equals(crossPointAreaDirect, COMP_RIGHT_BOTTOM)) { bottomComp = container.getRightBottomComp(cX, cY, cH, cW); - isNotDefaultArea = (bottomComp == null) || (bottomComp.getX()+bottomComp.getWidth() != cX + cW) ; + isNotDefaultArea = (bottomComp == null) || (bottomComp.getX() + bottomComp.getWidth() != cX + cW); rightComp = container.getBottomRightComp(cX, cY, cH, cW); minLength = isNotDefaultArea ? Math.min(cH, rightComp.getHeight()) : Math.min(cW, bottomComp.getWidth()); min = isNotDefaultArea ? min : minWidth * 2; @@ -105,12 +108,12 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ minLength = isNotDefaultArea ? Math.min(cW, bottomComp.getWidth()) : Math.min(cH, leftComp.getHeight()); min = isNotDefaultArea ? minWidth * 2 : min; } else if (ComparatorUtils.equals(crossPointAreaDirect, COMP_RIGHT_TOP)) { - isNotDefaultArea = (rightComp == null) || (rightComp.getY() != cY) ; + isNotDefaultArea = (rightComp == null) || (rightComp.getY() != cY); topComp = container.getRightTopComp(cX, cY, cW); minLength = isNotDefaultArea ? Math.min(cW, topComp.getWidth()) : Math.min(cH, rightComp.getWidth()); - min = isNotDefaultArea ? minWidth * 2 : min ; + min = isNotDefaultArea ? minWidth * 2 : min; } else if (ComparatorUtils.equals(crossPointAreaDirect, COMP_TOP)) { - minLength= Math.min(rightComp.getHeight(), Math.min(cH, leftComp.getHeight())); + minLength = Math.min(rightComp.getHeight(), Math.min(cH, leftComp.getHeight())); } else if (ComparatorUtils.equals(crossPointAreaDirect, COMP_BOTTOM)) { leftComp = container.getBottomLeftComp(cX, cY, cH); rightComp = container.getBottomRightComp(cX, cY, cH, cW); @@ -129,9 +132,10 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ /** * 三等分区域时,能否对应位置放入组件 + * * @param comp 待放置组件 - * @param x x - * @param y y + * @param x x + * @param y y * @return 能否放入 */ protected boolean canAcceptWhileTrisection(Component comp, int x, int y) { @@ -142,28 +146,28 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ upMinHeight = getUpMinHeightComp(cY, x); downMinHeight = getDownMinHeightComp(comp, y); return upMinHeight == 0 ? downMinHeight >= minHeight * 2 + actualVal : (upMinHeight + downMinHeight) >= minHeight * 3 + actualVal; - } else if(ComparatorUtils.equals(trisectAreaDirect, COMP_BOTTOM)) { + } else if (ComparatorUtils.equals(trisectAreaDirect, COMP_BOTTOM)) { upMinHeight = getUpMinHeightComp(cY + cH + actualVal, x); - if (cY + cH + DEFAULT_AREA_LENGTH>container.getHeight() - margin.getBottom()){ + if (cY + cH + DEFAULT_AREA_LENGTH > container.getHeight() - margin.getBottom()) { downMinHeight = 0; } else { Component targetComp = container.getBottomComp(x, cY, cH); downMinHeight = getDownMinHeightComp(targetComp, cY + cH + DEFAULT_AREA_LENGTH + actualVal); } - return downMinHeight == 0 ? (upMinHeight >= minHeight * 2 + actualVal) : ((upMinHeight+downMinHeight) >= minHeight * 3 + actualVal); - } else if(ComparatorUtils.equals(trisectAreaDirect, COMP_LEFT)) { - rightMinWidth = getMinRightWidth(cX, 0, y); - if(cX - DEFAULT_AREA_LENGTH < margin.getLeft()) { + return downMinHeight == 0 ? (upMinHeight >= minHeight * 2 + actualVal) : ((upMinHeight + downMinHeight) >= minHeight * 3 + actualVal); + } else if (ComparatorUtils.equals(trisectAreaDirect, COMP_LEFT)) { + rightMinWidth = getMinRightWidth(cX, 0, y); + if (cX - DEFAULT_AREA_LENGTH < margin.getLeft()) { leftMinWidth = 0; } else { Component targetRightComp = container.getLeftComp(cX, y); leftMinWidth = getMinLeftWidth(targetRightComp, cX - DEFAULT_AREA_LENGTH - actualVal); } - return leftMinWidth == 0 ? (rightMinWidth >= minWidth * 2 + actualVal) : ((leftMinWidth+rightMinWidth) >= minWidth * 3 + actualVal); - } else if(ComparatorUtils.equals(trisectAreaDirect, COMP_RIGHT)) { + return leftMinWidth == 0 ? (rightMinWidth >= minWidth * 2 + actualVal) : ((leftMinWidth + rightMinWidth) >= minWidth * 3 + actualVal); + } else if (ComparatorUtils.equals(trisectAreaDirect, COMP_RIGHT)) { leftMinWidth = getMinLeftWidth(comp, x); rightMinWidth = getMinRightWidth(cX, cW, y); - return rightMinWidth == 0 ? (leftMinWidth >= minWidth * 2 + actualVal) : ((leftMinWidth+rightMinWidth) >= minWidth * 3 + actualVal); + return rightMinWidth == 0 ? (leftMinWidth >= minWidth * 2 + actualVal) : ((leftMinWidth + rightMinWidth) >= minWidth * 3 + actualVal); } return false; } @@ -176,16 +180,16 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (cY == margin.getTop()) { return 0; } - int max=container.getWidth() - margin.getRight(); + int max = container.getWidth() - margin.getRight(); int mouseX = x; int minHeight = cY; int bott = 0; if (isFindRelatedComps) { upComps = new ArrayList(); } - for(; mouseX margin.getLeft()) { + while (mouseX > margin.getLeft()) { Component comp = container.getTopComp(mouseX, cY); - bott = comp.getHeight() + comp.getY()+actualVal; + bott = comp.getHeight() + comp.getY() + actualVal; if (bott == cY) { if (comp.getHeight() < minHeight) { minHeight = comp.getHeight(); } - mouseX = comp.getX()-DEFAULT_AREA_LENGTH-actualVal; + mouseX = comp.getX() - DEFAULT_AREA_LENGTH - actualVal; if (isFindRelatedComps) { upComps.add(comp); } - } else{ + } else { break; } } @@ -231,13 +235,13 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int cX = currentcomp.getX(); int cY = currentcomp.getY(); int minHeight = currentcomp.getHeight(); - int max=container.getWidth() - margin.getRight(); + int max = container.getWidth() - margin.getRight(); if (isFindRelatedComps) { downComps = new ArrayList(); } int mouseX = cX + DEFAULT_AREA_LENGTH; while (mouseX < max) { - Component comp = container.getComponentAt(mouseX, y); + Component comp = container.getComponentAt(mouseX, y); if (comp.getY() == cY) { if (comp.getHeight() < minHeight) { minHeight = comp.getHeight(); @@ -246,12 +250,12 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (isFindRelatedComps) { downComps.add(comp); } - }else{ + } else { break; } } mouseX = cX - DEFAULT_AREA_LENGTH - actualVal; - while(mouseX > margin.getLeft()) { + while (mouseX > margin.getLeft()) { Component comp = container.getComponentAt(mouseX, y); if (comp.getY() == cY) { if (comp.getHeight() < minHeight) { @@ -261,7 +265,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (isFindRelatedComps) { downComps.add(comp); } - }else{ + } else { break; } } @@ -273,9 +277,9 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ * 判断对齐时考虑间隔 */ private int getMinRightWidth(int cX, int cW, int y) { - int xL = cX + DEFAULT_AREA_LENGTH ; + int xL = cX + DEFAULT_AREA_LENGTH; xL = cW == 0 ? xL : (xL + cW + actualVal); - if (xL > container.getWidth() - margin.getRight()){ + if (xL > container.getWidth() - margin.getRight()) { return 0; } // 以当前组件紧挨着右侧的组件为基准,在y轴方向查找符合条件的组件 @@ -286,7 +290,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ rightComps = new ArrayList(); } int mouseY = targetComp.getY() + DEFAULT_AREA_LENGTH; - while (mouseY margin.getTop()) { + while (mouseY > margin.getTop()) { Component comp = container.getComponentAt(xL, mouseY); if (comp.getX() == targetComp.getX()) { if (comp.getWidth() < minWidth) { @@ -311,7 +315,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (isFindRelatedComps) { rightComps.add(comp); } - }else{ + } else { break; } } @@ -329,9 +333,9 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (isFindRelatedComps) { leftComps = new ArrayList(); } - int rightx = 0; + int rightx = 0; int mouseY = currentComp.getY() + DEFAULT_AREA_LENGTH; - while(mouseYmargin.getTop()) { + while (mouseY > margin.getTop()) { Component comp = container.getComponentAt(x, mouseY); - rightx = comp.getX()+comp.getWidth(); + rightx = comp.getX() + comp.getWidth(); if (rightx == compRightLength) { if (comp.getWidth() < minWidth) { minWidth = comp.getWidth(); @@ -358,7 +362,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (isFindRelatedComps) { leftComps.add(comp); } - }else{ + } else { break; } } @@ -367,13 +371,14 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ /** * 判断是否鼠标在组件的三等分区域,如果组件在布局管理器中间,上下左右都可能会三等分 + * * @param parentComp 鼠标所在区域的组件 - * @param x 坐标x - * @param y 坐标y + * @param x 坐标x + * @param y 坐标y * @return 是则返回true */ public boolean isTrisectionArea(Component parentComp, int x, int y) { - XCreator creator = (XCreator)parentComp; + XCreator creator = (XCreator) parentComp; if (container.getComponentCount() <= 1) { return false; } @@ -382,23 +387,23 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int xL = parentComp.getX(); int yL = parentComp.getY(); // 组件宽高的十分之一和默认值取大 - int minRangeWidth = Math.max(maxWidth/BORDER_PROPORTION, DEFAULT_AREA_LENGTH); - int minRangeHeight = Math.max(maxHeight/BORDER_PROPORTION, DEFAULT_AREA_LENGTH); - if(y < yL+minRangeHeight ) { + int minRangeWidth = Math.max(maxWidth / BORDER_PROPORTION, DEFAULT_AREA_LENGTH); + int minRangeHeight = Math.max(maxHeight / BORDER_PROPORTION, DEFAULT_AREA_LENGTH); + if (y < yL + minRangeHeight) { // 在组件上侧三等分 trisectAreaDirect = COMP_TOP; - } else if(y > yL + maxHeight - minRangeHeight) { + } else if (y > yL + maxHeight - minRangeHeight) { // 在组件下侧三等分 trisectAreaDirect = COMP_BOTTOM; } else if (x < xL + minRangeWidth) { // 在组件左侧三等分 trisectAreaDirect = COMP_LEFT; - } else if(x > xL + maxWidth - minRangeWidth) { + } else if (x > xL + maxWidth - minRangeWidth) { // 在组件右侧三等分 trisectAreaDirect = COMP_RIGHT; } // tab布局的边界特殊处理,不进行三等分 - if(!creator.getTargetChildrenList().isEmpty()){ + if (!creator.getTargetChildrenList().isEmpty()) { return false; } @@ -407,21 +412,22 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ /** * 是否为组件交叉点区域 或者是相邻三组建中间点 + * * @param currentComp 当前组件 - * @param x 坐标x - * @param y 坐标y + * @param x 坐标x + * @param y 坐标y * @return 是则返回true */ public boolean isCrossPointArea(Component currentComp, int x, int y) { // 3个及以上都会出现交叉点区域(包括边界处的) - if(currentComp == null || container.getComponentCount() <= 2){ + if (currentComp == null || container.getComponentCount() <= 2) { return false; } int cX = currentComp.getX(); int cY = currentComp.getY(); int cW = currentComp.getWidth(); int cH = currentComp.getHeight(); - int areaWidth = Math.max(cW / BORDER_PROPORTION ,DEFAULT_AREA_LENGTH); + int areaWidth = Math.max(cW / BORDER_PROPORTION, DEFAULT_AREA_LENGTH); int areaHeight = Math.max(cH / BORDER_PROPORTION, DEFAULT_AREA_LENGTH); int rx = cX + cW; int by = cY + cH; @@ -432,27 +438,27 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ if (x < objX && y < objY) { //左上角区域 crossPointAreaDirect = cY > margin.getTop() || cX > margin.getLeft() ? COMP_LEFT_TOP : 0; - } else if (y < objY && x > rx - areaWidth){ + } else if (y < objY && x > rx - areaWidth) { //右上角 crossPointAreaDirect = cY > margin.getTop() || rx < containerW ? COMP_RIGHT_TOP : 0; } else if (x < objX && y > by - areaHeight) { //左下角 crossPointAreaDirect = cX > margin.getLeft() || by < containerH ? COMP_LEFT_BOTTOM : 0; - } else if (x > rx-areaWidth && y > by - areaHeight) { + } else if (x > rx - areaWidth && y > by - areaHeight) { //右下角 crossPointAreaDirect = by < containerH || rx < containerW ? COMP_RIGHT_BOTTOM : 0; } else { isMiddlePosition(currentComp, x, y, areaWidth, areaHeight); } // tab布局的边界特殊处理 - XCreator creator = (XCreator)currentComp; - if(!creator.getTargetChildrenList().isEmpty()){ + XCreator creator = (XCreator) currentComp; + if (!creator.getTargetChildrenList().isEmpty()) { return false; } return crossPointAreaDirect != 0; } - private void isMiddlePosition(Component comp, int x, int y, int areaWidth , int areaHeight) { + private void isMiddlePosition(Component comp, int x, int y, int areaWidth, int areaHeight) { int cX = comp.getX(); int cY = comp.getY(); int cW = comp.getWidth(); @@ -479,14 +485,14 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ Component bottomComp = container.getBottomComp(cX, cY, cH); if (x < (cX + areaWidth)) { isCrosspoint = topComp != null && bottomComp != null && topComp.getX() == cX && bottomComp.getX() == cX; - crossPointAreaDirect = isCrosspoint ? COMP_LEFT : 0; + crossPointAreaDirect = isCrosspoint ? COMP_LEFT : 0; } else if (x > (cX + cW - areaWidth)) { topComp = container.getRightTopComp(cX, cY, cW); bottomComp = container.getRightBottomComp(cX, cY, cH, cW); if (topComp != null && bottomComp != null) { - isCrosspoint = topComp.getX() + topComp.getWidth() == cX + cW && bottomComp.getX() + bottomComp.getWidth() == cX+cW; + isCrosspoint = topComp.getX() + topComp.getWidth() == cX + cW && bottomComp.getX() + bottomComp.getWidth() == cX + cW; } - crossPointAreaDirect = isCrosspoint ? COMP_RIGHT : 0; + crossPointAreaDirect = isCrosspoint ? COMP_RIGHT : 0; } } } @@ -513,15 +519,16 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ /** * 平分,正常情况拖入组件时,按照上1/4区域、下1/4区域为上下平分,中左侧1/2区域、中右侧1/2区域为左右平分 + * * @param currentComp 当前位置组件 - * @param child 待放置组件 - * @param x x - * @param y y + * @param child 待放置组件 + * @param x x + * @param y y */ protected void fixHalve(Component currentComp, XCreator child, int x, int y) { - XCreator creator = (XCreator)currentComp; - if(!creator.getTargetChildrenList().isEmpty()){ - fixHalveOfTab(creator,child,x,y); + XCreator creator = (XCreator) currentComp; + if (!creator.getTargetChildrenList().isEmpty()) { + fixHalveOfTab(creator, child, x, y); return; } int maxWidth = currentComp.getWidth(); @@ -536,18 +543,18 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int finalY = yL; int finalW = maxWidth; int finalH = maxHeight; - if (isDividUp){ + if (isDividUp) { dim.width = maxWidth; dim.height = maxHeight / 2 - actualVal / 2; finalY = yL + dim.height + actualVal; finalH = maxHeight - dim.height - actualVal; - } else if(isDividDown){ + } else if (isDividDown) { // 若当前区域高度非偶数,那么和isDividUp时计算一致,否则永远都是上半部分小1px dim.height = maxHeight / 2 - actualVal / 2; dim.width = maxWidth; finalH = maxHeight - dim.height - actualVal; yL = yL + finalH + actualVal; - } else if(isDividLeft){ + } else if (isDividLeft) { dim.width = maxWidth / 2 - actualVal / 2; dim.height = maxHeight; finalX = xL + dim.width + actualVal; @@ -571,7 +578,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ // 边界判断抄得原来的逻辑 // tab布局的边界拖入新组件,和当前tab布局平分,这时候的actualVal组建间隔是tab里面的组建间隔 // 不应该在外层自适应布局添加 - private void fixHalveOfTab(XCreator currentCreator, XCreator child, int x, int y){ + private void fixHalveOfTab(XCreator currentCreator, XCreator child, int x, int y) { int maxWidth = currentCreator.getWidth(); int maxHeight = currentCreator.getHeight(); int xL = currentCreator.getX(); @@ -582,7 +589,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int finalY = yL; int finalW = maxWidth; int finalH = maxHeight; - switch(position){ + switch (position) { case COMP_TOP: dim.width = maxWidth; dim.height = maxHeight / 2; @@ -592,7 +599,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ case COMP_BOTTOM: dim.height = maxHeight / 2; dim.width = maxWidth; - finalH = maxHeight-dim.height; + finalH = maxHeight - dim.height; yL = yL + finalH; break; case COMP_LEFT: @@ -619,13 +626,31 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ } } - private int getPositionOfFix(XCreator currentCreator,int x,int y){ + private int getPositionOfFix(XCreator currentCreator, int x, int y) { int position = 0; XLayoutContainer cardLayout = ((XWCardMainBorderLayout) currentCreator).getCardPart(); + XLayoutContainer container = (XLayoutContainer) cardLayout.getComponent(0); Rectangle rect = ComponentUtils.getRelativeBounds(container); + + /* + * 为了获取到鼠标drop位置的控件, + * 我们之前已经将y值变为相对坐标值; + * 由于在x轴上没有偏移,所以x值一直等于相对坐标值,最多差一个边界值1。 + * 在进行新添加的控件位置计算时, + * 又通过ComponentUtils.getRelativeBounds()方法获取到了绝对坐标, + * 再次计算相对坐标,所以将y值重新变成绝对坐标。 + * */ + if (currentCreator.getParent().getParent().getComponent(0) instanceof XWParameterLayout) { + int high = currentCreator.getParent().getParent().getComponent(0).getHeight(); + y = y + WCardMainBorderLayout.TAB_HEIGHT + high; + + } else { + y = y + WCardMainBorderLayout.TAB_HEIGHT; + } + int tempX = x - rect.x; - int tempY = y - rect.y + WCardMainBorderLayout.TAB_HEIGHT; + int tempY = y - rect.y; int containerX = container.getX(); int containerY = container.getY(); int containerWidth = container.getWidth(); @@ -634,13 +659,13 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ Rectangle currentXY = new Rectangle(tempX, tempY, 1, 1); // 上边缘 Rectangle upEdge = new Rectangle(containerX, containerY, containerWidth, BORDER_PROPORTION); - if(upEdge.intersects(currentXY)){ + if (upEdge.intersects(currentXY)) { position = COMP_TOP; } int bottomY = containerY + containerHeight - BORDER_PROPORTION; // 下边缘 Rectangle bottomEdge = new Rectangle(containerX, bottomY, containerWidth, BORDER_PROPORTION); - if(bottomEdge.intersects(currentXY)){ + if (bottomEdge.intersects(currentXY)) { position = COMP_BOTTOM; } //左右边缘的高度 -10*2 是为了不和上下边缘重合 @@ -648,7 +673,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int leftY = containerY + BORDER_PROPORTION; // 左边缘 Rectangle leftEdge = new Rectangle(containerX, leftY, BORDER_PROPORTION, verticalHeight); - if(leftEdge.intersects(currentXY)){ + if (leftEdge.intersects(currentXY)) { position = COMP_LEFT; } return position; @@ -658,37 +683,38 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ * 组件交叉区域进行插入时,调整受到变动的其他组件,之前是交叉区域插入也按照三等分逻辑,后面测试中发现有bug,改为和bi一样的鼠标所在侧平分 * 默认左上角、右下角区域是垂直方向插入组件 * 右上角和左下角是水平方向插入组件,这样避免田字块时重复 + * * @param currentComp 当前位置组件 - * @param child 待放置组件 - * @param x x - * @param y y + * @param child 待放置组件 + * @param x x + * @param y y */ protected void fixCrossPointArea(Component currentComp, XCreator child, int x, int y) { //计算前先全部初始化待调整控件所在的list initCompsList(); - switch(crossPointAreaDirect) { - case COMP_LEFT_TOP : + switch (crossPointAreaDirect) { + case COMP_LEFT_TOP: dealCrossPointAtLeftTop(currentComp, child); break; - case COMP_RIGHT_BOTTOM : + case COMP_RIGHT_BOTTOM: dealCrossPointAtRightBottom(currentComp, child); break; - case COMP_LEFT_BOTTOM : + case COMP_LEFT_BOTTOM: dealCrossPointAtLeftBottom(currentComp, child); break; - case COMP_RIGHT_TOP : + case COMP_RIGHT_TOP: dealCrossPointAtRightTop(currentComp, child); break; - case COMP_TOP : + case COMP_TOP: dealCrossPointAtTop(currentComp, child); break; - case COMP_BOTTOM : + case COMP_BOTTOM: dealCrossPointAtBottom(currentComp, child); break; - case COMP_LEFT : + case COMP_LEFT: dealCrossPointAtLeft(currentComp, child); break; - case COMP_RIGHT : + case COMP_RIGHT: dealCrossPointAtRight(currentComp, child); break; } @@ -708,16 +734,16 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ Component topComp = container.getTopComp(cX, cY); Component leftComp = container.getLeftComp(cX, cY); //上方没有组件或者有一个x坐标不相同的组件 - if (topComp==null || topComp.getX()!=cX) { + if (topComp == null || topComp.getX() != cX) { minDH = cH < leftComp.getHeight() ? cH : leftComp.getHeight(); downComps.add(leftComp); downComps.add(currentComp); int dLength = minDH / 2; - childw = leftComp.getWidth()+cW+actualVal; - childh = dLength-actualVal / 2; + childw = leftComp.getWidth() + cW + actualVal; + childh = dLength - actualVal / 2; if (isCalculateChildPos) { childPosition = new int[]{leftComp.getX(), leftComp.getY(), childw, childh}; - } else{ + } else { //先设置child位置,不然leftComp坐标调整后就不对了 child.setLocation(leftComp.getX(), leftComp.getY()); child.setSize(childw, childh); @@ -726,7 +752,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ } else { rightComps.add(currentComp); rightComps.add(topComp); - minRW = cW= minDH) { minDH -= actualVal / 2; if ((minDH * 2 / 3) < minHeight) { dLength = minDH - minHeight; - }else { + } else { dLength = minDH / 3; } uLength = averageH - dLength; - } else{ + } else { minUH -= actualVal / 2; if ((minUH * 2 / 3) < minHeight) { uLength = minUH - minHeight; - }else { + } else { uLength = minUH / 3; } dLength = averageH - uLength; @@ -999,16 +1026,16 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ child.setLocation(margin.getLeft(), margin.getRight()); child.setSize(rightLength - actualVal / 2, height); } else { - childPosition = new int[] {margin.getLeft(), margin.getRight(), rightLength - actualVal / 2, height}; + childPosition = new int[]{margin.getLeft(), margin.getRight(), rightLength - actualVal / 2, height}; } return; - } else if(minRW == 0){ + } else if (minRW == 0) { leftLength = minLW / 2; calculateLeftComps(leftLength, child, leftLength); return; } else if (minRW >= minLW) { minLW -= actualVal / 2; - if(minLW * 2 / 3 < minWidth) { + if (minLW * 2 / 3 < minWidth) { leftLength = minLW - minWidth; } else { leftLength = minLW / 3; @@ -1016,7 +1043,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ rightLength = averageW - leftLength; } else { minRW -= actualVal / 2; - if(minRW * 2 / 3 < minWidth) { + if (minRW * 2 / 3 < minWidth) { rightLength = minRW - minWidth; } else { rightLength = minRW / 3; @@ -1033,12 +1060,12 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ private void calculateBottomComps(int length) { length += actualVal / 2; - for (int i = 0,num = downComps.size(); i < num; i++){ + for (int i = 0, num = downComps.size(); i < num; i++) { Component comp = downComps.get(i); comp.setLocation(comp.getX(), comp.getY() + length); int offset = comp.getHeight() - length; comp.setSize(comp.getWidth(), offset); - XCreator creator = (XCreator)comp; + XCreator creator = (XCreator) comp; creator.recalculateChildHeight(offset); } } @@ -1048,24 +1075,24 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ int childWidth = (upComps.size() - 1) * actualVal; int childX = container.getWidth() - margin.getLeft() - margin.getRight(); int childY = 0; - if(upComps.size() > INDEX_ZERO){ + if (upComps.size() > INDEX_ZERO) { childY = upComps.get(INDEX_ZERO).getY() + upComps.get(INDEX_ZERO).getHeight() - length; } - for (int i = 0,num = upComps.size(); i < num; i++){ + for (int i = 0, num = upComps.size(); i < num; i++) { Component comp = upComps.get(i); childWidth += comp.getWidth(); - if (comp.getX() < childX){ + if (comp.getX() < childX) { childX = comp.getX(); } if (!isCalculateChildPos) { int offset = comp.getHeight() - length; comp.setSize(comp.getWidth(), offset); - XCreator creator = (XCreator)comp; + XCreator creator = (XCreator) comp; creator.recalculateChildHeight(offset); } } childY += actualVal; - averageH -= actualVal/2; + averageH -= actualVal / 2; if (isCalculateChildPos) { childPosition = new int[]{childX, childY, childWidth, averageH}; } else { @@ -1081,25 +1108,25 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ } int childH = (leftComps.size() - 1) * actualVal; int childX = 0; - if(leftComps.size() > INDEX_ZERO){ + if (leftComps.size() > INDEX_ZERO) { childX = leftComps.get(INDEX_ZERO).getX() + leftComps.get(INDEX_ZERO).getWidth() - length; } int childY = container.getHeight() - margin.getBottom(); - for (int i = 0,num = leftComps.size(); i < num; i++){ + for (int i = 0, num = leftComps.size(); i < num; i++) { Component comp = leftComps.get(i); childH += comp.getHeight(); - if (comp.getY() < childY){ + if (comp.getY() < childY) { childY = comp.getY(); } if (!isCalculateChildPos) { int offset = comp.getWidth() - length; comp.setSize(offset, comp.getHeight()); - XCreator creator = (XCreator)comp; + XCreator creator = (XCreator) comp; creator.recalculateChildWidth(offset); } } childX += actualVal; - averageW -= actualVal/2; + averageW -= actualVal / 2; if (isCalculateChildPos) { childPosition = new int[]{childX, childY, averageW, childH}; } else { @@ -1110,33 +1137,34 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter{ private void calculateRightComps(int length) { length += actualVal / 2; - for (int i=0,num=rightComps.size(); i Date: Mon, 20 Feb 2017 11:00:44 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9=E4=B8=BA=E7=A7=81=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRBodyLayoutAdapter.java | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java index dc1fb7d36..e189c607f 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java @@ -19,37 +19,37 @@ import java.util.*; * Created by zhouping on 2016/8/18. */ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { - protected static final int COMP_TOP = 1; - protected static final int COMP_BOTTOM = 2; - protected static final int COMP_LEFT = 3; - protected static final int COMP_RIGHT = 4; + private static final int COMP_TOP = 1; + private static final int COMP_BOTTOM = 2; + private static final int COMP_LEFT = 3; + private static final int COMP_RIGHT = 4; private static final int COMP_LEFT_TOP = 5; private static final int COMP_LEFT_BOTTOM = 6; private static final int COMP_RIGHT_TOP = 7; private static final int COMP_RIGHT_BOTTOM = 8; private static final int INDEX_ZERO = 0; - protected static final double TOP_HALF = 0.25; - protected static final double BOTTOM_HALF = 0.75; - protected static final int DEFAULT_AREA_LENGTH = 5; //判断交叉区域范围的默认长度 - protected static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小 + private static final double TOP_HALF = 0.25; + private static final double BOTTOM_HALF = 0.75; + private static final int DEFAULT_AREA_LENGTH = 5; //判断交叉区域范围的默认长度 + private static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小 - protected int trisectAreaDirect = 0; - protected int crossPointAreaDirect = 0; + private int trisectAreaDirect = 0; + private int crossPointAreaDirect = 0; // 增加删除拉伸控件用的临时list - protected java.util.List rightComps; - protected java.util.List leftComps; - protected java.util.List downComps; - protected java.util.List upComps; + private java.util.List rightComps; + private java.util.List leftComps; + private java.util.List downComps; + private java.util.List upComps; // 三等分时计算对应侧的组件 - protected boolean isFindRelatedComps = false; + private boolean isFindRelatedComps = false; // 渲染时只计算对应的bounds而不调整 private boolean isCalculateChildPos = false; private int[] childPosition = null; //painter用的位置 - protected int minWidth = 0; // 最小尺寸,由于屏幕百分比里不同,显示的最小大小也不同 - protected int minHeight = 0; - protected int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 - protected PaddingMargin margin; // 布局容器边距 + private int minWidth = 0; // 最小尺寸,由于屏幕百分比里不同,显示的最小大小也不同 + private int minHeight = 0; + private int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 + private PaddingMargin margin; // 布局容器边距 /** * 在添加组件状态时,当鼠标移动到某个容器上方时,如果该容器有布局管理器,则会调用该布局 @@ -629,10 +629,8 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { private int getPositionOfFix(XCreator currentCreator, int x, int y) { int position = 0; XLayoutContainer cardLayout = ((XWCardMainBorderLayout) currentCreator).getCardPart(); - XLayoutContainer container = (XLayoutContainer) cardLayout.getComponent(0); Rectangle rect = ComponentUtils.getRelativeBounds(container); - /* * 为了获取到鼠标drop位置的控件, * 我们之前已经将y值变为相对坐标值; @@ -644,11 +642,9 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { if (currentCreator.getParent().getParent().getComponent(0) instanceof XWParameterLayout) { int high = currentCreator.getParent().getParent().getComponent(0).getHeight(); y = y + WCardMainBorderLayout.TAB_HEIGHT + high; - } else { y = y + WCardMainBorderLayout.TAB_HEIGHT; } - int tempX = x - rect.x; int tempY = y - rect.y; int containerX = container.getX(); From bb99b03e2b30c2cd433662fb29076e24f526bf5c Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 20 Feb 2017 14:06:08 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRBodyLayoutAdapter.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java index e189c607f..8db19d9fb 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java @@ -19,37 +19,37 @@ import java.util.*; * Created by zhouping on 2016/8/18. */ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { - private static final int COMP_TOP = 1; - private static final int COMP_BOTTOM = 2; - private static final int COMP_LEFT = 3; - private static final int COMP_RIGHT = 4; + protected static final int COMP_TOP = 1; + protected static final int COMP_BOTTOM = 2; + protected static final int COMP_LEFT = 3; + protected static final int COMP_RIGHT = 4; private static final int COMP_LEFT_TOP = 5; private static final int COMP_LEFT_BOTTOM = 6; private static final int COMP_RIGHT_TOP = 7; private static final int COMP_RIGHT_BOTTOM = 8; private static final int INDEX_ZERO = 0; - private static final double TOP_HALF = 0.25; - private static final double BOTTOM_HALF = 0.75; - private static final int DEFAULT_AREA_LENGTH = 5; //判断交叉区域范围的默认长度 - private static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小 + protected static final double TOP_HALF = 0.25; + protected static final double BOTTOM_HALF = 0.75; + protected static final int DEFAULT_AREA_LENGTH = 5; //判断交叉区域范围的默认长度 + protected static final int BORDER_PROPORTION = 10; //边界三等分或交叉区域大小取组件1/10和默认大小 - private int trisectAreaDirect = 0; + protected int trisectAreaDirect = 0; private int crossPointAreaDirect = 0; // 增加删除拉伸控件用的临时list - private java.util.List rightComps; - private java.util.List leftComps; - private java.util.List downComps; - private java.util.List upComps; + protected java.util.List rightComps; + protected java.util.List leftComps; + protected java.util.List downComps; + protected java.util.List upComps; // 三等分时计算对应侧的组件 - private boolean isFindRelatedComps = false; + protected boolean isFindRelatedComps = false; // 渲染时只计算对应的bounds而不调整 private boolean isCalculateChildPos = false; private int[] childPosition = null; //painter用的位置 - private int minWidth = 0; // 最小尺寸,由于屏幕百分比里不同,显示的最小大小也不同 - private int minHeight = 0; - private int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 - private PaddingMargin margin; // 布局容器边距 + protected int minWidth = 0; // 最小尺寸,由于屏幕百分比里不同,显示的最小大小也不同 + protected int minHeight = 0; + protected int actualVal = 0; // 存在间隔时,add move drag 判断对齐等都要考虑 + protected PaddingMargin margin; // 布局容器边距 /** * 在添加组件状态时,当鼠标移动到某个容器上方时,如果该容器有布局管理器,则会调用该布局 From 7d077a4653ac392a379f816db3f45db158b4f4f4 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 24 Feb 2017 17:33:36 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20tab?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=AD=97=E4=BD=93=E3=80=81=E5=AD=97=E5=8F=B7?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=AE=E6=94=B9=EF=BC=8Crelease=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=88=B0dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XCardSwitchButton.java | 10 +--- .../creator/cardlayout/XWTabFitLayout.java | 51 ++----------------- 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index effa8856e..04e678029 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -48,7 +48,6 @@ public class XCardSwitchButton extends XButton { //设置的图片类型 private static final String COLOR_BACKGROUND_TYPE = "ColorBackground"; private static final String DEFAULT_TYPE = "default"; - private static final String DEFAULT_FONT_NAME = "SimSun"; //默认颜色 public static final Color NORMAL_GRAL = new Color(236,236,236); @@ -67,7 +66,6 @@ public class XCardSwitchButton extends XButton { private static final int FONT_SIZE_ADJUST = 2; private static final int SIDE_OFFSET = 57; - private static final int FONT_SIZE = 9; private XWCardLayout cardLayout; private XWCardTagLayout tagLayout; @@ -345,10 +343,7 @@ public class XCardSwitchButton extends XButton { // 标题部分 WidgetTitle title = style.getTitle(); - FRFont font = button.getFont(); - if (font == null) { - font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE); - } + FRFont font = title.getFrFont(); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); UILabel label = this.getContentLabel(); label.setFont(newFont); @@ -427,9 +422,6 @@ public class XCardSwitchButton extends XButton { XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData(); FRFont frFont = cardSwitchButton.getFont(); - if (frFont == null) { - frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE); - } UILabel label = temp.getContentLabel(); label.setSize(dimension); label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution())); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index f4cac3e15..ee74339a9 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -1,11 +1,5 @@ package com.fr.design.designer.creator.cardlayout; -import java.awt.*; -import java.beans.IntrospectionException; - -import javax.swing.border.Border; - -import com.fr.base.ScreenResolution; import com.fr.base.background.ColorBackground; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; @@ -16,25 +10,25 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; -import com.fr.design.mainframe.widget.editors.FontEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; -import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.Background; -import com.fr.general.FRFont; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; +import javax.swing.border.Border; +import java.awt.*; +import java.beans.IntrospectionException; + /** * @author focus @@ -46,14 +40,10 @@ public class XWTabFitLayout extends XWFitLayout { // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // 这里先将拖拽之前的宽高先做备份 private static final Color NORMAL_GRAL = new Color(236,236,236); - private static final String DEFAULT_FONT_NAME = "SimSun"; - public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12); - public final static FRFont DEFAULT_FRFT = FRFont.getInstance(DEFAULT_FONT_NAME, 0, 9); private Dimension referDim; private Background initialBackground; private Background overBackground; private Background clickBackground; - private FRFont font; private XCardSwitchButton xCardSwitchButton; public Dimension getReferDim() { @@ -88,15 +78,6 @@ public class XWTabFitLayout extends XWFitLayout { this.clickBackground = clickBackground; } - @Override - public FRFont getFont() { - return font; - } - - public void setFont(FRFont font) { - this.font = font; - } - public XCardSwitchButton getxCardSwitchButton() { return xCardSwitchButton; } @@ -164,21 +145,7 @@ public class XWTabFitLayout extends XWFitLayout { cardSwitchButton.setClickBackground(clickBackground); } } - ), - //字体 - creatNonListenerStyle(4).setPropertyChangeListener( - new PropertyChangeAdapter() { - @Override - public void propertyChange() { - font = ((WTabFitLayout) data).getFont(); - CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData(); - cardSwitchButton.setFont(font); - UILabel uiLabel = xCardSwitchButton.getLabel(); - uiLabel.setFont(font.applyResolutionNP(ScreenResolution.getScreenResolution())); - uiLabel.setForeground(font.getForeground()); - xCardSwitchButton.setLabel(uiLabel); - } - }), + ) }; } @@ -210,9 +177,6 @@ public class XWTabFitLayout extends XWFitLayout { XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont")) - .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }; return crPropertyDescriptors[i]; @@ -243,20 +207,15 @@ public class XWTabFitLayout extends XWFitLayout { if (!isStyle) { this.xCardSwitchButton.setCustomStyle(false); this.xCardSwitchButton.setSelectBackground(bg); - this.xCardSwitchButton.getLabel().setFont(DEFAULTFT); cardSwitchButton.setInitialBackground(null); cardSwitchButton.setClickBackground(null); cardSwitchButton.setOverBackground(null); - cardSwitchButton.setFont(DEFAULT_FRFT); } else { Background initialBackground = cardSwitchButton.getInitialBackground(); bg = initialBackground == null ? bg : initialBackground; this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setCustomStyle(true); cardSwitchButton.setCustomStyle(true); - if (font != null) { - cardSwitchButton.setFont(font); - } if (this.initialBackground != null){ this.xCardSwitchButton.setSelectBackground(this.initialBackground); cardSwitchButton.setInitialBackground(this.initialBackground); From d191a6303661583e41e52ebe9cf3b53499292dc8 Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Fri, 24 Feb 2017 17:52:06 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E5=B0=91?= =?UTF-8?q?=E4=BA=86=E5=8F=A5=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/locale/designer.properties | 2 +- .../src/com/fr/design/locale/designer_en_US.properties | 4 ++-- .../src/com/fr/design/locale/designer_zh_CN.properties | 4 ++-- .../src/com/fr/design/locale/designer_zh_TW.properties | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index cd0440813..423f8c42c 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -567,4 +567,4 @@ FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP -FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid \ No newline at end of file +FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 47afa410c..b0acea3ab 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -567,5 +567,5 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP -FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid \ No newline at end of file +FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. +FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index b85d0a192..bdb97b094 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -571,5 +571,5 @@ FR-Designer_DS_TableData=\u6570\u636E\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F -FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA\: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548. \ No newline at end of file +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA\: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 48ee886d3..3acd7487c 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -559,5 +559,5 @@ FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u904E\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8ACB\u806F\u7E6B\u958B\u767C\u8005\u5347\u7D1A\u63D2\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F -FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548 \ No newline at end of file +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002 \ No newline at end of file From 04bba80e9f190fc6e22ad6d94abc8939aed5caa0 Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Fri, 24 Feb 2017 17:53:11 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=A1=A5=E4=B8=8A=E5=8F=A5=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/locale/designer.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 423f8c42c..0a66c326e 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -566,5 +566,5 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP +FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. \ No newline at end of file From b388a85042d384f76b0036ddbaa55fc30c3e70ec Mon Sep 17 00:00:00 2001 From: fr_shine Date: Mon, 27 Feb 2017 09:39:29 +0800 Subject: [PATCH 7/9] editlabel not append origin label --- .../mainframe/chart/gui/UIEditLabel.java | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java index ceca4f9dc..c7c3c51c7 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java @@ -161,35 +161,47 @@ public class UIEditLabel extends JPanel implements UIObserver{ return text; } + protected boolean appendOriginalLabel() { + return true; + } + private void stopEditing(){ isEditingStopped = true; this.removeAll(); - String text =this.showLabel.getText(); - text = StringUtils.cutStringEndWith(text,":"); - text = !ComparatorUtils.equals(text, this.originalLabel) ? - StringUtils.perfectEnd(text, "(" + this.originalLabel + ")"): this.originalLabel; - showLabel.setText(StringUtils.perfectEnd(text,":")); + if(appendOriginalLabel()) { + String text = this.showLabel.getText(); + text = StringUtils.cutStringEndWith(text, ":"); + text = !ComparatorUtils.equals(text, this.originalLabel) ? + StringUtils.perfectEnd(text, "(" + this.originalLabel + ")") : this.originalLabel; + showLabel.setText(StringUtils.perfectEnd(text, ":")); + } this.add(showLabel, BorderLayout.CENTER); this.revalidate(); this.repaint(); } public String getText(){ - String text =this.showLabel.getText(); - text = StringUtils.cutStringEndWith(text,":"); - return StringUtils.cutStringEndWith(text,"("+this.originalLabel+")"); + if(appendOriginalLabel()) { + String text = this.showLabel.getText(); + text = StringUtils.cutStringEndWith(text, ":"); + return StringUtils.cutStringEndWith(text, "(" + this.originalLabel + ")"); + } else { + return this.showLabel.getText(); + } } public void setText(String text){ - if(text == null || StringUtils.isEmpty(text)){ - this.showLabel.setText(this.originalLabel); - return; - } - if(!ComparatorUtils.equals(text,originalLabel)){ - text = StringUtils.cutStringEndWith(text, ":"); - text = StringUtils.perfectEnd(text,"("+originalLabel+")"); + if(appendOriginalLabel()) { + if (text == null || StringUtils.isEmpty(text)) { + this.showLabel.setText(this.originalLabel); + return; + } + if (!ComparatorUtils.equals(text, originalLabel)) { + text = StringUtils.cutStringEndWith(text, ":"); + text = StringUtils.perfectEnd(text, "(" + originalLabel + ")"); + } + text = StringUtils.perfectEnd(text, ":"); } - text = StringUtils.perfectEnd(text,":"); this.showLabel.setText(text); } From d2730c56f7790ce1ea070d739d13e4dfcf9aebc3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 27 Feb 2017 10:49:39 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=97=A0=E4=BB=BB=E5=8A=A1=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRBodyLayoutAdapter.java | 6 +++--- .../adapters/layout/FRTabFitLayoutAdapter.java | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java index 8db19d9fb..b3072667b 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java @@ -6,6 +6,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.PaddingMargin; +import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; @@ -639,9 +640,8 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter { * 又通过ComponentUtils.getRelativeBounds()方法获取到了绝对坐标, * 再次计算相对坐标,所以将y值重新变成绝对坐标。 * */ - if (currentCreator.getParent().getParent().getComponent(0) instanceof XWParameterLayout) { - int high = currentCreator.getParent().getParent().getComponent(0).getHeight(); - y = y + WCardMainBorderLayout.TAB_HEIGHT + high; + if (currentCreator.getBackupParent().getLocation().y == WBorderLayout.DEFAULT_SIZE) { + y = y + WCardMainBorderLayout.TAB_HEIGHT + WBorderLayout.DEFAULT_SIZE; } else { y = y + WCardMainBorderLayout.TAB_HEIGHT; } diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index f0ccc3eb8..63a70e1bb 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -15,6 +15,7 @@ import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; +import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; @@ -92,16 +93,16 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { private int adjustY(int y, XWTabFitLayout tabLayout) { XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent(); LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); - if (container.getParent().getComponent(0) instanceof XWParameterLayout) { - y = y - container.getParent().getComponent(0).getHeight() - container.getParent().getComponent(0).getY(); + if (container.getLocation().y == WBorderLayout.DEFAULT_SIZE) { + y = y - WBorderLayout.DEFAULT_SIZE; } if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { - y -= WCardMainBorderLayout.TAB_HEIGHT; + y = y - WCardMainBorderLayout.TAB_HEIGHT; } return y; } - protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout){ - return ComponentUtils.getRelativeBounds(mainLayout); - } + protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) { + return ComponentUtils.getRelativeBounds(mainLayout); + } } \ No newline at end of file From 0bcbfe576d113b328a13bae3654e72615ecdfdd0 Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 28 Feb 2017 16:57:34 +0800 Subject: [PATCH 9/9] =?UTF-8?q?REPORT-1980=20=E6=8D=A2=E6=88=90listmap?= =?UTF-8?q?=E7=BB=B4=E6=8C=81=E5=8E=9F=E6=9C=89=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/frpane/HyperlinkGroupPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java index 112fa54dc..99fc5948e 100644 --- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -13,6 +13,7 @@ import com.fr.js.JavaScript; import com.fr.js.NameJavaScript; import com.fr.js.NameJavaScriptGroup; import com.fr.plugin.PluginManager; +import com.fr.stable.ListMap; import com.fr.stable.Nameable; import java.util.ArrayList; @@ -34,7 +35,7 @@ public class HyperlinkGroupPane extends JListControlPane { * @return 返回Nameable按钮数组. */ public NameableCreator[] createNameableCreators() { - Map nameCreators = new TreeMap(); + Map nameCreators = new ListMap<>(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); for (NameableCreator creator : creators) { nameCreators.put(creator.menuName(), creator);