diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java index 444569fbcd..a9876b7a3d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java @@ -1,24 +1,22 @@ package com.fr.design.widget.ui.designer.mobile; import com.fr.base.mobile.MobileScanCodeAttr; -import com.fr.base.mobile.TextInputMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.gui.ibutton.ModeButtonGroup; -import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; import com.fr.form.ui.TextEditor; +import java.awt.BorderLayout; -import javax.swing.*; -import java.awt.*; public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { private XCreator xCreator; - private ModeButtonGroup buttonGroup; + private MobileTextFieldInputSettingPane settingPane; public ScanCodeMobileDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -27,39 +25,11 @@ public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { @Override public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel mobileSettingsPane = getMobileSettingsPane(); - this.add(mobileSettingsPane, BorderLayout.NORTH); + settingPane = new MobileTextFieldInputSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); this.repaint(); } - private UIExpandablePane getMobileSettingsPane() { - JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); - buttonGroup = new ModeButtonGroup<>(); - UIRadioButton scanCodeAndManualInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design__Mobile_Support_Scan_Code_And_Manual_Input"), true); - UIRadioButton onlyManualInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Manual_Input"), false); - UIRadioButton onlyScanCodeInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Scan_Code_Input"), false); - scanCodeAndManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - onlyManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - onlyScanCodeInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - buttonGroup.put(TextInputMode.SUPPORT_SCAN_CODE_And_MANUAL, scanCodeAndManualInput); - buttonGroup.put(TextInputMode.ONLY_SUPPORT_MANUAL, onlyManualInput); - buttonGroup.put(TextInputMode.ONLY_SUPPORT_SCAN_CODE, onlyScanCodeInput); - buttonGroup.add(scanCodeAndManualInput); - buttonGroup.add(onlyManualInput); - buttonGroup.add(onlyScanCodeInput); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - panel.add(scanCodeAndManualInput); - panel.add(onlyManualInput); - panel.add(onlyScanCodeInput); - final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panelWrapper.add(panel, BorderLayout.NORTH); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, - panelWrapper); - } - private void bindListeners2Widgets() { reInitAllListeners(); AttributeChangeListener changeListener = new AttributeChangeListener() { @@ -78,14 +48,14 @@ public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - buttonGroup.setSelectButton(mobileScanCodeAttr.getTextInputMode()); + settingPane.populateBean(mobileScanCodeAttr); this.bindListeners2Widgets(); } @Override public void update() { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - mobileScanCodeAttr.setTextInputMode(buttonGroup.getCurrentSelected()); + settingPane.updateBean(mobileScanCodeAttr); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java new file mode 100644 index 0000000000..75d924e53a --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -0,0 +1,61 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.base.mobile.MobileScanCodeAttr; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2021/12/15 + */ +public class MobileTextFieldInputSettingPane extends BasicBeanPane { + + private final UICheckBox manualInputCheckBox; + private final UICheckBox scanCodeCheckBox; + private final UICheckBox nfcInputCheckBox; + + public MobileTextFieldInputSettingPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel settingPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); + manualInputCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Manual_Input"), true); + scanCodeCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Scan_Code_Input"), true); + nfcInputCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_NFC_Input"), false); + settingPane.add(manualInputCheckBox); + settingPane.add(scanCodeCheckBox); + settingPane.add(nfcInputCheckBox); + this.add(settingPane, BorderLayout.NORTH); + } + + @Override + public void populateBean(MobileScanCodeAttr ob) { + manualInputCheckBox.setSelected(ob.isSupportManual()); + scanCodeCheckBox.setSelected(ob.isSupportScan()); + nfcInputCheckBox.setSelected(ob.isSupportNFC()); + } + + @Override + public MobileScanCodeAttr updateBean() { + // do nothing + return null; + } + + @Override + public void updateBean(MobileScanCodeAttr ob) { + ob.setSupportManual(manualInputCheckBox.isSelected()); + ob.setSupportScan(scanCodeCheckBox.isSelected()); + ob.setSupportNFC(nfcInputCheckBox.isSelected()); + } + + + @Override + protected String title4PopupWindow() { + return null; + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index 74807add94..6f9b379067 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -1,63 +1,37 @@ package com.fr.design.widget.ui.mobile; import com.fr.base.mobile.MobileScanCodeAttr; -import com.fr.base.mobile.TextInputMode; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.ibutton.ModeButtonGroup; -import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; +import java.awt.BorderLayout; -import javax.swing.*; -import java.awt.*; public class ScanCodeMobilePane extends WidgetMobilePane { - private ModeButtonGroup buttonGroup; + private MobileTextFieldInputSettingPane settingPane; @Override protected void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.add(getMobileSettingPane(), BorderLayout.NORTH); - } - - private UIExpandablePane getMobileSettingPane() { - JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); - buttonGroup = new ModeButtonGroup<>(); - UIRadioButton scanCodeAndManualInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design__Mobile_Support_Scan_Code_And_Manual_Input"), true); - UIRadioButton onlyManualInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Manual_Input"), false); - UIRadioButton onlyScanCodeInput = new UIRadioButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Scan_Code_Input"), false); - scanCodeAndManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - onlyManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - onlyScanCodeInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - buttonGroup.put(TextInputMode.SUPPORT_SCAN_CODE_And_MANUAL, scanCodeAndManualInput); - buttonGroup.put(TextInputMode.ONLY_SUPPORT_MANUAL, onlyManualInput); - buttonGroup.put(TextInputMode.ONLY_SUPPORT_SCAN_CODE, onlyScanCodeInput); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - panel.add(scanCodeAndManualInput); - panel.add(onlyManualInput); - panel.add(onlyScanCodeInput); - final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panelWrapper.add(panel, BorderLayout.NORTH); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, - panelWrapper); + settingPane = new MobileTextFieldInputSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); } @Override public void populate(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - buttonGroup.setSelectButton(mobileScanCodeAttr.getTextInputMode()); + settingPane.populateBean(mobileScanCodeAttr); } @Override public void update(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - mobileScanCodeAttr.setTextInputMode(buttonGroup.getCurrentSelected()); + settingPane.updateBean(mobileScanCodeAttr); }