From 3a08631e192068721c48f03ef25b9ae1728a77f9 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 9 Aug 2017 10:47:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/CustomWritableRepeatEditorPane.java | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java index 81025e2631..e0e7eb6f34 100644 --- a/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java @@ -1 +1,64 @@ -package com.fr.design.widget.ui; import com.fr.base.GraphHelper; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.CustomWriteAbleRepeatEditor; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : Shockway * Date: 13-9-18 * Time: 下午2:17 */ public abstract class CustomWritableRepeatEditorPane extends WritableRepeatEditorPane { private UICheckBox customDataCheckBox; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; public CustomWritableRepeatEditorPane() { this.initComponents(); } @Override protected JPanel setThirdContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); this.customDataCheckBox.setPreferredSize( new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = this.setForthContentPane(); return otherContentPane; } public JPanel setValidatePane(){ JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); } \ No newline at end of file +package com.fr.design.widget.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.CustomWriteAbleRepeatEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Author : Shockway + * Date: 13-9-18 + * Time: 下午2:17 + */ +public abstract class CustomWritableRepeatEditorPane extends WritableRepeatEditorPane { + + private UICheckBox customDataCheckBox; + private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; + private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; + + public CustomWritableRepeatEditorPane() { + this.initComponents(); + } + + @Override + protected JPanel setThirdContentPane() { + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); + this.customDataCheckBox.setPreferredSize( + new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); + JPanel otherContentPane = this.setForthContentPane(); + return otherContentPane; + } + + + public JPanel setValidatePane(){ + JPanel otherContentPane = super.setValidatePane(); + otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); + return otherContentPane; + } + + + protected abstract JPanel setForthContentPane(); + + protected void populateSubWritableRepeatEditorBean(T e) { + this.customDataCheckBox.setSelected(e.isCustomData()); + populateSubCustomWritableRepeatEditorBean(e); + } + + protected abstract void populateSubCustomWritableRepeatEditorBean(T e); + + protected T updateSubWritableRepeatEditorBean() { + T e = updateSubCustomWritableRepeatEditorBean(); + e.setCustomData(this.customDataCheckBox.isSelected()); + return e; + } + + protected abstract T updateSubCustomWritableRepeatEditorBean(); + +} \ No newline at end of file