Browse Source

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

【问题原因】rt
【改动思路】详见开发文档-设计器部分,https://kms.fineres.com/pages/viewpage.action?pageId=722437221
【review建议】无
feature/x
Yvan 2 years ago
parent
commit
be63185211
  1. 90
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java

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

@ -3,13 +3,16 @@ 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.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
@ -25,25 +28,38 @@ 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());
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());
});
initComponents();
// 初始状态,内容类型面板不可见
nfcContentTypePane.setVisible(false);
}
private void initComponents() {
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Input_Way")), manualInputCheckBox},
new Component[]{null, scanCodeCheckBox},
new Component[]{null, nfcInputCheckBox}
new Component[]{null, nfcInputCheckBox},
new Component[]{null, nfcContentTypePane},
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p, p};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_LARGE, LayoutConstants.VGAP_LARGE);
this.add(settingPane, BorderLayout.NORTH);
}
@ -53,6 +69,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
@ -66,6 +83,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);
}
@ -74,4 +103,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