From cf48cc3a1e4024057729ced6f6b403fd80612aec Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 7 Jun 2016 13:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=B1=9E=E6=80=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mobile/AppFitBrowserPane.java | 13 ++-- .../report/mobile/MobileRadioCheckPane.java | 71 +++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java diff --git a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java index 8a28187a11..5e75639cdb 100644 --- a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java +++ b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java @@ -19,6 +19,8 @@ public class AppFitBrowserPane extends BasicBeanPane { private MobileRadioGroupPane horizionPane; //竖屏设置面板 private MobileRadioGroupPane verticalPane; + //缩放选项面板 + private MobileRadioCheckPane radioCheckPane; //效果预览面板 private AppFitPreviewPane appFitPreviewPane; @@ -34,11 +36,13 @@ public class AppFitBrowserPane extends BasicBeanPane { JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); + radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-ZOOM")); ActionListener actionListener = getAppPreviewActionListener(); horizionPane.addActionListener(actionListener); verticalPane.addActionListener(actionListener); fitOpsPane.add(horizionPane, BorderLayout.NORTH); - fitOpsPane.add(verticalPane, BorderLayout.SOUTH); + fitOpsPane.add(verticalPane, BorderLayout.CENTER); + fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH); borderPane.add(fitOpsPane); this.add(borderPane); @@ -50,7 +54,7 @@ public class AppFitBrowserPane extends BasicBeanPane { //纵向和横向独立设置 public int[] getCurrentFitOptions() { - return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()}; + return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()}; } @Override @@ -60,6 +64,7 @@ public class AppFitBrowserPane extends BasicBeanPane { } horizionPane.populateBean(ob.getHorziontalAttr()); verticalPane.populateBean(ob.getVerticalAttr()); + radioCheckPane.populateBean(ob.getZoom()); appFitPreviewPane.refreshPreview(getCurrentFitOptions()); } @@ -68,8 +73,8 @@ public class AppFitBrowserPane extends BasicBeanPane { public ElementCaseMobileAttr updateBean() { MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean(); - - return new ElementCaseMobileAttr(horizonState, verticalState); + boolean isZoom = radioCheckPane.updateBean(); + return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); } @Override diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java b/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java new file mode 100644 index 0000000000..0a6b17155a --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java @@ -0,0 +1,71 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +public class MobileRadioCheckPane extends BasicBeanPane { + + private List checkBoxes = new ArrayList(); + + public MobileRadioCheckPane(String title) { + initComponents(title); + } + + private void initComponents(String title) { + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p,p}; + + UICheckBox checkBox = new UICheckBox(Inter.getLocText("FS-CPT_ZOOM")); + checkBox.setSelected(true); + + checkBoxes.add(checkBox); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(title), checkBox} + }; + JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + + this.add(fitOpsPane); + } + + public int getCurrentState() { + return checkBoxes.get(0).isSelected() ? 0 : 1; + } + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UICheckBox checkBox : checkBoxes) { + checkBox.setEnabled(enabled); + } + } + + @Override + protected String title4PopupWindow() { + return StringUtils.EMPTY; + } + + @Override + public void populateBean(Boolean ob) { + checkBoxes.get(0).setSelected(ob); + } + + @Override + public Boolean updateBean() { + int state = getCurrentState(); + return state == 0 ? true : false; + } +} \ No newline at end of file