From 4face0de220920ab655239c64fc9b252e1960473 Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Thu, 17 Aug 2017 16:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AE=BE=E8=AE=A1=E5=99=A8-?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7-=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E6=96=B9=E5=BC=8F=20=E5=88=A0=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E8=A7=84=E5=88=99=E4=B8=AD=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mobile/MobileRadioGroupPane.java | 8 +- .../report/mobile/MobileUseHtmlGroupPane.java | 32 ----- .../report/mobile/ReportMobileAttrPane.java | 6 - .../mobile/MobileUseHtmlGroupBeanPane.java | 112 ------------------ .../form/mobile/FormMobileAttrPane.java | 14 +-- .../form/mobile/MobileUseHtmlGroupPane.java | 33 ------ 6 files changed, 4 insertions(+), 201 deletions(-) delete mode 100644 designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java delete mode 100644 designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java delete mode 100644 designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java index 68446abc9..072b34b6c 100644 --- a/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java +++ b/designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java @@ -29,21 +29,19 @@ public class MobileRadioGroupPane extends BasicBeanPane{ private void initComponents(String title) { double p = TableLayout.PREFERRED; double[] rowSize = {p}; - double[] columnSize = {p, p, p, p, p, p}; + double[] columnSize = {p, p, p, p, p}; - IndexRadioButton defaultRadio = new IndexRadioButton(MobileFitAttrState.DEFAULT.description(), MobileFitAttrState.DEFAULT); - defaultRadio.setSelected(true); IndexRadioButton horizonRadio = new IndexRadioButton(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL); + horizonRadio.setSelected(true); IndexRadioButton verticalRadio = new IndexRadioButton(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL); IndexRadioButton bidirectionalRadio = new IndexRadioButton(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL); IndexRadioButton notFitRadio = new IndexRadioButton(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE); - addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio); + addToButtonGroup(horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio); Component[][] components = new Component[][]{ new Component[] { new UILabel(title), - defaultRadio, horizonRadio, verticalRadio, bidirectionalRadio, diff --git a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java deleted file mode 100644 index ee3c51fec..000000000 --- a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fr.design.report.mobile; - -import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane; -import com.fr.report.mobile.ElementCaseMobileAttr; - -/** - * Created by kunsnat on 2016/8/3. - */ -public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane { - public MobileUseHtmlGroupPane(String annotation) { - super(annotation); - } - - @Override - public void populateBean(ElementCaseMobileAttr mobileAttr) { - if(mobileAttr != null) { - selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0); - } - } - - @Override - public ElementCaseMobileAttr updateBean() { - return null; - } - - @Override - public void updateBean(ElementCaseMobileAttr mobileAttr) { - if(mobileAttr != null) { - mobileAttr.setUseHTML(getSelectRadioIndex() == 1); - } - } -} diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index e91d1d3b8..5c97dae8c 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -15,8 +15,6 @@ public class ReportMobileAttrPane extends BasicBeanPane{ private AppFitBrowserPane appFitBrowserPane; - private MobileUseHtmlGroupPane htmlGroupPane; - //工具栏容器 private MobileToolBarPane mobileToolBarPane; @@ -34,8 +32,6 @@ public class ReportMobileAttrPane extends BasicBeanPane{ appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); jPanel.add(appFitBrowserPane); - jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane(Inter.getLocText("FR-Designer_Mobile_Report_Analysis_Annotation"))); - jPanel.add(mobileToolBarPane = new MobileToolBarPane()); jPanel.add(appFitPreviewPane); @@ -50,7 +46,6 @@ public class ReportMobileAttrPane extends BasicBeanPane{ } appFitBrowserPane.populateBean(ob); mobileToolBarPane.populateBean(ob); - htmlGroupPane.populateBean(ob); } @@ -58,7 +53,6 @@ public class ReportMobileAttrPane extends BasicBeanPane{ public ElementCaseMobileAttr updateBean() { ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); mobileToolBarPane.updateBean(caseMobileAttr); - htmlGroupPane.updateBean(caseMobileAttr); return caseMobileAttr; } diff --git a/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java deleted file mode 100644 index 06666ee57..000000000 --- a/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fr.design.dialog.mobile; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.border.UITitledBorder; -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -/** - * 由于MobileUserHtmlGroupPane 现在在report和form中均会用到,会出现重复代码,故放入base中 - * Created by fanglei on 2016/12/28. - */ -public abstract class MobileUseHtmlGroupBeanPane extends BasicBeanPane { - - private List radioButtons = new ArrayList(); - - public MobileUseHtmlGroupBeanPane(String annotation) { - initComponents(annotation); - } - - private void initComponents(String annotation) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow())); - - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, p, p}; - - UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); - useApp.setSelected(true); - UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); - - addToButtonGroup(useApp, useHTML5); - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5}, - new Component[]{new UILabel(annotation), null, null} - }; - JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); - - this.add(usePane); - } - - private void addToButtonGroup(UIRadioButton... radios) { - ButtonGroup buttonGroup = new ButtonGroup(); - for (UIRadioButton radio : radios) { - radioButtons.add(radio); - buttonGroup.add(radio); - } - } - - /** - * 设置按钮状态 - */ - public void setEnabled(boolean enabled) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.setEnabled(enabled); - } - } - - /** - * 获取当前选中的按钮index - * - * @return 按钮index - */ - public int getSelectRadioIndex() { - for (int i = 0, len = radioButtons.size(); i < len; i++) { - if (radioButtons.get(i).isSelected()) { - return i; - } - } - - return 0; - } - - /** - * 选中指定index的按钮 - */ - public void selectIndexButton(int index) { - if (index < 0 || index > radioButtons.size() - 1) { - return; - } - - UIRadioButton button = radioButtons.get(index); - button.setSelected(true); - } - - /** - * 给所有的按钮加上监听 - */ - public void addActionListener(ActionListener actionListener) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.addActionListener(actionListener); - } - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-mobile_report_analysis"); - } -} - diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java index 6dc1f20ef..a4d657e11 100644 --- a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -16,9 +16,6 @@ public class FormMobileAttrPane extends BasicBeanPane{ //工具栏容器 private MobileToolBarPane mobileToolBarPane; - //h5解析容器 - private MobileUseHtmlGroupPane mobileUseHtmlGroupPane; - static final int PADDINGHEIGHT = 10; public FormMobileAttrPane() { @@ -29,21 +26,14 @@ public class FormMobileAttrPane extends BasicBeanPane{ //拉长两个Panel的高度去填满整个对话框。 private void initComponents() { JPanel jPanel1 = new JPanel(); - JPanel jPanel2 = new JPanel(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout()); jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jPanel2.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.mobileToolBarPane = new MobileToolBarPane(); - this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane(Inter.getLocText("FR-Designer_Mobile_Form_Analysis_Annotation")); //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); - jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); - jPanel1.add("North", this.mobileUseHtmlGroupPane); - jPanel2.add("North", this.mobileToolBarPane); + jPanel1.add("North", this.mobileToolBarPane); this.add("North", jPanel1); - this.add("Center", jPanel2); } @Override @@ -52,14 +42,12 @@ public class FormMobileAttrPane extends BasicBeanPane{ ob = new FormMobileAttr(); } this.mobileToolBarPane.populateBean(ob); - this.mobileUseHtmlGroupPane.populateBean(ob); } @Override public FormMobileAttr updateBean() { FormMobileAttr formMobileAttr = new FormMobileAttr(); this.mobileToolBarPane.updateBean(formMobileAttr); - this.mobileUseHtmlGroupPane.updateBean(formMobileAttr); return formMobileAttr; } diff --git a/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java b/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java deleted file mode 100644 index ab400d4a3..000000000 --- a/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fr.design.form.mobile; - -import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane; -import com.fr.form.main.mobile.FormMobileAttr; - -/** - * 直接copyreport中的MobileUseHtmlGroupPane - * Created by fanglei on 2016/12/28. - */ -public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane { - public MobileUseHtmlGroupPane(String annotation) { - super(annotation); - } - - @Override - public void populateBean(FormMobileAttr mobileAttr) { - if(mobileAttr != null) { - selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0); - } - } - - @Override - public FormMobileAttr updateBean() { - return null; - } - - @Override - public void updateBean(FormMobileAttr mobileAttr) { - if(mobileAttr != null) { - mobileAttr.setUseHTML(getSelectRadioIndex() == 1); - } - } -}