Browse Source

REPORT-89863 【国际化】移动端NFC支持读取uid信息---报表支撑

【问题原因】任务REPORT-90316 延期,回退代码影响了这部分
【改动思路】按照原来的规格把新面板加上去
feature/x
parent
commit
43ffd9ab48
  1. 84
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java

84
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java

@ -2,10 +2,13 @@ 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.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
@ -21,15 +24,28 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane<MobileScanCod
private final UICheckBox scanCodeCheckBox;
private final UICheckBox nfcInputCheckBox;
/**
* NFC内容类型面板
*/
private final NfcContentTypePane nfcContentTypePane = new NfcContentTypePane();
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);
nfcInputCheckBox.addChangeListener(e -> {
UICheckBox source = (UICheckBox) e.getSource();
// 更新面板是否可见
updateNfcContentTypePane(source.isSelected(), nfcContentTypePane.getSelectedType());
});
settingPane.add(manualInputCheckBox);
settingPane.add(scanCodeCheckBox);
settingPane.add(nfcInputCheckBox);
settingPane.add(nfcContentTypePane);
// 初始状态,内容类型面板不可见
nfcContentTypePane.setVisible(false);
this.add(settingPane, BorderLayout.NORTH);
}
@ -38,6 +54,7 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane<MobileScanCod
manualInputCheckBox.setSelected(ob.isSupportManual());
scanCodeCheckBox.setSelected(ob.isSupportScan());
nfcInputCheckBox.setSelected(ob.isSupportNFC());
updateNfcContentTypePane(ob.isSupportNFC(), ob.getNfcContentType());
}
@Override
@ -51,6 +68,18 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane<MobileScanCod
ob.setSupportManual(manualInputCheckBox.isSelected());
ob.setSupportScan(scanCodeCheckBox.isSelected());
ob.setSupportNFC(nfcInputCheckBox.isSelected());
ob.setNfcContentType(nfcContentTypePane.getSelectedType());
}
/**
* 更新NFC内容类型面板可见选项
*
* @param visible 是否可见
* @param contentType 内容类型
*/
private void updateNfcContentTypePane(boolean visible, MobileScanCodeAttr.NFCContentType contentType) {
nfcContentTypePane.setVisible(visible);
nfcContentTypePane.setSelectedType(contentType);
}
@ -59,4 +88,59 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane<MobileScanCod
return null;
}
/**
* NFC内容类型面板封装
*/
private class NfcContentTypePane extends JPanel {
/**
* 类型-卡片内容
*/
private UIRadioButton contentTypeButton;
/**
* 类型-UID
*/
private UIRadioButton uidTypeButton;
NfcContentTypePane() {
VerticalFlowLayout layout = new VerticalFlowLayout();
layout.setAlignLeft(true);
this.setLayout(layout);
contentTypeButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_NFC_Content_Type_Content"));
uidTypeButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_NFC_Content_Type_UID"));
contentTypeButton.setSelected(true);
uidTypeButton.setSelected(false);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(contentTypeButton);
buttonGroup.add(uidTypeButton);
this.add(contentTypeButton);
this.add(uidTypeButton);
}
/**
* 根据NFCContentType设置Button的选中状态
*
* @param contentType
*/
void setSelectedType(MobileScanCodeAttr.NFCContentType contentType) {
contentTypeButton.setSelected(contentType == MobileScanCodeAttr.NFCContentType.CONTENT);
uidTypeButton.setSelected(contentType == MobileScanCodeAttr.NFCContentType.UID);
}
/**
* 获取当前选中Button代表的NFCContentType
*
* @return
*/
MobileScanCodeAttr.NFCContentType getSelectedType() {
return uidTypeButton.isSelected() ?
MobileScanCodeAttr.NFCContentType.UID :
MobileScanCodeAttr.NFCContentType.CONTENT;
}
}
}

Loading…
Cancel
Save