From 16b92e158f07afc8016cf579595b51b276482e0b Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:43:14 +0800 Subject: [PATCH 01/84] =?UTF-8?q?=E6=89=93=E5=BC=80=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=95=8C=E9=9D=A2=E6=8C=87=E5=AE=9A=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginWebBridge.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 156627b6b..70366d2b7 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -35,6 +35,7 @@ public class PluginWebBridge { private static PluginWebBridge helper; private UIDialog uiDialog; + private String showKeyword; public static PluginWebBridge getHelper() { if (helper != null) { @@ -59,6 +60,14 @@ public class PluginWebBridge { private PluginWebBridge() { } + public String getShowKeyword() { + return showKeyword; + } + + public void setShowKeyword(String showKeyWord) { + this.showKeyword = showKeyWord; + } + public void setEngine(WebEngine webEngine) { this.webEngine = webEngine; } From 5e7272212e39367ebb0699532d7c2dc717a6195e Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:54:45 +0800 Subject: [PATCH 02/84] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86?= =?UTF-8?q?=E5=BA=97=E4=BB=A5=E5=85=B3=E9=94=AE=E8=AF=8D=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/PluginManagerPane.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index 36948fe36..a449044be 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -66,6 +66,11 @@ public class PluginManagerPane extends BasicPane { initTraditionalStore(); } } + + public PluginManagerPane(String keyword){ + this(); + PluginWebBridge.getHelper().setShowKeyword(keyword); + } private void addPane(String installHome) { PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); From c7cc2bc67bd83a96fd534c09974c6721eeba5bab Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:56:46 +0800 Subject: [PATCH 03/84] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginManagerPane.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index a449044be..d479a5028 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -66,7 +66,11 @@ public class PluginManagerPane extends BasicPane { initTraditionalStore(); } } - + + /** + * 以关键词打开设计器商店 + * @param keyword 关键词 + */ public PluginManagerPane(String keyword){ this(); PluginWebBridge.getHelper().setShowKeyword(keyword); From 9d7085cd0fc07094d492300c3b27300c6f801156 Mon Sep 17 00:00:00 2001 From: zhouping Date: Thu, 28 Jul 2016 20:36:41 +0800 Subject: [PATCH 04/84] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E7=9A=84=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hanlder/BottomCornerMouseHanlder.java | 42 +++- .../design/beans/location/Absorptionline.java | 165 ++++++++++++- .../fr/design/beans/location/MoveUtils.java | 227 +++++++++++++++++- .../beans/location/WidgetForbidWindow.java | 48 ++++ .../layout/FRAbsoluteLayoutAdapter.java | 35 ++- .../adapters/layout/FRFitLayoutAdapter.java | 3 - .../beans/location/AccessDirection.java | 60 +++-- .../design/designer/beans/location/Inner.java | 76 +++++- .../designer/beans/models/StateModel.java | 13 + .../painters/FRAbsoluteLayoutPainter.java | 26 ++ .../designer/creator/XWAbsoluteLayout.java | 90 ++++++- .../design/designer/creator/XWFitLayout.java | 2 +- .../designer/creator/XWParameterLayout.java | 11 + .../fr/design/gui/core/FormWidgetOption.java | 2 +- .../mainframe/EditingMouseListener.java | 23 +- .../com/fr/design/mainframe/FormDesigner.java | 17 ++ 16 files changed, 796 insertions(+), 44 deletions(-) create mode 100644 designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java create mode 100644 designer_form/src/com/fr/design/designer/beans/painters/FRAbsoluteLayoutPainter.java diff --git a/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java b/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java index e98ce6d02..7668411c8 100644 --- a/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java +++ b/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java @@ -103,7 +103,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { Rectangle bounds = block.getBounds().toRectangle(resolution); Point resultPoint = MoveUtils.sorption(bounds.x + dragStart.x < 0 ? 0 : bounds.x + dragStart.x, bounds.y - + dragStart.y < 0 ? 0 : bounds.y + dragStart.y, bounds.width, bounds.height, rectDesigner); + + dragStart.y < 0 ? 0 : bounds.y + dragStart.y, bounds.width, bounds.height, rectDesigner, false); block.setBounds(new UnitRectangle(new Rectangle(resultPoint.x, resultPoint.y, bounds.width, bounds.height), resolution)); designer.repaint(); @@ -124,7 +124,17 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { public RectangleIterator createRectangleIterator() { return getRectangleIt(); } - + + /** + * 设置等距线 + * + * @param line 吸附线 + */ + @Override + public void setEquidistantLine(Absorptionline line) { + + } + /** * 获取当前选中块的垂直线数组 * @@ -145,6 +155,34 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { return editor.getValue().getHorizontalLine(); } + /** + * 设置designer内部组件是否重叠的标志位 + * + * @param isIntersects 是否重叠 + */ + @Override + public void setWidgetsIntersects(boolean isIntersects) { + } + + /** + * 获取designer内部组件是否重叠的标志位 + * + * @return 重叠 + */ + @Override + public boolean getWidgetsIntersects() { + return false; + } + + /** + * 获取designer相对屏幕的位置 + * + * @return 位置 + */ + @Override + public Point getDesignerLocationOnScreen() { + return null; + } }; private RectangleIterator getRectangleIt(){ diff --git a/designer_base/src/com/fr/design/beans/location/Absorptionline.java b/designer_base/src/com/fr/design/beans/location/Absorptionline.java index f72892eef..a0ff0d0e4 100644 --- a/designer_base/src/com/fr/design/beans/location/Absorptionline.java +++ b/designer_base/src/com/fr/design/beans/location/Absorptionline.java @@ -1,23 +1,42 @@ package com.fr.design.beans.location; -import java.awt.Color; -import java.awt.Graphics; +import java.awt.*; import com.fr.base.GraphHelper; import com.fr.design.scrollruler.ScrollRulerComponent; import com.fr.stable.ArrayUtils; +import com.fr.third.org.hsqldb.lib.Collection; public class Absorptionline { + //箭头线前段为4px的等边三角形,给定了一个点的坐标,计算一下剩下两个点的坐标偏移量 + //而且箭头分为四个朝向,故有四组坐标(2根号3 约为 3) + // 1.(x,y)(x+2,y±2根号3)(x-2,y±2根号3) + // 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2) + private static int RECTANGLE_OFFSET_X = 2; + private static int RECTANGLE_OFFSET_Y = 3; + //控件周围八个拖拽框的大小 + private static int RESIZE_BOX_SIZE = 5; + private static Absorptionline lineInX = new Absorptionline(null, null, null, true); private static Absorptionline lineInY = new Absorptionline(null, null, null, false); + private static Absorptionline lineEquidistant = new Absorptionline(null, null, null, true); + private Color lineColor = new Color(228, 225, 199); private Color midLineColor = new Color(196, 227, 237); + private Color equidistantLineColor = new Color(0xff, 0x0d, 0x7b); + private Integer x1; private Integer x2; private Integer middle; private int[] verticalLines; private int[] horizontalLines; + + private int top; + private int left; + private int bottom; + private int right; + private Rectangle equidistantStart; private boolean trans; @@ -89,6 +108,19 @@ public class Absorptionline { return lineInY; } + /** + * 创建等距线 + * @return 等距线 + */ + public static Absorptionline createEquidistantAbsorptionline(Rectangle equidistantStart, int top, int left, int bottom, int right) { + lineEquidistant.equidistantStart = equidistantStart; + lineEquidistant.top = top; + lineEquidistant.left = left; + lineEquidistant.bottom = bottom; + lineEquidistant.right = right; + return lineEquidistant; + } + private Absorptionline(Integer x1, Integer x2, Integer middleInX, boolean trans) { this.x1 = x1; this.x2 = x2; @@ -186,5 +218,134 @@ public class Absorptionline { } } + //画等距线 + if (equidistantStart != null) { + g.setColor(equidistantLineColor); + if (top > 0) { + paintTopEquidistantLine(g); + } + if (left > 0) { + paintLeftEquidistantLine(g); + } + if (bottom > 0) { + paintBottomEquidistantLine(g); + } + if (right > 0) { + paintRightEquidistantLine(g); + } + } + } + + //朝向上方的等距线 + private void paintTopEquidistantLine(Graphics g){ + int x1[] = { + equidistantStart.x + equidistantStart.width / 2, + equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, + equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X + }; + int y1[] = { + top, + top + RECTANGLE_OFFSET_Y, + top + RECTANGLE_OFFSET_Y + }; + int x2[] = { + equidistantStart.x + equidistantStart.width / 2, + equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, + equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X + }; + int y2[] = { + equidistantStart.y - RESIZE_BOX_SIZE, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + g.fillPolygon(x1, y1, 3); + g.fillPolygon(x2, y2, 3); + GraphHelper.drawLine(g, + equidistantStart.x + equidistantStart.width / 2, top, + equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE); + } + //朝向左侧的等距线 + private void paintLeftEquidistantLine(Graphics g){ + int x1[] = { + left, + left + RECTANGLE_OFFSET_Y, + left + RECTANGLE_OFFSET_Y, + }; + int y1[] = { + equidistantStart.y + equidistantStart.height / 2, + equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, + equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, + }; + int x2[] = { + equidistantStart.x - RESIZE_BOX_SIZE, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + int y2[] = { + equidistantStart.y + equidistantStart.height / 2, + equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, + equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X + }; + g.fillPolygon(x1, y1, 3); + g.fillPolygon(x2, y2, 3); + GraphHelper.drawLine(g, + left, equidistantStart.y + equidistantStart.height / 2, + equidistantStart.x - RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2); + } + //朝向下方的等距线 + private void paintBottomEquidistantLine(Graphics g) { + int x1[] = { + equidistantStart.x + equidistantStart.width / 2, + equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, + equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, + }; + int y1[] = { + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + }; + int x2[] = { + equidistantStart.x + equidistantStart.width / 2, + equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, + equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X + }; + int y2[] = { + bottom, + bottom - RECTANGLE_OFFSET_Y, + bottom - RECTANGLE_OFFSET_Y + }; + g.fillPolygon(x1, y1, 3); + g.fillPolygon(x2, y2, 3); + GraphHelper.drawLine(g, + equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width / 2, bottom); + } + //朝向右侧的等距线 + private void paintRightEquidistantLine(Graphics g){ + int x1[] = { + right, + right - 3, + right - 3 + }; + int y1[] = { + equidistantStart.y + equidistantStart.height / 2, + equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, + equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X + }; + int x2[] = { + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y + }; + int y2[] = { + equidistantStart.y + equidistantStart.height / 2, + equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, + equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, + }; + g.fillPolygon(x1, y1, 3); + g.fillPolygon(x2, y2, 3); + GraphHelper.drawLine(g, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2, + right, equidistantStart.y + equidistantStart.height / 2); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/beans/location/MoveUtils.java b/designer_base/src/com/fr/design/beans/location/MoveUtils.java index fddb87648..e0bed7ca1 100644 --- a/designer_base/src/com/fr/design/beans/location/MoveUtils.java +++ b/designer_base/src/com/fr/design/beans/location/MoveUtils.java @@ -3,6 +3,8 @@ */ package com.fr.design.beans.location; +import com.fr.stable.ArrayUtils; + import javax.swing.*; import java.awt.*; import java.util.ArrayList; @@ -17,6 +19,10 @@ public class MoveUtils { public static final int SORPTION_UNIT = 5; + public static WidgetForbidWindow widgetForbidWindow = new WidgetForbidWindow(); + + public static ArrayList equidistantLines = new ArrayList<>(); + private MoveUtils() { } @@ -68,6 +74,30 @@ public class MoveUtils { * */ int[] getHorizontalLine(); + + /** + * 设置designer内部组件是否重叠的标志位 + * @param isIntersects 是否重叠 + */ + void setWidgetsIntersects(boolean isIntersects); + + /** + * 获取designer内部组件是否重叠的标志位 + * @return 重叠 + */ + boolean getWidgetsIntersects(); + + /** + * 获取designer相对屏幕的位置 + * @return 位置 + */ + Point getDesignerLocationOnScreen(); + + /** + * 设置等距线 + * @param line 吸附线 + */ + void setEquidistantLine(Absorptionline line); } public interface RectangleIterator { @@ -183,6 +213,53 @@ public class MoveUtils { } } + private static void findEquidistantLine(Rectangle bounds, int left, int top, int height, int width) { + //最近的距离与坐标 + EquidistantLine equidistantLineInfo = new EquidistantLine(0, 0, 0); + //等距线从各边中点画出,先要判断是不是在范围内 + int topMiddleX = left + width / 2; + int leftMiddleY = top + height / 2; + if ((topMiddleX > bounds.getX()) && (topMiddleX < (bounds.getX() + bounds.getWidth()))){ + //当前操作rec在bounds的下方 + if (top > (bounds.getY() + bounds.getHeight())){ + equidistantLineInfo.setDistance(top - (bounds.y + bounds.height)); + equidistantLineInfo.setReference(bounds.y + bounds.height); + equidistantLineInfo.setDirection(SwingConstants.TOP); + } + //当前操作rec在bounds上方 + if ((top + height) < bounds.getY()){ + equidistantLineInfo.setDistance(bounds.y - (top + height)); + equidistantLineInfo.setReference(bounds.y); + equidistantLineInfo.setDirection(SwingConstants.BOTTOM); + } + } + else if ((leftMiddleY > bounds.getY()) && (leftMiddleY < (bounds.getY() + bounds.getHeight()))){ + //当前操作rec在bounds的右侧 + if (left > (bounds.getX() + bounds.getWidth())){ + equidistantLineInfo.setDistance(left - (bounds.x + bounds.width)); + equidistantLineInfo.setReference(bounds.x + bounds.width); + equidistantLineInfo.setDirection(SwingConstants.LEFT); + } + //当前操作rec在bounds的左侧 + if ((left + width) < bounds.getX()){ + equidistantLineInfo.setDistance(bounds.x - (left + width)); + equidistantLineInfo.setReference(bounds.x); + equidistantLineInfo.setDirection(SwingConstants.RIGHT); + } + } + if(equidistantLineInfo.getDistance() > 0) { + equidistantLines.add(equidistantLineInfo); + } + } + + public static void displayForbidWindow(int x, int y) { + widgetForbidWindow.showWindow(x, y); + } + + public static void hideForbidWindow() { + widgetForbidWindow.hideWindow(); + } + /** * 吸附 * @@ -197,28 +274,67 @@ public class MoveUtils { * @date 2015-2-12-下午2:39:16 * */ - public static Point sorption(int x, int y, int width, int height, RectangleDesigner designer) { + public static Point sorption(int x, int y, int width, int height, RectangleDesigner designer, boolean isParameterLayout) { int left = x, top = y, bottom = top + height, right = left + width; + Rectangle operatingRectangle = new Rectangle(x, y, width, height); + + equidistantLines.clear(); + PlacePointing px = new PlacePointing(x); PlacePointing py = new PlacePointing(y); + + PlacePointing pEquidistantX = new PlacePointing(x); + PlacePointing pEquidistantY = new PlacePointing(y); + RectangleIterator iterator = designer.createRectangleIterator(); java.util.List cacheRecs = new ArrayList(); + //是否存在控件重叠 + boolean isWidgetsIntersects = false; while (iterator.hasNext()) { Rectangle bounds = iterator.nextRectangle(); cacheRecs.add(bounds); + boolean isIntersects = operatingRectangle.intersects(bounds); findX(px, bounds, left, right, width); findY(py, bounds, top, bottom, height); - if (px.isFind() && py.isFind()) { - break; + + if(isIntersects && !isParameterLayout){ + isWidgetsIntersects = true; + } + else{ + findEquidistantLine(bounds, left, top, height, width); } } + showForbiddenWindow(designer, x, y, isWidgetsIntersects); createXAbsorptionline(px, designer, width, cacheRecs); createYAbsorptionline(py, designer, height, cacheRecs); - return new Point(px.palce, py.palce); + operatingRectangle.x = px.palce; + operatingRectangle.y = py.palce; + createEquidistantLine(pEquidistantX, pEquidistantY, operatingRectangle, designer); + Point sorptionPoint = new Point(px.palce,py.palce); + if (!px.isFind()){ + sorptionPoint.x = pEquidistantX.palce; + } + if (!py.isFind()){ + sorptionPoint.y = pEquidistantY.palce; + } + return sorptionPoint; + } + + public static void showForbiddenWindow(RectangleDesigner designer, int x, int y, boolean isIntersects){ + if (isIntersects){ + if(designer.getDesignerLocationOnScreen() != null) { + displayForbidWindow(x + designer.getDesignerLocationOnScreen().x, y + designer.getDesignerLocationOnScreen().y); + } + designer.setWidgetsIntersects(true); + } + else{ + designer.setWidgetsIntersects(false); + hideForbidWindow(); + } } private static void createXAbsorptionline(PlacePointing px, RectangleDesigner designer, int width, java.util.List cacheRecs) { @@ -300,6 +416,70 @@ public class MoveUtils { } designer.setYAbsorptionline(line); } + + private static void createEquidistantLine(PlacePointing px, PlacePointing py, Rectangle operatingRectangle, RectangleDesigner designer){ + processEquidistantLinesList(px, py, operatingRectangle); + Absorptionline line = null; + if(equidistantLines.size() > 0) { + int top = -1; + int left = -1; + int bottom = -1; + int right = -1; + for(int i = 0; i < equidistantLines.size(); i++){ + if (equidistantLines.get(i).getDirection() == SwingConstants.TOP){ + top = equidistantLines.get(i).getReference(); + } + if (equidistantLines.get(i).getDirection() == SwingConstants.LEFT){ + left = equidistantLines.get(i).getReference(); + } + if (equidistantLines.get(i).getDirection() == SwingConstants.BOTTOM){ + bottom = equidistantLines.get(i).getReference(); + } + if (equidistantLines.get(i).getDirection() == SwingConstants.RIGHT){ + right = equidistantLines.get(i).getReference(); + } + } + line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle, top, left, bottom, right); + } + designer.setEquidistantLine(line); + } + + private static void processEquidistantLinesList(PlacePointing pEquidistantX, PlacePointing pEquidistantY, Rectangle operatingRectangle){ + EquidistantLine[] equidistantLines1 = new EquidistantLine[4]; + //先按方向处理,只保留四个方向上距离最近 + for(int count = 0; count < equidistantLines.size(); count++){ + for (int direction = 0; direction < 4; direction++){ + if(equidistantLines.get(count).getDirection() == (direction + 1)){//direction 1,2,3,4 分别对应top,left,bottom,right + if(equidistantLines1[direction] != null + && equidistantLines1[direction].getDistance() > equidistantLines.get(count).getDistance() + || equidistantLines1[direction] == null) { + equidistantLines1[direction] = equidistantLines.get(count); + } + } + } + } + + equidistantLines.clear(); + //找list中横纵分别等距的组合 + if (equidistantLines1[0] != null && equidistantLines1[2] != null){//top, bottom + int offset = equidistantLines1[0].getDistance() - equidistantLines1[2].getDistance(); + if (Math.abs(offset) <= SORPTION_UNIT * 2){ + pEquidistantY.direction = SwingConstants.TOP; + equidistantLines.add(equidistantLines1[0]); + equidistantLines.add(equidistantLines1[2]); + pEquidistantY.palce = operatingRectangle.y - offset / 2; + } + } + if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right + int offset = equidistantLines1[1].getDistance() - equidistantLines1[3].getDistance(); + if (Math.abs(offset) <= SORPTION_UNIT * 2){ + pEquidistantX.direction = SwingConstants.LEFT; + equidistantLines.add(equidistantLines1[1]); + equidistantLines.add(equidistantLines1[3]); + pEquidistantX.palce = operatingRectangle.x - offset / 2; + } + } + } //更新纵向行列线 private static void updateVerticalLine(int[] selfVertical, RectangleIterator iterator, Absorptionline line){ @@ -329,4 +509,43 @@ public class MoveUtils { return false; } + + private static class EquidistantLine{ + //与操作rectangle的距离 + private int distance; + //参考rectangle的位置 + private int reference; + //等距线的方向 + private int direction; + + EquidistantLine(int distance, int reference, int direction){ + this.distance = distance; + this.reference = reference; + this.direction = direction; + } + + public void setDistance(int distance){ + this.distance = distance; + } + + public int getDistance(){ + return this.distance; + } + + public void setReference(int reference){ + this.reference = reference; + } + + public int getReference(){ + return this.reference; + } + + public void setDirection(int direction){ + this.direction = direction; + } + + public int getDirection(){ + return this.direction; + } + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java b/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java new file mode 100644 index 000000000..089a242da --- /dev/null +++ b/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java @@ -0,0 +1,48 @@ +package com.fr.design.beans.location; + +import com.fr.base.BaseUtils; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.icon.IconPathConstants; +import com.fr.general.Inter; + +import javax.swing.*; + +/** + * Created by zhouping on 2016/7/24. + */ +public class WidgetForbidWindow extends JWindow { + + private static final int WIDTH = 150; + private static final int HEIGHT = 20; + + private UIButton promptButton = new UIButton("禁止组件相互重叠", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); + + /** + * 构造函数 + */ + public WidgetForbidWindow() { + this.add(promptButton); + + this.setSize(WIDTH, HEIGHT); + } + + /** + * 在指定位置显示窗口, 默认将window的中心点放到指定位置上 + * + * @param x x坐标 + * @param y y坐标 + * + */ + public void showWindow(int x, int y){ + this.setLocation(x - WIDTH / 2, y - HEIGHT / 2); + this.setVisible(true); + } + + /** + * 隐藏当前窗口 + * + */ + public void hideWindow(){ + this.setVisible(false); + } +} diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index dadfed504..8ce0d0529 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -1,8 +1,10 @@ package com.fr.design.designer.beans.adapters.layout; -import java.awt.Rectangle; +import java.awt.*; import com.fr.design.designer.beans.ConstraintsGroupModel; +import com.fr.design.designer.beans.HoverPainter; +import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; @@ -13,10 +15,16 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter { - + private HoverPainter painter; public FRAbsoluteLayoutAdapter(XLayoutContainer container) { super(container); + painter = new FRAbsoluteLayoutPainter(container); } + + @Override + public HoverPainter getPainter() { + return painter; + } /** * 是否能在指定位置添加组件 @@ -27,8 +35,15 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter { */ @Override public boolean accept(XCreator creator, int x, int y) { - return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() + Component comp = container.getComponentAt(x, y); + //布局控件要先判断是不是可编辑 + XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); + if(topLayout != null && !topLayout.isEditable()){ + return false; + } + boolean isAccept = x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() && creator.getWidth() <= container.getWidth(); + return isAccept; } @Override @@ -46,10 +61,20 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter { } fix(creator, x, y); - container.add(creator); + + if (creator.shouldScaleCreator() || creator.hasTitleStyle()) { + addParentCreator(creator); + } else { + container.add(creator, creator.toData().getWidgetName()); + } LayoutUtils.layoutRootContainer(container); } - + + private void addParentCreator(XCreator child) { + XLayoutContainer parentPanel = child.initCreatorWrapper(child.getHeight()); + container.add(parentPanel, child.toData().getWidgetName()); + } + /** * 组件拖拽后调整大小 * @param creator 组件 diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 840d3a7db..2777c4476 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -117,9 +117,6 @@ public class FRFitLayoutAdapter extends AbstractLayoutAdapter { */ @Override public void addComp(XCreator child, int x, int y) { - if (ComparatorUtils.equals(child.getIconPath(), WIDGETPANEICONPATH)) { - return; - } fix(child, x, y); if (child.shouldScaleCreator() || child.hasTitleStyle()) { addParentCreator(child); diff --git a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java index a5758639b..b44145c0c 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java @@ -3,20 +3,17 @@ */ package com.fr.design.designer.beans.location; -import java.awt.Cursor; -import java.awt.Point; -import java.awt.Rectangle; +import java.awt.*; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; +import com.fr.design.designer.creator.*; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWBorderLayout; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; +import com.fr.form.ui.container.WParameterLayout; /** * @author richer @@ -39,10 +36,7 @@ public abstract class AccessDirection implements Direction { return new int[] { x, y }; } else { int posy = current_bounds.y; - if (posy >= designer.getParaHeight() && !designer.isFormParaDesigner()) { - return new int[] { x, y }; - } - + Point relativePoint = getRelativePoint(x, y, current_bounds,designer); sorptionPoint(relativePoint,current_bounds, designer); return new int[] { relativePoint.x, relativePoint.y }; @@ -72,12 +66,14 @@ public abstract class AccessDirection implements Direction { WAbsoluteLayout layout =getLayout(designer); FormSelection selection = designer.getSelectionModel().getSelection(); + + boolean isWidgetsIntersect = false; for (int i = 0, count = layout.getWidgetCount(); i < count; i++) { BoundsWidget temp = (BoundsWidget) layout.getWidget(i); if (!temp.isVisible() || selection.contains(temp.getWidget())) { continue; } - Rectangle bounds = temp.getBounds(); + Rectangle bounds = getWidgetRelativeBounds(temp.getBounds(), selection); if (!findInX) { int x1 = bounds.x; if (Math.abs(x1 - point.x) <= MoveUtils.SORPTION_UNIT) { @@ -106,18 +102,54 @@ public abstract class AccessDirection implements Direction { if (findInX && findInY) { break; } + + if (current_bounds.intersects(bounds) && !(layout instanceof WParameterLayout)){ + isWidgetsIntersect = true; + } } + processRectangleIntersects(designer, point.x, point.y, isWidgetsIntersect); designer.getStateModel().setXAbsorptionline(findInX && current_bounds.getWidth() > MoveUtils.SORPTION_UNIT ? Absorptionline.createXAbsorptionline(point.x) : null); designer.getStateModel().setYAbsorptionline(findInY && current_bounds.getHeight() > MoveUtils.SORPTION_UNIT ? Absorptionline.createYAbsorptionline(point.y) : null); } + private Rectangle getWidgetRelativeBounds(Rectangle bounds, FormSelection selection){ + Rectangle relativeRec = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator()); + if (parent == null) { + return relativeRec; + } + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + relativeRec.x += rec.x; + relativeRec.y += rec.y; + return relativeRec; + } + + private void processRectangleIntersects(FormDesigner designer, int x, int y, boolean isIntersects){ + if(isIntersects){ + if(designer.getLocationOnScreen() != null) { + MoveUtils.displayForbidWindow(x + designer.getLocationOnScreen().x, y + designer.getLocationOnScreen().y); + } + designer.setWidgetsIntersect(true); + } + else{ + MoveUtils.hideForbidWindow(); + designer.setWidgetsIntersect(false); + } + } + private WAbsoluteLayout getLayout(final FormDesigner designer){ XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator( designer.getTarget().getContainer()); WAbsoluteLayout layout; - if (formLayoutContainer.acceptType(XWBorderLayout.class)){ - layout = (WAbsoluteLayout) designer.getParaComponent().toData(); + if (formLayoutContainer.acceptType(XWBorderLayout.class)){//看起来这边的作用应该是为了区别cpt(得到XWParameterLayout)还是frm(得到XWBorderLayout)的参数界面 + Container container = designer.getSelectionModel().getSelection().getSelectedCreator().getParent(); + if(container instanceof XWAbsoluteLayout){ + layout = ((XWAbsoluteLayout)container).toData(); + } + else { + layout = (WAbsoluteLayout) designer.getParaComponent().toData(); + } } else{ layout = (WAbsoluteLayout) designer.getTarget().getContainer(); } diff --git a/designer_form/src/com/fr/design/designer/beans/location/Inner.java b/designer_form/src/com/fr/design/designer/beans/location/Inner.java index 68db5241e..f6c5bdef6 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/Inner.java +++ b/designer_form/src/com/fr/design/designer/beans/location/Inner.java @@ -4,16 +4,17 @@ import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils.RectangleDesigner; import com.fr.design.beans.location.MoveUtils.RectangleIterator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWBorderLayout; +import com.fr.design.designer.creator.*; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; +import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.stable.ArrayUtils; +import com.fr.third.com.lowagie.text.*; import java.awt.*; +import java.awt.Rectangle; public class Inner extends AccessDirection { @@ -78,17 +79,72 @@ public class Inner extends AccessDirection { public RectangleIterator createRectangleIterator() { return getRectangleIterator(designer); } + + /** + * 设置designer内部组件是否重叠的标志位 + * + * @param isIntersects 是否重叠 + */ + @Override + public void setWidgetsIntersects(boolean isIntersects) { + designer.setWidgetsIntersect(isIntersects); + } + + /** + * 获取designer内部组件是否重叠的标志位 + * + * @return 重叠 + */ + @Override + public boolean getWidgetsIntersects() { + return designer.isWidgetsIntersect(); + } + + /** + * 获取designer相对屏幕的位置 + * + * @return 位置 + */ + @Override + public Point getDesignerLocationOnScreen() { + return designer.getLocationOnScreen(); + } + + /** + * 设置等距线 + * + * @param line 吸附线 + */ + @Override + public void setEquidistantLine(Absorptionline line) { + designer.getStateModel().setEquidistantLine(line); + } }; - point.setLocation(MoveUtils.sorption(point.x, point.y, current_bounds.width, current_bounds.height, rd)); + //判断当前操作的是不是参数面板,要特殊处理 + boolean isParameterLayout = (designer.getSelectionModel().getSelection().getSelectedCreator().getParent()) instanceof XWParameterLayout; + point.setLocation(MoveUtils.sorption(point.x, point.y, current_bounds.width, current_bounds.height, rd, isParameterLayout)); } private RectangleIterator getRectangleIterator(final FormDesigner designer){ + return new RectangleIterator() { private int i; private WAbsoluteLayout layout = getLayout(designer); private int count = layout.getWidgetCount(); private FormSelection selection = designer.getSelectionModel().getSelection(); + private Rectangle getWidgetRelativeBounds(Rectangle bounds){ + Rectangle relativeRec = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator()); + if (parent == null) { + return relativeRec; + } + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + relativeRec.x += rec.x; + relativeRec.y += rec.y; + return relativeRec; + } + public boolean hasNext() { if (i >= count) { return false; @@ -110,7 +166,7 @@ public class Inner extends AccessDirection { } public Rectangle nextRectangle() { BoundsWidget temp = (BoundsWidget) layout.getWidget(i++); - return temp.getBounds(); + return getWidgetRelativeBounds(temp.getBounds()); } }; } @@ -119,8 +175,14 @@ public class Inner extends AccessDirection { XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator( designer.getTarget().getContainer()); WAbsoluteLayout layout; - if (formLayoutContainer.acceptType(XWBorderLayout.class)){ - layout = (WAbsoluteLayout) designer.getParaComponent().toData(); + if (formLayoutContainer.acceptType(XWBorderLayout.class)){//看起来这边的作用应该是为了区别cpt(得到XWParameterLayout)还是frm(得到XWBorderLayout)的参数界面 + Container container = designer.getSelectionModel().getSelection().getSelectedCreator().getParent(); + if(container instanceof XWAbsoluteLayout){ + layout = ((XWAbsoluteLayout)container).toData(); + } + else { + layout = (WAbsoluteLayout) designer.getParaComponent().toData(); + } } else{ layout = (WAbsoluteLayout) designer.getTarget().getContainer(); } diff --git a/designer_form/src/com/fr/design/designer/beans/models/StateModel.java b/designer_form/src/com/fr/design/designer/beans/models/StateModel.java index d92cd9c76..a623caddc 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/StateModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/StateModel.java @@ -44,6 +44,8 @@ public class StateModel { private Absorptionline lineInX; private Absorptionline lineInY; + //等距线 + private Absorptionline lineEquidistant; // 当前是否处于拖拽选择状态 private boolean selecting; @@ -357,6 +359,14 @@ public class StateModel { this.lineInY = line; } + /** + * 等距线赋值 + * @param line 线 + */ + public void setEquidistantLine(Absorptionline line){ + this.lineEquidistant = line; + } + /** *画吸附线 * @param g Graphics类 @@ -368,6 +378,9 @@ public class StateModel { if(lineInY != null) { lineInY.paint(g,designer.getArea()); } + if(lineEquidistant != null){ + lineEquidistant.paint(g,designer.getArea()); + } } /** diff --git a/designer_form/src/com/fr/design/designer/beans/painters/FRAbsoluteLayoutPainter.java b/designer_form/src/com/fr/design/designer/beans/painters/FRAbsoluteLayoutPainter.java new file mode 100644 index 000000000..04e6018fc --- /dev/null +++ b/designer_form/src/com/fr/design/designer/beans/painters/FRAbsoluteLayoutPainter.java @@ -0,0 +1,26 @@ +package com.fr.design.designer.beans.painters; + +import com.fr.design.designer.creator.XLayoutContainer; + +import java.awt.*; + +/** + * Created by zhouping on 2016/7/11. + */ +public class FRAbsoluteLayoutPainter extends AbstractPainter { + public FRAbsoluteLayoutPainter(XLayoutContainer container) { + super(container); + } + + /** + * 组件渲染 + * + * @param g 画图类 + * @param startX 开始位置x + * @param startY 开始位置y + */ + @Override + public void paint(Graphics g, int startX, int startY) { + super.paint(g, startX, startY); + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 6cf0fc216..46e1c42c2 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -3,26 +3,38 @@ */ package com.fr.design.designer.creator; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.ContainerEvent; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; import java.util.HashMap; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.adapters.layout.AbsoluteLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; +import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.icon.IconPathConstants; +import com.fr.design.mainframe.EditingMouseListener; +import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; +import com.fr.general.IOUtils; +import com.fr.general.Inter; /** * @author richer * @since 6.5.3 */ public class XWAbsoluteLayout extends XLayoutContainer { + + private static final int EDIT_BTN_WIDTH = 60; + private static final int EDIT_BTN_HEIGHT = 24; private HashMap xConnectorMap; @@ -158,7 +170,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { WAbsoluteLayout wabs = this.toData(); if (!creator.acceptType(XWFitLayout.class)) { creator.setDirections(Direction.ALL); - } + } wabs.addWidget(new BoundsWidget(creator.toData(), creator.getBounds())); } @@ -187,4 +199,74 @@ public class XWAbsoluteLayout extends XLayoutContainer { public LayoutAdapter getLayoutAdapter() { return new FRAbsoluteLayoutAdapter(this); } + + @Override + public XLayoutContainer getTopLayout() { + XLayoutContainer xTopLayout = XCreatorUtils.getParentXLayoutContainer(this).getTopLayout(); + if (xTopLayout != null && !xTopLayout.isEditable()){ + return xTopLayout; + } + else{ + return this; + } + } + + public void paint(Graphics g) { + super.paint(g); + //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 + if (isMouseEnter && !this.editable) { + int x = 0; + int y = 0; + int w = getWidth(); + int h = getHeight(); + + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + //画白色的编辑层 + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F)); + g2d.setColor(Color.WHITE); + g2d.fillRect(x, y, w, h); + //画编辑按钮所在框 + g2d.setComposite(oldComposite); + g2d.setColor(new Color(176, 196, 222)); + g2d.fillRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT); + //画编辑按钮图标 + BufferedImage image = IOUtils.readImage(IconPathConstants.TD_EDIT_ICON_PATH); + g2d.drawImage( + image, + (x + w / 2 - 23), + (y + h / 2 - image.getHeight() / 2), + image.getWidth(), + image.getHeight(), + null, + this + ); + g2d.setColor(Color.BLACK); + //画编辑文字 + g2d.drawString(Inter.getLocText("Edit"), x + w / 2 - 2, y + h / 2 + 5); + } + } + + /** + * 响应点击事件 + * + * @param editingMouseListener 鼠标点击,位置处理器 + * @param e 鼠标点击事件 + */ + public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ + FormDesigner designer = editingMouseListener.getDesigner(); + SelectionModel selectionModel = editingMouseListener.getSelectionModel(); + boolean isEditing = isEditable() || designer.getCursor().getType() == Cursor.HAND_CURSOR || e.getClickCount() == 2; + setEditable(isEditing); + + selectionModel.selectACreatorAtMouseEvent(e); + designer.repaint(); + + if (editingMouseListener.stopEditing()) { + if (this != designer.getRootComponent()) { + ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); + editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter); + } + } + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 38652b3d4..489aab52b 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -825,7 +825,7 @@ public class XWFitLayout extends XLayoutContainer { /** * 处理自适应布局的directions - * @param creator 组件 + * @param xcreator 组件 */ private void dealDirections(XCreator xcreator, boolean isInit) { if (xcreator == null) { diff --git a/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java b/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java index 9e5520716..890612ccc 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java @@ -163,4 +163,15 @@ public class XWParameterLayout extends XWAbsoluteLayout { public void setBackground(Background background){ this.toData().setBackground(background); } + + @Override + public void paint(Graphics g) { + //参数面板特殊处理,不出现编辑层 + setEditable(true); + super.paint(g); + } + @Override + public XLayoutContainer getTopLayout() { + return this; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java index 229b54943..76287c30f 100644 --- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java +++ b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java @@ -1 +1 @@ -package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file +package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index a4ccae7c2..fc25bd124 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -1,12 +1,16 @@ package com.fr.design.mainframe; -import java.awt.*; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Rectangle; import java.awt.event.MouseEvent; import javax.swing.*; import javax.swing.event.MouseInputAdapter; import com.fr.base.BaseUtils; +import com.fr.design.beans.location.MoveUtils; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; @@ -69,6 +73,9 @@ public class EditingMouseListener extends MouseInputAdapter { private DesignerEditor current_editor; private XCreator current_creator; + //备份开始拖动的位置和大小 + private Rectangle dragBackupBounds; + /** * 获取最小移动距离 * @@ -186,6 +193,14 @@ public class EditingMouseListener extends MouseInputAdapter { if (stateModel.isDragging()) { // 当前鼠标所在的组件 XCreator hoveredComponent = designer.getComponentAt(e.getX(), e.getY()); + if(designer.isWidgetsIntersect() && dragBackupBounds != null && hoveredComponent != null){ + XCreator selectionXCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + if(selectionXCreator != null){ + selectionXCreator.setBounds(dragBackupBounds.x, dragBackupBounds.y, dragBackupBounds.width, dragBackupBounds.height); + MoveUtils.hideForbidWindow(); + } + } + dragBackupBounds = null; // 拉伸时鼠标拖动过快,导致所在组件获取会为空 if (hoveredComponent == null && e.getY() < 0) { // bug63538 @@ -384,6 +399,12 @@ public class EditingMouseListener extends MouseInputAdapter { stateModel.dragging(e); // 获取e所在的焦点组件 XCreator hotspot = designer.getComponentAt(e.getX(), e.getY()); + if(dragBackupBounds == null) { + XCreator selectingXCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + if(selectingXCreator != null){ + dragBackupBounds = new Rectangle(selectingXCreator.getX(), selectingXCreator.getY(), selectingXCreator.getWidth(), selectingXCreator.getHeight()); + } + } // 拉伸时鼠标拖动过快,导致所在组件获取会为空 if (hotspot == null) { return; diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 19bf64c70..40add6915 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -84,6 +84,9 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private ConnectorHelper ConnectorHelper; private boolean isReportBlockEditing = false; + //组件重叠 + private boolean isWidgetsIntersect = false; + /** * 下面的变量都是非序列化成员,不记录设计状态,只作为设计时临时状态使用。 */ @@ -539,6 +542,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection if (paraComponent != null && paraComponent.acceptType(XWParameterLayout.class)){ return true; } + else{ + if (this.getSelectionModel().getSelection().getSelectedCreator().getParent() != null + && ((XLayoutContainer)this.getSelectionModel().getSelection().getSelectedCreator().getParent()).acceptType(XWAbsoluteLayout.class)){ + return true; + } + } return false; } @@ -558,6 +567,14 @@ public class FormDesigner extends TargetComponent implements TreeSelection return this.isReportBlockEditing; } + public void setWidgetsIntersect(boolean isWidgetsIntersect){ + this.isWidgetsIntersect = isWidgetsIntersect; + } + + public boolean isWidgetsIntersect(){ + return this.isWidgetsIntersect; + } + /** * 是否重命名控件 * @param creator 组件 From 0374fd648c17d3d1e07dfc05f198bdf9fe651951 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 29 Jul 2016 09:26:04 +0800 Subject: [PATCH 05/84] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/beans/location/WidgetForbidWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java b/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java index 089a242da..acf934e25 100644 --- a/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java +++ b/designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java @@ -15,7 +15,7 @@ public class WidgetForbidWindow extends JWindow { private static final int WIDTH = 150; private static final int HEIGHT = 20; - private UIButton promptButton = new UIButton("禁止组件相互重叠", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); + private UIButton promptButton = new UIButton(Inter.getLocText("FR-Designer_Forbid_Widgets_Intersects"), BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); /** * 构造函数 From b930df76890e627ca4271dea752888d09f7e8361 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 29 Jul 2016 10:18:31 +0800 Subject: [PATCH 06/84] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8Binstanceof?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E6=88=90acceptType=E5=A5=BD=E4=B8=80?= =?UTF-8?q?=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/designer/beans/location/Inner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/designer/beans/location/Inner.java b/designer_form/src/com/fr/design/designer/beans/location/Inner.java index f6c5bdef6..9e17b4ac3 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/Inner.java +++ b/designer_form/src/com/fr/design/designer/beans/location/Inner.java @@ -121,7 +121,7 @@ public class Inner extends AccessDirection { } }; //判断当前操作的是不是参数面板,要特殊处理 - boolean isParameterLayout = (designer.getSelectionModel().getSelection().getSelectedCreator().getParent()) instanceof XWParameterLayout; + boolean isParameterLayout = ((XCreator)(designer.getSelectionModel().getSelection().getSelectedCreator().getParent())).acceptType(XWParameterLayout.class); point.setLocation(MoveUtils.sorption(point.x, point.y, current_bounds.width, current_bounds.height, rd, isParameterLayout)); } From 479116088873f89a3dc9131116e69f37aa99dddc Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 29 Jul 2016 14:26:52 +0800 Subject: [PATCH 07/84] sonar --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index f3ad57a2d..05253b02f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectKey=finereport.design # this is the name displayed in the SonarQube UI sonar.projectName=finereport.design sonar.projectVersion=1.0 -sonar.branch=master +sonar.branch=dev # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # Since SonarQube 4.2, this property is optional if sonar.modules is set. From 49d9558d667274d590a9731fb5202c0a59f34bec Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 29 Jul 2016 14:56:57 +0800 Subject: [PATCH 08/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96=E5=92=8C=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/widget/CellWidgetCardPane.java | 7 +- .../widget/ui/FieldEditorDefinePane.java | 28 ++- .../widget/ui/NumberEditorDefinePane.java | 59 ++++-- .../widget/ui/TextFieldEditorDefinePane.java | 64 +++++- .../src/com/fr/design/gui/frpane/RegPane.java | 185 +++++++++--------- .../component/CompositeComponentAdapter.java | 17 +- .../fr/design/designer/creator/XButton.java | 3 +- .../fr/design/designer/creator/XCheckBox.java | 2 + .../designer/creator/XCheckBoxGroup.java | 30 +-- .../fr/design/designer/creator/XComboBox.java | 11 +- .../designer/creator/XComboCheckBox.java | 16 +- .../creator/XCustomWriteAbleRepeatEditor.java | 2 +- .../design/designer/creator/XDateEditor.java | 25 +-- .../designer/creator/XDirectWriteEditor.java | 4 +- .../design/designer/creator/XFieldEditor.java | 6 +- .../fr/design/designer/creator/XLabel.java | 2 +- .../designer/creator/XNumberEditor.java | 31 ++- .../fr/design/designer/creator/XPassword.java | 9 +- .../design/designer/creator/XRadioGroup.java | 18 +- .../fr/design/designer/creator/XTextArea.java | 13 +- .../design/designer/creator/XTextEditor.java | 34 ++-- .../designer/creator/XTreeComboBoxEditor.java | 4 +- .../design/designer/creator/XTreeEditor.java | 18 +- .../design/form/util/XCreatorConstants.java | 1 + .../accessibles/AccessiblePropertyEditor.java | 5 + 25 files changed, 380 insertions(+), 214 deletions(-) diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index b2d206c91..4e8682f1c 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -86,7 +86,12 @@ public class CellWidgetCardPane extends BasicPane { attriPane.remove(widgetPropertyPane); widgetPropertyPane = new BasicWidgetPropertySettingPane(); - attriPane.add(widgetPropertyPane, BorderLayout.NORTH); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 5, 8)); + JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties")); + northPane.add(basic); + basic.add(widgetPropertyPane); + attriPane.add(northPane, BorderLayout.NORTH); WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { @Override diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index 1d1c36d32..f454657e2 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -32,14 +32,10 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northPane, BorderLayout.NORTH); - JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); - // 是否允许为空 - firstPanel.add(allowBlankCheckBox); + allowBlankCheckBox.addItemListener(new ItemListener() { @Override @@ -50,8 +46,16 @@ public abstract class FieldEditorDefinePane extends Abstr // 错误信息 JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - firstPanel.add(errorMsgPane); - northPane.add(firstPanel); + //目前只整改了文本、密码、文本域和数字四个控件 + if(!(this instanceof TextFieldEditorDefinePane)&&!(this instanceof NumberEditorDefinePane)){ + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + this.add(northPane, BorderLayout.NORTH); + JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + firstPanel.add(allowBlankCheckBox); + firstPanel.add(errorMsgPane); + northPane.add(firstPanel); + } errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); errorMsgTextField = new UITextField(16); errorMsgPane.add(errorMsgTextField); @@ -109,4 +113,12 @@ public abstract class FieldEditorDefinePane extends Abstr public void checkValid() throws Exception { } + public UICheckBox getAllowBlankCheckBox(){ + return allowBlankCheckBox; + } + + public UITextField getErrorMsgTextField(){ + return errorMsgTextField; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 9837a9a08..d322c5d39 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -14,10 +14,13 @@ import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import javax.swing.text.DefaultFormatter; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; @@ -39,6 +42,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane private com.fr.design.editor.editor.IntegerEditor decimalLength; private JPanel limitNumberPane; private WaterMarkDictPane waterMarkDictPane; + private UITextField regErrorMsgTextField; private ActionListener actionListener1 = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -121,9 +125,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); - } + if (setMinValueCheckBox.isSelected()) { + minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + } } } }; @@ -133,9 +137,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); - } + if (setMaxValueCheckBox.isSelected()) { + maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + } } } }; @@ -153,26 +157,34 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - content.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + content.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); content.setLayout(FRGUIPaneFactory.createBorderLayout()); // richer:数字的允许直接编辑没有意义 - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); content.add(northPane, BorderLayout.NORTH); waterMarkDictPane = new WaterMarkDictPane(); northPane.add(waterMarkDictPane); + JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + validatePane.setPreferredSize(new Dimension(400,200)); + centerPane.add(validatePane); + content.add(northPane, BorderLayout.NORTH); + content.add(centerPane, BorderLayout.CENTER); + validatePane.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); this.decimalLength.setColumns(4); limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, FlowLayout.LEFT, 4); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); this.allowDecimalsCheckBox.addActionListener(actionListener1); this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); this.allowNegativeCheckBox.addActionListener(actionListener2); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); @@ -180,7 +192,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); maxValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.maxValueSpinner); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); this.maxValueSpinner.setVisible(false); this.setMaxValueCheckBox.addActionListener(actionListener3); this.maxValueSpinner.addChangeListener(changeListener1); @@ -189,10 +201,29 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); minValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.minValueSpinner); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); this.minValueSpinner.setVisible(false); this.setMinValueCheckBox.addActionListener(actionListener4); this.minValueSpinner.addChangeListener(changeListener2); + + regErrorMsgTextField = new UITextField(16); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); + + regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + }); + return content; } @@ -227,7 +258,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane minValueSpinner.setVisible(true); minValueSpinner.setValue(new Double(e.getMinValue())); } - + this.regErrorMsgTextField.setText(e.getRegErrorMessage()); this.waterMarkDictPane.populate(e); } @@ -255,6 +286,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.waterMarkDictPane.update(ob); + ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); + return ob; } diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 28217bf03..12003ec2b 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,19 +1,29 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.TextEditor; +import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class TextFieldEditorDefinePane extends FieldEditorDefinePane { protected RegPane regPane; private WaterMarkDictPane waterMarkDictPane; + private UITextField regErrorMsgTextField; public TextFieldEditorDefinePane() { this.initComponents(); @@ -22,10 +32,28 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); + attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - attrPane.add(contenter, BorderLayout.NORTH); + contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + attrPane.add(contenter); + JPanel regErrorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + regErrorMsgTextField = new UITextField(16); + regErrorMsgPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); + + regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + }); regPane = createRegPane(); final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { @@ -45,7 +73,15 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }; regPane.addPhoneRegListener(pl); - + JPanel spp1 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + getAllowBlankCheckBox().setPreferredSize(new Dimension(444,40)); + validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); + validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); + spp1.add(validateContent); + JPanel spp2 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane.addInputKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { @@ -54,8 +90,21 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane waterMarkDictPane.removeInputKeyListener(this); } }); - contenter.add(regPane, BorderLayout.NORTH); - contenter.add(waterMarkDictPane, BorderLayout.CENTER); + //监听填写规则下拉框的值的变化 + regPane.getRegComboBox().addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + RegExp regExp = (RegExp)regPane.getRegComboBox().getSelectedItem(); + if(regExp instanceof NoneReg){ + regErrorMsgTextField.setEnabled(false); + }else{ + regErrorMsgTextField.setEnabled(true); + } + + } + }); + spp2.add(waterMarkDictPane); + contenter.add(spp2, BorderLayout.NORTH); + contenter.add(spp1, BorderLayout.CENTER); return attrPane; } @@ -71,13 +120,14 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected void populateSubFieldEditorBean(TextEditor e) { this.regPane.populate(e.getRegex()); + regErrorMsgTextField.setText(e.getRegErrorMessage()); waterMarkDictPane.populate(e); } @Override protected TextEditor updateSubFieldEditorBean() { TextEditor ob = newTextEditorInstance(); - + ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); ob.setRegex(this.regPane.update()); waterMarkDictPane.update(ob); diff --git a/designer_base/src/com/fr/design/gui/frpane/RegPane.java b/designer_base/src/com/fr/design/gui/frpane/RegPane.java index 8e0ae5eff..22ac8863d 100644 --- a/designer_base/src/com/fr/design/gui/frpane/RegPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/RegPane.java @@ -48,15 +48,15 @@ public class RegPane extends BasicPane { new MobileReg(), new CustomReg() }; - + public static final RegExp[] TEXTAREA_REG_TYPE = { new NoneReg(), new LengthReg(), new CustomReg() }; - + public static final RegExp[] PASSWORD_REG_TYPE = TEXTAREA_REG_TYPE; - + private RegExp[] regType; private UIComboBox regComboBox; private CardLayout detailedCardLayout; @@ -64,16 +64,21 @@ public class RegPane extends BasicPane { private RegPhonePane regPhonePane; private DefaultRegPane defaultRegPane; private CustomRegRexPane customRegRexPane; - + + + public UIComboBox getRegComboBox(){ + return regComboBox; + } + public RegPane() { this(ALL_REG_TYPE); } - + public RegPane(RegExp[] types) { this.regType = types; this.initComponents(); } - + private void initComponents(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); @@ -82,7 +87,7 @@ public class RegPane extends BasicPane { regComboBox = new UIComboBox(regType); regComboBox.setRenderer(listCellRender); contentPane.add(regComboBox); - + final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); detailedCardLayout = new CardLayout(); cardPane.setLayout(detailedCardLayout); @@ -90,7 +95,7 @@ public class RegPane extends BasicPane { cardPane.add((regLengthPane = new RegLengthPane()), "Length"); cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); - + this.add(cardPane); regComboBox.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { @@ -111,15 +116,15 @@ public class RegPane extends BasicPane { } fireRegChangeAction(); } - } + } }); } - + @Override protected String title4PopupWindow() { return Inter.getLocText("FR-Designer_Input_Rule"); } - + private int getRegTypeIndex(RegExp regex) { if (regex != null) { for (int i = 0; i < regType.length; i++) { @@ -131,7 +136,7 @@ public class RegPane extends BasicPane { return 0; } - + public void populate(RegExp regex) { regComboBox.setSelectedIndex(getRegTypeIndex(regex)); if (regex instanceof LengthReg) { @@ -144,111 +149,111 @@ public class RegPane extends BasicPane { defaultRegPane.populate(regex); } } - + public RegExp update(){ RegExp regExp = (RegExp)regComboBox.getSelectedItem(); - + if (regExp instanceof LengthReg){ return regLengthPane.update(); } else if(regExp instanceof PhoneReg) { return regPhonePane.update(); - } else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg - || regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) { + } else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg + || regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) { return regExp; } else if (regExp instanceof CustomReg){ - if (customRegRexPane.isEmpty()) { - return new NoneReg(); - } + if (customRegRexPane.isEmpty()) { + return new NoneReg(); + } return customRegRexPane.update(); } else { return defaultRegPane.update(); } } - + private static abstract class DisplayPane extends BasicPane { public abstract void populate(RegExp regRex); - + public abstract RegExp update(); } - + private static class DefaultRegPane extends DisplayPane { public RegExp regRex; - + public DefaultRegPane(){ - + } - + @Override protected String title4PopupWindow() { return "Default"; } - + @Override public void populate(RegExp regRex) { - + } @Override public RegExp update() { - + return this.regRex; - } + } } - + /** * 添加电话规则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:30:55 - * + * */ public void addPhoneRegListener(PhoneRegListener listener) { this.listenerList.add(PhoneRegListener.class, listener); } - + /** * 移除电话规则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:30:55 - * + * */ public void removePhoneRegListener(PhoneRegListener listener) { this.listenerList.remove(PhoneRegListener.class, listener); } - + /** * 添加正则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:29:48 - * + * */ public void addRegChangeListener(RegChangeListener listener) { this.listenerList.add(RegChangeListener.class, listener); } - + /** * 移除正则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:29:48 - * + * */ public void removeRegChangeListener(RegChangeListener listener) { this.listenerList.remove(RegChangeListener.class, listener); } - + public class PhoneRegEvent extends EventObject { private String phoneRegString; public PhoneRegEvent(Object source, String phoneRegString) { @@ -275,48 +280,48 @@ public class RegPane extends BasicPane { return regString; } } - + public interface PhoneRegListener extends EventListener{ - + /** * 电话规则变化监听 - * + * * @param e 变化事件 - * + * * * @date 2014-12-3-下午7:29:01 - * + * */ void phoneRegChangeAction(PhoneRegEvent e); - + } - + public interface RegChangeListener extends EventListener { - + /** * 正则表达规则变化监听 - * + * * * @date 2014-12-3-下午7:29:01 - * + * */ void regChangeAction(); } protected void firePhoneRegAction(String phoneReg) { Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==PhoneRegListener.class) { - ((PhoneRegListener)listeners[i+1]).phoneRegChangeAction(new PhoneRegEvent(this , phoneReg)); - } - } + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==PhoneRegListener.class) { + ((PhoneRegListener)listeners[i+1]).phoneRegChangeAction(new PhoneRegEvent(this , phoneReg)); + } + } } protected void fireRegChangeAction() { Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==RegChangeListener.class) { - ((RegChangeListener)listeners[i+1]).regChangeAction(); - } - } + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==RegChangeListener.class) { + ((RegChangeListener)listeners[i+1]).regChangeAction(); + } + } } private class RegPhonePane extends DisplayPane { private static final String EMB_REG1 = "025-85679591"; @@ -324,7 +329,7 @@ public class RegPane extends BasicPane { private static final String EMB_REG3 = "025 85679591"; private static final int LIMIT_LENGTH = 20; private static final String REG_PATTERN = "0123456789-*# "; - + private UIComboBox dataTypeComboBox; private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")}; DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); @@ -357,7 +362,7 @@ public class RegPane extends BasicPane { protected String title4PopupWindow() { return "PHONE"; } - + @Override public void populate(RegExp regRex) { if(!(regRex instanceof PhoneReg)) { @@ -369,13 +374,13 @@ public class RegPane extends BasicPane { } dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString()); } - + private boolean checkEmbedded(String regstr){ return !ComparatorUtils.equals(EMB_REG1, regstr) && - !ComparatorUtils.equals(EMB_REG2, regstr) && - !ComparatorUtils.equals(EMB_REG3, regstr); + !ComparatorUtils.equals(EMB_REG2, regstr) && + !ComparatorUtils.equals(EMB_REG3, regstr); } - + @Override public RegExp update() { PhoneReg regRex = new PhoneReg(); @@ -383,11 +388,11 @@ public class RegPane extends BasicPane { return regRex; } } - + private static class RegLengthPane extends DisplayPane { private UISpinner minLenSpinner; private UISpinner maxLenSpinner; - + public RegLengthPane(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); @@ -395,9 +400,9 @@ public class RegPane extends BasicPane { this.add(minLenSpinner); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - this.add(maxLenSpinner); + this.add(maxLenSpinner); } - + @Override protected String title4PopupWindow() { return "LENGTH"; @@ -408,11 +413,11 @@ public class RegPane extends BasicPane { if (!(regRex instanceof LengthReg)){ return; } - + int minLength = ((LengthReg)regRex).getMinLen(); int maxLength = ((LengthReg)regRex).getMaxLen(); minLenSpinner.setValue(minLength); - maxLenSpinner.setValue(maxLength); + maxLenSpinner.setValue(maxLength); } @Override @@ -422,21 +427,21 @@ public class RegPane extends BasicPane { LengthReg regRex = new LengthReg(); regRex.setMinLen(startLength); regRex.setMaxLen(endLength); - + return regRex; - } + } } - + private static class CustomRegRexPane extends DisplayPane{ private UITextField regTextField; - + public CustomRegRexPane(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":")); regTextField = new UITextField(20); this.add(regTextField); } - + @Override protected String title4PopupWindow() { return "CUSTOM"; @@ -451,19 +456,19 @@ public class RegPane extends BasicPane { } @Override - public RegExp update() { + public RegExp update() { return new CustomReg(regTextField.getText()); } - public boolean isEmpty() { - return StringUtils.isEmpty(regTextField.getText()); - } + public boolean isEmpty() { + return StringUtils.isEmpty(regTextField.getText()); + } } - + ListCellRenderer listCellRender = new UIComboBoxRenderer(){ @Override public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { + int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof NoneReg){ this.setText(Inter.getLocText("FR-Designer_None")); @@ -484,6 +489,6 @@ public class RegPane extends BasicPane { } return this; } - + }; } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java index 82c939060..e6f607e41 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java @@ -100,7 +100,10 @@ public class CompositeComponentAdapter implements ComponentAdapter { for (CRPropertyDescriptor property : properties) { String groupName = (String) property.getValue(XCreatorConstants.PROPERTY_CATEGORY); if (StringUtils.isEmpty(groupName)) { - groupName = XCreatorConstants.DEFAULT_GROUP_NAME; + groupName = (String) property.getValue(XCreatorConstants.PROPERTY_VALIDATE); + if(StringUtils.isEmpty(groupName)){ + groupName = XCreatorConstants.DEFAULT_GROUP_NAME; + } } ArrayList groupProperties = maps.get(groupName); if (groupProperties == null) { @@ -110,6 +113,7 @@ public class CompositeComponentAdapter implements ComponentAdapter { } groupProperties.add(property); } + adjustGroupNamesPosition(groupNames); ArrayList groups = new ArrayList(); for (String groupName : groupNames) { ArrayList groupProperties = maps.get(groupName); @@ -120,6 +124,15 @@ public class CompositeComponentAdapter implements ComponentAdapter { return groups; } + public void adjustGroupNamesPosition(ArrayList groupNames){ + for(String groupName : groupNames){ + if(groupName.equals("Form-Basic_Properties")){ + groupNames.remove(groupName); + groupNames.add(0,groupName); + break; + } + } + } @Override public ArrayList getXCreatorPropertyModel() { ArrayList groupModels = new ArrayList(); @@ -130,7 +143,7 @@ public class CompositeComponentAdapter implements ComponentAdapter { groupModels.addAll(groups); return groupModels; } - + /** * 自适应布局中放置文本框等用的scaleLayout和报表块、图表块支持的标题控件用的titleLayout时 * 控件树处只显示父容器,但是控件属性还是为自身的 diff --git a/designer_form/src/com/fr/design/designer/creator/XButton.java b/designer_form/src/com/fr/design/designer/creator/XButton.java index 4e0bd880a..9913c27d0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XButton.java +++ b/designer_form/src/com/fr/design/designer/creator/XButton.java @@ -91,7 +91,7 @@ public class XButton extends XWidgetCreator { protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ CRPropertyDescriptor[] crPropertyDescriptors = { new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( - Inter.getLocText(new String[] {"Form-Button", "Name"})), + Inter.getLocText(new String[] {"Form-Button", "Name"})).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Form-Button", "Style"})).setEditorClass( ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), @@ -164,6 +164,7 @@ public class XButton extends XWidgetCreator { return new CRPropertyDescriptor[]{ new CRPropertyDescriptor("text", this.data.getClass()) .setI18NName(Inter.getLocText(new String[] {"Form-Button", "Name"})) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCheckBox.java b/designer_form/src/com/fr/design/designer/creator/XCheckBox.java index 39d41407e..92c09aed7 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCheckBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XCheckBox.java @@ -32,6 +32,7 @@ public class XCheckBox extends XWidgetCreator { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(Inter.getLocText("Text")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override @@ -41,6 +42,7 @@ public class XCheckBox extends XWidgetCreator { }), new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java index 0aba61dad..a14c9330a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java @@ -34,35 +34,35 @@ public class XCheckBoxGroup extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), getCRPropertyDescriptor()); - } - - private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { + CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( - DictionaryRenderer.class), + DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor()); + return properties; + } + + private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class), new CRPropertyDescriptor("chooseAll", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Provide", "Choose_All"})).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( - Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") }; + Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }; if (((CheckBoxGroup) this.toData()).isReturnString()) { crp = (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, new CRPropertyDescriptor[] { new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( - Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value"), + Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") }); + Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } if (!((CheckBoxGroup) this.toData()).isAdaptive()) { crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("columnsInRow", this.data diff --git a/designer_form/src/com/fr/design/designer/creator/XComboBox.java b/designer_form/src/com/fr/design/designer/creator/XComboBox.java index b08b6369c..64d379c5a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XComboBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XComboBox.java @@ -10,6 +10,7 @@ import java.beans.IntrospectionException; import javax.swing.JComponent; +import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.editors.DictionaryEditor; @@ -38,11 +39,11 @@ public class XComboBox extends XCustomWriteAbleRepeatEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll( - super.supportedDescriptor(), - new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), - new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) - }); + new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + }, super.supportedDescriptor()); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java b/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java index 482af817b..84869a2c0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java @@ -32,20 +32,20 @@ public class XComboCheckBox extends XComboBox { Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setEditorClass( - InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") } : new CRPropertyDescriptor[] { + InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") } : new CRPropertyDescriptor[] { new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( - Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("ComboCheckBox-Start_Symbol")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value") }); + Inter.getLocText("ComboCheckBox-End_Symbol")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java b/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java index 6166dea95..141ceba08 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java @@ -1 +1 @@ -package com.fr.design.designer.creator; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData"))}); } } \ No newline at end of file +package com.fr.design.designer.creator; import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData")) .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")}); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XDateEditor.java b/designer_form/src/com/fr/design/designer/creator/XDateEditor.java index 80efa40fc..2a8f6aedd 100644 --- a/designer_form/src/com/fr/design/designer/creator/XDateEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XDateEditor.java @@ -46,17 +46,20 @@ public class XDateEditor extends XDirectWriteEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor [] tempt=(CRPropertyDescriptor[]) ArrayUtils.addAll( new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class).setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - initFieldText(); - } - }), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced").setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + initFieldText(); + } + })},super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(tempt, + new CRPropertyDescriptor[] { new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName( Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass( DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), @@ -66,11 +69,11 @@ public class XDateEditor extends XDirectWriteEditor { new CRPropertyDescriptor("endDate", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_End-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(DateRangeEditor.class), - new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value"), new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced"), + new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } diff --git a/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java b/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java index 80b899380..e1690e506 100644 --- a/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java @@ -6,6 +6,7 @@ package com.fr.design.designer.creator; import java.awt.Dimension; import java.beans.IntrospectionException; +import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.DirectWriteEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -24,6 +25,7 @@ public abstract class XDirectWriteEditor extends XFieldEditor { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("directEdit", this.data.getClass()) - .setI18NName(Inter.getLocText("Form-Allow_Edit")) }); + .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue( + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate") }); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java index c5af4a4ae..4b8a0db68 100644 --- a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java @@ -6,6 +6,8 @@ package com.fr.design.designer.creator; import java.awt.Color; import java.awt.Dimension; import java.beans.IntrospectionException; +import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.border.Border; @@ -38,10 +40,10 @@ public abstract class XFieldEditor extends XWidgetCreator { private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( Inter.getLocText("Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( Inter.getLocText("Verify-Message")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") .setI18NName(Inter.getLocText(new String[]{"FRFont", "FRFont-Size"})) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); diff --git a/designer_form/src/com/fr/design/designer/creator/XLabel.java b/designer_form/src/com/fr/design/designer/creator/XLabel.java index 20491ec39..2a47eb3af 100644 --- a/designer_form/src/com/fr/design/designer/creator/XLabel.java +++ b/designer_form/src/com/fr/design/designer/creator/XLabel.java @@ -59,7 +59,7 @@ public class XLabel extends XWidgetCreator { new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), diff --git a/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java b/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java index a57a90059..3340f4bf6 100644 --- a/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java @@ -41,31 +41,42 @@ public class XNumberEditor extends XWrapperedFieldEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] sup = super.supportedDescriptor(); + CRPropertyDescriptor[] sup =(CRPropertyDescriptor[]) ArrayUtils.addAll( + new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetValue", this.data.getClass()) + .setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})) + .setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")} + ,super.supportedDescriptor()); CRPropertyDescriptor allowDecimal = new CRPropertyDescriptor("allowDecimals", this.data.getClass()) .setEditorClass(InChangeBooleanEditor.class) - .setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals")); + .setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals")) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor decimalLength = new CRPropertyDescriptor("maxDecimalLength", this.data.getClass()) - .setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"})); + .setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"})) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, ((NumberEditor)this.data).isAllowDecimals() ? new CRPropertyDescriptor[] {allowDecimal, decimalLength} : new CRPropertyDescriptor[] {allowDecimal}); return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] { new CRPropertyDescriptor("allowNegative", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Allow_Negative")) - .setEditorClass(InChangeBooleanEditor.class), + .setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("minValue", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Min_Value")) - .setEditorClass(SpinnerMinNumberEditor.class), + .setEditorClass(SpinnerMinNumberEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("maxValue", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Max_Value")) - .setEditorClass(SpinnerMaxNumberEditor.class), - new CRPropertyDescriptor("widgetValue", this.data.getClass()) - .setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})) - .setEditorClass(WidgetValueEditor.class), + .setEditorClass(SpinnerMaxNumberEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_WaterMark")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("regErrorMessage", this.data.getClass()) + .setI18NName(Inter.getLocText("Verify-Message")) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate") }); } diff --git a/designer_form/src/com/fr/design/designer/creator/XPassword.java b/designer_form/src/com/fr/design/designer/creator/XPassword.java index b25d63778..b42c171f0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XPassword.java +++ b/designer_form/src/com/fr/design/designer/creator/XPassword.java @@ -47,16 +47,19 @@ public class XPassword extends XWrapperedFieldEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll( new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")} + , super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, + new CRPropertyDescriptor[] { new CRPropertyDescriptor("regex", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Input_Rule")) .setEditorClass(RegexEditor.RegexEditor4TextArea.class) .putKeyValue("renderer", RegexCellRencerer.class) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_WaterMark")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") diff --git a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java index d54f12dab..daf2b25e4 100644 --- a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.DictionaryRenderer; import com.fr.form.ui.RadioGroup; import com.fr.design.form.util.XCreatorConstants; +import com.fr.function.ARRAY; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -39,16 +40,19 @@ public class XRadioGroup extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),getCRPropertyDescriptor()); - } - - private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { + CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( - DictionaryRenderer.class), + DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor()); + return properties; + } + + private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class)}; if (!toData().isAdaptive()) { diff --git a/designer_form/src/com/fr/design/designer/creator/XTextArea.java b/designer_form/src/com/fr/design/designer/creator/XTextArea.java index fbaf1a44e..d91bb97bd 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextArea.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextArea.java @@ -36,15 +36,16 @@ public class XTextArea extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll( + new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( Inter.getLocText("Input_Rule")).setEditorClass(RegexEditor.RegexEditor4TextArea.class) - .putKeyValue("renderer", RegexCellRencerer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue("renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), }); diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 0165b3e18..52ce65295 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -18,6 +18,7 @@ import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; import com.fr.form.ui.TextEditor; +import com.fr.form.ui.reg.NoneReg; import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -40,18 +41,27 @@ public class XTextEditor extends XWrapperedFieldEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), - new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), - new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( - "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced"), - new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced"), }); + CRPropertyDescriptor widgetValue=new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + CRPropertyDescriptor regex= new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( + "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor regErrorMessage=new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName( + Inter.getLocText("Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor waterMark= new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced"); + CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {widgetValue},super.supportedDescriptor()); + Boolean displayRegField = false; + if((((TextEditor) toData()).getRegex() instanceof NoneReg) || ((TextEditor) toData()).getRegex()==null){ + displayRegField = false; + }else{ + displayRegField = true; + } + return displayRegField? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, + new CRPropertyDescriptor[] {regex, regErrorMessage, waterMark} ): + (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,new CRPropertyDescriptor[] {regex, waterMark}); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java b/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java index 52ec9d7a6..2023215ee 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java @@ -53,13 +53,13 @@ public class XTreeComboBoxEditor extends XTreeEditor { protected CRPropertyDescriptor[] addAllowEdit(CRPropertyDescriptor[] crp) throws IntrospectionException{ return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("directEdit", this.data.getClass()) .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")); } protected CRPropertyDescriptor[] addCustomData(CRPropertyDescriptor[] crp) throws IntrospectionException{ return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("customData", this.data.getClass()) .setI18NName(Inter.getLocText("Form-Allow_CustomData")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java b/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java index 4b36820bc..683843cae 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java @@ -41,26 +41,28 @@ public class XTreeEditor extends XWidgetCreator { CRPropertyDescriptor[] crp = !((FieldEditor) toData()).isAllowBlank() ? new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( - TreeModelRenderer.class), + TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_Verify-Message")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), } : new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( - TreeModelRenderer.class), + TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),}; + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),}; crp = this.addWaterMark(crp); crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, diff --git a/designer_form/src/com/fr/design/form/util/XCreatorConstants.java b/designer_form/src/com/fr/design/form/util/XCreatorConstants.java index 26bf0a049..acbb520d5 100644 --- a/designer_form/src/com/fr/design/form/util/XCreatorConstants.java +++ b/designer_form/src/com/fr/design/form/util/XCreatorConstants.java @@ -21,6 +21,7 @@ public class XCreatorConstants { // 描述属性的分类 public static final String PROPERTY_CATEGORY = "category"; public static final String DEFAULT_GROUP_NAME = "Form-Basic_Properties"; + public static final String PROPERTY_VALIDATE = "validate"; public static final Color FORM_BG = new Color(252, 252, 254); // 拖拽标识块的大小 public static final int RESIZE_BOX_SIZ = 5; diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java index fc15d746f..45d816590 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java @@ -33,6 +33,11 @@ public class AccessiblePropertyEditor extends AbstractPropertyEditor { editor.setValue(value); } + @Override + public boolean refreshInTime() { + return true; + } + @Override public Object getValue() { return editor.getValue(); From c3226b26590c2a64070993cd3eb2b8358ce03b74 Mon Sep 17 00:00:00 2001 From: zhouping Date: Sun, 31 Jul 2016 22:40:30 +0800 Subject: [PATCH 09/84] =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/beans/location/Absorptionline.java | 192 +++++++++++------- .../fr/design/beans/location/MoveUtils.java | 2 + 2 files changed, 119 insertions(+), 75 deletions(-) diff --git a/designer_base/src/com/fr/design/beans/location/Absorptionline.java b/designer_base/src/com/fr/design/beans/location/Absorptionline.java index a0ff0d0e4..189c7e046 100644 --- a/designer_base/src/com/fr/design/beans/location/Absorptionline.java +++ b/designer_base/src/com/fr/design/beans/location/Absorptionline.java @@ -14,6 +14,7 @@ public class Absorptionline { // 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2) private static int RECTANGLE_OFFSET_X = 2; private static int RECTANGLE_OFFSET_Y = 3; + private static int WIDGET_DISTANCE_MIN = 8; //控件周围八个拖拽框的大小 private static int RESIZE_BOX_SIZE = 5; @@ -238,114 +239,155 @@ public class Absorptionline { //朝向上方的等距线 private void paintTopEquidistantLine(Graphics g){ - int x1[] = { + int x[] = { equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X }; - int y1[] = { - top, - top + RECTANGLE_OFFSET_Y, - top + RECTANGLE_OFFSET_Y - }; - int x2[] = { - equidistantStart.x + equidistantStart.width / 2, - equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, - equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X - }; - int y2[] = { - equidistantStart.y - RESIZE_BOX_SIZE, - equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, - equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] y1, y2; + if (equidistantStart.y - top > WIDGET_DISTANCE_MIN) { + y1 = new int[] { + top, + top + RECTANGLE_OFFSET_Y, + top + RECTANGLE_OFFSET_Y + }; + y2 = new int[]{ + equidistantStart.y - RESIZE_BOX_SIZE, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + } + else{ + y1 = new int[] { + top, + top - RECTANGLE_OFFSET_Y, + top - RECTANGLE_OFFSET_Y + }; + y2 = new int[] { + equidistantStart.y, + equidistantStart.y + RECTANGLE_OFFSET_Y, + equidistantStart.y + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x, y1, 3); + g.fillPolygon(x, y2, 3); GraphHelper.drawLine(g, equidistantStart.x + equidistantStart.width / 2, top, equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE); } //朝向左侧的等距线 private void paintLeftEquidistantLine(Graphics g){ - int x1[] = { - left, - left + RECTANGLE_OFFSET_Y, - left + RECTANGLE_OFFSET_Y, - }; - int y1[] = { + int y[] = { equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, }; - int x2[] = { - equidistantStart.x - RESIZE_BOX_SIZE, - equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, - equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y - }; - int y2[] = { - equidistantStart.y + equidistantStart.height / 2, - equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, - equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] x1, x2; + if (equidistantStart.x - left > WIDGET_DISTANCE_MIN) { + x1 = new int[] { + left, + left + RECTANGLE_OFFSET_Y, + left + RECTANGLE_OFFSET_Y, + }; + + x2 = new int[] { + equidistantStart.x - RESIZE_BOX_SIZE, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + } + else{ + x1 = new int[] { + left, + left - RECTANGLE_OFFSET_Y, + left - RECTANGLE_OFFSET_Y, + }; + x2 = new int[] { + equidistantStart.x, + equidistantStart.x + RECTANGLE_OFFSET_Y, + equidistantStart.x + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x1, y, 3); + g.fillPolygon(x2, y, 3); GraphHelper.drawLine(g, left, equidistantStart.y + equidistantStart.height / 2, - equidistantStart.x - RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2); + equidistantStart.x, equidistantStart.y + equidistantStart.height / 2); } //朝向下方的等距线 private void paintBottomEquidistantLine(Graphics g) { - int x1[] = { + int x[] = { equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, }; - int y1[] = { - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - }; - int x2[] = { - equidistantStart.x + equidistantStart.width / 2, - equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, - equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X - }; - int y2[] = { - bottom, - bottom - RECTANGLE_OFFSET_Y, - bottom - RECTANGLE_OFFSET_Y - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] y1, y2; + if (bottom - equidistantStart.y + equidistantStart.height > WIDGET_DISTANCE_MIN) { + y1 = new int[] { + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + }; + y2 = new int[] { + bottom, + bottom - RECTANGLE_OFFSET_Y, + bottom - RECTANGLE_OFFSET_Y + }; + } + else{ + y1 = new int[] { + equidistantStart.y + equidistantStart.height, + equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, + equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, + }; + y2 = new int[] { + bottom, + bottom + RECTANGLE_OFFSET_Y, + bottom + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x, y1, 3); + g.fillPolygon(x, y2, 3); GraphHelper.drawLine(g, - equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height, equidistantStart.x + equidistantStart.width / 2, bottom); } //朝向右侧的等距线 private void paintRightEquidistantLine(Graphics g){ - int x1[] = { - right, - right - 3, - right - 3 - }; - int y1[] = { + int y[] = { equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X }; - int x2[] = { - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y - }; - int y2[] = { - equidistantStart.y + equidistantStart.height / 2, - equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, - equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] x1, x2; + if(right - equidistantStart.x > WIDGET_DISTANCE_MIN) { + x1 = new int[]{ + right, + right - RECTANGLE_OFFSET_Y, + right - RECTANGLE_OFFSET_Y + }; + x2 = new int[]{ + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y + }; + } + else{ + x1 = new int[]{ + right, + right + RECTANGLE_OFFSET_Y, + right + RECTANGLE_OFFSET_Y + }; + x2 = new int[]{ + equidistantStart.x + equidistantStart.width, + equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y, + equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x1, y, 3); + g.fillPolygon(x2, y, 3); GraphHelper.drawLine(g, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2, + equidistantStart.x + equidistantStart.width, equidistantStart.y + equidistantStart.height / 2, right, equidistantStart.y + equidistantStart.height / 2); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/beans/location/MoveUtils.java b/designer_base/src/com/fr/design/beans/location/MoveUtils.java index e0bed7ca1..18c282cdc 100644 --- a/designer_base/src/com/fr/design/beans/location/MoveUtils.java +++ b/designer_base/src/com/fr/design/beans/location/MoveUtils.java @@ -468,6 +468,7 @@ public class MoveUtils { equidistantLines.add(equidistantLines1[0]); equidistantLines.add(equidistantLines1[2]); pEquidistantY.palce = operatingRectangle.y - offset / 2; + operatingRectangle.y = pEquidistantY.palce; } } if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right @@ -477,6 +478,7 @@ public class MoveUtils { equidistantLines.add(equidistantLines1[1]); equidistantLines.add(equidistantLines1[3]); pEquidistantX.palce = operatingRectangle.x - offset / 2; + operatingRectangle.x = pEquidistantX.palce; } } } From c26bf215ea83d5a105ea628e10fc55dd8fcdcb68 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 1 Aug 2016 09:09:59 +0800 Subject: [PATCH 10/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FieldEditorDefinePane.java | 20 ++++++++++--------- .../widget/ui/NumberEditorDefinePane.java | 16 ++++++++------- .../widget/ui/TextFieldEditorDefinePane.java | 19 +++++++++++------- .../design/designer/creator/XTextEditor.java | 9 +++++---- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index f454657e2..f5172fd7c 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -47,15 +47,7 @@ public abstract class FieldEditorDefinePane extends Abstr // 错误信息 JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); //目前只整改了文本、密码、文本域和数字四个控件 - if(!(this instanceof TextFieldEditorDefinePane)&&!(this instanceof NumberEditorDefinePane)){ - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northPane, BorderLayout.NORTH); - JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); - firstPanel.add(allowBlankCheckBox); - firstPanel.add(errorMsgPane); - northPane.add(firstPanel); - } + this.addAllowBlankPane(allowBlankCheckBox,errorMsgPane); errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); errorMsgTextField = new UITextField(16); errorMsgPane.add(errorMsgTextField); @@ -113,6 +105,16 @@ public abstract class FieldEditorDefinePane extends Abstr public void checkValid() throws Exception { } + + public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){ + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + this.add(northPane, BorderLayout.NORTH); + JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + firstPanel.add(allowBlankCheckBox); + firstPanel.add(errorMsgPane); + northPane.add(firstPanel); + } public UICheckBox getAllowBlankCheckBox(){ return allowBlankCheckBox; } diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index d322c5d39..e4261061b 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -125,9 +125,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); - } + if (setMinValueCheckBox.isSelected()) { + minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + } } } }; @@ -137,9 +137,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); - } + if (setMaxValueCheckBox.isSelected()) { + maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + } } } }; @@ -315,5 +315,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane df.setAllowsInvalid(false); } } + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){} -} \ No newline at end of file + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 12003ec2b..ecee0612b 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -73,15 +74,15 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }; regPane.addPhoneRegListener(pl); - JPanel spp1 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); getAllowBlankCheckBox().setPreferredSize(new Dimension(444,40)); validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); - spp1.add(validateContent); - JPanel spp2 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); + basicPane.add(validateContent); + JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane.addInputKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { @@ -102,9 +103,9 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }); - spp2.add(waterMarkDictPane); - contenter.add(spp2, BorderLayout.NORTH); - contenter.add(spp1, BorderLayout.CENTER); + advancedPane.add(waterMarkDictPane); + contenter.add(advancedPane, BorderLayout.NORTH); + contenter.add(basicPane, BorderLayout.CENTER); return attrPane; } @@ -138,4 +139,8 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane return new TextEditor(); } -} \ No newline at end of file + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane){} + + + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 52ce65295..5586728e2 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -19,10 +19,12 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import jdk.nashorn.internal.runtime.regexp.joni.Regex; /** * @author richer @@ -53,11 +55,10 @@ public class XTextEditor extends XWrapperedFieldEditor { Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {widgetValue},super.supportedDescriptor()); - Boolean displayRegField = false; - if((((TextEditor) toData()).getRegex() instanceof NoneReg) || ((TextEditor) toData()).getRegex()==null){ + Boolean displayRegField = true; + RegExp reg = ((TextEditor) toData()).getRegex(); + if(reg == null || reg.toRegText().equals("")){ displayRegField = false; - }else{ - displayRegField = true; } return displayRegField? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] {regex, regErrorMessage, waterMark} ): From 4f8b8bba2b1844dfe2aafbb3ea709a95aa1d96e8 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 1 Aug 2016 11:27:56 +0800 Subject: [PATCH 11/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FieldEditorDefinePane.java | 202 +++++++++--------- 1 file changed, 102 insertions(+), 100 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index f5172fd7c..23cf15e12 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -8,6 +8,7 @@ import javax.swing.BorderFactory; import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.ilable.UILabel; + import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -22,105 +23,106 @@ import com.fr.general.Inter; import com.fr.design.widget.DataModify; public abstract class FieldEditorDefinePane extends AbstractDataModify { - private UICheckBox allowBlankCheckBox; - // richer:错误信息,是所有控件共有的属性,所以放到这里来 - private UITextField errorMsgTextField; - - public FieldEditorDefinePane() { - this.initComponents(); - } - - protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); - allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); - - allowBlankCheckBox.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); - } - }); - - // 错误信息 - JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - //目前只整改了文本、密码、文本域和数字四个控件 - this.addAllowBlankPane(allowBlankCheckBox,errorMsgPane); - errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); - errorMsgTextField = new UITextField(16); - errorMsgPane.add(errorMsgTextField); - - // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - JPanel contentPane = this.setFirstContentPane(); - if (contentPane != null) { - //contentPane.add(firstPanel); - this.add(contentPane, BorderLayout.CENTER); - } else { - //this.add(firstPanel, BorderLayout.CENTER); - } - } - - @Override - public void populateBean(T ob) { - this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); - this.errorMsgTextField.setText(ob.getErrorMessage()); - - populateSubFieldEditorBean(ob); - } - - protected abstract void populateSubFieldEditorBean(T ob); - - @Override - public T updateBean() { - T e = updateSubFieldEditorBean(); - - e.setAllowBlank(this.allowBlankCheckBox.isSelected()); - e.setErrorMessage(this.errorMsgTextField.getText()); - - return e; - } - - protected abstract T updateSubFieldEditorBean(); - - protected abstract JPanel setFirstContentPane(); - - @Override - public void checkValid() throws Exception { - - } - - public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){ - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northPane, BorderLayout.NORTH); - JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); - firstPanel.add(allowBlankCheckBox); - firstPanel.add(errorMsgPane); - northPane.add(firstPanel); - } - public UICheckBox getAllowBlankCheckBox(){ - return allowBlankCheckBox; - } - - public UITextField getErrorMsgTextField(){ - return errorMsgTextField; - } + private UICheckBox allowBlankCheckBox; + // richer:错误信息,是所有控件共有的属性,所以放到这里来 + private UITextField errorMsgTextField; + + public FieldEditorDefinePane() { + this.initComponents(); + } + + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); + allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); + + allowBlankCheckBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); + } + }); + + // 错误信息 + JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + //目前只整改了文本、密码、文本域和数字四个控件 + this.addAllowBlankPane(allowBlankCheckBox, errorMsgPane); + errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); + errorMsgTextField = new UITextField(16); + errorMsgPane.add(errorMsgTextField); + + // richer:主要为了方便查看比较长的错误信息 + errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + }); + JPanel contentPane = this.setFirstContentPane(); + if (contentPane != null) { + //contentPane.add(firstPanel); + this.add(contentPane, BorderLayout.CENTER); + } else { + //this.add(firstPanel, BorderLayout.CENTER); + } + } + + @Override + public void populateBean(T ob) { + this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); + errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); + this.errorMsgTextField.setText(ob.getErrorMessage()); + + populateSubFieldEditorBean(ob); + } + + protected abstract void populateSubFieldEditorBean(T ob); + + @Override + public T updateBean() { + T e = updateSubFieldEditorBean(); + + e.setAllowBlank(this.allowBlankCheckBox.isSelected()); + e.setErrorMessage(this.errorMsgTextField.getText()); + + return e; + } + + protected abstract T updateSubFieldEditorBean(); + + protected abstract JPanel setFirstContentPane(); + + @Override + public void checkValid() throws Exception { + + } + + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + this.add(northPane, BorderLayout.NORTH); + JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + firstPanel.add(allowBlankCheckBox); + firstPanel.add(errorMsgPane); + northPane.add(firstPanel); + } + + public UICheckBox getAllowBlankCheckBox() { + return allowBlankCheckBox; + } + + public UITextField getErrorMsgTextField() { + return errorMsgTextField; + } } \ No newline at end of file From c7fad3e33622cba47735c586e7647048320f4556 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 1 Aug 2016 11:44:19 +0800 Subject: [PATCH 12/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XTextEditor.java | 79 ++++++++++--------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 5586728e2..2d068ccb1 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -24,6 +24,7 @@ import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import jdk.nashorn.internal.runtime.regexp.joni.Regex; /** @@ -38,51 +39,53 @@ public class XTextEditor extends XWrapperedFieldEditor { /** * 控件的属性列表 + * * @return 此控件所用的属性列表 * @throws IntrospectionException 异常 */ @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor widgetValue=new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( - WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); - CRPropertyDescriptor regex= new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( - "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); - CRPropertyDescriptor regErrorMessage=new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName( - Inter.getLocText("Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); - CRPropertyDescriptor waterMark= new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced"); - CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {widgetValue},super.supportedDescriptor()); - Boolean displayRegField = true; - RegExp reg = ((TextEditor) toData()).getRegex(); - if(reg == null || reg.toRegText().equals("")){ - displayRegField = false; - } - return displayRegField? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, - new CRPropertyDescriptor[] {regex, regErrorMessage, waterMark} ): - (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,new CRPropertyDescriptor[] {regex, waterMark}); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor widgetValue = new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( + "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName( + Inter.getLocText("Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced"); + CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[]{widgetValue}, super.supportedDescriptor()); + Boolean displayRegField = true; + RegExp reg = ((TextEditor) toData()).getRegex(); + if (reg == null || !StringUtils.isNotEmpty(reg.toRegText())) { - TextEditor area = (TextEditor) data; - if (area.getWidgetValue() != null) { - Graphics2D g2d = (Graphics2D) g.create(); - BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() - .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) - .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); - } - } + displayRegField = false; + } + return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, + new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) : + (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark}); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + + TextEditor area = (TextEditor) data; + if (area.getWidgetValue() != null) { + Graphics2D g2d = (Graphics2D) g.create(); + BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() + .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) + .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); + } + } @Override - protected JComponent initEditor() { - setBorder(FIELDBORDER); - return this; - } + protected JComponent initEditor() { + setBorder(FIELDBORDER); + return this; + } @Override protected String getIconName() { From 95b199b57ed52ef65c319401056793bfd72a9a9b Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 1 Aug 2016 15:47:06 +0800 Subject: [PATCH 13/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FieldEditorDefinePane.java | 19 ++ .../widget/ui/NumberEditorDefinePane.java | 46 ++-- .../widget/ui/TextFieldEditorDefinePane.java | 226 ++++++++---------- 3 files changed, 138 insertions(+), 153 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index 23cf15e12..eebd9c4f0 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -26,6 +26,7 @@ public abstract class FieldEditorDefinePane extends Abstr private UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 private UITextField errorMsgTextField; + private UITextField regErrorMsgTextField; public FieldEditorDefinePane() { this.initComponents(); @@ -33,6 +34,20 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + regErrorMsgTextField = new UITextField(16); + regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + public void changedUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + }); //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); @@ -125,4 +140,8 @@ public abstract class FieldEditorDefinePane extends Abstr return errorMsgTextField; } + public UITextField getRegErrorMsgTextField() { + return regErrorMsgTextField; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index e4261061b..26d34065c 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -42,7 +42,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane private com.fr.design.editor.editor.IntegerEditor decimalLength; private JPanel limitNumberPane; private WaterMarkDictPane waterMarkDictPane; - private UITextField regErrorMsgTextField; private ActionListener actionListener1 = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -125,9 +124,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); - } + if (setMinValueCheckBox.isSelected()) { + minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + } } } }; @@ -137,9 +136,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); - } + if (setMaxValueCheckBox.isSelected()) { + maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + } } } }; @@ -168,12 +167,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane northPane.add(waterMarkDictPane); JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); JPanel validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - validatePane.setPreferredSize(new Dimension(400,200)); + validatePane.setPreferredSize(new Dimension(400, 200)); centerPane.add(validatePane); content.add(northPane, BorderLayout.NORTH); content.add(centerPane, BorderLayout.CENTER); validatePane.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); - validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getErrorMsgTextField()}, FlowLayout.LEFT, 24)); this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); @@ -205,24 +204,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.minValueSpinner.setVisible(false); this.setMinValueCheckBox.addActionListener(actionListener4); this.minValueSpinner.addChangeListener(changeListener2); - - regErrorMsgTextField = new UITextField(16); - validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); - - regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - }); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); return content; } @@ -258,7 +240,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane minValueSpinner.setVisible(true); minValueSpinner.setValue(new Double(e.getMinValue())); } - this.regErrorMsgTextField.setText(e.getRegErrorMessage()); + this.getRegErrorMsgTextField().setText(e.getRegErrorMessage()); this.waterMarkDictPane.populate(e); } @@ -286,7 +268,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.waterMarkDictPane.update(ob); - ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); + ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); return ob; } @@ -315,7 +297,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane df.setAllowsInvalid(false); } } + @Override - public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){} + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + } - } \ No newline at end of file +} \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index ecee0612b..2399a90ce 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -22,125 +22,107 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class TextFieldEditorDefinePane extends FieldEditorDefinePane { - protected RegPane regPane; - private WaterMarkDictPane waterMarkDictPane; - private UITextField regErrorMsgTextField; - - public TextFieldEditorDefinePane() { - this.initComponents(); - } - - @Override - protected JPanel setFirstContentPane() { - JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); - JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); - attrPane.add(contenter); - JPanel regErrorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - regErrorMsgTextField = new UITextField(16); - regErrorMsgPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); - - regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - }); - regPane = createRegPane(); - final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { - - @Override - public void regChangeAction() { - waterMarkDictPane.setWaterMark(""); - regPane.removeRegChangeListener(this); - } - }; - final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { - public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { - if (StringUtils.isNotEmpty(e.getPhoneRegString()) - && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { - waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); - regPane.addRegChangeListener(rl); - } - } - }; - regPane.addPhoneRegListener(pl); - JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); - JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - getAllowBlankCheckBox().setPreferredSize(new Dimension(444,40)); - validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); - validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); - validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); - validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); - basicPane.add(validateContent); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); - waterMarkDictPane = new WaterMarkDictPane(); - waterMarkDictPane.addInputKeyListener(new KeyAdapter() { - public void keyTyped(KeyEvent e) { - regPane.removePhoneRegListener(pl); - regPane.removeRegChangeListener(rl); - waterMarkDictPane.removeInputKeyListener(this); - } - }); - //监听填写规则下拉框的值的变化 - regPane.getRegComboBox().addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - RegExp regExp = (RegExp)regPane.getRegComboBox().getSelectedItem(); - if(regExp instanceof NoneReg){ - regErrorMsgTextField.setEnabled(false); - }else{ - regErrorMsgTextField.setEnabled(true); - } - - } - }); - advancedPane.add(waterMarkDictPane); - contenter.add(advancedPane, BorderLayout.NORTH); - contenter.add(basicPane, BorderLayout.CENTER); - return attrPane; - } - - protected RegPane createRegPane() { - return new RegPane(); - } - - @Override - protected String title4PopupWindow() { - return "text"; - } - - @Override - protected void populateSubFieldEditorBean(TextEditor e) { - this.regPane.populate(e.getRegex()); - regErrorMsgTextField.setText(e.getRegErrorMessage()); - waterMarkDictPane.populate(e); - } - - @Override - protected TextEditor updateSubFieldEditorBean() { - TextEditor ob = newTextEditorInstance(); - ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); - ob.setRegex(this.regPane.update()); - waterMarkDictPane.update(ob); - - return ob; - } - - protected TextEditor newTextEditorInstance() { - return new TextEditor(); - } - - @Override - public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane){} - - - } \ No newline at end of file + protected RegPane regPane; + private WaterMarkDictPane waterMarkDictPane; + + public TextFieldEditorDefinePane() { + this.initComponents(); + } + + @Override + protected JPanel setFirstContentPane() { + JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + attrPane.add(contenter); + regPane = createRegPane(); + final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { + + @Override + public void regChangeAction() { + waterMarkDictPane.setWaterMark(""); + regPane.removeRegChangeListener(this); + } + }; + final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { + public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { + if (StringUtils.isNotEmpty(e.getPhoneRegString()) + && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { + waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); + regPane.addRegChangeListener(rl); + } + } + }; + regPane.addPhoneRegListener(pl); + JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + getAllowBlankCheckBox().setPreferredSize(new Dimension(444, 40)); + validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getErrorMsgTextField()}, FlowLayout.LEFT, 24)); + validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); + basicPane.add(validateContent); + JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); + waterMarkDictPane = new WaterMarkDictPane(); + waterMarkDictPane.addInputKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + regPane.removePhoneRegListener(pl); + regPane.removeRegChangeListener(rl); + waterMarkDictPane.removeInputKeyListener(this); + } + }); + //监听填写规则下拉框的值的变化 + regPane.getRegComboBox().addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); + if (!StringUtils.isNotEmpty(regExp.toRegText())) { + getRegErrorMsgTextField().setEnabled(false); + } else { + getRegErrorMsgTextField().setEnabled(true); + } + + } + }); + advancedPane.add(waterMarkDictPane); + contenter.add(advancedPane, BorderLayout.NORTH); + contenter.add(basicPane, BorderLayout.CENTER); + return attrPane; + } + + protected RegPane createRegPane() { + return new RegPane(); + } + + @Override + protected String title4PopupWindow() { + return "text"; + } + + @Override + protected void populateSubFieldEditorBean(TextEditor e) { + this.regPane.populate(e.getRegex()); + getRegErrorMsgTextField().setText(e.getRegErrorMessage()); + waterMarkDictPane.populate(e); + } + + @Override + protected TextEditor updateSubFieldEditorBean() { + TextEditor ob = newTextEditorInstance(); + ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); + ob.setRegex(this.regPane.update()); + waterMarkDictPane.update(ob); + + return ob; + } + + protected TextEditor newTextEditorInstance() { + return new TextEditor(); + } + + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + } + + +} \ No newline at end of file From 8cf0a2224abc05dd291f46a21be8e5af5aeb7a9c Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 1 Aug 2016 16:47:35 +0800 Subject: [PATCH 14/84] =?UTF-8?q?new=EF=BC=9A=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=95=86=E5=BA=97=E6=89=93=E5=BC=80=E5=8A=A8=E4=BD=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginManagerPane.java | 5 +- .../com/fr/design/extra/PluginWebBridge.java | 77 ++++++++++++++++--- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index d479a5028..64ceea369 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -69,11 +69,12 @@ public class PluginManagerPane extends BasicPane { /** * 以关键词打开设计器商店 + * * @param keyword 关键词 */ - public PluginManagerPane(String keyword){ + public PluginManagerPane(String keyword) { this(); - PluginWebBridge.getHelper().setShowKeyword(keyword); + PluginWebBridge.getHelper().openWithSearch(keyword); } private void addPane(String installHome) { diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 70366d2b7..144f913da 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -6,7 +6,6 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.*; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.general.SiteCenter; import com.fr.plugin.Plugin; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; @@ -18,13 +17,14 @@ import javafx.scene.web.WebEngine; import javafx.stage.FileChooser; import javafx.stage.Stage; import netscape.javascript.JSObject; +import org.json.JSONObject; import javax.swing.*; import java.awt.*; import java.io.File; import java.io.IOException; import java.net.URI; -import java.util.ArrayList; +import java.util.*; import java.util.List; /** @@ -35,7 +35,26 @@ public class PluginWebBridge { private static PluginWebBridge helper; private UIDialog uiDialog; - private String showKeyword; + private ACTIONS action; + private String ACTION = "action"; + private String KEYWORD = "keyword"; + private Map config; + + /** + * 动作枚举 + */ + public enum ACTIONS { + SEARCH("search"); + private String context; + + ACTIONS(String context) { + this.context = context; + } + + public String getContext() { + return context; + } + } public static PluginWebBridge getHelper() { if (helper != null) { @@ -60,12 +79,52 @@ public class PluginWebBridge { private PluginWebBridge() { } - public String getShowKeyword() { - return showKeyword; + /** + * 获取打开动作配置 + * + * @return 配置信息 + */ + public String getRunConfig() { + if (action != null) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ACTION, action.getContext()); + Set keySet = config.keySet(); + for (String key : keySet) { + jsonObject.put(key, config.get(key).toString()); + } + return jsonObject.toString(); + } + return StringUtils.EMPTY; } - public void setShowKeyword(String showKeyWord) { - this.showKeyword = showKeyWord; + /** + * 配置打开动作 + * + * @param action 动作 + * @param config 参数 + */ + public void setRunConfig(ACTIONS action, Map config) { + this.action = action; + this.config = config; + } + + /** + * 清楚打开动作 + */ + public void clearRunConfig() { + this.action = null; + this.config = null; + } + + /** + * 打开时搜索 + * + * @param keyword 关键词 + */ + public void openWithSearch(String keyword) { + HashMap map = new HashMap(2); + map.put(KEYWORD, keyword); + setRunConfig(ACTIONS.SEARCH, map); } public void setEngine(WebEngine webEngine) { @@ -212,7 +271,7 @@ public class PluginWebBridge { * * @return 已安装的插件授权对象 */ - public PluginLicense getPluginLicenseByID(String pluginID ) { + public PluginLicense getPluginLicenseByID(String pluginID) { return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); } @@ -305,7 +364,7 @@ public class PluginWebBridge { /** * 在本地浏览器里打开url * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) - * 所以最好的是不要重载在js可以访问的接口文件中 + * 所以最好的是不要重载在js可以访问的接口文件中 * * @param url 要打开的地址 */ From 687f040263802aba61e0149368aac6b37ce1e628 Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 1 Aug 2016 23:02:09 +0800 Subject: [PATCH 15/84] =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E7=9A=84=E5=B1=9E=E6=80=A7=E8=A1=A8=E7=BC=A9=E6=94=BE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteLayoutAdapter.java | 14 ++- .../designer/creator/XWAbsoluteLayout.java | 31 +++++- .../properties/AbsoluteStateRenderer.java | 12 +++ .../properties/AbsoluteStateWrapper.java | 12 +++ .../FRAbsoluteLayoutPropertiesGroupModel.java | 94 +++++++++++++++++++ .../items/FRAbsoluteConstraintsItems.java | 19 ++++ .../AbsoluteLayoutDirectionEditor.java | 13 +++ 7 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java create mode 100644 designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java create mode 100644 designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java create mode 100644 designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 8ce0d0529..2847cd8c0 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -2,14 +2,14 @@ package com.fr.design.designer.beans.adapters.layout; import java.awt.*; +import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.BoundsGroupModel; +import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel; +import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; @@ -112,4 +112,10 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { return new BoundsGroupModel((XWAbsoluteLayout)container, creator); } + + @Override + public GroupModel getLayoutProperties() { + XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) container; + return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 46e1c42c2..b729ce049 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -7,6 +7,7 @@ import java.awt.*; import java.awt.event.ContainerEvent; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; +import java.beans.IntrospectionException; import java.util.HashMap; import com.fr.design.designer.beans.AdapterBus; @@ -17,15 +18,21 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.form.util.XCreatorConstants; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; +import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; +import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; +import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.stable.core.PropertyChangeAdapter; /** * @author richer @@ -105,7 +112,17 @@ public class XWAbsoluteLayout extends XLayoutContainer { protected void initLayoutManager() { this.setLayout(new FRAbsoluteLayout()); } - + + /** + * 是否支持标题样式 + * + * @return 默认false + */ + @Override + public boolean hasTitleStyle() { + return false; + } + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -211,6 +228,18 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } + /** + * 得到属性名 + * @return 属性名 + * @throws java.beans.IntrospectionException + */ + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Form-Widget_Name")) + }; + } + public void paint(Graphics g) { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 diff --git a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java new file mode 100644 index 000000000..4cc770eec --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java @@ -0,0 +1,12 @@ +package com.fr.design.designer.properties; + +import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteStateRenderer extends EncoderCellRenderer { + public AbsoluteStateRenderer() { + super(new AbsoluteStateWrapper()); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java new file mode 100644 index 000000000..3a07be8a7 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java @@ -0,0 +1,12 @@ +package com.fr.design.designer.properties; + +import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteStateWrapper extends ItemWrapper{ + public AbsoluteStateWrapper() { + super(new FRAbsoluteConstraintsItems()); + } +} diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java new file mode 100644 index 000000000..fc9c0985c --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java @@ -0,0 +1,94 @@ +package com.fr.design.designer.properties; + +import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor; +import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; +import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.Inter; + +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; + +/** + * Created by zhouping on 2016/8/1. + */ +public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { + + private PropertyCellEditor editor; + private DefaultTableCellRenderer renderer; + private AbsoluteLayoutDirectionEditor stateEditor; + private AbsoluteStateRenderer stateRenderer; + private WAbsoluteLayout layout; + private XWAbsoluteLayout xwAbsoluteLayout; + + public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){ + this.xwAbsoluteLayout = xwAbsoluteLayout; + this.layout = xwAbsoluteLayout.toData(); + renderer = new DefaultTableCellRenderer(); + editor = new PropertyCellEditor(new IntegerPropertyEditor()); + stateEditor = new AbsoluteLayoutDirectionEditor(); + stateRenderer = new AbsoluteStateRenderer(); + } + + /** + * 布局管理器自己的属性 + */ + @Override + public String getGroupName() { + return Inter.getLocText("FR-Designer-Widget_Area_Scaling"); + } + + @Override + public int getRowCount() { + return 1; + } + + @Override + public TableCellRenderer getRenderer(int row) { + return stateRenderer; + } + + @Override + public TableCellEditor getEditor(int row) { + return stateEditor; + } + + @Override + public Object getValue(int row, int column) { + if (column == 0) { + return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); + } else { + return layout.getCompState(); + } + } + + @Override + public boolean setValue(Object value, int row, int column) { + int state = 0; + if(value instanceof Integer) { + state = (Integer)value; + } + if (column == 0 || state < 0) { + return false; + } else { + if (row == 0) { + layout.setCompState(state); + return true; + } + return false; + } + } + + /** + * 是否可编辑 + * @param row 行 + * @return 否 + */ + @Override + public boolean isEditable(int row) { + return true; + } +} diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java new file mode 100644 index 000000000..5b46b8956 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java @@ -0,0 +1,19 @@ +package com.fr.design.designer.properties.items; + +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2016/8/1. + */ +public class FRAbsoluteConstraintsItems implements ItemProvider{ + + public static final Item[] ITEMS = new Item[] { + new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), + new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) + }; + + public Item[] getItems() { + return ITEMS; + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java new file mode 100644 index 000000000..2998cfdbf --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe.widget.editors; + +import com.fr.design.designer.properties.EnumerationEditor; +import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteLayoutDirectionEditor extends EnumerationEditor { + public AbsoluteLayoutDirectionEditor() { + super(new FRAbsoluteConstraintsItems()); + } +} From 24b97d49a8752db95984227ebad41069c7957e9e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 2 Aug 2016 09:26:39 +0800 Subject: [PATCH 16/84] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8jar?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FieldEditorDefinePane.java | 4 -- .../widget/ui/NumberEditorDefinePane.java | 3 -- .../widget/ui/TextFieldEditorDefinePane.java | 4 -- .../design/designer/creator/XFieldEditor.java | 38 +++++++++---------- .../design/designer/creator/XRadioGroup.java | 1 - .../design/designer/creator/XTextEditor.java | 2 - 6 files changed, 18 insertions(+), 34 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index eebd9c4f0..fb8268208 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -6,21 +6,17 @@ import java.awt.event.ItemListener; import javax.swing.BorderFactory; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.ilable.UILabel; import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.FieldEditor; import com.fr.general.Inter; -import com.fr.design.widget.DataModify; public abstract class FieldEditorDefinePane extends AbstractDataModify { private UICheckBox allowBlankCheckBox; diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 26d34065c..85f09bb5b 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -14,13 +14,10 @@ import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import javax.swing.text.DefaultFormatter; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 2399a90ce..6055de083 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -3,18 +3,14 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.TextEditor; -import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.RegExp; import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java index 4b8a0db68..4cd6b57f9 100644 --- a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java @@ -6,8 +6,6 @@ package com.fr.design.designer.creator; import java.awt.Color; import java.awt.Dimension; import java.beans.IntrospectionException; -import java.util.ArrayList; -import java.util.List; import javax.swing.BorderFactory; import javax.swing.border.Border; @@ -24,8 +22,8 @@ import com.fr.stable.ArrayUtils; */ public abstract class XFieldEditor extends XWidgetCreator { - protected static final Border FIELDBORDER = BorderFactory.createLineBorder(new Color(128, 152, 186), 1); - + protected static final Border FIELDBORDER = BorderFactory.createLineBorder(new Color(128, 152, 186), 1); + public XFieldEditor(FieldEditor widget, Dimension initSize) { super(widget, initSize); } @@ -33,22 +31,22 @@ public abstract class XFieldEditor extends XWidgetCreator { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll( - super.supportedDescriptor(),getCRPropertyDescriptor() - ); + super.supportedDescriptor(), getCRPropertyDescriptor() + ); } - private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { - CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( - Inter.getLocText("Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); - CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( - Inter.getLocText("Verify-Message")) - .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); - CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") - .setI18NName(Inter.getLocText(new String[]{"FRFont", "FRFont-Size"})) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); - return !((FieldEditor) toData()).isAllowBlank() ? - new CRPropertyDescriptor[] {allowBlank, blankErrorMsg, fontSize} - : new CRPropertyDescriptor[] {allowBlank, fontSize}; - } + private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { + CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( + Inter.getLocText("Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( + Inter.getLocText("Verify-Message")) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") + .setI18NName(Inter.getLocText(new String[]{"FRFont", "FRFont-Size"})) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + return !((FieldEditor) toData()).isAllowBlank() ? + new CRPropertyDescriptor[]{allowBlank, blankErrorMsg, fontSize} + : new CRPropertyDescriptor[]{allowBlank, fontSize}; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java index daf2b25e4..487e0c730 100644 --- a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java @@ -19,7 +19,6 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.DictionaryRenderer; import com.fr.form.ui.RadioGroup; import com.fr.design.form.util.XCreatorConstants; -import com.fr.function.ARRAY; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 2d068ccb1..ee0f4d03c 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -18,14 +18,12 @@ import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; import com.fr.form.ui.TextEditor; -import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.RegExp; import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import jdk.nashorn.internal.runtime.regexp.joni.Regex; /** * @author richer From 18ba11eff8df43a2242b43e3e836cc44aab7f4ef Mon Sep 17 00:00:00 2001 From: kunsnat Date: Wed, 3 Aug 2016 17:22:15 +0800 Subject: [PATCH 17/84] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mobile/MobileUseHtmlGroupPane.java | 130 ++++++++++++++++++ .../report/mobile/ReportMobileAttrPane.java | 12 +- 2 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java diff --git a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java new file mode 100644 index 000000000..cab8f0f63 --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java @@ -0,0 +1,130 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.UITitledBorder; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.report.mobile.ElementCaseMobileAttr; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kunsnat on 2016/8/3. + */ +public class MobileUseHtmlGroupPane extends BasicBeanPane { + + private List radioButtons = new ArrayList(); + + public MobileUseHtmlGroupPane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow())); + + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, p, p}; + + UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); + useApp.setSelected(true); + UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); + + addToButtonGroup(useApp, useHTML5); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5}, + new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null} + }; + JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + + this.add(usePane); + } + + private void addToButtonGroup(UIRadioButton... radios) { + ButtonGroup buttonGroup = new ButtonGroup(); + for (UIRadioButton radio : radios) { + radioButtons.add(radio); + buttonGroup.add(radio); + } + } + + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.setEnabled(enabled); + } + } + + /** + * 获取当前选中的按钮index + * + * @return 按钮index + */ + public int getSelectRadioIndex() { + for (int i = 0, len = radioButtons.size(); i < len; i++) { + if (radioButtons.get(i).isSelected()) { + return i; + } + } + + return 0; + } + + /** + * 选中指定index的按钮 + */ + public void selectIndexButton(int index) { + if (index < 0 || index > radioButtons.size() - 1) { + return; + } + + UIRadioButton button = radioButtons.get(index); + button.setSelected(true); + } + + /** + * 给所有的按钮加上监听 + */ + public void addActionListener(ActionListener actionListener) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.addActionListener(actionListener); + } + } + + @Override + public void populateBean(ElementCaseMobileAttr mobileAttr) { + if(mobileAttr != null) { + selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0); + } + } + + @Override + public ElementCaseMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(ElementCaseMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setUseHTML(getSelectRadioIndex() == 1); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-mobile_report_analysis"); + } +} diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index 1d2d39931..3c0023219 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -14,6 +14,8 @@ public class ReportMobileAttrPane extends BasicBeanPane{ private AppFitBrowserPane appFitBrowserPane; + private MobileUseHtmlGroupPane htmlGroupPane; + public ReportMobileAttrPane() { initComponents(); } @@ -27,6 +29,8 @@ public class ReportMobileAttrPane extends BasicBeanPane{ appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); this.add(appFitBrowserPane); + this.add(htmlGroupPane = new MobileUseHtmlGroupPane()); + this.add(appFitPreviewPane); } @@ -37,11 +41,17 @@ public class ReportMobileAttrPane extends BasicBeanPane{ } appFitBrowserPane.populateBean(ob); + htmlGroupPane.populateBean(ob); + } @Override public ElementCaseMobileAttr updateBean() { - return appFitBrowserPane.updateBean(); + ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); + + htmlGroupPane.updateBean(caseMobileAttr); + + return caseMobileAttr; } @Override From c1740ebe1c4758334c3331bd145d91c1e03fa8de Mon Sep 17 00:00:00 2001 From: kunsnat Date: Wed, 3 Aug 2016 17:29:07 +0800 Subject: [PATCH 18/84] T --- .../src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java index cab8f0f63..50c5e3238 100644 --- a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java +++ b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java @@ -37,7 +37,7 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); useApp.setSelected(true); - UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); + UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); addToButtonGroup(useApp, useHTML5); From 40e05379742c954a8ccbc11e4f66e4958df6bdd1 Mon Sep 17 00:00:00 2001 From: fangdong sun Date: Thu, 4 Aug 2016 13:59:11 +0800 Subject: [PATCH 19/84] =?UTF-8?q?=E7=A7=BB=E9=99=A4jar=E5=8C=85=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=B8=8D=E9=9C=80=E8=A6=81=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/build.gradle | 4 ++-- designer_chart/build.gradle | 5 +++-- designer_form/build.gradle | 22 ++++++++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/designer_base/build.gradle b/designer_base/build.gradle index 36753c97c..d44d269d5 100644 --- a/designer_base/build.gradle +++ b/designer_base/build.gradle @@ -36,7 +36,7 @@ compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') task copyFile(type:Copy,dependsOn:compileJava){ copy{ from ("${srcDir}/src"){ - exclude '**/*.java' + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' } into 'build/classes/main' } @@ -54,7 +54,7 @@ task compressJS{ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ fileset (dir:"${srcDir}/src"){ include (name:'**/*.js') - + include (name:'**/*.css') } } diff --git a/designer_chart/build.gradle b/designer_chart/build.gradle index 5daf8d856..288077655 100644 --- a/designer_chart/build.gradle +++ b/designer_chart/build.gradle @@ -34,7 +34,8 @@ compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') task copyFile(type:Copy,dependsOn:compileJava){ copy{ from ("${srcDir}/src"){ - exclude '**/*.java' + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } into 'build/classes/main' } @@ -51,7 +52,7 @@ task compressJS{ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ fileset (dir:"${srcDir}/src"){ include (name:'**/*.js') - + include (name:'**/*.css') } } diff --git a/designer_form/build.gradle b/designer_form/build.gradle index c17cb4cf6..b7a91f113 100644 --- a/designer_form/build.gradle +++ b/designer_form/build.gradle @@ -32,15 +32,20 @@ compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') testCompile 'junit:junit:4.12' } +//ָ޷ļ· +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + //.javaļƵclassesļ task copyFile(type:Copy,dependsOn:compileJava){ copy{ - from ("${srcDir}/src"){ - exclude '**/*.java' - } - from ("${srcDir}/../designer/src"){ - exclude '**/*.java' - } + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") into ('build/classes/main') } @@ -54,14 +59,15 @@ task compressJS{ fileset(dir:'../../finereport-build-stable',includes:'**/*.jar') } } - ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ fileset (dir:"${srcDir}/src"){ include (name:'**/*.js') + include (name:'**/*.css') } fileset (dir:"${srcDir}/../designer/src"){ include (name:'**/*.js') - + include (name:'**/*.css') } } From 5f56d3db18284a71c66cebc135a59e64d5f648eb Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 5 Aug 2016 11:12:45 +0800 Subject: [PATCH 20/84] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=9C=80=E6=B1=82=E5=89=A9=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/widget/CellWidgetCardPane.java | 2 +- .../fr/design/widget/ui/ButtonDefinePane.java | 2 +- .../design/widget/ui/CheckBoxDefinePane.java | 5 +- .../widget/ui/CheckBoxGroupDefinePane.java | 5 +- .../ui/CustomWritableRepeatEditorPane.java | 2 +- .../widget/ui/DateEditorDefinePane.java | 92 +++++++++++-------- .../ui/DirectWriteEditorDefinePane.java | 13 ++- .../widget/ui/FieldEditorDefinePane.java | 42 ++++----- .../widget/ui/IframeEditorDefinePane.java | 15 ++- .../design/widget/ui/MultiFileEditorPane.java | 17 ++-- .../widget/ui/NumberEditorDefinePane.java | 24 ++--- .../widget/ui/RadioGroupDefinePane.java | 5 +- .../widget/ui/TextFieldEditorDefinePane.java | 23 +---- .../widget/ui/TreeEditorDefinePane.java | 4 +- .../widget/ui/WritableRepeatEditorPane.java | 2 - .../ui/WriteUnableRepeatEditorPane.java | 4 +- .../btn/TreeNodeToogleButtonDefinePane.java | 6 +- .../btn/ButtonWithHotkeysDetailPane.java | 21 +++-- .../fr/design/designer/creator/XPassword.java | 56 ++++++----- .../fr/design/designer/creator/XTextArea.java | 72 ++++++++------- 20 files changed, 225 insertions(+), 187 deletions(-) diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index 4e8682f1c..d1c81d53a 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -87,7 +87,7 @@ public class CellWidgetCardPane extends BasicPane { attriPane.remove(widgetPropertyPane); widgetPropertyPane = new BasicWidgetPropertySettingPane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 5, 8)); + northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8)); JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties")); northPane.add(basic); basic.add(widgetPropertyPane); diff --git a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java index b7dd0fdf5..5d5c8d2fa 100644 --- a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java @@ -24,7 +24,7 @@ public class ButtonDefinePane extends AbstractDataModify