From 19df32d4b03f0e8fb935f9f2116364e1c6f8a7cb Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Apr 2017 17:26:29 +0800 Subject: [PATCH 1/9] =?UTF-8?q?REPORT-1916=20=E6=A8=A1=E6=9D=BF=E8=80=97?= =?UTF-8?q?=E6=97=B6=3D=E3=80=8B=E4=BF=AE=E5=A4=8D=E5=88=9D=E6=AC=A1?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A8=A1=E6=9D=BF=E6=97=B6=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E4=BF=9D=E5=AD=98ID=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/JTemplate.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 92dd63e11..e28090299 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -529,12 +529,13 @@ public abstract class JTemplate> ex } protected boolean saveNewFile(FILE editingFILE, String oldName){ - this.editingFILE = editingFILE; + // 在保存之前,初始化 templateID + initForCollect(); // 如果保存新模板(新建模板直接保存,或者另存为),则添加 templateID + this.editingFILE = editingFILE; boolean result = this.saveFile(); if (result) { DesignerFrameFileDealerPane.getInstance().refresh(); - initForCollect(); // 如果保存新模板(新建模板直接保存,或者另存为),则添加 templateID collectInfo(); } //更换最近打开 From 5eeeaa37e7e2c2a6b4b2e7d4eed3a94386364aed Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 10 Apr 2017 14:43:17 +0800 Subject: [PATCH 2/9] =?UTF-8?q?REPORT-2334=20=E8=A1=A8=E5=8D=95tab?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=B8=AD=E5=9B=BE=E8=A1=A8=E6=94=BE=E5=A4=A7?= =?UTF-8?q?=E7=BC=A9=E5=B0=8F=E4=BC=9A=E6=98=8E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRFitLayoutAdapter.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 e31ee6a5d..f5aa87a2b 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 @@ -274,12 +274,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { } private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { - // 参数界面高度对纵坐标产生的影响 - JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - if (jform.getFormDesign().getParaComponent() != null) { - backupBound.y -= jform.getFormDesign().getParaHeight(); - } - + // zhouping: REPORT-2334 表单tab布局中图表放大缩小会明显 + // 这边不需要单独处理参数面板高度了,下面的方法中获取的是XWCardMainBorderLayout相对坐标 Rectangle rec = getLayoutBound(mainLayout); // XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响 // 减掉之后可以按照它原来的逻辑执行 From 9d5bdf6f595604b4ad0e39772736b1e733b1f313 Mon Sep 17 00:00:00 2001 From: syoki Date: Tue, 11 Apr 2017 00:18:09 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20design=E9=83=A8=E5=88=86=20=E5=BA=84=E5=A5=87=20201?= =?UTF-8?q?704110018?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/locale/designer_ja_JP.properties | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index d74f09b9d..37d913e73 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -366,24 +366,30 @@ FR-Designer_XMLA_Get_Catalog=\u30AB\u30BF\u30ED\u30B0\u3092\u691C\u7D22\u3059\u3 FR-Designer_XMLA_Not_NULL=\u3053\u3053\u306F\u7A7A\u6B04\u306B\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093 FR-Designer_Column-Axis=\u5217\u8EF8 FR-Designer_LiteCondition_Common=\u4E00\u822C -FR-Designer_LiteCondition_Formula=\u516C\u5F0F +FR-Designer_LiteCondition_Formula=\u6570\u5F0F FR-Designer_LiteCondition_ConditionB-AND=\u30A2\u30F3\u30C9(AND) FR-Designer_LiteCondition_ConditionB-OR=\u30AA\u30A2(OR) FR-Designer_LiteCondition_Common_Condition=\u666E\u901A\u6761\u4EF6 -FR-Designer_LiteCondition_Formula_Condition=\u516C\u5F0F\u6761\u4EF6 +FR-Designer_LiteCondition_Formula_Condition=\u6570\u5F0F\u6761\u4EF6 FR-Designer_LiteCondition_Define=\u5B9A\u7FA9 +FR-Designer_Normal=\u6B63\u5E38 +FR-Designer_Alert=\u30A2\u30E9\u30FC\u30C8 FR-Designer_Select_All=\u5168\u9078\u629E -FR-Designer-Plugin_Expire_Dialog_Title=\u671F\u9650\u5207\u308C\u306E\u30D7\u30E9\u30B0\u30A4\u30F3 -FR-Designer-Plugin_Expire_Dialog_Text=\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u3001\u8CFC\u5165\u3092\u3059\u308B\u305F\u3081\u306B\u5E06\u30BD\u30D5\u30C8\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30BB\u30F3\u30BF\u30FC\u3092\u884C\u304F\u3001\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u3066\u3044\u307E\u3059\u3002 -FR-Designer-Plugin_Finerest_Addon=\u5E06\u8EDF\u5FDC\u7528\u30BB\u30F3\u30BF\u30FC +FR-Designer_Clear_All=\u5168\u3066\u3092\u30AF\u30EA\u30A2 +FR-Designer_Copy=\u30B3\u30D4\u30FC +FR-Designer_Log=\u30ED\u30B0 +FR-Designer-Plugin_Expire_Dialog_Title=\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u671F\u9650\u5207\u308C +FR-Designer-Plugin_Expire_Dialog_Text=\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u3066\u3044\u307E\u3059\u3001\u30D5\u30A1\u30F3\u30E9\u30F3\u30A2\u30D7\u30EA\u30BB\u30F3\u30BF\u30FC\u3078\u8CFC\u5165\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +FR-Designer-Plugin_Finerest_Addon=\u30D5\u30A1\u30F3\u30E9\u30F3\u30A2\u30D7\u30EA\u30BB\u30F3\u30BF\u30FC FR-Designer_Performance_First=\u6027\u80FD\u512A\u5148 FR-Designer_Total_N_Grade=\u5168\u90E8\u3067\:${N}\u5C64 FR-Designer_time(s)=\u56DE -FR-Designer_General=\u5E38\u7528 -FR-Designer_Advanced=\u9AD8\u7D1A +FR-Designer_General=\u901A\u5E38 +FR-Designer_Advanced=\u8A73\u7D30 +FR-Designer_Validate=\u691C\u8A3C FR-Designer_Oracle=\u3059\u3079\u3066\u306E\u30C6\u30FC\u30D6\u30EB FR-Designer_Product_improve=\u88FD\u54C1\u6539\u5584 -FR-Designer_Join_Product_improve=\u88FD\u54C1\u6539\u5584\u30D7\u30E9\u30F3\u306B\u52A0\u3048\u308B +FR-Designer_Join_Product_improve=\u88FD\u54C1\u6539\u5584\u30D7\u30E9\u30F3\u306B\u5165\u308B FR-Designer_Preference-Function=\u30D5\u30A1\u30F3\u30AF\u30B7\u30E7\u30F3\u8A2D\u5B9A FR-Designer_max_undo_limit=\u6700\u5927\u53D6\u308A\u6D88\u3057\u56DE\u6570 FR-Designer_Surport_String_To_Formula=\u30AD\u30E3\u30E9\u30AF\u30BF\u30FC\u6587\u5B57\u5217\u7DE8\u96C6\u3092\u516C\u5F0F\u3068\u3059\u308B\u3053\u3068\u306B\u30B5\u30DD\u30FC\u30C8 @@ -539,24 +545,26 @@ FR-Designer_Show_As_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30EA\u30F3\u3 FR-Designer_File_Name_For_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30D5\u30A1\u30A4\u30EB\u540D FR-Designer_No=\u3044\u3044\u3048 FR-Designer_Pagination=\u30DA\u30FC\u30B8\u30F3\u30B0 -FR-Designer_DS_TableData=\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9 +FR-Designer_DS_TableData=\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8 FR-Designer_Parameter-Formula=\u6570\u5F0F FR-Designer_Background_Null=\u80CC\u666F\u306A\u3057 FR-Designer_Background_Color=\u8272 -FR-Designer_Background_Texture=\u67C4 -FR-Designer_Background_Pattern=\u6A21\u69D8 -FR-Designer_Background_Gradient_Color=\u30B0\u30E9\u30C7\u30FC\u30B7\u30E7\u30F3\u8272 -FR-Designer_Background_Image=\u5199\u771F +FR-Designer_Background_Texture=\u30C6\u30AF\u30B9\u30C1\u30E3 +FR-Designer_Background_Pattern=\u30D1\u30BF\u30FC\u30F3 +FR-Designer_Background_Gradient_Color=\u30B0\u30E9\u30C7\u30FC\u30B7\u30E7\u30F3 +FR-Designer_Background_Image=\u753B\u50CF FR-Designer_Background_Clear=\u30AF\u30EA\u30A2 -FR-Designer_Background_Image_Select=\u5199\u771F\u3092\u9078\u629E +FR-Designer_Background_Image_Select=\u753B\u50CF\u9078\u629E FR-Designer_Initial_Background_Tips=\u30DC\u30BF\u30F3\u306E\u521D\u671F\u80CC\u666F -FR-Designer_Mouse_Move_Tips=\u30DE\u30A6\u30B9\u304C\u30DC\u30BF\u30F3\u306B\u79FB\u3059\u6642\u306E\u80CC\u666F -FR-Designer_Mouse_Click_Tips=\u30DE\u30A6\u30B9\u304C\u30DC\u30BF\u30F3\u306B\u79FB\u3059\u6642\u306E\u80CC\u666F +FR-Designer_Mouse_Move_Tips=\u30DE\u30A6\u30B9\u304C\u30DC\u30BF\u30F3\u306B\u79FB\u3059\u6642\u5909\u5316\u3059\u308B\u80CC\u666F +FR-Designer_Mouse_Click_Tips=\u30DC\u30BF\u30F3\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u6642\u5909\u5316\u3059\u308B\u80CC\u666F FR-Designer-Move_Tab_First=\u30C8\u30C3\u30D7\u306B\u79FB\u3059 FR-Designer-Move_Tab_End=\u6700\u5F8C\u306B\u79FB\u3059 FR-Designer-Move_Tab_Next=\u5F8C\u308D\u306B\u79FB\u3059 FR-Designer-Move_Tab_Prev=\u524D\u306B\u79FB\u3059 -FR-Designer_AxisReversed=\u8EF8\u9006\u914D\u5217 +FR-Designer_AxisReversed=\u8EF8\u9006\u9806 FR-Designer_Logarithmic=\u5BFE\u6570\u76EE\u76DB\u308A FR-Designer_Chart_Log_Base=\u5E95\u6570 -FR-Designer_Chart_F_Radar_Axis=\u5782\u76F4\u8EF8 \ No newline at end of file +FR-Designer_Chart_F_Radar_Axis=\u5782\u76F4\u8EF8 +FR-Designer_Too_Large_To_Paste=\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30B5\u30A4\u30BA\u306F\u30DC\u30FC\u30C0\u30FC\u306B\u8D85\u3048\u305F\u306E\u3067\u3001\u8CBC\u308A\u4ED8\u3051\u3067\u304D\u307E\u305B\u3093\uFF01 +FR-Designer_Too_Small_To_Paste=\u8A72\u5F53\u51E6\u306B\u8CBC\u308A\u4ED8\u3051\u3067\u304D\u307E\u305B\u3093\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30B5\u30A4\u30BA\u306F\u9AD8\u3059\u304E\uFF01 \ No newline at end of file From 6a9cec9bb37f797bb79e6c3bd61e141109a22ca1 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 11 Apr 2017 10:57:22 +0800 Subject: [PATCH 4/9] =?UTF-8?q?report-1945frm=E6=9C=AC=E5=9C=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8=EF=BC=9A1=E3=80=81=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E6=88=96=E8=80=85tab=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E9=80=89=E4=B8=AD=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BA=E4=B8=8A=E4=B8=8B=E5=B9=B3=E5=88=86?= =?UTF-8?q?=E5=B7=A6=E4=B8=8A=E8=A7=92=E7=9A=84=E7=BB=84=E4=BB=B6=EF=BC=9B?= =?UTF-8?q?2=E3=80=81tab=E5=B8=83=E5=B1=80=EF=BC=88=E6=9C=89=E6=97=A0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=EF=BC=89=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 44 ++++++++++++------- .../design/mainframe/FormSelectionUtils.java | 20 +++++++-- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java index a70d9b156..dc4ea6a49 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java @@ -136,19 +136,20 @@ public class SelectionModel { if (designer.getClass().equals(FormDesigner.class)) { if (selection.getSelectedCreator() instanceof XWFitLayout) { if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) { - Rectangle rec = selection.getRelativeBounds(); - //Tab布局 - FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(), - clipboard, - rec.x + rec.width / 2, - rec.y + DELTA_X_Y); + XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator(); + //tab布局编辑器内部左上角第一个坐标点 + int leftUpX = container.toData().getMargin().getLeft() + 1; + int leftUpY = container.toData().getMargin().getTop() + 1; + //选中第一个坐标点坐在的组件 + selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY)); + pasteFromClipBoard(); } else { - Rectangle rec = selection.getRelativeBounds(); - //自适应布局 - FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), - clipboard, - rec.x + rec.width / 2, - rec.y + DELTA_X_Y); + //自适应布局编辑器内部左上角第一个坐标点 + int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; + int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; + //选中第一个坐标点坐在的组件 + selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); + pasteFromClipBoard(); } } else { //绝对布局 @@ -178,12 +179,23 @@ public class SelectionModel { container = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator()); if (container != null && selection.getSelectedCreator().getParent() instanceof XWFitLayout) { //自适应布局 + Rectangle selectionRec = selection.getRelativeBounds(); + //获取父容器位置,补充因参数面板高度导致的位置坐标计算偏移 Rectangle containerRec = ComponentUtils.getRelativeBounds(container); - //计算自适应布局位置 - int positionX = selectionRec.x - containerRec.x + selectionRec.width / 2; - int positionY = (int) (selectionRec.y - containerRec.y + selectionRec.height * OFFSET_RELATIVE); - + int positionX, positionY; + + if (container.getClass().equals(XWTabFitLayout.class)) { + //tab内部粘贴不补充高度偏移 + //且不计算参数面板造成的影响,因为在 + //@see com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter#addBean中做了 + positionX = selectionRec.x + selectionRec.width / 2; + positionY = (int) (selectionRec.y + selectionRec.height * OFFSET_RELATIVE); + } else { + //计算自适应布局位置 + positionX = selectionRec.x - containerRec.x + selectionRec.width / 2; + positionY = (int) (selectionRec.y - containerRec.y + selectionRec.height * OFFSET_RELATIVE); + } FormSelectionUtils.paste2Container(designer, container, clipboard, positionX, positionY); } else if (container != null && selection.getSelectedCreator().getParent() instanceof XWAbsoluteLayout) { //绝对布局 diff --git a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java index 79f52519e..1978e8432 100644 --- a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java @@ -3,8 +3,10 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter; +import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.*; +import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; @@ -83,14 +85,26 @@ public class FormSelectionUtils { * 相对布局粘贴 */ private static void relativePaste(FormDesigner designer, FormSelection clipboard, LayoutAdapter adapter, int x, int y) { + + //@see FRTabFitLayoutAdapter + Rectangle tabContainerRect = ComponentUtils.getRelativeBounds(designer.getSelectionModel().getSelection() + .getSelectedCreator().getParent()); + designer.getSelectionModel().getSelection().reset(); for (XCreator creator : clipboard.getSelectedCreators()) { try { Widget copied = copyWidget(designer, creator); XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); - if (!adapter.accept(copiedCreator, x, y)) { - designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste")); - return; + if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) { + if (!adapter.accept(copiedCreator, x - tabContainerRect.x, y - tabContainerRect.y)) { + designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste")); + return; + } + } else { + if (!adapter.accept(copiedCreator, x, y)) { + designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste")); + return; + } } boolean addSuccess = adapter.addBean(copiedCreator, x, y); if (addSuccess) { From cc99e7d54fa965cfe3e25506ee44c75c7e64d3e2 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 11 Apr 2017 15:07:00 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=97=A0=E4=BB=BB=E5=8A=A1=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XWAbsoluteLayout.java | 887 +++++++++--------- 1 file changed, 451 insertions(+), 436 deletions(-) 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 4ed1b6549..1854b91f4 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -34,322 +34,335 @@ import com.fr.general.Inter; */ public class XWAbsoluteLayout extends XLayoutContainer { - private static final int EDIT_BTN_WIDTH = 60; - private static final int EDIT_BTN_HEIGHT = 24; - private int minWidth = WLayout.MIN_WIDTH; - private int minHeight = WLayout.MIN_HEIGHT; - - //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 - protected double containerPercent = 1.0; - - private HashMap xConnectorMap; - - public XWAbsoluteLayout() { - this(new WAbsoluteLayout(),new Dimension()); - } - - public XWAbsoluteLayout(WAbsoluteLayout widget) { - this(widget,new Dimension()); - } - - public XWAbsoluteLayout(WAbsoluteLayout widget, Dimension initSize) { - super(widget, initSize); - this.xConnectorMap = new HashMap(); - Connector connector; - for (int i = 0; i < widget.connectorCount(); i++) { - connector = widget.getConnectorIndex(i); - xConnectorMap.put(connector, new XConnector(connector, this)); - } - - initPercent(widget); - } - - /** - * 初始化时默认的组件大小 - * - * @return 默认Dimension - */ - @Override - public Dimension initEditorSize() { - return new Dimension(500, 300); - } - - //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% - private void initPercent(WAbsoluteLayout widget){ - Toolkit toolkit = Toolkit.getDefaultToolkit(); - Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getByDimension(scrnsize).getValue(); - if(screenValue != FormArea.DEFAULT_SLIDER){ - this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); - } - } - - /** - * 返回容器大小的百分比 - * @return the containerPercent - */ - public double getContainerPercent() { - return containerPercent; - } - - /** - * 设置容器大小的百分比 - * @param containerPercent the containerPercent to set - */ - public void setContainerPercent(double containerPercent) { - this.containerPercent = containerPercent; - minWidth = (int) (XWAbsoluteLayout.MIN_WIDTH*containerPercent); - minHeight = (int) (XWAbsoluteLayout.MIN_HEIGHT*containerPercent); - } - - /** - * 返回界面处根据百分比调整后的最小宽度 - * @return 最小宽度 - */ - public int getActualMinWidth() { - return this.minWidth; - } - - /** - * 返回界面处根据百分比调整后的最小高度 - * @return 最小高度 - */ - public int getActualMinHeight() { - return this.minHeight; - } - - /** - * 返回界面处根据百分比调整后的间隔大小(且为偶数) - * @return 间隔 - */ - public int getAcualInterval() { - // adapter那边交叉三等分、删除都要判断是否对齐,所以间隔转为偶数 - int interval = (int) (toData().getCompInterval()*containerPercent); - int val = interval/2; - return val*2; - } - - /** - * 界面容器大小不是默认的时,处理控件的BoundsWidget,且避免出现空隙 - */ - private Rectangle dealWidgetBound(Rectangle rec) { - if (containerPercent == 1.0) { - return rec; - } - rec.x = (int) (rec.x/containerPercent); - rec.y = (int) (rec.y/containerPercent); - rec.width = (int) (rec.width/containerPercent); - rec.height = (int) (rec.height/containerPercent); - return rec; - } - - /** - * 新增删除拉伸后单个组件的BoundsWidget - */ - public void updateBoundsWidget(XCreator xCreator) { - WAbsoluteLayout layout = this.toData(); - if (xCreator.hasTitleStyle()) { - xCreator = (XLayoutContainer)xCreator.getParent(); - } - if (xCreator.acceptType(XWAbsoluteLayout.class)){ - ((XWAbsoluteLayout) xCreator).updateBoundsWidget(); - } - BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); - Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); - } - - private Rectangle calculateBound(Rectangle rec, double pw, double ph){ - Rectangle calRec = new Rectangle(0,0,0,0); - calRec.x = (int)(rec.x / pw); - calRec.y = (int)(rec.y / ph); - calRec.width = (int)(rec.width / pw); - calRec.height = (int)(rec.height / ph); - return calRec; - } - - /** - * 新增删除拉伸后每个组件的BoundsWidget - */ - public void updateBoundsWidget() { - WAbsoluteLayout layout = this.toData(); - Rectangle backupBound = this.getBackupBound(); - Rectangle currentBound = this.getBounds(); - if (backupBound != null && layout.getCompState() == WAbsoluteLayout.STATE_FIT) { - double percentW = ((double) backupBound.width / (double) currentBound.width); - double percentH = ((double) backupBound.height / (double) currentBound.height); - for (int index = 0, n = this.getComponentCount(); index < n; index++){ - XCreator creator = (XCreator) this.getComponent(index); - BoundsWidget wgt = layout.getBoundsWidget(creator.toData()); - // 用当前的显示大小计算后调正具体位置 - Rectangle wgtBound = creator.getBounds(); - Rectangle rec = calculateBound(wgtBound, percentW, percentH); - wgt.setBounds(rec); - creator.setBounds(rec); - //绝对布局嵌套,要更新内部的绝对布局 - if (creator.acceptType(XWAbsoluteLayout.class)){ - creator.setBackupBound(wgtBound); - ((XWAbsoluteLayout) creator).updateBoundsWidget(); - } - } - } - } - - /** - * 更新子组件的Bound - * 这边主要用于绝对布局子组件在适应区域选项时 - * 涉及到的不同分辨率下缩放 - * @param minHeight 最小高度 - */ - @Override - public void updateChildBound(int minHeight) { - double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; - if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) { - for (int i = 0; i < this.getComponentCount(); i++) { - XCreator creator = getXCreator(i); - Rectangle rec = new Rectangle(creator.getBounds()); - rec.x = (int)(rec.x / prevContainerPercent * containerPercent); - rec.y = (int)(rec.y / prevContainerPercent * containerPercent); - rec.height = (int)(rec.height / prevContainerPercent * containerPercent); - rec.width = (int)(rec.width / prevContainerPercent * containerPercent); - BoundsWidget wgt = toData().getBoundsWidget(creator.toData()); - wgt.setBounds(rec); - creator.setBounds(rec); - creator.updateChildBound(minHeight); - } - } - toData().setDesigningResolution(Toolkit.getDefaultToolkit().getScreenSize()); - } - - /** - * 增加对齐线 - * @param connector 对齐线 - */ - public void addConnector(Connector connector) { - xConnectorMap.put(connector, new XConnector(connector, this)); - ((WAbsoluteLayout) data).addConnector(connector); - } - - public XConnector getXConnector(Connector connector) { - return xConnectorMap.get(connector); - } - - /** - * 去除对齐线 - * @param connector 对齐线 - */ - public void removeConnector(Connector connector) { - ((WAbsoluteLayout) data).removeConnector(connector); - xConnectorMap.remove(connector); - } - - /** - * 返回对应的widget容器 - * @return 返回WAbsoluteLayout - */ - @Override - public WAbsoluteLayout toData() { - return (WAbsoluteLayout) data; - } - - @Override - protected String getIconName() { - return "layout_absolute_new.png"; - } - - /** - * 返回默认的容器name - * @return 返回绝对布局容器名 - */ - @Override - public String createDefaultName() { - return "absolute"; - } - - @Override - protected void initLayoutManager() { - this.setLayout(new FRAbsoluteLayout()); - } - - /** - * 是否支持标题样式 - * - * @return 默认false - */ - @Override - public boolean hasTitleStyle() { - return false; - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - WAbsoluteLayout layout = (WAbsoluteLayout) data; - Connector[] connector = layout.getConnector(); - for (int i = 0, size = connector.length; i < size; i++) { - connector[i].draw(g); - } - } - - /** - * 转换保存组件信息的wlayout为对应的container - */ - @Override - public void convert() { - isRefreshing = true; - WAbsoluteLayout abs = toData(); - this.removeAll(); - for (int i = 0, count = abs.getWidgetCount(); i < count; i++) { - BoundsWidget bw = (BoundsWidget)abs.getWidget(i); - if (bw != null) { - Rectangle bounds = bw.getBounds(); - XWidgetCreator comp = (XWidgetCreator)XCreatorUtils.createXCreator(bw.getWidget()); - if (!comp.acceptType(XWParameterLayout.class)) { - comp.setDirections(Direction.ALL); - } - add(comp); - comp.setBounds(bounds); - } - } - isRefreshing = false; - } - - /** - * 当前组件zorder位置替换新的控件 - * @param widget 控件 - * @param oldcreator 旧组件 - * @return 组件 - */ - @Override - public XCreator replace(Widget widget, XCreator oldcreator) { - int i = this.getComponentZOrder(oldcreator); - if (i != -1) { - this.toData().replace(new BoundsWidget(widget, oldcreator.getBounds()), - new BoundsWidget(oldcreator.toData(), oldcreator.getBounds())); - this.convert(); - return (XCreator) this.getComponent(i); - } - return null; - } - - /** + private static final int EDIT_BTN_WIDTH = 60; + private static final int EDIT_BTN_HEIGHT = 24; + private int minWidth = WLayout.MIN_WIDTH; + private int minHeight = WLayout.MIN_HEIGHT; + + //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 + protected double containerPercent = 1.0; + + private HashMap xConnectorMap; + + public XWAbsoluteLayout() { + this(new WAbsoluteLayout(), new Dimension()); + } + + public XWAbsoluteLayout(WAbsoluteLayout widget) { + this(widget, new Dimension()); + } + + public XWAbsoluteLayout(WAbsoluteLayout widget, Dimension initSize) { + super(widget, initSize); + this.xConnectorMap = new HashMap(); + Connector connector; + for (int i = 0; i < widget.connectorCount(); i++) { + connector = widget.getConnectorIndex(i); + xConnectorMap.put(connector, new XConnector(connector, this)); + } + + initPercent(widget); + } + + /** + * 初始化时默认的组件大小 + * + * @return 默认Dimension + */ + @Override + public Dimension initEditorSize() { + return new Dimension(500, 300); + } + + //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% + private void initPercent(WAbsoluteLayout widget) { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Dimension scrnsize = toolkit.getScreenSize(); + double screenValue = FRScreen.getByDimension(scrnsize).getValue(); + if (screenValue != FormArea.DEFAULT_SLIDER) { + this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); + } + } + + /** + * 返回容器大小的百分比 + * + * @return the containerPercent + */ + public double getContainerPercent() { + return containerPercent; + } + + /** + * 设置容器大小的百分比 + * + * @param containerPercent the containerPercent to set + */ + public void setContainerPercent(double containerPercent) { + this.containerPercent = containerPercent; + minWidth = (int) (XWAbsoluteLayout.MIN_WIDTH * containerPercent); + minHeight = (int) (XWAbsoluteLayout.MIN_HEIGHT * containerPercent); + } + + /** + * 返回界面处根据百分比调整后的最小宽度 + * + * @return 最小宽度 + */ + public int getActualMinWidth() { + return this.minWidth; + } + + /** + * 返回界面处根据百分比调整后的最小高度 + * + * @return 最小高度 + */ + public int getActualMinHeight() { + return this.minHeight; + } + + /** + * 返回界面处根据百分比调整后的间隔大小(且为偶数) + * + * @return 间隔 + */ + public int getAcualInterval() { + // adapter那边交叉三等分、删除都要判断是否对齐,所以间隔转为偶数 + int interval = (int) (toData().getCompInterval() * containerPercent); + int val = interval / 2; + return val * 2; + } + + /** + * 界面容器大小不是默认的时,处理控件的BoundsWidget,且避免出现空隙 + */ + private Rectangle dealWidgetBound(Rectangle rec) { + if (containerPercent == 1.0) { + return rec; + } + rec.x = (int) (rec.x / containerPercent); + rec.y = (int) (rec.y / containerPercent); + rec.width = (int) (rec.width / containerPercent); + rec.height = (int) (rec.height / containerPercent); + return rec; + } + + /** + * 新增删除拉伸后单个组件的BoundsWidget + */ + public void updateBoundsWidget(XCreator xCreator) { + WAbsoluteLayout layout = this.toData(); + if (xCreator.hasTitleStyle()) { + xCreator = (XLayoutContainer) xCreator.getParent(); + } + if (xCreator.acceptType(XWAbsoluteLayout.class)) { + ((XWAbsoluteLayout) xCreator).updateBoundsWidget(); + } + BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); + Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); + } + + private Rectangle calculateBound(Rectangle rec, double pw, double ph) { + Rectangle calRec = new Rectangle(0, 0, 0, 0); + calRec.x = (int) (rec.x / pw); + calRec.y = (int) (rec.y / ph); + calRec.width = (int) (rec.width / pw); + calRec.height = (int) (rec.height / ph); + return calRec; + } + + /** + * 新增删除拉伸后每个组件的BoundsWidget + */ + public void updateBoundsWidget() { + WAbsoluteLayout layout = this.toData(); + Rectangle backupBound = this.getBackupBound(); + Rectangle currentBound = this.getBounds(); + if (backupBound != null && layout.getCompState() == WAbsoluteLayout.STATE_FIT) { + double percentW = ((double) backupBound.width / (double) currentBound.width); + double percentH = ((double) backupBound.height / (double) currentBound.height); + for (int index = 0, n = this.getComponentCount(); index < n; index++) { + XCreator creator = (XCreator) this.getComponent(index); + BoundsWidget wgt = layout.getBoundsWidget(creator.toData()); + // 用当前的显示大小计算后调正具体位置 + Rectangle wgtBound = creator.getBounds(); + Rectangle rec = calculateBound(wgtBound, percentW, percentH); + wgt.setBounds(rec); + creator.setBounds(rec); + //绝对布局嵌套,要更新内部的绝对布局 + if (creator.acceptType(XWAbsoluteLayout.class)) { + creator.setBackupBound(wgtBound); + ((XWAbsoluteLayout) creator).updateBoundsWidget(); + } + } + } + } + + /** + * 更新子组件的Bound + * 这边主要用于绝对布局子组件在适应区域选项时 + * 涉及到的不同分辨率下缩放 + * + * @param minHeight 最小高度 + */ + @Override + public void updateChildBound(int minHeight) { + double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; + if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) { + for (int i = 0; i < this.getComponentCount(); i++) { + XCreator creator = getXCreator(i); + Rectangle rec = new Rectangle(creator.getBounds()); + rec.x = (int) (rec.x / prevContainerPercent * containerPercent); + rec.y = (int) (rec.y / prevContainerPercent * containerPercent); + rec.height = (int) (rec.height / prevContainerPercent * containerPercent); + rec.width = (int) (rec.width / prevContainerPercent * containerPercent); + BoundsWidget wgt = toData().getBoundsWidget(creator.toData()); + wgt.setBounds(rec); + creator.setBounds(rec); + creator.updateChildBound(minHeight); + } + } + toData().setDesigningResolution(Toolkit.getDefaultToolkit().getScreenSize()); + } + + /** + * 增加对齐线 + * + * @param connector 对齐线 + */ + public void addConnector(Connector connector) { + xConnectorMap.put(connector, new XConnector(connector, this)); + ((WAbsoluteLayout) data).addConnector(connector); + } + + public XConnector getXConnector(Connector connector) { + return xConnectorMap.get(connector); + } + + /** + * 去除对齐线 + * + * @param connector 对齐线 + */ + public void removeConnector(Connector connector) { + ((WAbsoluteLayout) data).removeConnector(connector); + xConnectorMap.remove(connector); + } + + /** + * 返回对应的widget容器 + * + * @return 返回WAbsoluteLayout + */ + @Override + public WAbsoluteLayout toData() { + return (WAbsoluteLayout) data; + } + + @Override + protected String getIconName() { + return "layout_absolute_new.png"; + } + + /** + * 返回默认的容器name + * + * @return 返回绝对布局容器名 + */ + @Override + public String createDefaultName() { + return "absolute"; + } + + @Override + protected void initLayoutManager() { + this.setLayout(new FRAbsoluteLayout()); + } + + /** + * 是否支持标题样式 + * + * @return 默认false + */ + @Override + public boolean hasTitleStyle() { + return false; + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + WAbsoluteLayout layout = (WAbsoluteLayout) data; + Connector[] connector = layout.getConnector(); + for (int i = 0, size = connector.length; i < size; i++) { + connector[i].draw(g); + } + } + + /** + * 转换保存组件信息的wlayout为对应的container + */ + @Override + public void convert() { + isRefreshing = true; + WAbsoluteLayout abs = toData(); + this.removeAll(); + for (int i = 0, count = abs.getWidgetCount(); i < count; i++) { + BoundsWidget bw = (BoundsWidget) abs.getWidget(i); + if (bw != null) { + Rectangle bounds = bw.getBounds(); + XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(bw.getWidget()); + if (!comp.acceptType(XWParameterLayout.class)) { + comp.setDirections(Direction.ALL); + } + add(comp); + comp.setBounds(bounds); + } + } + isRefreshing = false; + } + + /** + * 当前组件zorder位置替换新的控件 + * + * @param widget 控件 + * @param oldcreator 旧组件 + * @return 组件 + */ + @Override + public XCreator replace(Widget widget, XCreator oldcreator) { + int i = this.getComponentZOrder(oldcreator); + if (i != -1) { + this.toData().replace(new BoundsWidget(widget, oldcreator.getBounds()), + new BoundsWidget(oldcreator.toData(), oldcreator.getBounds())); + this.convert(); + return (XCreator) this.getComponent(i); + } + return null; + } + + /** * 组件增加 + * * @param e 容器事件 */ - @Override - public void componentAdded(ContainerEvent e) { - if (isRefreshing) { - return; - } - XWidgetCreator creator = (XWidgetCreator) e.getChild(); - WAbsoluteLayout wabs = this.toData(); - if (!creator.acceptType(XWFitLayout.class)) { - creator.setDirections(Direction.ALL); - } - wabs.addWidget(new BoundsWidget(creator.toData(), creator.getBounds())); - } - - /** + @Override + public void componentAdded(ContainerEvent e) { + if (isRefreshing) { + return; + } + XWidgetCreator creator = (XWidgetCreator) e.getChild(); + WAbsoluteLayout wabs = this.toData(); + if (!creator.acceptType(XWFitLayout.class)) { + creator.setDirections(Direction.ALL); + } + wabs.addWidget(new BoundsWidget(creator.toData(), creator.getBounds())); + } + + /** * 在设计界面中有组件移除的时候,需要通知WLayout容器重新paint + * * @param e 容器事件 */ @Override @@ -363,128 +376,130 @@ public class XWAbsoluteLayout extends XLayoutContainer { BoundsWidget bw = new BoundsWidget(wgt, xwc.getBounds()); wlayout.removeWidget(bw); } - - @Override - public Dimension getMinimumSize() { - return toData().getMinDesignSize(); - } - - @Override - 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; - } - } - - /** - * 得到属性名 - * @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); - //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 - 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("FR-Designer_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); - } - } - } - - /** - * body大小手动调整的时候 - * 按照比例调整组件的宽度 - * @param percent 比例 - */ - @Override - public void adjustCompWidth(double percent) { - for (int i = 0; i < getComponentCount(); i++) { - XCreator xCreator = (XCreator) getComponent(i); - Rectangle rectangle = xCreator.getBounds(); - xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height); - BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); - widget.setBounds(xCreator.getBounds()); - } - } - - /** - * body大小手动调整的时候 - * 按照比例调整组件的高度 - * @param percent 比例 - */ - @Override - public void adjustCompHeight(double percent) { - for (int i = 0; i < getComponentCount(); i++) { - XCreator xCreator = (XCreator) getComponent(i); - Rectangle rectangle = xCreator.getBounds(); - xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent)); - BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); - widget.setBounds(xCreator.getBounds()); - } - } + + @Override + public Dimension getMinimumSize() { + return toData().getMinDesignSize(); + } + + @Override + 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; + } + } + + /** + * 得到属性名 + * + * @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); + //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 + 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("FR-Designer_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); + } + } + } + + /** + * body大小手动调整的时候 + * 按照比例调整组件的宽度 + * + * @param percent 比例 + */ + @Override + public void adjustCompWidth(double percent) { + for (int i = 0; i < getComponentCount(); i++) { + XCreator xCreator = (XCreator) getComponent(i); + Rectangle rectangle = xCreator.getBounds(); + xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height); + BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + widget.setBounds(xCreator.getBounds()); + } + } + + /** + * body大小手动调整的时候 + * 按照比例调整组件的高度 + * + * @param percent 比例 + */ + @Override + public void adjustCompHeight(double percent) { + for (int i = 0; i < getComponentCount(); i++) { + XCreator xCreator = (XCreator) getComponent(i); + Rectangle rectangle = xCreator.getBounds(); + xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent)); + BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + widget.setBounds(xCreator.getBounds()); + } + } } \ No newline at end of file From 228d8bb8e8865d78257a6aa825529ce26bdb4fc3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 11 Apr 2017 15:07:37 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E5=B1=82=E5=8F=A0=E9=A1=BA=E5=BA=8F=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9A=84=E7=BB=84=E4=BB=B6=E5=9C=A8=E4=B8=8A=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRAbsoluteLayoutAdapter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 603626e13..0384de675 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 @@ -235,7 +235,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { if (creator.hasTitleStyle()) { addParentCreator(creator); } else { - container.add(creator, creator.toData().getWidgetName()); + container.add(creator, creator.toData().getWidgetName(),0); } XWAbsoluteLayout layout = (XWAbsoluteLayout) container; layout.updateBoundsWidget(creator); @@ -246,7 +246,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { if (creator.shouldScaleCreator() || creator.hasTitleStyle()) { addParentCreator(creator); } else { - container.add(creator, creator.toData().getWidgetName()); + container.add(creator, creator.toData().getWidgetName(),0); } XWFitLayout layout = (XWFitLayout) container; // 更新对应的BoundsWidget @@ -265,7 +265,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { private void addParentCreator(XCreator child) { XLayoutContainer parentPanel = child.initCreatorWrapper(child.getHeight()); - container.add(parentPanel, child.toData().getWidgetName()); + container.add(parentPanel, child.toData().getWidgetName(),0); } /** From 03ae87935a5ce59af7fc70aee38b21d88821ed91 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 12 Apr 2017 09:06:25 +0800 Subject: [PATCH 7/9] =?UTF-8?q?report-1945=20=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E6=97=A0=E7=BB=84=E4=BB=B6=E6=98=AF=E7=B2=98=E8=B4=B4=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/beans/models/SelectionModel.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java index dc4ea6a49..4b7b97e7d 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java @@ -149,7 +149,15 @@ public class SelectionModel { int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; //选中第一个坐标点坐在的组件 selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); - pasteFromClipBoard(); + if (hasSelectedPasteSource()) { + selectedPaste(); + } else { + FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), + clipboard, + DELTA_X_Y, + DELTA_X_Y); + } + } } else { //绝对布局 From 25116d6466188442d0d384252bb81b01047681ad Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 12 Apr 2017 09:30:27 +0800 Subject: [PATCH 8/9] =?UTF-8?q?report-1945,tab|=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?,=E6=97=A0=E7=BB=84=E4=BB=B6=E6=97=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java index 4b7b97e7d..13eaa18ac 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java @@ -142,22 +142,29 @@ public class SelectionModel { int leftUpY = container.toData().getMargin().getTop() + 1; //选中第一个坐标点坐在的组件 selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY)); - pasteFromClipBoard(); + Rectangle rectangle = selection.getRelativeBounds(); + if (hasSelectedPasteSource()) { + selectedPaste(); + } else { + FormSelectionUtils.paste2Container(designer, container, clipboard, + rectangle.x + rectangle.width / 2, + rectangle.y + DELTA_X_Y); + } } else { //自适应布局编辑器内部左上角第一个坐标点 int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; //选中第一个坐标点坐在的组件 selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); + Rectangle rectangle = selection.getRelativeBounds(); if (hasSelectedPasteSource()) { selectedPaste(); } else { FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), clipboard, - DELTA_X_Y, - DELTA_X_Y); + rectangle.x + rectangle.width / 2, + rectangle.y + DELTA_X_Y); } - } } else { //绝对布局 From 50dd30c362cd0804b5af586cd8e0362e50980c3a Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 12 Apr 2017 11:46:58 +0800 Subject: [PATCH 9/9] =?UTF-8?q?REPORT-2344=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E2=80=94=E2=80=94=E7=B9=81=E4=BD=93=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=B0=91=E4=BA=86key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 8 +++- .../design/locale/designer_en_US.properties | 7 +++- .../design/locale/designer_ja_JP.properties | 28 ++++++++++++- .../design/locale/designer_ko_KR.properties | 40 ++++++++++++++++++- .../design/locale/designer_zh_CN.properties | 2 + .../design/locale/designer_zh_TW.properties | 15 ++++++- 6 files changed, 95 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 6aa27aba3..62d19e737 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -590,4 +590,10 @@ FR-Designer_Logarithmic=Logarithmic FR-Designer_Chart_Log_Base=Log Base FR-Designer_Chart_F_Radar_Axis=Chart_F_Radar_Axis FR-Designer_Too_Large_To_Paste=too large to paste -FR-Designer_Too_Small_To_Paste=Too small to paste \ No newline at end of file +FR-Designer_Too_Small_To_Paste=Too small to paste +FR-Designer_Validate= +FR-Designer_Get-CubeGetting cube= +FR-Designer_Get-CubeGetting= +FR-Designer_Fit= +FR-Designer_Properties_Mobile= +FR-Designer_Oracle= diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 79f9c4139..bfab2989f 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -591,4 +591,9 @@ FR-Designer_Logarithmic=Log scale FR-Designer_Chart_Log_Base=Log Base FR-Designer_Chart_F_Radar_Axis=Value Axis FR-Designer_Too_Large_To_Paste=Too large to paste! -FR-Designer_Too_Small_To_Paste=Too small to paste! \ No newline at end of file +FR-Designer_Too_Small_To_Paste=Too small to paste! +FR-Designer_SimpleCross_Report= +FR-Designer_Get-Cube= +FR-Designer_DoubleLayer_Report= +FR-Designer_Get-CubeGetting= +FR-Designer_SimpleDetail_Report= diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 37d913e73..ae7510e78 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -567,4 +567,30 @@ FR-Designer_Logarithmic=\u5BFE\u6570\u76EE\u76DB\u308A FR-Designer_Chart_Log_Base=\u5E95\u6570 FR-Designer_Chart_F_Radar_Axis=\u5782\u76F4\u8EF8 FR-Designer_Too_Large_To_Paste=\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30B5\u30A4\u30BA\u306F\u30DC\u30FC\u30C0\u30FC\u306B\u8D85\u3048\u305F\u306E\u3067\u3001\u8CBC\u308A\u4ED8\u3051\u3067\u304D\u307E\u305B\u3093\uFF01 -FR-Designer_Too_Small_To_Paste=\u8A72\u5F53\u51E6\u306B\u8CBC\u308A\u4ED8\u3051\u3067\u304D\u307E\u305B\u3093\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30B5\u30A4\u30BA\u306F\u9AD8\u3059\u304E\uFF01 \ No newline at end of file +FR-Designer_Too_Small_To_Paste=\u8A72\u5F53\u51E6\u306B\u8CBC\u308A\u4ED8\u3051\u3067\u304D\u307E\u305B\u3093\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30B5\u30A4\u30BA\u306F\u9AD8\u3059\u304E\uFF01 +FR-Designer_DoubleLayer_Report= +FR-Designer_Printer_Native_Button= +FR-Designer_Mobile-Warning= +FR-Designer_Form-Fit-Tip= +FR-Designer_Form-Forzen-Speed= +FR-Designer_Mobile_Form_Analysis_Annotation= +FR-Designer_TableData-Default-Para= +FR-Designer-Selected_Widget= +FR-Designer_Plugin_Should_Update_Please_Contact_Developer= +FR-Designer_SimpleCross_Report= +FR-Designer_Button-Cancel= +FR-Designer_Delete_Template= +FR-Designer_Install_Template= +FR-Designer_SimpleDetail_Report= +FR-Designer_LocalWidget= +FR-Designer_WidgetOrder= +FR-Designer_Form-Frozen-Tip= +FR-Designer-Invalid_Page_Number= +FR-Designer_Reset= +FR-Designer-Plugin_Please_Update_Jar= +FR-Designer_Get-CubeGetting cube= +FR-Designer_Mobile_Report_Analysis_Annotation= +FR-Designer_Properties_Mobile= +FR-Designer_Button-OK= +FR-Designer_Allow-Blank= +FR-Designer_AllCategories= diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 0c798b87a..f6c1591ef 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -556,4 +556,42 @@ FR-Designer-Move_Tab_Prev= FR-Designer_AxisReversed=\uCD95\uC5ED\uC21C FR-Designer_Logarithmic=\uB85C\uADF8\uB208\uAE08 FR-Designer_Chart_Log_Base=\uAE30\uC218 -FR-Designer_Chart_F_Radar_Axis=\uAC12\uCD95 \ No newline at end of file +FR-Designer_Chart_F_Radar_Axis=\uAC12\uCD95 +FR-Designer_COMMUNITY_VIDEO= +FR-Designer_DoubleLayer_Report= +FR-Designer_Too_Small_To_Paste= +FR-Designer_formDesignerModule= +FR-Designer_Mobile-Warning= +FR-Designer_Mobile-Open= +FR-Designer_Form-Fit-Tip= +FR-Designer_Form-Forzen-Speed= +FR-Designer_Mobile_Form_Analysis_Annotation= +FR-Designer_Too_Large_To_Paste= +FR-Designer_COMMUNITY_HELP= +FR-Designer_Validate= +FR-Designer_Button-Cancel= +FR-Designer_Plugin_Should_Update_Please_Contact_Developer= +FR-Designer_COMMUNITY_QUESTIONS= +FR-Designer_SimpleCross_Report= +FR-Designer_COMMUNITY_NEED= +FR-Designer_Delete_Template= +FR-Designer_TableData-Default-Para= +FR-Designer_Allow-Blank= +FR-Designer_LocalWidget= +FR-Designer_WidgetOrder= +FR-Designer_Form-Frozen-Tip= +FR-Designer_Mobile-Horizontal= +FR-Designer-Invalid_Page_Number= +FR-Designer_COMMUNITY_BBS= +FR-Designer_COMMUNITY_SIGN= +FR-Designer_COMMUNITY_UPDATE= +FR-Designer_Mobile-Vertical= +FR-Designer_Get-CubeGetting cube= +FR-Designer_COMMUNITY= +FR-Designer_Mobile_Report_Analysis_Annotation= +FR-Designer_Properties_Mobile= +FR-Designer_Button-OK= +FR-Designer_COMMUNITY_BUG= +FR-Designer_AllCategories= +FR-Designer_Mobile-Attr= +FR-Designer_Mobile-Zoom= diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 060eddbd7..b71145820 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -596,3 +596,5 @@ FR-Designer_Chart_Log_Base=\u5E95\u6570 FR-Designer_Chart_F_Radar_Axis=\u503C\u8F74 FR-Designer_Too_Large_To_Paste=\u7EC4\u4EF6\u5927\u5C0F\u8D85\u51FA\u8FB9\u754C\uFF0C\u65E0\u6CD5\u7C98\u8D34\uFF01 FR-Designer_Too_Small_To_Paste=\u6B64\u5904\u65E0\u6CD5\u7C98\u8D34\uFF0C\u5C0F\u4E8E\u7EC4\u4EF6\u6700\u5C0F\u9AD8\u5EA6\uFF01 + +FR-Designer_Get-CubeGetting cube= diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 1329b3ba6..c16164185 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -584,4 +584,17 @@ FR-Designer_Logarithmic=\u5C0D\u6578\u523B\u5EA6 FR-Designer_Chart_Log_Base=\u5E95\u6578 FR-Designer_Chart_F_Radar_Axis=\u503C\u8EF8 FR-Designer_Too_Large_To_Paste=\u7D44\u4EF6\u5927\u5C0F\u8D85\u51FA\u908A\u754C\uFF0C\u7121\u6CD5\u7C98\u8CBC\uFF01 -FR-Designer_Too_Small_To_Paste=\u6B64\u8655\u7121\u6CD5\u7C98\u8CBC\uFF0C\u5C0F\u65BC\u7D44\u4EF6\u6700\u5C0F\u9AD8\u5EA6\uFF01 \ No newline at end of file +FR-Designer_Too_Small_To_Paste=\u6B64\u8655\u7121\u6CD5\u7C98\u8CBC\uFF0C\u5C0F\u65BC\u7D44\u4EF6\u6700\u5C0F\u9AD8\u5EA6\uFF01 +FR-Designer_Download_Template= +FR-Designer-Selected_Widget= +FR-Designer_LocalWidget= +FR-Designer_Get-CubeGetting cube= +FR-Designer_Install_Template= +FR-Designer_Reset= +FR-Designer_SimpleCross_Report= +FR-Designer_Allow-Blank= +FR-Designer_AllCategories= +FR-Designer_SimpleDetail_Report= +FR-Designer_DoubleLayer_Report= +FR-Designer_Delete_Template= +FR-Designer_Validate=