diff --git a/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java index 81025e263..e0e7eb6f3 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