diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index 34c355f51..bb3565c82 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -20,7 +20,7 @@ import com.fr.form.ui.FieldEditor; import com.fr.general.Inter; public abstract class FieldEditorDefinePane extends AbstractDataModify { - private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Blank") + 30; + private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; private UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 @@ -39,7 +39,7 @@ public abstract class FieldEditorDefinePane extends Abstr initRegErrorMsgTextField(); //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); - allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Blank")); + allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); allowBlankCheckBox.addItemListener(new ItemListener() { diff --git a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java index eb75dabe1..001bd5626 100644 --- a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java +++ b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java @@ -20,6 +20,7 @@ import com.fr.file.FunctionManagerProvider; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.stable.ProductConstants; import com.fr.stable.project.ProjectConstants; import com.fr.stable.script.FunctionDef; @@ -159,7 +160,11 @@ public class FunctionManagerPane extends BasicPane { descriptionArea.setWrapStyleWord(true); descriptionArea.setLineWrap(true); northPane.add(descriptionArea); - descriptionArea.setText(Inter.getLocText("FR-Designer_Function_Description_Area_Text", File.separator, File.separator, FRContext.getCurrentEnv().getPath() + File.separator)); + + String path1 = getEscapePath(File.separator + ProjectConstants.WEBINF_NAME + File.separator + ProjectConstants.CLASSES_NAME); + String path2 = getEscapePath(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.CLASSES_NAME); + descriptionArea.setText(Inter.getLocText("FR-Designer_Function_Description_Area_Text", path1, path2)); + JPanel descriptionPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); //Description Pane this.add(descriptionPane, BorderLayout.SOUTH); descriptionPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); @@ -167,6 +172,10 @@ public class FunctionManagerPane extends BasicPane { this.descriptionTextArea = new UITextArea(6, 24); descriptionPane.add(new JScrollPane(this.descriptionTextArea), BorderLayout.CENTER); } + + private String getEscapePath(String path) { + return path.replace("\\", "\\\\"); + } private ActionListener createEditorButtonActionListener() { return new ActionListener() { diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 157c12525..268f5d53d 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -534,13 +534,13 @@ FR-Designer_Mouse_Click_Tips= FR-Designer_About_Version=Version FR-Designer_About_CopyRight=Copy Right FR-Designer_Service_Phone=Service Phone -FR-Designer_Allow_Blank=Allow Blank +FR-Designer_Allow_Null=Allow null FR-Designer_PageSetup_Page=Page FR-Designer_Custom_Job_Description=Description FR-Designer_Property=Property FR-Designer_ClassName=Class Name FR-Designer_Polyblock_Edit=Polyblock Edit -FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes} +FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2}} FR-Designer_PageSetup_Horizontal=Horizontal FR-Designer_PageSetup_Vertical=Vertical FR-Designer_Gradient_Direction=Gradient Direction 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 9735aa3d2..b0bf16d5d 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 @@ -525,22 +525,22 @@ FR-Designer_Background_Gradient_Color=Gradient Color FR-Designer_Background_Image=Image FR-Designer_Background_Clear=Clear FR-Designer_Background_Image_Select=Select Picture -FR-Designer_Tab_carousel= -FR-Designer_setCarousel= -FR-Designer_carouselInterval= +FR-Designer_Tab_carousel=tab carousel +FR-Designer_setCarousel=set carousel +FR-Designer_carouselInterval=interval FR-Designer_Initial_Background_Tips=Initial background of the button FR-Designer_Mouse_Move_Tips=Move the mouse to the button on the background, in the absence of not changing the background FR-Designer_Mouse_Click_Tips=The background of the mouse to click the button, in the absence of not changing the background FR-Designer_About_Version=Version FR-Designer_About_CopyRight=Copy Right FR-Designer_Service_Phone=Service Phone -FR-Designer_Allow_Blank=Allow Null +FR-Designer_Allow_Null=Allow null FR-Designer_PageSetup_Page=Page FR-Designer_Custom_Job_Description=Description FR-Designer_Property=Property FR-Designer_ClassName=Class Name FR-Designer_Polyblock_Edit=Aggregation block edition -FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class files should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes +FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class files should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2} FR-Designer_PageSetup_Horizontal=Horizontal FR-Designer_PageSetup_Vertical=Vertical FR-Designer_Gradient_Direction=Gradient Direction 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 84559cf36..0ef9ce10c 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 @@ -513,13 +513,13 @@ FR-Designer_Mouse_Click_Tips= FR-Designer_About_Version=\u30D0\u30FC\u30B8\u30E7\u30F3 FR-Designer_About_CopyRight=\u8457\u4F5C\u6A29\u6240\u6709 FR-Designer_Service_Phone=\u30B5\u30FC\u30D3\u30B9\u96FB\u8A71\uFF1A -FR-Designer_Allow_Blank=\u7A7A\u6B04\u3042\u308A +FR-Designer_Allow_Null=\u7A7A\u6B04\u3042\u308A FR-Designer_PageSetup_Page=\u30DA\u30FC\u30B8 FR-Designer_Custom_Job_Description=\u8A18\u8FF0 FR-Designer_Property=\u5C5E\u6027 FR-Designer_ClassName=\u985E\u540D FR-Designer_Polyblock_Edit=\u30A2\u30B0\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30D6\u30ED\u30C3\u30AF\u7DE8\u96C6 -FR-Designer_Function_Description_Area_Text=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u7D99\u627F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"com.fr.script.AbstractFunction"\u3002\u3092\u7D99\u627F\u3059\u3079\u304D\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u5F8C\u306E\u985E\u30D5\u30A1\u30A4\u30EB\u3092\nJ2EE\u30B5\u30FC\u30D0\u30FC "{R1}WEB-INF{R2}classes" \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u306B\u30B3\u30D4\u30FC\u3057\u3066\u3001class\u306B\u5BFE\u5FDC\u3059\u308Bjava\u30D5\u30A1\u30A4\u30EB\u3082\u5F53\u76EE\u6B21\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\u3002\n\u4F8B\u3048\u3070\uFF1A{R3}classes +FR-Designer_Function_Description_Area_Text=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u7D99\u627F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"com.fr.script.AbstractFunction"\u3002\u3092\u7D99\u627F\u3059\u3079\u304D\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u5F8C\u306E\u985E\u30D5\u30A1\u30A4\u30EB\u3092\nJ2EE\u30B5\u30FC\u30D0\u30FC "{R1}" \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u306B\u30B3\u30D4\u30FC\u3057\u3066\u3001class\u306B\u5BFE\u5FDC\u3059\u308Bjava\u30D5\u30A1\u30A4\u30EB\u3082\u5F53\u76EE\u6B21\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\u3002\n\u4F8B\u3048\u3070\uFF1A{R2} FR-Designer_PageSetup_Horizontal=\u6A2A\u65B9\u5411 FR-Designer_PageSetup_Vertical=\u7E26\u65B9\u5411 FR-Designer_Gradient_Direction=\u65B9\u5411\u3092\u5F90\u3005\u306B\u5909\u5316 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 f80d8ab0b..5bc3966dc 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 @@ -508,13 +508,13 @@ FR-Designer_Mouse_Click_Tips= FR-Designer_About_Version=\uBC84\uC804 FR-Designer_About_CopyRight=\uD310\uAD8C\uC18C\uC720 FR-Designer_Service_Phone=\uC11C\uBE44\uC2A4\uC804\uD654\uFF1A -FR-Designer_Allow_Blank=\uBE48\uCE78\uD5C8\uC6A9 +FR-Designer_Allow_Null=\uBE48\uCE78\uD5C8\uC6A9 FR-Designer_PageSetup_Page=\uC6F9\uD398\uC774\uC9C0 FR-Designer_Custom_Job_Description=\uC124\uBA85 FR-Designer_Property=\uC18D\uC131 FR-Designer_ClassName=\uD074\uB798\uC2A4\uB124\uC784 FR-Designer_Polyblock_Edit=\uCDE8\uD569\uBE14\uB7ED\uD3B8\uC9D1 -FR-Designer_Function_Description_Area_Text=\uD574\uB2F9\uD074\uB798\uC2A4\uB294\uACC4\uC2B9\uD574\uC57C\uD55C\uB2E4."com.fr.script.AbstractFunction".\uCEF4\uD30C\uC77C\uD6C4\uC758\uD074\uB798\uC2A4\uD30C\uC77C\uC744~\uB85C\uBCF5\uC0AC\nJ2EE\uC11C\uBC84 "{R1}WEB-INF{R2}classes" \uB514\uB809\uD130\uB9AC, \uD544\uC694\uC2DC class \uC0C1\uC751\uD558\uB294 java\uC18C\uC2A4\uD30C\uC77C\uB3C4\uD574\uB2F9\uB514\uB809\uD130\uB9AC\uD558\uB2E8\uC5D0\uB450\uC5B4\uD3B8\uC9D1\uBC0F\uCC3E\uC544\uBCF4\uAE30\uB97C\uD560\uC218\uC788\uC2B5\uB2C8\uB2E4.\n\uC608: {R3}classes +FR-Designer_Function_Description_Area_Text=\uD574\uB2F9\uD074\uB798\uC2A4\uB294\uACC4\uC2B9\uD574\uC57C\uD55C\uB2E4."com.fr.script.AbstractFunction".\uCEF4\uD30C\uC77C\uD6C4\uC758\uD074\uB798\uC2A4\uD30C\uC77C\uC744~\uB85C\uBCF5\uC0AC\nJ2EE\uC11C\uBC84 "{R1}" \uB514\uB809\uD130\uB9AC, \uD544\uC694\uC2DC class \uC0C1\uC751\uD558\uB294 java\uC18C\uC2A4\uD30C\uC77C\uB3C4\uD574\uB2F9\uB514\uB809\uD130\uB9AC\uD558\uB2E8\uC5D0\uB450\uC5B4\uD3B8\uC9D1\uBC0F\uCC3E\uC544\uBCF4\uAE30\uB97C\uD560\uC218\uC788\uC2B5\uB2C8\uB2E4.\n\uC608: {R2} FR-Designer_PageSetup_Horizontal=\uAC00\uB85C FR-Designer_PageSetup_Vertical=\uC138\uB85C FR-Designer_Gradient_Direction=\uADF8\uB77C\uB370\uC774\uC158 \uBC29\uD5A5 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 7255d42bf..c8ecd5bef 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 @@ -538,13 +538,13 @@ FR-Designer_Mouse_Click_Tips=\u9F20\u6807\u70B9\u51FB\u6309\u94AE\u65F6\u80CC\u6 FR-Designer_About_Version=\u7248\u672C FR-Designer_About_CopyRight=\u7248\u6743\u6240\u6709 FR-Designer_Service_Phone=\u670D\u52A1\u7535\u8BDD\uFF1A -FR-Designer_Allow_Blank=\u5141\u8BB8\u4E3A\u7A7A +FR-Designer_Allow_Null=\u5141\u8BB8\u4E3A\u7A7A FR-Designer_PageSetup_Page=\u9875\u9762 FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Property=\u5C5E\u6027 FR-Designer_ClassName=\u7C7B\u540D FR-Designer_Polyblock_Edit=\u805A\u5408\u5757\u7F16\u8F91 -FR-Designer_Function_Description_Area_Text=\u8BE5\u7C7B\u5FC5\u987B\u7EE7\u627F"com.fr.script.AbstractFunction"\u3002\u5E94\u5C06\u7F16\u8BD1\u540E\u7684\u7C7B\u6587\u4EF6\u62F7\u8D1D\u5230\nJ2EE\u670D\u52A1\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u5F55\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8BDD\u5C06class\u5BF9\u5E94\u7684java\u6E90\u6587\u4EF6\u4E5F\u653E\u7F6E\u5230\u8BE5\u76EE\u5F55\u4E0B\u65B9\u4FBF\u7F16\u8F91\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes +FR-Designer_Function_Description_Area_Text=\u8BE5\u7C7B\u5FC5\u987B\u7EE7\u627F"com.fr.script.AbstractFunction"\u3002\u5E94\u5C06\u7F16\u8BD1\u540E\u7684\u7C7B\u6587\u4EF6\u62F7\u8D1D\u5230\nJ2EE\u670D\u52A1\u5668 "{R1}" \u76EE\u5F55\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8BDD\u5C06class\u5BF9\u5E94\u7684java\u6E90\u6587\u4EF6\u4E5F\u653E\u7F6E\u5230\u8BE5\u76EE\u5F55\u4E0B\u65B9\u4FBF\u7F16\u8F91\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R2} FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 FR-Designer_PageSetup_Vertical=\u7EB5\u5411 FR-Designer_Gradient_Direction=\u6E10\u53D8\u65B9\u5411 @@ -566,4 +566,4 @@ FR-Designer_Role=\u89D2\u8272 FR-Designer_DS_TableData=\u6570\u636E\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 -FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F \ No newline at end of file +FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F 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 96c6d0d88..a31f31760 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 @@ -526,13 +526,13 @@ FR-Designer_Mouse_Click_Tips= FR-Designer_About_Version=\u7248\u672C FR-Designer_About_CopyRight=\u7248\u6B0A\u6240\u6709 FR-Designer_Service_Phone=\u670D\u52D9\u96FB\u8A71\uFF1A -FR-Designer_Allow_Blank=\u5141\u8A31\u70BA\u7A7A\u767D +FR-Designer_Allow_Null=\u5141\u8A31\u70BA\u7A7A\u767D FR-Designer_PageSetup_Page=\u9801\u9762 FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Property=\u5C6C\u6027 FR-Designer_ClassName=\u985E\u540D FR-Designer_Polyblock_Edit=\u805A\u5408\u584A\u7DE8\u8F2F -FR-Designer_Function_Description_Area_Text=\u8A72\u985E\u5FC5\u9808\u7E7C\u627F"com.fr.script.AbstractFunction"\u3002\u61C9\u5C07\u7DE8\u8B6F\u5F8C\u7684\u985E\u6A94\u6848\u62F7\u8C9D\u5230\nJ2EE\u4F3A\u670D\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u9304\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8A71\u5C07class\u5C0D\u61C9\u7684java\u539F\u59CB\u6A94\u6848\u4E5F\u653E\u7F6E\u5230\u8A72\u76EE\u9304\u4E0B\u65B9\u4FBF\u7DE8\u8F2F\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes +FR-Designer_Function_Description_Area_Text=\u8A72\u985E\u5FC5\u9808\u7E7C\u627F"com.fr.script.AbstractFunction"\u3002\u61C9\u5C07\u7DE8\u8B6F\u5F8C\u7684\u985E\u6A94\u6848\u62F7\u8C9D\u5230\nJ2EE\u4F3A\u670D\u5668 "{R1}" \u76EE\u9304\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8A71\u5C07class\u5C0D\u61C9\u7684java\u539F\u59CB\u6A94\u6848\u4E5F\u653E\u7F6E\u5230\u8A72\u76EE\u9304\u4E0B\u65B9\u4FBF\u7DE8\u8F2F\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R2} FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 FR-Designer_PageSetup_Vertical=\u7E31\u5411 FR-Designer_Gradient_Direction=\u6F38\u8B8A\u65B9\u5411 @@ -554,4 +554,4 @@ FR-Designer_Role= FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u633F\u4EF6\u7248\u672C\u904E\u4F4E\uFF0C\u5B58\u5728API\u4E0D\u76F8\u5BB9\uFF0C\u8ACB\u806F\u7CFB\u958B\u767C\u8005\u965E\u7D1A\u633F\u4EF6 -FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F \ No newline at end of file +FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle index 20dc49a33..ae16b033e 100644 --- a/designer_form/build.dev.gradle +++ b/designer_form/build.dev.gradle @@ -4,7 +4,7 @@ tasks.withType(JavaCompile){ options.encoding = 'UTF-8' } //指定构建的jdk版本 -sourceCompatibility=1.8 +sourceCompatibility=1.7 //指定生成的jar包版本 version='8.0' 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 0cfd0c714..f578b28ab 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 @@ -277,6 +277,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { super.clearCompsList(); } + protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout){ + return mainLayout.getBounds(); + } + private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { // 参数界面高度对纵坐标产生的影响 JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); @@ -284,7 +288,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { backupBound.y -= jform.getFormDesign().getParaHeight(); } - Rectangle rec = mainLayout.getBounds(); + Rectangle rec = getLayoutBound(mainLayout); // XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响 // 减掉之后可以按照它原来的逻辑执行 backupBound.x -= rec.x; diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index 8c67a44ab..bd85fc83b 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -4,13 +4,12 @@ package com.fr.design.designer.beans.adapters.layout; -import java.awt.Rectangle; - import com.fr.design.beans.GroupModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.utils.ComponentUtils; @@ -18,6 +17,8 @@ import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; +import java.awt.*; + /** * tab布局tabFit适配器 * @@ -91,4 +92,8 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { } return y; } + + protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout){ + return ComponentUtils.getRelativeBounds(mainLayout); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveAction.java new file mode 100644 index 000000000..354846d91 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveAction.java @@ -0,0 +1,80 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.FRLogger; + +/** + * Created by zhouping on 2017/2/17. + */ +public class TabMoveAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMoveAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + XCardSwitchButton xCardSwitchButton = getxCardSwitchButton(); + XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); + try { + int currentIndex = currentButton.getIndex(); + int maxIndex = xwCardTagLayout.getComponentCount(); + XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); + WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); + xwCardTagLayout.setSwitchingTab(true); + + changeTabIndex(xwCardTagLayout, xwCardLayout, currentIndex, maxIndex); + + moveTabAction(xwCardTagLayout, currentButton, xCurrentTab, currentTab); + + xwCardTagLayout.setSwitchingTab(false); + }catch (Exception e){ + xwCardTagLayout.setSwitchingTab(false); + FRLogger.getLogger().error(e.getMessage()); + return false; + } + return true; + } + + private void moveTabAction(XWCardTagLayout xwCardTagLayout, CardSwitchButton currentButton, XWTabFitLayout xCurrentTab, WTabFitLayout currentTab) { + int move2Index = getTabMoveIndex(currentButton); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + xwCardTagLayout.remove(xCardSwitchButton); + xwCardTagLayout.add(xCardSwitchButton, move2Index); + xwCardLayout.remove(xCurrentTab); + xwCardLayout.add(xCurrentTab, move2Index); + currentButton.setIndex(move2Index); + currentTab.setIndex(move2Index); + currentTab.setTabNameIndex(move2Index); + xwCardLayout.toData().setShowIndex(move2Index); + xwCardLayout.showCard(); + } + + //改变Tab的索引号 + protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) { + } + + /** + * 获取tab移动的目的索引:首位,末尾,下一个,上一个 + * @param currentButton 当前按钮 + * @return 索引 + */ + protected int getTabMoveIndex(CardSwitchButton currentButton) { + return currentButton.getIndex(); + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java index 93a62287e..8930c686c 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java @@ -1,32 +1,17 @@ package com.fr.design.designer.creator.cardlayout; -import com.fr.base.BaseUtils; -import com.fr.design.designer.beans.actions.FormUndoableAction; import com.fr.design.mainframe.FormDesigner; +import com.fr.general.IOUtils; /** * Created by zhouping on 2017/2/9. */ -public class TabMoveCustomAction extends FormUndoableAction { - private XCardSwitchButton xCardSwitchButton; +public class TabMoveCustomAction extends TabMoveAction { public TabMoveCustomAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { - super(t); + super(t, xCardSwitchButton); this.setName(""); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); - this.xCardSwitchButton = xCardSwitchButton; + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); } - @Override - public boolean executeActionReturnUndoRecordNeeded() { - return false; - } - - public XCardSwitchButton getxCardSwitchButton() { - return xCardSwitchButton; - } - - public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { - this.xCardSwitchButton = xCardSwitchButton; - } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java index ae101dbe4..5da5dd1c7 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java @@ -1,66 +1,36 @@ package com.fr.design.designer.creator.cardlayout; -import com.fr.base.BaseUtils; -import com.fr.design.designer.beans.actions.FormUndoableAction; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; /** * Created by zhouping on 2017/2/9. */ -public class TabMoveEndAction extends FormUndoableAction { - private XCardSwitchButton xCardSwitchButton; +public class TabMoveEndAction extends TabMoveAction { public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { - super(t); + super(t, xCardSwitchButton); this.setName(Inter.getLocText("FR-Designer-Move_Tab_End")); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/rightright.png")); - this.xCardSwitchButton = xCardSwitchButton; + this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/rightright.png")); } - @Override - public boolean executeActionReturnUndoRecordNeeded() { - XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); - XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); - CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); - try { - int currentIndex = currentButton.getIndex(); - int maxIndex = xwCardTagLayout.getComponentCount(); - XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); - WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); - xwCardTagLayout.setSwitchingTab(true); - //修改当前tab往后所有tab的索引号 - for (int i = currentIndex + 1; i < maxIndex; i++) { - CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); - tempBtn.setIndex(i - 1); - WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); - tempTab.setIndex(i - 1); - tempTab.setTabNameIndex(i - 1); - } - xwCardTagLayout.remove(xCardSwitchButton); - xwCardTagLayout.add(xCardSwitchButton); - xwCardLayout.remove(xCurrentTab); - xwCardLayout.add(xCurrentTab); - currentButton.setIndex(maxIndex - 1); - currentTab.setIndex(maxIndex - 1); - currentTab.setTabNameIndex(maxIndex - 1); - xwCardTagLayout.setSwitchingTab(false); - }catch (Exception e){ - xwCardTagLayout.setSwitchingTab(false); - FRLogger.getLogger().error(e.getMessage()); - return false; + //改变Tab的索引号 + protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) { + //修改当前tab往后所有tab的索引号 + for (int i = currentIndex + 1; i < maxIndex; i++) { + CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); + tempBtn.setIndex(i - 1); + WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); + tempTab.setIndex(i - 1); + tempTab.setTabNameIndex(i - 1); } - return true; - } - - public XCardSwitchButton getxCardSwitchButton() { - return xCardSwitchButton; } - public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { - this.xCardSwitchButton = xCardSwitchButton; + @Override + protected int getTabMoveIndex(CardSwitchButton btn) { + return getxCardSwitchButton().getTagLayout().getComponentCount() - 1; } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java index 0d6047636..26195b946 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java @@ -1,65 +1,36 @@ package com.fr.design.designer.creator.cardlayout; -import com.fr.base.BaseUtils; -import com.fr.design.designer.beans.actions.FormUndoableAction; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; /** * Created by zhouping on 2017/2/9. */ -public class TabMoveFirstAction extends FormUndoableAction { - private XCardSwitchButton xCardSwitchButton; +public class TabMoveFirstAction extends TabMoveAction { public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { - super(t); + super(t, xCardSwitchButton); this.setName(Inter.getLocText("FR-Designer-Move_Tab_First")); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/leftleft.png")); - this.xCardSwitchButton = xCardSwitchButton; + this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/leftleft.png")); } @Override - public boolean executeActionReturnUndoRecordNeeded() { - XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); - XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); - CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); - try { - int currentIndex = currentButton.getIndex(); - XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); - WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); - xwCardTagLayout.setSwitchingTab(true); - //修改当前tab往前所有tab的索引号 - for (int i = currentIndex - 1; i >= 0; i--) { - CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); - tempBtn.setIndex(i + 1); - WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); - tempTab.setIndex(i + 1); - tempTab.setTabNameIndex(i + 1); - } - xwCardTagLayout.remove(xCardSwitchButton); - xwCardTagLayout.add(xCardSwitchButton, 0); - xwCardLayout.remove(xCurrentTab); - xwCardLayout.add(xCurrentTab, 0); - currentButton.setIndex(0); - currentTab.setIndex(0); - currentTab.setTabNameIndex(0); - xwCardTagLayout.setSwitchingTab(false); - }catch (Exception e){ - xwCardTagLayout.setSwitchingTab(false); - FRLogger.getLogger().error(e.getMessage()); - return false; + protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) { + //修改当前tab往前所有tab的索引号 + for (int i = currentIndex - 1; i >= 0; i--) { + CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); + tempBtn.setIndex(i + 1); + WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); + tempTab.setIndex(i + 1); + tempTab.setTabNameIndex(i + 1); } - return true; } - public XCardSwitchButton getxCardSwitchButton() { - return xCardSwitchButton; - } - - public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { - this.xCardSwitchButton = xCardSwitchButton; + @Override + protected int getTabMoveIndex(CardSwitchButton btn) { + return 0; } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java index 15bfa7337..10e796abc 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java @@ -1,64 +1,34 @@ package com.fr.design.designer.creator.cardlayout; -import com.fr.base.BaseUtils; -import com.fr.design.designer.beans.actions.FormUndoableAction; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; /** * Created by zhouping on 2017/2/9. */ -public class TabMoveNextAction extends FormUndoableAction { - private XCardSwitchButton xCardSwitchButton; +public class TabMoveNextAction extends TabMoveAction { public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { - super(t); + super(t, xCardSwitchButton); this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next")); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/right.png")); - this.xCardSwitchButton = xCardSwitchButton; + this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/right.png")); } @Override - public boolean executeActionReturnUndoRecordNeeded() { - XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); - XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); - CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); - try { - int currentIndex = currentButton.getIndex(); - XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); - WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); - xwCardTagLayout.setSwitchingTab(true); - //修改下一个tab的索引号 - CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData(); - nextBtn.setIndex(currentIndex); - WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData(); - nextTab.setIndex(currentIndex); - nextTab.setTabNameIndex(currentIndex); - - xwCardTagLayout.remove(xCardSwitchButton); - xwCardTagLayout.add(xCardSwitchButton, currentIndex + 1); - xwCardLayout.remove(xCurrentTab); - xwCardLayout.add(xCurrentTab, currentIndex + 1); - currentButton.setIndex(currentIndex + 1); - currentTab.setIndex(currentIndex + 1); - currentTab.setTabNameIndex(currentIndex + 1); - xwCardTagLayout.setSwitchingTab(false); - }catch (Exception e){ - xwCardTagLayout.setSwitchingTab(false); - FRLogger.getLogger().error(e.getMessage()); - return false; - } - return true; - } - - public XCardSwitchButton getxCardSwitchButton() { - return xCardSwitchButton; + protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) { + //修改下一个tab的索引号 + CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData(); + nextBtn.setIndex(currentIndex); + WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData(); + nextTab.setIndex(currentIndex); + nextTab.setTabNameIndex(currentIndex); } - public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { - this.xCardSwitchButton = xCardSwitchButton; + @Override + protected int getTabMoveIndex(CardSwitchButton currentButton) { + return currentButton.getIndex() + 1; } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java index cac70db82..859a27eea 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java @@ -1,64 +1,34 @@ package com.fr.design.designer.creator.cardlayout; -import com.fr.base.BaseUtils; -import com.fr.design.designer.beans.actions.FormUndoableAction; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; /** * Created by zhouping on 2017/2/9. */ -public class TabMovePrevAction extends FormUndoableAction { - private XCardSwitchButton xCardSwitchButton; +public class TabMovePrevAction extends TabMoveAction { public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { - super(t); + super(t, xCardSwitchButton); this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev")); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/left.png")); - this.xCardSwitchButton = xCardSwitchButton; + this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/left.png")); } @Override - public boolean executeActionReturnUndoRecordNeeded() { - XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); - XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); - CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); - try { - int currentIndex = currentButton.getIndex(); - XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); - WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); - xwCardTagLayout.setSwitchingTab(true); - //修改上一个tab的索引号 - CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData(); - prevBtn.setIndex(currentIndex); - WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData(); - prevTab.setIndex(currentIndex); - prevTab.setTabNameIndex(currentIndex); - - xwCardTagLayout.remove(xCardSwitchButton); - xwCardTagLayout.add(xCardSwitchButton, currentIndex - 1); - xwCardLayout.remove(xCurrentTab); - xwCardLayout.add(xCurrentTab, currentIndex - 1); - currentButton.setIndex(currentIndex - 1); - currentTab.setIndex(currentIndex - 1); - currentTab.setTabNameIndex(currentIndex - 1); - xwCardTagLayout.setSwitchingTab(false); - }catch (Exception e){ - xwCardTagLayout.setSwitchingTab(false); - FRLogger.getLogger().error(e.getMessage()); - return false; - } - return true; - } - - public XCardSwitchButton getxCardSwitchButton() { - return xCardSwitchButton; + protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) { + //修改上一个tab的索引号 + CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData(); + prevBtn.setIndex(currentIndex); + WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData(); + prevTab.setIndex(currentIndex); + prevTab.setTabNameIndex(currentIndex); } - public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { - this.xCardSwitchButton = xCardSwitchButton; + @Override + protected int getTabMoveIndex(CardSwitchButton currentButton) { + return currentButton.getIndex() - 1; } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 32a7134ad..8a7db6059 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -295,9 +295,15 @@ public class XWCardLayout extends XLayoutContainer { * 判断当前tab组件是不是嵌套的 * @return 嵌套与否 */ - private boolean isNested(){ - XLayoutContainer xLayoutContainer = this.getBackupParent().getBackupParent(); - return xLayoutContainer != null && xLayoutContainer.acceptType(XWTabFitLayout.class); + private boolean isNested() { + XCreator xCreator = (XCreator)this.getBackupParent().getParent(); + while (xCreator != null) { + if (xCreator.acceptType(XWCardMainBorderLayout.class)) { + return true; + } + xCreator = (XCreator) xCreator.getParent(); + } + return false; } public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException { diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index b290bcccf..eb4b31154 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -26,8 +26,11 @@ import java.util.Comparator; public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPropertiesGroupModel { private LayoutTypeEditor layoutTypeEditor; private LayoutTypeRenderer layoutTypeRenderer; + //默认body是0,自适应布局;1,绝对布局. private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; + private static final int EACH_ROW_COUNT = 4; + public FRAbsoluteBodyLayoutPropertiesGroupModel(XWAbsoluteBodyLayout xwAbsoluteBodyLayout) { super(xwAbsoluteBodyLayout); } @@ -180,9 +183,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr // 把绝对布局中的元素按规则移动到自适应布局中 // 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度 private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { - int eachRowCount = 4; Component[] components = xwFitLayout.getComponents(); - if (components.length <= 1){ + if (components.length == 0){ xwFitLayout.updateBoundsWidget(); return; } @@ -191,17 +193,17 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr int leftMargin = xwFitLayout.toData().getMargin().getLeft(); int topMargin = xwFitLayout.toData().getMargin().getTop(); xwFitLayout.toData().setCompInterval(0); - int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1); + int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1); //最后一行的列数不定 - int column = components.length % eachRowCount == 0 ? eachRowCount : components.length % eachRowCount; - int componentWidth = layoutWidth / eachRowCount; + int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT; + int componentWidth = layoutWidth / EACH_ROW_COUNT; int componentHeight = layoutHeight / row; for(int i = 0;i < row - 1;i++){ - for(int j = 0;j < eachRowCount;j++){ - components[eachRowCount * i + j].setBounds( + for(int j = 0;j < EACH_ROW_COUNT;j++){ + components[EACH_ROW_COUNT * i + j].setBounds( leftMargin + componentWidth * j, topMargin + componentHeight * i, - j == eachRowCount - 1 ? layoutWidth - componentWidth * (eachRowCount - 1) : componentWidth, + j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth, componentHeight ); } @@ -210,7 +212,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr int lastRowWidth = layoutWidth / column; int lastRowHeight = layoutHeight - componentHeight * (row - 1); for (int i = 0;i < column;i++) { - components[eachRowCount * (row - 1) + i].setBounds( + components[EACH_ROW_COUNT * (row - 1) + i].setBounds( leftMargin + lastRowWidth * i, topMargin + componentHeight * (row - 1), i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth, diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index f1f61b2b2..88dc9268f 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.location.Location; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.xpane.ToolTipEditor; @@ -519,6 +520,10 @@ public class EditingMouseListener extends MouseInputAdapter { public void mouseClicked(MouseEvent e) { XCreator creator = designer.getComponentAt(e); + if (e.getButton() != MouseEvent.BUTTON1 && !creator.acceptType(XCardSwitchButton.class)) { + return; + } + creator = processTopLayoutMouseClick(creator); if(creator != null){