From c63c6aab4d56e084a9c4bc7f4bdd81776df33545 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 5 Aug 2017 16:10:38 +0800 Subject: [PATCH 01/36] =?UTF-8?q?REPORT-3293=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=8E=A7=E4=BB=B6=E8=AE=BE=E7=BD=AE=E9=87=8D=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/frpane/RegPane.java | 154 ++++++--- .../com/fr/design/locale/designer.properties | 9 + .../design/locale/designer_en_US.properties | 9 + .../design/locale/designer_ja_JP.properties | 9 + .../design/locale/designer_ko_KR.properties | 9 + .../design/locale/designer_zh_CN.properties | 9 + .../design/locale/designer_zh_TW.properties | 9 + .../src/com/fr/design/widget/DataModify.java | 21 ++ .../src/com/fr/design/widget/Operator.java | 11 + .../btn/ButtonWithHotkeysDetailPane.java | 91 +++-- .../creator/XBorderStyleWidgetCreator.java | 4 + .../fr/design/designer/creator/XCreator.java | 16 + .../designer/creator/XWScaleLayout.java | 6 +- .../design/mainframe/WidgetPropertyPane.java | 79 +++-- .../widget/ui/FormBasicPropertyPane.java | 56 ++++ .../ui/FormBasicWidgetPropertyPane.java | 46 +++ .../widget/ui/FormWidgetCardPane.java | 212 ++++++++++++ .../parameter/RootDesignDefinePane.java | 111 +++++++ .../FormWidgetDefinePaneFactoryBase.java | 104 ++++++ .../ui/designer/AbstractDataModify.java | 34 ++ .../widget/ui/designer/ButtonDefinePane.java | 60 ++++ .../ui/designer/ButtonGroupDictPane.java | 51 +++ .../ui/designer/CheckBoxDefinePane.java | 62 ++++ .../widget/ui/designer/CheckBoxDictPane.java | 93 ++++++ .../ui/designer/CheckBoxGroupDefinePane.java | 78 +++++ .../ui/designer/ComboBoxDefinePane.java | 43 +++ .../ui/designer/ComboCheckBoxDefinePane.java | 89 +++++ .../CustomWritableRepeatEditorPane.java | 1 + .../ui/designer/DateEditorDefinePane.java | 245 ++++++++++++++ .../designer/DirectWriteEditorDefinePane.java | 94 ++++++ .../ui/designer/FieldEditorDefinePane.java | 139 ++++++++ .../ui/designer/IframeEditorDefinePane.java | 83 +++++ .../widget/ui/designer/LabelDefinePane.java | 70 ++++ .../ui/designer/ListEditorDefinePane.java | 60 ++++ .../ui/designer/MultiFileEditorPane.java | 91 +++++ .../ui/designer/NoneWidgetDefinePane.java | 25 ++ .../ui/designer/NumberEditorDefinePane.java | 313 ++++++++++++++++++ .../ui/designer/ParameterTreeComboBox.java | 179 ++++++++++ .../ui/designer/PasswordDefinePane.java | 23 ++ .../widget/ui/designer/RadioDefinePane.java | 44 +++ .../ui/designer/RadioGroupDefinePane.java | 48 +++ .../ui/designer/TextAreaDefinePane.java | 21 ++ .../designer/TextFieldEditorDefinePane.java | 128 +++++++ .../TreeComboBoxEditorDefinePane.java | 78 +++++ .../ui/designer/TreeEditorDefinePane.java | 104 ++++++ .../ui/designer/UserEditorDefinePane.java | 46 +++ .../widget/ui/designer/WaterMarkDictPane.java | 29 ++ .../ui/designer/WritableRepeatEditorPane.java | 26 ++ .../designer/WriteUnableRepeatEditorPane.java | 51 +++ .../designer/btn/ButtonDetailPaneFactory.java | 64 ++++ .../designer/btn/ButtonGroupDefinePane.java | 93 ++++++ .../designer/btn/ButtonSytleDefinedPane.java | 143 ++++++++ .../designer/btn/DefaultButtonDetailPane.java | 30 ++ .../designer/btn/DefaultButtonStylePane.java | 56 ++++ .../ui/designer/btn/FreeButtonDetailPane.java | 40 +++ .../component/FormWidgetValuePane.java | 56 ++++ .../designer/component/PaddingBoundPane.java | 67 ++++ .../component/WidgetAbsoluteBoundPane.java | 81 +++++ .../designer/component/WidgetBoundPane.java | 77 +++++ .../ui/designer/custom/WidgetValueField.java | 40 +++ .../designer/custom/WidgetValueFormula.java | 33 ++ .../ui/designer/custom/WidgetValuePane.java | 17 + .../ui/designer/custom/WidgetValueString.java | 33 ++ .../FRAbsoluteBodyLayoutDefinePane.java | 219 ++++++++++++ .../layout/FRAbsoluteLayoutDefinePane.java | 103 ++++++ .../layout/FRFitLayoutDefinePane.java | 161 +++++++++ .../layout/WCardMainLayoutDefinePane.java | 39 +++ .../layout/WTitleLayoutDefinePane.java | 54 +++ 68 files changed, 4682 insertions(+), 97 deletions(-) create mode 100644 designer_base/src/com/fr/design/widget/DataModify.java create mode 100644 designer_base/src/com/fr/design/widget/Operator.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java create mode 100644 designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/IframeEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ListEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/NoneWidgetDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/PasswordDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/RadioDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/TextAreaDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/UserEditorDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/WaterMarkDictPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/WritableRepeatEditorPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/WriteUnableRepeatEditorPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueField.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueFormula.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValuePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueString.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java diff --git a/designer_base/src/com/fr/design/gui/frpane/RegPane.java b/designer_base/src/com/fr/design/gui/frpane/RegPane.java index 22ac8863d2..2832da390d 100644 --- a/designer_base/src/com/fr/design/gui/frpane/RegPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/RegPane.java @@ -1,20 +1,6 @@ package com.fr.design.gui.frpane; -import java.awt.CardLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.EventListener; -import java.util.EventObject; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.ListCellRenderer; - +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; @@ -22,19 +8,24 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.form.ui.reg.CustomReg; -import com.fr.form.ui.reg.IDCardReg; -import com.fr.form.ui.reg.LengthReg; -import com.fr.form.ui.reg.MailReg; -import com.fr.form.ui.reg.MobileReg; -import com.fr.form.ui.reg.NoneReg; -import com.fr.form.ui.reg.PhoneReg; -import com.fr.form.ui.reg.PostCardReg; -import com.fr.form.ui.reg.RegExp; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.form.ui.reg.*; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.StringUtils; +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.EventListener; +import java.util.EventObject; + public class RegPane extends BasicPane { public static final RegExp[] ALL_REG_TYPE = { new NoneReg(), @@ -64,6 +55,7 @@ public class RegPane extends BasicPane { private RegPhonePane regPhonePane; private DefaultRegPane defaultRegPane; private CustomRegRexPane customRegRexPane; + protected RegErrorMsgPane regErrorMsgPane; public UIComboBox getRegComboBox(){ @@ -80,14 +72,20 @@ public class RegPane extends BasicPane { } private void initComponents(){ - this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); - this.add(contentPane); - contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule") + ":")); + this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + this.add(contentPane, BorderLayout.NORTH); + contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule"))); regComboBox = new UIComboBox(regType); + regComboBox.setPreferredSize(new Dimension(140, 20)); regComboBox.setRenderer(listCellRender); + UILabel uiLabel = new UILabel(); + uiLabel.setPreferredSize(new Dimension(20, 20)); + contentPane.add(uiLabel); contentPane.add(regComboBox); + regErrorMsgPane = new RegErrorMsgPane(); final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); detailedCardLayout = new CardLayout(); cardPane.setLayout(detailedCardLayout); @@ -95,27 +93,35 @@ public class RegPane extends BasicPane { cardPane.add((regLengthPane = new RegLengthPane()), "Length"); cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); - - this.add(cardPane); + this.add(cardPane, BorderLayout.CENTER); + this.add(regErrorMsgPane, BorderLayout.SOUTH); regComboBox.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp)regComboBox.getSelectedItem(); if(regExp instanceof PhoneReg) { + cardPane.setPreferredSize(new Dimension(220, 30)); Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); firePhoneRegAction(regString); detailedCardLayout.show(cardPane, "Phone"); - } - else { + } else { if (regExp instanceof LengthReg){ + cardPane.setPreferredSize(new Dimension(220, 60)); detailedCardLayout.show(cardPane, "Length"); } else if (regExp instanceof CustomReg){ + cardPane.setPreferredSize(new Dimension(220, 30)); detailedCardLayout.show(cardPane, "Custom"); } else { + cardPane.setPreferredSize(new Dimension(0,0 )); detailedCardLayout.show(cardPane, "Default"); } fireRegChangeAction(); } + if(regExp instanceof NoneReg){ + regErrorMsgPane.setVisible(false); + return; + } + regErrorMsgPane.setVisible(true); } }); } @@ -148,11 +154,12 @@ public class RegPane extends BasicPane { } else { defaultRegPane.populate(regex); } + regErrorMsgPane.populate(regex); } public RegExp update(){ RegExp regExp = (RegExp)regComboBox.getSelectedItem(); - + regErrorMsgPane.update(); if (regExp instanceof LengthReg){ return regLengthPane.update(); } else if(regExp instanceof PhoneReg) { @@ -334,6 +341,7 @@ public class RegPane extends BasicPane { private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")}; DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); public RegPhonePane() { + this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":")); dataTypeComboBox = new UIComboBox(DefaultComboBoxModel); @@ -394,13 +402,30 @@ public class RegPane extends BasicPane { private UISpinner maxLenSpinner; public RegLengthPane(){ - this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); - this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); + this.setPreferredSize(new Dimension(210, 56)); +// this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - this.add(minLenSpinner); - this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); +// this.add(minLenSpinner); +// this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - this.add(maxLenSpinner); +// this.add(maxLenSpinner); + + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"), minLenSpinner }, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"), maxLenSpinner}, + }; + double[] rowSize = {p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + this.add(panel); + + } @Override @@ -437,8 +462,9 @@ public class RegPane extends BasicPane { public CustomRegRexPane(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":")); - regTextField = new UITextField(20); + regTextField = new UITextField(10); this.add(regTextField); } @@ -465,6 +491,58 @@ public class RegPane extends BasicPane { } } + private static class RegErrorMsgPane extends DisplayPane{ + private UITextField regErrorMsgField; + + public RegErrorMsgPane(){ + this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + initRegErrorMsgField(); +// this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); + this.add(new UILabel("错误提示" + ":")); + regErrorMsgField = new UITextField(10); + this.add(regErrorMsgField); + } + + private void initRegErrorMsgField(){ + regErrorMsgField = new UITextField(13); + regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() { + public void changedUpdate(DocumentEvent e) { + regErrorMsgField.setToolTipText(regErrorMsgField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + regErrorMsgField.setToolTipText(regErrorMsgField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + regErrorMsgField.setToolTipText(regErrorMsgField.getText()); + } + }); + } + + @Override + protected String title4PopupWindow() { + return "CUSTOM"; + } + + @Override + public void populate(RegExp regRex) { + if (!(regRex instanceof CustomReg)){ + return; + } + regErrorMsgField.setText(regRex.toRegText()); + } + + @Override + public RegExp update() { + return new CustomReg(regErrorMsgField.getText()); + } + + public boolean isEmpty() { + return StringUtils.isEmpty(regErrorMsgField.getText()); + } + } + ListCellRenderer listCellRender = new UIComboBoxRenderer(){ @Override public Component getListCellRendererComponent(JList list, Object value, diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 83d7dbc8e8..fe8b05b8be 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2105,3 +2105,12 @@ FR-Designer_Insert_Text=Insert_Text FR-Designer_Double=Double FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Widget_Position=widget Position +FR-Designer_Widget_Field=field +FR-Designer_Widget_Formula=formula +FR-Designer_Widget_String=String +FR-Designer_Widget_Display_Report_Tool=display report tool \u663E\u793A\u62A5\u8868\u5757\u5DE5\u5177\u680F +FR-Designer_Widget_No_Repeat=no repeat \u53BB\u9664\u91CD\u590D\u9879 +FR-Designer_Widget_Error_Tip=no repeat \u9519\u8BEF\u63D0\u793A +FR-Designer_Widget_Return_Leaf=no repeat \u7ED3\u679C\u8FD4\u56DE\u53F6\u5B50\u8282\u70B9 +FR-Designer_Widget_Return_Path=no repeat \u7ED3\u679C\u8FD4\u56DE\u5B8C\u6574\u5C42\u6B21\u8DEF\u5F84 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 915b1eac93..aa243eb77e 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 @@ -2106,3 +2106,12 @@ FR-Designer_Scale_Slider=Scale_Slider FR-Designer_Scale_Grade=Scale_Grade FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Widget_Position=widget Position +FR-Designer_Widget_Field=field +FR-Designer_Widget_Formula=formula +FR-Designer_Widget_String=String +FR-Designer_Widget_Display_Report_Tool=display report tool +FR-Designer_Widget_No_Repeat=no repeat +FR-Designer_Widget_Error_Tip=error tip +FR-Designer_Widget_Return_Leaf=return leaf +FR-Designer_Widget_Return_Path=return path 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 0e6bbf7f31..a944f01477 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 @@ -2109,3 +2109,12 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Insert_Formula= FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093 +FR-Designer_Widget_Position= +FR-Designer_Widget_Field= +FR-Designer_Widget_Formula= +FR-Designer_Widget_String= +FR-Designer_Widget_Display_Report_Tool= +FR-Designer_Widget_No_Repeat= +FR-Designer_Widget_Error_Tip= +FR-Designer_Widget_Return_Leaf= +FR-Designer_Widget_Return_Path= 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 d27bb8fd44..66f9a44531 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 @@ -2109,3 +2109,12 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. +FR-Designer_Widget_Position= +FR-Designer_Widget_Field= +FR-Designer_Widget_Formula= +FR-Designer_Widget_String= +FR-Designer_Widget_Display_Report_Tool= +FR-Designer_Widget_No_Repeat= +FR-Designer_Widget_Error_Tip= +FR-Designer_Widget_Return_Leaf= +FR-Designer_Widget_Return_Path= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 8f128d45ab..22f71ca98b 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 @@ -2112,3 +2112,12 @@ FR-Designer_Scale_Up=\u653E\u5927 FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757 FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002 FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236 +FR-Designer_Widget_Position=\u63A7\u4EF6\u4F4D\u7F6E +FR-Designer_Widget_Field=\u5B57\u6BB5 +FR-Designer_Widget_Formula=\u516C\u5F0F +FR-Designer_Widget_String=\u5B57\u7B26\u4E32 +FR-Designer_Widget_Display_Report_Tool=\u663E\u793A\u62A5\u8868\u5757\u5DE5\u5177\u680F +FR-Designer_Widget_No_Repeat=\u53BB\u9664\u91CD\u590D\u9879 +FR-Designer_Widget_Error_Tip=\u9519\u8BEF\u63D0\u793A +FR-Designer_Widget_Return_Leaf=\u7ED3\u679C\u8FD4\u56DE\u53F6\u5B50\u8282\u70B9 +FR-Designer_Widget_Return_Path=\u7ED3\u679C\u8FD4\u56DE\u5B8C\u6574\u5C42\u6B21\u8DEF\u5F84 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 d525837958..ad47fe3ea3 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 @@ -2109,3 +2109,12 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236 +FR-Designer_Widget_Position= +FR-Designer_Widget_Field= +FR-Designer_Widget_Formula= +FR-Designer_Widget_String= +FR-Designer_Widget_Display_Report_Tool= +FR-Designer_Widget_No_Repeat= +FR-Designer_Widget_Error_Tip= +FR-Designer_Widget_Return_Leaf= +FR-Designer_Widget_Return_Path= diff --git a/designer_base/src/com/fr/design/widget/DataModify.java b/designer_base/src/com/fr/design/widget/DataModify.java new file mode 100644 index 0000000000..be56a2d915 --- /dev/null +++ b/designer_base/src/com/fr/design/widget/DataModify.java @@ -0,0 +1,21 @@ +package com.fr.design.widget; + +import com.fr.design.data.DataCreatorUI; +import com.fr.design.gui.frpane.TreeSettingPane; +import com.fr.design.present.dict.DictionaryPane; +import com.fr.form.ui.Widget; + +import javax.swing.*; + +public interface DataModify { + + void populateBean(T ob); + + T updateBean(); + + void checkValid() throws Exception; + + DataCreatorUI dataUI(); + + JComponent toSwingComponent(); +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/widget/Operator.java b/designer_base/src/com/fr/design/widget/Operator.java new file mode 100644 index 0000000000..f8aad788e8 --- /dev/null +++ b/designer_base/src/com/fr/design/widget/Operator.java @@ -0,0 +1,11 @@ +package com.fr.design.widget; + +import com.fr.design.data.DataCreatorUI; + +/** + * Created by richie on 15/11/16. + */ +public interface Operator { + + void did(DataCreatorUI ui, String cardName); +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java b/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java index 9efdb92622..18ae3a5c43 100644 --- a/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java +++ b/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java @@ -1,9 +1,7 @@ package com.fr.design.widget.btn; -import java.awt.*; - -import javax.swing.*; - +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -14,6 +12,11 @@ import com.fr.form.ui.Button; import com.fr.general.Inter; import com.fr.stable.StableUtils; +import javax.swing.*; +import java.awt.*; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + /** * Created by IntelliJ IDEA. * Author : Richer @@ -25,43 +28,66 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt private UITextField hotkeysTextField; private UITextField buttonNameTextField; private IconDefinePane iconPane; + private AttributeChangeListener listener; + public ButtonWithHotkeysDetailPane() { initComponents(); } - private void initComponents() { + private void initComponents() { +// creator. this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); - advancedPane.setPreferredSize(new Dimension(600, 341)); +// JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); +// advancedPane.setPreferredSize(new Dimension(600, 341)); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); - this.add(advancedPane); - double p = TableLayout.PREFERRED; - double rowSize[] = {p, p, p, p}; - double columnSize[] = {p, p}; - JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - iconPane = new IconDefinePane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double rowSize[] = {p, p, p, p, p, p, p}; + double columnSize[] = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 1}, {1, 1}}; + JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + iconPane = new IconDefinePane(); labelPane.add(iconPane); - Component[][] n_components = { - {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)}, - {new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane}, - {new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()}, - {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)} + Component[][] n_components = { + {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField()}, + {new UILabel("背景" + ":"), new UITextField()}, + {new UILabel("字体" + ":"), new UITextField()}, + {new UILabel("图标" + ":"), new UITextField()}, + {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField()} }; - hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8); - advancedPane.add(panel,BorderLayout.NORTH); - Component comp = createCenterPane(); - if(comp != null ) { - advancedPane.add(comp,BorderLayout.CENTER); - } - } + buttonNameTextField.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + + } + + @Override + public void focusLost(FocusEvent e) { +// creator.getWidget().set + + } + }); + hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8); + panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); + jPanel.add(panel, BorderLayout.CENTER); + UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, jPanel); + this.add(advancedPane); + } + + //add By kerry + public void addAttributeChangeListener(AttributeChangeListener listener) { + this.listener = listener; + } + protected abstract Component createCenterPane(); - @Override - public void populate(Button button) { + @Override + public void populate(Button button) { if (button == null) { return; } @@ -71,11 +97,18 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt } @Override - public T update() { + public T update() { T button = createButton(); button.setIconName(iconPane.update()); button.setText(buttonNameTextField.getText()); button.setHotkeys(hotkeysTextField.getText()); return button; } + + + public void updateBean(Button ob) { + ob.setIconName(iconPane.update()); + ob.setText(buttonNameTextField.getText()); + ob.setHotkeys(hotkeysTextField.getText()); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 5fb559fc4d..e2b01a6460 100644 --- a/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -144,5 +144,9 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); } + + public boolean supportSetVisibleOrEnable(){ + return false; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index 4788bc8f3c..1e7058f529 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -626,4 +626,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return; } + /** + * 是否支持设置可见和可用 + * return boolean + */ + public boolean supportSetVisibleOrEnable(){ + return true; + } + + /** + * 重新设置data + * + */ + public void resetData(Widget data){ + this.data = data; + } + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java index a2e5d07aed..a8ae49ddce 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java @@ -156,5 +156,9 @@ public class XWScaleLayout extends DedicateLayoutContainer { XCreator child = getXCreator(INDEX); child.setSize(getWidth(), minHeight); } - + + + public boolean supportSetVisibleOrEnable(){ + return true; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 8b959deec9..1eb778257e 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -6,12 +6,12 @@ import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.EventPropertyTable; -import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.fun.WidgetPropertyUIProvider; -import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.form.ui.Widget; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -28,11 +28,11 @@ import java.util.Set; * 控件属性表绘制 * Modified by fanglei */ -public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { +public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { private static final String PARA = "para"; private static final String BODY = "body"; - private WidgetPropertyTable propertyTable; // 控件的属性表 + private FormWidgetCardPane formWidgetCardPane; // 控件的属性表 private EventPropertyTable eventTable; // 控件的事件表 private List widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private FormDesigner designer; // 当前designer @@ -45,6 +45,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private JTableHeader header;//把表头单独get出来作为一个组件 + private UIHeadGroup tabsHeaderIconPane; + public static WidgetPropertyPane getInstance() { if (HOLDER.singleton == null) { @@ -67,6 +69,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper setLayout(FRGUIPaneFactory.createBorderLayout()); } + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer-Widget_Settings"); + } + + @Override public String getViewTitle() { return Inter.getLocText("Form-Widget_Property_Table"); @@ -103,7 +111,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper * 初始化属性表,事件表,移动端拓展的属性表 */ private void initTables() { - propertyTable.initPropertyGroups(null); + formWidgetCardPane.populate(); eventTable.refresh(); for (AbstractPropertyTable propertyTable : widgetPropertyTables) { propertyTable.initPropertyGroups(designer); @@ -114,10 +122,11 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper * 创建属性表table */ private void createPropertyTable() { - propertyTable = new WidgetPropertyTable(designer); - designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); - propertyTable.setBorder(null); - psp = new UIScrollPane(propertyTable); // 用来装载属性表table + formWidgetCardPane = new FormWidgetCardPane(designer); + + designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); + + psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table psp.setBorder(null); } @@ -170,9 +179,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper * 将属性表,事件表,移动端控件列表整合到TabPane里面去 */ private void createTabPane() { - UITabbedPane tabbedPane = new UITabbedPane(); // tab选项卡容器 - initTabPane(tabbedPane); - add(tabbedPane, BorderLayout.CENTER); + initTabPane(); } /** @@ -206,7 +213,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); widgetPropertyTables.add(propertyTable); - designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); + designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); + UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); wsp.add(uiScrollPane); } @@ -231,13 +239,27 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper return abstractPropertyTable; } - private void initTabPane(UITabbedPane tabbedPane) { - tabbedPane.setOpaque(true); - tabbedPane.setBorder(null); - tabbedPane.setTabPlacement(SwingConstants.BOTTOM); - tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp); - tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), eventTable); - tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); + private void initTabPane() { + final String[] tabTitles = new String[]{ + Inter.getLocText("FR-Designer_Properties"), + Inter.getLocText("FR-Designer_Event"), + Inter.getLocText("FR-Widget_Mobile_Terminal") + }; + final CardLayout tabbedPane = new CardLayout(); + final JPanel center = new JPanel(tabbedPane); + center.add(formWidgetCardPane, Inter.getLocText("FR-Designer_Properties")); + center.add(eventTable, Inter.getLocText("FR-Designer_Event")); + center.add(wsp, Inter.getLocText("FR-Widget_Mobile_Terminal")); + this.add(center, BorderLayout.CENTER); + + tabsHeaderIconPane = new UIHeadGroup(tabTitles) { + @Override + public void tabChanged(int index) { + tabbedPane.show(center, tabTitles[index]); + } + }; + tabsHeaderIconPane.setNeedLeftRightOutLine(false); + this.add(tabsHeaderIconPane, BorderLayout.NORTH); } @@ -266,7 +288,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper } private void clearDockingView() { - propertyTable = null; + formWidgetCardPane = null; eventTable = null; if (widgetPropertyTables != null) { widgetPropertyTables.clear(); @@ -280,26 +302,25 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper * 属性表监听界面事件(编辑,删除,选中,改变大小) */ private class WidgetPropertyDesignerAdapter implements DesignerEditListener { - AbstractPropertyTable propertyTable; + FormWidgetCardPane formWidgetCardPane; - WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { - this.propertyTable = propertyTable; + WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) { + this.formWidgetCardPane = formWidgetCardPane; } @Override public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED - || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - propertyTable.initPropertyGroups(designer); - } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { - repaint(); + || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED + || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { + formWidgetCardPane.populate(); } } @Override public boolean equals(Object o) { - return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable; + return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).formWidgetCardPane == this.formWidgetCardPane; } } diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java new file mode 100644 index 0000000000..22cbd0eb9f --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java @@ -0,0 +1,56 @@ +package com.fr.design.mainframe.widget.ui; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.form.ui.Widget; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by ibm on 2017/8/4. + */ +public class FormBasicPropertyPane extends BasicPane { + private UITextField widgetName; + + public FormBasicPropertyPane(){ + initContentPane(); + } + + protected void initContentPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + widgetName = new UITextField(); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Form-Widget_Name") + ":"), widgetName}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + this.add(panel, BorderLayout.NORTH); + } + + + @Override + public String title4PopupWindow() { + return "basicProperty"; + } + + public void populate(Widget widget) { + widgetName.setText(widget.getWidgetName()); + } + + public void update(Widget widget) { + widget.setWidgetName(widgetName.getText()); + } + +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java new file mode 100644 index 0000000000..d924514239 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -0,0 +1,46 @@ +package com.fr.design.mainframe.widget.ui; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.Widget; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by ibm on 2017/7/26. + */ +public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane { + private UICheckBox enableCheckBox; + private UICheckBox visibleCheckBox; + + public FormBasicWidgetPropertyPane (){ + initOtherPane(); + } + + protected void initOtherPane() { + JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); + enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true); + pane2.add(enableCheckBox); + visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); + pane2.add(visibleCheckBox); + this.add(pane2, BorderLayout.CENTER); + } + + @Override + public String title4PopupWindow() { + return "basicProperty"; + } + + public void populate(Widget widget) { + enableCheckBox.setSelected(widget.isEnabled()); + visibleCheckBox.setSelected(widget.isVisible()); + } + + public void update(Widget widget) { + widget.setEnabled(enableCheckBox.isSelected()); + widget.setEnabled(visibleCheckBox.isSelected()); + } + +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java new file mode 100644 index 0000000000..60632248fa --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -0,0 +1,212 @@ +package com.fr.design.mainframe.widget.ui; + +import com.fr.design.data.DataCreatorUI; +import com.fr.design.designer.creator.*; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.DataModify; +import com.fr.design.widget.Operator; +import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; +import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; +import com.fr.design.widget.ui.designer.component.WidgetBoundPane; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WScaleLayout; +import com.fr.form.ui.widget.CRBoundsWidget; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by ibm on 2017/7/25. + */ +public class FormWidgetCardPane extends AbstractAttrNoScrollPane { + private AttributeChangeListener listener2; + private FormDesigner designer; + //当前的编辑器属性定义面板 + private DataModify currentEditorDefinePane; + private FormBasicPropertyPane widgetPropertyPane; + private JPanel attriCardPane; + + private XCreator xCreator; + private WidgetBoundPane widgetBoundPane; + + + public FormWidgetCardPane(FormDesigner designer) { + super(); + this.xCreator = findXcreator(designer); + this.designer = designer; + initComponents(); + initDefinePane(); + widgetBoundPane = createWidgetBoundPane(xCreator); + if (widgetBoundPane != null) { + attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); + } + + } + + public XLayoutContainer getParent(XCreator source) { + XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); + if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { + container = null; + } + return container; + } + + public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { + XLayoutContainer xLayoutContainer = getParent(xCreator); + if (xLayoutContainer == null || xCreator instanceof XWParameterLayout || xCreator instanceof XWAbsoluteLayout) { + return null; + } else if (xLayoutContainer instanceof XWAbsoluteLayout) { + return new WidgetAbsoluteBoundPane(xCreator); + } + return new WidgetBoundPane(xCreator); + } + + protected JPanel createContentPane() { + return null; + } + + public XCreator findXcreator(FormDesigner designer) { + int size = designer.getSelectionModel().getSelection().size(); + if (size == 0 || size == 1) { + XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection() + .getSelectedCreator(); + return creator; + } else { + return null; + } + + } + + /** + * 后台初始化所有事件. + */ + public void initAllListeners() { + + } + + /** + * 后台初始化所有事件. + */ + public void reinitAllListeners() { + initListener(this); + } + + + protected void initContentPane() { + } + + private void initComponents() { + + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + if (xCreator.supportSetVisibleOrEnable()) { + widgetPropertyPane = new FormBasicWidgetPropertyPane(); + } else { + widgetPropertyPane = new FormBasicPropertyPane(); + } + + UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); + + this.add(uiExpandablePane, BorderLayout.NORTH); + + attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + this.add(attriCardPane, BorderLayout.CENTER); + + this.listener2 = new AttributeChangeListener() { + @Override + public void attributeChange() { + updateCreator(); + } + }; + + } + + private void initDefinePane() { + currentEditorDefinePane = null; + XCreator creator = xCreator; + if (xCreator instanceof XWScaleLayout) { + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + creator = (XCreator) xCreator.getComponent(0); + } + } + } + FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() { + @Override + public void did(DataCreatorUI ui, String cardName) { + + } + }); + DataModify definePane = rn.getDefinePane(); + + JComponent jComponent = definePane.toSwingComponent(); + + attriCardPane.add(jComponent, BorderLayout.NORTH); + currentEditorDefinePane = definePane; + } + + + @Override + public String title4PopupWindow() { + return "Widget"; + } + + public void populate() { + //populate之前先移除所有的监听 + removeAttributeChangeListener(); + Widget cellWidget = xCreator.toData(); + if (widgetBoundPane != null) { + widgetBoundPane.populate(); + } + if (cellWidget instanceof WScaleLayout) { + Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget(); + currentEditorDefinePane.populateBean(((CRBoundsWidget) crBoundsWidget).getWidget()); + } else { + currentEditorDefinePane.populateBean(cellWidget); + } + widgetPropertyPane.populate(cellWidget); + reinitAllListeners(); + this.addAttributeChangeListener(listener2); + } + + + public void updateCreator() { + Widget widget = currentEditorDefinePane.updateBean(); + widgetPropertyPane.update(widget); + if (widgetBoundPane != null) { + widgetBoundPane.update(); + } + fireValueChanged(); + + if (xCreator instanceof XWScaleLayout) { + XCreator xCreator1 = xCreator.getEditingChildCreator(); + xCreator1.resetData(widget); + } else { + xCreator.resetData(widget); + } + } + + + @Override + /** + *检查 + */ + public void checkValid() throws Exception { + currentEditorDefinePane.checkValid(); + } + + public void fireValueChanged() { + designer.repaint(); + } + + public String getIconPath() { + return ""; + } + + +} diff --git a/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java b/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java new file mode 100644 index 0000000000..c5d1f5eaa3 --- /dev/null +++ b/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java @@ -0,0 +1,111 @@ +package com.fr.design.parameter; + +import com.fr.design.data.DataCreatorUI; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.designer.properties.items.ItemProvider; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.widget.ui.designer.AbstractDataModify; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.form.ui.container.WParameterLayout; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by ibm on 2017/8/2. + */ +public class RootDesignDefinePane extends AbstractDataModify { + private XWParameterLayout root; + private UISpinner designerWidth; + private UICheckBox displayReport; + + public RootDesignDefinePane(XCreator xCreator) { + super(xCreator); + this.root = (XWParameterLayout) xCreator; + initComponent(); + } + + + public void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + designerWidth = new UISpinner(1, 1000, 1); + JPanel advancePane = createAdvancePane(); + UIExpandablePane advanceExpandablePane = new UIExpandablePane("高级", 280, 20, advancePane); + this.add(advanceExpandablePane, BorderLayout.NORTH); + JPanel layoutPane = createBoundsPane(); +// layoutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); +// layoutPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel("设计宽度"), designerWidth}, FlowLayout.LEFT, 4)); + UIExpandablePane layoutExpandablePane = new UIExpandablePane("尺寸", 280, 20, layoutPane); + this.add(layoutExpandablePane, BorderLayout.CENTER); + } + + public JPanel createBoundsPane(){ + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel("设计宽度"), designerWidth}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5)); + return panel; + } + + public JPanel createAdvancePane(){ + displayReport = new UICheckBox("点击查询前不显示报表内容"); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p,p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel("背景"), new UITextField()}, + new Component[]{displayReport, null }, + new Component[]{new UILabel("显示位置"), new UITextField()} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5)); + return panel; + } + + @Override + public String title4PopupWindow() { + return "wfitlayout"; + } + + @Override + public void populateBean(WParameterLayout ob) { + + } + + + @Override + public WParameterLayout updateBean() { + WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); + wParameterLayout.setDesignWidth((int) designerWidth.getValue()); + wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); + return wParameterLayout; + } + + @Override + public DataCreatorUI dataUI() { + return null; + } + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java new file mode 100644 index 0000000000..79281d303e --- /dev/null +++ b/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -0,0 +1,104 @@ +package com.fr.design.widget; + +import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.core.WidgetConstants; +import com.fr.design.parameter.RootDesignDefinePane; +import com.fr.design.widget.ui.designer.*; +import com.fr.design.widget.ui.designer.layout.*; +import com.fr.form.ui.*; +import com.fr.form.ui.container.*; +import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; +import com.fr.general.Inter; +import com.fr.stable.bridge.BridgeMark; +import com.fr.stable.bridge.StableFactory; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-14 + * Time : 上午11:17 + */ +public class FormWidgetDefinePaneFactoryBase { + private static Map, Appearance> defineMap = new HashMap, Appearance>(); + + static { + defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + "")); + defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); + defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); + defineMap.put(Radio.class, new Appearance(RadioDefinePane.class, WidgetConstants.RADIO + "")); + defineMap.put(CheckBox.class, new Appearance(CheckBoxDefinePane.class, WidgetConstants.CHECKBOX + "")); + defineMap.put(TreeComboBoxEditor.class, new Appearance(TreeComboBoxEditorDefinePane.class, WidgetConstants.TREECOMBOBOX + "")); + defineMap.put(TreeEditor.class, new Appearance(TreeEditorDefinePane.class, WidgetConstants.TREE + "")); + defineMap.put(MultiFileEditor.class, new Appearance(MultiFileEditorPane.class, WidgetConstants.MULTI_FILE + "")); + defineMap.put(TextArea.class, new Appearance(TextAreaDefinePane.class, WidgetConstants.TEXTAREA + "")); + defineMap.put(Password.class, new Appearance(PasswordDefinePane.class, WidgetConstants.PASSWORD + "")); + defineMap.put(IframeEditor.class, new Appearance(IframeEditorDefinePane.class, WidgetConstants.IFRAME + "")); + defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); + defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); + defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); + defineMap.put(ListEditor.class, new Appearance(ListEditorDefinePane.class, WidgetConstants.LIST + "")); + defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); + defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); + defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); + + defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + "")); + defineMap.put(Button.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); + defineMap.put(FreeButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); + defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); + defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, Inter.getLocText("WLayout-Card-ToolTips"))); + if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) { + defineMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class), new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); + } + + defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, Inter.getLocText("FR-Designer_AbsoluteLayout"))); + defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); + defineMap.put(WParameterLayout.class, new Appearance(RootDesignDefinePane.class, Inter.getLocText("FR-Designer_Para-Body"))); + defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "tab")); + defineMap.put(WTitleLayout.class, new Appearance(WTitleLayoutDefinePane.class, "tab")); + defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label")); + defineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap()); + } + + private FormWidgetDefinePaneFactoryBase() { + + } + + public static RN createWidgetDefinePane(XCreator creator, Widget widget, Operator operator) { + Appearance dn = defineMap.get(widget.getClass()); + DataModify definePane = null; + try { + Constructor con = dn.getDefineClass().getConstructor(XCreator.class); + definePane = (DataModify)con.newInstance(creator); + operator.did(definePane.dataUI(), dn.getDisplayName()); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return new RN(definePane, dn.getDisplayName()); + } + + public static class RN { + private DataModify definePane; + private String cardName; + + public RN(DataModify definePane, String cardName) { + this.definePane = definePane; + this.cardName = cardName; + } + + public DataModify getDefinePane() { + return definePane; + } + + public String getCardName() { + return cardName; + } + } + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java new file mode 100644 index 0000000000..c4f97fee29 --- /dev/null +++ b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java @@ -0,0 +1,34 @@ +package com.fr.design.widget.ui.designer; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.data.DataCreatorUI; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.widget.DataModify; + +import javax.swing.*; + +/** + * Created by kerry on 17/07/28. + */ +public abstract class AbstractDataModify extends BasicBeanPane implements DataModify { + protected XCreator creator; + + public AbstractDataModify(){ + + } + public AbstractDataModify(XCreator xCreator){ + this.creator = xCreator; + } + + @Override + public DataCreatorUI dataUI() { + return null; + } + + @Override + public JComponent toSwingComponent() { + return this; + } + + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java new file mode 100644 index 0000000000..84df22ac98 --- /dev/null +++ b/designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java @@ -0,0 +1,60 @@ +package com.fr.design.widget.ui.designer; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.btn.ButtonDetailPane; +import com.fr.design.widget.ui.designer.btn.ButtonDetailPaneFactory; +import com.fr.form.ui.Button; +import com.fr.form.ui.FreeButton; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +public class ButtonDefinePane extends AbstractDataModify