Browse Source

REPORT-12622 文本控件支持扫码 ui部分

research/10.0
Hades 6 years ago
parent
commit
595910ef7a
  1. 3
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java
  2. 64
      designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java

3
designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

@ -4,7 +4,9 @@ import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import java.util.HashMap;
@ -18,6 +20,7 @@ public class WidgetMobilePaneFactory {
static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class);
mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}

64
designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java

@ -0,0 +1,64 @@
package com.fr.design.widget.ui.mobile;
import com.fr.base.mobile.MobileScanCodeAttr;
import com.fr.base.mobile.ScanCodeState;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class ScanCodeMobilePane extends WidgetMobilePane {
private UICheckBox appScanCodeCheck;
protected void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getMobileSettingPane(), BorderLayout.NORTH);
}
private UIExpandablePane getMobileSettingPane() {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true);
appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
panel.add(appScanCodeCheck);
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);
}
@Override
public void populate(Widget widget) {
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr();
ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState();
appScanCodeCheck.setSelected(scanCodeState2boolean(scanCodeState));
}
@Override
public void update(Widget widget) {
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr();
mobileScanCodeAttr.setScanCodeState(boolean2ScanCodeState(appScanCodeCheck.isSelected()));
}
private ScanCodeState boolean2ScanCodeState(boolean scanCodeCheck) {
if (scanCodeCheck) {
return ScanCodeState.SUPPORT_SCAN_CODE;
} else {
return ScanCodeState.NOT_SUPPORT_SCAN_CODE;
}
}
private boolean scanCodeState2boolean(ScanCodeState scanCodeState) {
if (scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE) {
return true;
} else {
return false;
}
}
}
Loading…
Cancel
Save