diff --git a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java index 84d1facdf4..be9421312b 100644 --- a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -11,7 +11,10 @@ import com.fr.design.report.mobile.ReportMobileAttrPane; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.main.TemplateWorkBook; +import com.fr.plugin.ExtraClassManager; import com.fr.report.mobile.ElementCaseMobileAttr; +import com.fr.stable.ReportFunctionProcessor; +import com.fr.stable.fun.FunctionProcessor; import javax.swing.*; import java.awt.event.ActionEvent; @@ -50,8 +53,15 @@ public class ReportMobileAttrAction extends JWorkBookAction{ BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { - wbTpl.setReportMobileAttr(mobileAttrPane.updateBean()); + ElementCaseMobileAttr elementCaseMobileAttr = mobileAttrPane.updateBean(); + wbTpl.setReportMobileAttr(elementCaseMobileAttr); jwb.fireTargetModified(); + if (elementCaseMobileAttr.isMobileCanvasSize()) { + FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); + if (processor != null) { + processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_CPT); + } + } } }); dialog.setVisible(true); diff --git a/designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 103a695113..b1f3b2e1be 100644 --- a/designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -30,6 +30,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.form.FormElementCaseProvider; +import com.fr.form.main.Form; import com.fr.general.Inter; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; @@ -50,11 +51,11 @@ public class FormElementCaseDesigner{ - public FormElementCasePaneDelegate(FormElementCase sheet) { + public FormElementCasePaneDelegate(FormElementCase sheet, Form form) { super(sheet); + this.getGrid().setShowPaginateLine(form.getFormMobileAttr().isMobileOnly()); this.addSelectionChangeListener(new SelectionListener() { @Override public void selectionChanged(SelectionEvent e) { diff --git a/designer/src/com/fr/design/report/PageSetupPane.java b/designer/src/com/fr/design/report/PageSetupPane.java index 07076b1776..93460b7cc9 100644 --- a/designer/src/com/fr/design/report/PageSetupPane.java +++ b/designer/src/com/fr/design/report/PageSetupPane.java @@ -73,14 +73,6 @@ public class PageSetupPane extends BasicPane { private OtherPane otherPane; private UILabel zeroMarginWarn; - public final static PaperSize MOBILE_SMAIL_SIZE = new PaperSize(new MM(142.8f), new MM(254)); - public final static PaperSize MOBILE_LARGE_SIZE = new PaperSize(new MM(190.5f), new MM(338.7f)); - - public static final Object[][] MOBILE_NAME_SIZE_ARRAY = { - {Inter.getLocText("FR-Designer_PaperSize-Mobile-Large"),MOBILE_LARGE_SIZE}, - {Inter.getLocText("FR-Designer_PaperSize-Mobile-Small"),MOBILE_SMAIL_SIZE} - }; - public PageSetupPane() { this.initComponents(); } @@ -135,12 +127,10 @@ public class PageSetupPane extends BasicPane { private UIRadioButton landscapeRadioButton; private UIRadioButton predefinedRadioButton; - private UIRadioButton mobileRadioButton; private UIRadioButton customRadioButton; private UIComboBox predefinedComboBox; - private UIComboBox mobileComboBox; - + private UIBasicSpinner paperWidthSpinner; private UIBasicSpinner paperHeightSpinner; private UIComboBox switchInch; @@ -210,20 +200,14 @@ public class PageSetupPane extends BasicPane { predefinedRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Predefined") + ":"); predefinedRadioButton.setMnemonic('P'); predefinedRadioButton.addActionListener(previewListener); - - mobileRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_MobilePhone") + " :"); - mobileRadioButton.setMnemonic('M'); - mobileRadioButton.addActionListener(previewListener); - - + customRadioButton = new UIRadioButton(Inter.getLocText("Custom") + ":"); customRadioButton.setMnemonic('C'); customRadioButton.addActionListener(previewListener); predefinedComboBox = new UIComboBox(); - mobileComboBox = new UIComboBox(); - + paperWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); @@ -239,9 +223,7 @@ public class PageSetupPane extends BasicPane { predefinedComboBox.setRenderer(paperSizeCellRenderere); predefinedComboBox.addItemListener(paperSizeItemListener); - - mobileComboBox.setRenderer(paperSizeMobileCellRenderere); - mobileComboBox.addItemListener(paperSizeItemMobileListener); + ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener); ((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener); @@ -253,12 +235,6 @@ public class PageSetupPane extends BasicPane { Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; predefinedComboBox.addItem(tmpPaperSizeNameArray[1]); } - - for(int i=0; i{ - + private ReportMobileTemplateSettingsPane reportMobileTemplateSettingsPane; // 模版设置面板 private AppFitBrowserPane appFitBrowserPane; - //工具栏容器 private MobileToolBarPane mobileToolBarPane; @@ -28,6 +27,10 @@ public class ReportMobileAttrPane extends BasicBeanPane{ JPanel jPanel = new JPanel(); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + reportMobileTemplateSettingsPane = new ReportMobileTemplateSettingsPane(); + jPanel.add(reportMobileTemplateSettingsPane); + appFitBrowserPane = new AppFitBrowserPane(); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); jPanel.add(appFitBrowserPane); @@ -46,13 +49,14 @@ public class ReportMobileAttrPane extends BasicBeanPane{ } appFitBrowserPane.populateBean(ob); mobileToolBarPane.populateBean(ob); - + reportMobileTemplateSettingsPane.populateBean(ob); } @Override public ElementCaseMobileAttr updateBean() { ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); mobileToolBarPane.updateBean(caseMobileAttr); + reportMobileTemplateSettingsPane.updateBean(caseMobileAttr); return caseMobileAttr; } diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java new file mode 100644 index 0000000000..e449091a5b --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java @@ -0,0 +1,102 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.icheckbox.UICheckBox; +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 com.fr.report.mobile.ElementCaseMobileAttr; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by plough on 2018/1/8. + */ +public class ReportMobileTemplateSettingsPane extends BasicBeanPane { + + private UICheckBox mobileCanvasSizeCheck; // 设置为手机模版画布大小 + + public ReportMobileTemplateSettingsPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + + JPanel contentPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, 0, 0)); + + contentPane.add(getMobileCanvasSizeCheckPane(), BorderLayout.CENTER); + + borderPane.add(contentPane); + this.add(borderPane); + } + + private JPanel getMobileCanvasSizeCheckPane() { + JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + mobileCanvasSizeCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Canvas_Size")); + panel.add(mobileCanvasSizeCheck, BorderLayout.NORTH); + panel.add(getCanvasDescPane(), BorderLayout.CENTER); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); + return panel; + } + + private JPanel getCanvasDescPane() { + + UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Match_Desc")); + UILabel desc2 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_In_Desc")); + UILabel desc3 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_Out_Desc")); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{desc1, null}, + new Component[]{desc2, null}, + new Component[]{desc3, null} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L7, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0)); + return panel; + } + + private UILabel createDescLabel(String desc) { + UILabel label = new UILabel(desc); + label.setForeground(Color.gray); + return label; + } + + @Override + public void populateBean(ElementCaseMobileAttr ob) { + if (ob == null) { + ob = new ElementCaseMobileAttr(); + } + mobileCanvasSizeCheck.setSelected(ob.isMobileCanvasSize()); + } + + @Override + public ElementCaseMobileAttr updateBean() { + ElementCaseMobileAttr mobileAttr = new ElementCaseMobileAttr(); + mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected()); + return mobileAttr; + } + + @Override + public void updateBean(ElementCaseMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Template_Settings"); + } +} \ No newline at end of file diff --git a/designer/src/com/fr/grid/GridUI.java b/designer/src/com/fr/grid/GridUI.java index 2215fc2b79..b99297ee3b 100644 --- a/designer/src/com/fr/grid/GridUI.java +++ b/designer/src/com/fr/grid/GridUI.java @@ -583,11 +583,6 @@ public class GridUI extends ComponentUI { } private void paintPaginateLines(Graphics g, Grid grid) { - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if(!jTemplate.isJWorkBook()){ - //报表块无分页之说 - return; - } Graphics2D g2d = (Graphics2D) g; // james 画分页线 diff --git a/designer_base/src/com/fr/design/designer/IntervalConstants.java b/designer_base/src/com/fr/design/designer/IntervalConstants.java index 1f210c70f5..a2a2ee669e 100644 --- a/designer_base/src/com/fr/design/designer/IntervalConstants.java +++ b/designer_base/src/com/fr/design/designer/IntervalConstants.java @@ -27,4 +27,6 @@ public class IntervalConstants { public static final int INTERVAL_W3 = 49; + public static final int INTERVAL_W4 = 22; + } diff --git a/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java index ee38557612..af4bcea990 100644 --- a/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java +++ b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java @@ -1,6 +1,8 @@ package com.fr.design.dialog.mobile; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.ChangeListener; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; @@ -10,6 +12,7 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; +import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index b548c45068..f876d5012f 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2167,5 +2167,15 @@ FR-Designer_Tab_Template_Four=Template Four FR-Designer_Tab_Template_Five=Template Five FR-Designer_Tab_Template_Six=Template Six FR-Designer_Tab_Display_Position=Display Position +FR-Designer_Set_Mobile_Only_Template=Set as mobile only template +FR-Designer_Set_Mobile_Canvas_Size=Set as mobile canvas size +FR-Designer_Adaptive_Property_Auto_Match=Adaptive property auto match +FR-Designer_Open_Adaptive_Property_Auto_Match=Open adpative property auto match +FR-Designer_Canvas_Size_Lock_Desc=The size of the canvas is 375*560, the width is locked, the height is customizable +FR-Designer_Mobile_Screen_Match_Desc=4.7 inch screen phone: fit +FR-Designer_Mobile_Screen_Zoom_In_Desc=4.7 inch or more mobile phones: zooming in +FR-Designer_Mobile_Screen_Zoom_Out_Desc=4.7 inch mobile phone: zooming out +FR-Designer_Adaptive_Property_Auto_Match_Desc=In order to improve the end template effect of the mobile phone, when using the reserved layout function, the component scaling logic under the adaptive layout is set as "lateral adaptive" +FR-Designer_Template_Settings=Template Settings FR-Designer_Form_Widget_Rename_Failure=There are the same components, please set the other name FR-Designer_Joption_News=news diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index ca858e60e4..554d996452 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2166,5 +2166,15 @@ FR-Designer_Tab_Template_Four=Template Four FR-Designer_Tab_Template_Five=Template Five FR-Designer_Tab_Template_Six=Template Six FR-Designer_Tab_Display_Position=Display Position +FR-Designer_Set_Mobile_Only_Template=Set as mobile only template +FR-Designer_Set_Mobile_Canvas_Size=Set as mobile canvas size +FR-Designer_Adaptive_Property_Auto_Match=Adaptive property auto match +FR-Designer_Open_Adaptive_Property_Auto_Match=Open adpative property auto match +FR-Designer_Canvas_Size_Lock_Desc=The size of the canvas is 375*560, the width is locked, the height is customizable +FR-Designer_Mobile_Screen_Match_Desc=4.7 inch screen phone: fit +FR-Designer_Mobile_Screen_Zoom_In_Desc=4.7 inch or more mobile phones: zooming in +FR-Designer_Mobile_Screen_Zoom_Out_Desc=4.7 inch mobile phone: zooming out +FR-Designer_Adaptive_Property_Auto_Match_Desc=In order to improve the end template effect of the mobile phone, when using the reserved layout function, the component scaling logic under the adaptive layout is set as "lateral adaptive" +FR-Designer_Template_Settings=Template Settings FR-Designer_Form_Widget_Rename_Failure=There are the same components, please set the other name -FR-Designer_Joption_News=news \ No newline at end of file +FR-Designer_Joption_News=news diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index fbb1cf52f9..29cc7a636e 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -2167,5 +2167,12 @@ FR-Designer_Tab_Template_Four= FR-Designer_Tab_Template_Five= FR-Designer_Tab_Template_Six= FR-Designer_Tab_Display_Position= +FR-Designer_Set_Mobile_Only_Template= +FR-Designer_Set_Mobile_Canvas_Size= +FR-Designer_Open_Adaptive_Property_Auto_Match= +FR-Designer_Mobile_Screen_Zoom_In= +FR-Designer_Mobile_Screen_Zoom_Out= +FR-Designer_Adaptive_Property_Auto_Match_Desc= +FR-Designer_Template_Settings= FR-Designer_Form_Widget_Rename_Failure=\u5B58\u5728\u30EA\u30CD\u30FC\u30E0\u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u3001\u4ED6\u306E\u540D\u79F0\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002 FR-Designer_Joption_News=\u30CB\u30E5\u30FC\u30B9 diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 5446883ed2..0f15ec270b 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -2166,5 +2166,14 @@ FR-Designer_Tab_Template_Four= FR-Designer_Tab_Template_Five= FR-Designer_Tab_Template_Six= FR-Designer_Tab_Display_Position= +FR-Designer_Set_Mobile_Only_Template= +FR-Designer_Set_Mobile_Canvas_Size= +FR-Designer_Adaptive_Property_Auto_Match= +FR-Designer_Open_Adaptive_Property_Auto_Match= +FR-Designer_Mobile_Screen_Zoom_In= +FR-Designer_Mobile_Screen_Zoom_Out= +FR-Designer_Mobile_Screen_Zoom_Out_Desc= +FR-Designer_Adaptive_Property_Auto_Match_Desc= +FR-Designer_Template_Settings= FR-Designer_Form_Widget_Rename_Failure=\uC874\uC7AC \uB3D9\uBA85 \uAD6C\uC131 \uC694\uC18C \uC124\uC815 \uC880 \uB2E4\uB978 \uC774\uB984 FR-Designer_Joption_News=\uC18C\uC2DD diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 7fca1c2848..521b0bdf95 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2167,5 +2167,15 @@ FR-Designer_Tab_Template_Four=\u6A21\u677F\u56DB FR-Designer_Tab_Template_Five=\u6A21\u677F\u4E94 FR-Designer_Tab_Template_Six=\u6A21\u677F\u516D FR-Designer_Tab_Display_Position=\u663E\u793A\u4F4D\u7F6E +FR-Designer_Set_Mobile_Only_Template=\u8BBE\u7F6E\u4E3A\u624B\u673A\u7AEF\u4E13\u5C5E\u6A21\u7248 +FR-Designer_Set_Mobile_Canvas_Size=\u8BBE\u7F6E\u4E3A\u624B\u673A\u6A21\u7248\u753B\u5E03\u5927\u5C0F +FR-Designer_Adaptive_Property_Auto_Match=\u81EA\u9002\u5E94\u5C5E\u6027\u81EA\u52A8\u5339\u914D +FR-Designer_Open_Adaptive_Property_Auto_Match=\u5F00\u542F\u81EA\u9002\u5E94\u5C5E\u6027\u81EA\u52A8\u5339\u914D +FR-Designer_Canvas_Size_Lock_Desc=\u753B\u5E03\u5927\u5C0F375*560\uFF0C\u5BBD\u5EA6\u9501\u5B9A\uFF0C\u9AD8\u5EA6\u53EF\u81EA\u5B9A\u4E49 +FR-Designer_Mobile_Screen_Match_Desc=4.7\u5BF8\u5C4F\u5E55\u624B\u673A\uFF1A\u9002\u914D +FR-Designer_Mobile_Screen_Zoom_In_Desc=4.7\u5BF8\u4EE5\u4E0A\u624B\u673A\uFF1A\u653E\u5927 +FR-Designer_Mobile_Screen_Zoom_Out_Desc=4.7\u5BF8\u4EE5\u4E0B\u624B\u673A\uFF1A\u538B\u7F29 +FR-Designer_Adaptive_Property_Auto_Match_Desc=\u4E3A\u63D0\u5347\u624B\u673A\u7AEF\u6A21\u7248\u6548\u679C\uFF0C\u5728\u4F7F\u7528\u4FDD\u7559\u5E03\u5C40\u529F\u80FD\u65F6\uFF0C\u8BBE\u7F6E\u81EA\u9002\u5E94\u5E03\u5C40\u65B9\u5F0F\u4E0B\u7684\u7EC4\u4EF6\u7F29\u653E\u903B\u8F91\u4E3A"\u6A2A\u5411\u81EA\u9002\u5E94" +FR-Designer_Template_Settings=\u6A21\u7248\u8BBE\u7F6E FR-Designer_Form_Widget_Rename_Failure=\u5B58\u5728\u91CD\u540D\u7EC4\u4EF6\uFF0C\u8BF7\u8BBE\u7F6E\u5176\u4ED6\u540D\u79F0 -FR-Designer_Joption_News=\u6D88\u606F \ No newline at end of file +FR-Designer_Joption_News=\u6D88\u606F diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 76b01b545f..11c5505801 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2166,5 +2166,15 @@ FR-Designer_Tab_Template_Four=\u6A21\u677F\u56DB FR-Designer_Tab_Template_Five=\u6A21\u677F\u4E94 FR-Designer_Tab_Template_Six=\u6A21\u677F\u516D FR-Designer_Tab_Display_Position=\u986F\u793A\u4F4D\u7F6E +FR-Designer_Set_Mobile_Only_Template=\u8A2D\u5B9A\u70BA\u624B\u6A5F\u7AEF\u5C08\u5C6C\u6A21\u7248 +FR-Designer_Set_Mobile_Canvas_Size=\u8A2D\u5B9A\u70BA\u624B\u6A5F\u6A21\u7248\u756B\u5E03\u5927\u5C0F +FR-Designer_Adaptive_Property_Auto_Match=\u81EA\u6211\u8ABF\u6574\u5185\u5BB9\u81EA\u52D5\u5339\u914D +FR-Designer_Open_Adaptive_Property_Auto_Match=\u958B\u555F\u81EA\u6211\u8ABF\u6574\u5185\u5BB9\u81EA\u52D5\u5339\u914D +FR-Designer_Canvas_Size_Lock_Desc=\u756B\u5E03\u5927\u5C0F375*560\uFF0C\u5BEC\u5EA6\u9396\u5B9A\uFF0C\u9AD8\u5EA6\u53EF\u81EA\u5B9A\u7FA9 +FR-Designer_Mobile_Screen_Match_Desc=4.7\u5BF8\u8367\u5E55\u624B\u6A5F\uFF1A\u9069\u914D +FR-Designer_Mobile_Screen_Zoom_In_Desc=4.7\u5BF8\u4EE5\u4E0A\u624B\u6A5F\uFF1A\u653E\u5927 +FR-Designer_Mobile_Screen_Zoom_Out_Desc=4.7\u5BF8\u4EE5\u4E0B\u624B\u6A5F\uFF1A\u58D3\u7E2E +FR-Designer_Adaptive_Property_Auto_Match_Desc=\u70BA\u63D0\u5347\u624B\u6A5F\u7AEF\u6A21\u7248\u6548\u679C\uFF0C\u5728\u4F7F\u7528\u4FDD\u7559\u4F48\u5C40\u529F\u80FD\u6642\uFF0C\u8A2D\u5B9A\u81EA\u6211\u8ABF\u6574\u4F48\u5C40\u7BA1\u9053\u4E0B\u7684\u7D44\u4EF6\u7E2E\u653E\u908F\u8F2F\u70BA\u201C\u6A6B\u5411\u81EA\u6211\u8ABF\u6574\u201D +FR-Designer_Template_Settings=\u6A21\u7248\u8A2D\u5B9A FR-Designer_Form_Widget_Rename_Failure=\u5B58\u5728\u91CD\u540D\u7D44\u4EF6\uFF0C\u8ACB\u8A2D\u5B9A\u5176\u4ED6\u540D\u7A31 FR-Designer_Joption_News=\u6D88\u606F diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 42d7f6c134..faca73e836 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -905,7 +905,7 @@ public abstract class JTemplate> ex */ public void activeJTemplate(int index, JTemplate jt) { DesignerContext.getDesignerFrame().activateJTemplate(this); - }; + } /** * 激活已存在的模板 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 a4d657e117..a2650d8069 100644 --- a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -15,25 +15,29 @@ import java.awt.*; public class FormMobileAttrPane extends BasicBeanPane{ //工具栏容器 private MobileToolBarPane mobileToolBarPane; + // 模版设置面板 + private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane; - static final int PADDINGHEIGHT = 10; + private static final int PADDING = 10; public FormMobileAttrPane() { this.initComponents(); } - //现在只有两个panel,填不满自适应对话框,只能为工具栏Panel和h5解析方式panel分别包裹上一层Panel再计算高度,不然会自动 - //拉长两个Panel的高度去填满整个对话框。 private void initComponents() { - JPanel jPanel1 = new JPanel(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + JPanel mobileToolBarPaneWrapper = new JPanel(new BorderLayout()); + mobileToolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, 0, PADDING)); this.mobileToolBarPane = new MobileToolBarPane(); - //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 - jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); - jPanel1.add("North", this.mobileToolBarPane); - this.add("North", jPanel1); + mobileToolBarPaneWrapper.add(this.mobileToolBarPane, BorderLayout.NORTH); + + JPanel formMobileTemplateSettingsPaneWrapper = new JPanel(new BorderLayout()); + formMobileTemplateSettingsPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING)); + this.formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane(); + formMobileTemplateSettingsPaneWrapper.add(this.formMobileTemplateSettingsPane, BorderLayout.NORTH); + + this.add(formMobileTemplateSettingsPaneWrapper, BorderLayout.NORTH); + this.add(mobileToolBarPaneWrapper, BorderLayout.CENTER); } @Override @@ -42,12 +46,14 @@ public class FormMobileAttrPane extends BasicBeanPane{ ob = new FormMobileAttr(); } this.mobileToolBarPane.populateBean(ob); + this.formMobileTemplateSettingsPane.populateBean(ob); } @Override public FormMobileAttr updateBean() { FormMobileAttr formMobileAttr = new FormMobileAttr(); this.mobileToolBarPane.updateBean(formMobileAttr); + this.formMobileTemplateSettingsPane.updateBean(formMobileAttr); return formMobileAttr; } diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java new file mode 100644 index 0000000000..399f217f4b --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java @@ -0,0 +1,158 @@ +package com.fr.design.form.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.dialog.mobile.MobileRadioCheckPane; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icheckbox.UICheckBox; +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.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by plough on 2018/1/4. + */ +public class FormMobileTemplateSettingsPane extends BasicBeanPane { + + private UICheckBox mobileOnlyCheck; // 设置为手机端专属模版 + private UICheckBox mobileCanvasSizeCheck; // 设置为手机模版画布大小 + private UICheckBox adaptivePropertyAutoMatchCheck; // 自适应属性自动匹配 + + public FormMobileTemplateSettingsPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + + JPanel contentPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L2, 0)); + + JPanel mobileSettingsPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + mobileSettingsPane.setVisible(false); + mobileSettingsPane.add(getMobileCanvasSizeCheckPane(), BorderLayout.NORTH); + mobileSettingsPane.add(getAdaptivePropertyAutoMatchCheckPane(), BorderLayout.CENTER); + + + mobileOnlyCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Only_Template")); + mobileOnlyCheck.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + mobileSettingsPane.setVisible(mobileOnlyCheck.isSelected()); + } + }); + + contentPane.add(mobileOnlyCheck, BorderLayout.NORTH); + contentPane.add(mobileSettingsPane, BorderLayout.CENTER); + + borderPane.add(contentPane); + this.add(borderPane); + } + + private JPanel getMobileCanvasSizeCheckPane() { + JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + mobileCanvasSizeCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Canvas_Size")); + // 默认勾选,不可取消 + mobileCanvasSizeCheck.setSelected(true); + mobileCanvasSizeCheck.setEnabled(false); + panel.add(mobileCanvasSizeCheck, BorderLayout.NORTH); + panel.add(getCanvasDescPane(), BorderLayout.CENTER); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); + return panel; + } + + private JPanel getAdaptivePropertyAutoMatchCheckPane() { + JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + String selectedDesc = Inter.getLocText("FR-Designer_Adaptive_Property_Auto_Match"); + String unselectedDesc = Inter.getLocText("FR-Designer_Open_Adaptive_Property_Auto_Match"); + adaptivePropertyAutoMatchCheck = new UICheckBox(); + adaptivePropertyAutoMatchCheck.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + adaptivePropertyAutoMatchCheck.setText(adaptivePropertyAutoMatchCheck.isSelected() ? selectedDesc : unselectedDesc); + } + }); + adaptivePropertyAutoMatchCheck.setSelected(true); + panel.add(adaptivePropertyAutoMatchCheck, BorderLayout.NORTH); + panel.add(getAdaptivePropertyAutoMatchDescPane(), BorderLayout.CENTER); + return panel; + } + + private JPanel getCanvasDescPane() { + + UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Canvas_Size_Lock_Desc")); + UILabel desc2 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Match_Desc")); + UILabel desc3 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_In_Desc")); + UILabel desc4 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_Out_Desc")); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{desc1, null}, + new Component[]{desc2, null}, + new Component[]{desc3, null}, + new Component[]{desc4, null} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0)); + return panel; + } + + private JPanel getAdaptivePropertyAutoMatchDescPane() { + + UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Adaptive_Property_Auto_Match_Desc")); + + JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + panel.add(desc1, BorderLayout.CENTER); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0)); + return panel; + } + + private UILabel createDescLabel(String desc) { + UILabel label = new UILabel(desc); + label.setForeground(Color.gray); + return label; + } + + @Override + public void populateBean(FormMobileAttr ob) { + if (ob == null) { + ob = new FormMobileAttr(); + } +// this.mobileOnlyCheckPane.populateBean(ob.isRefresh()); + mobileOnlyCheck.setSelected(ob.isMobileOnly()); + adaptivePropertyAutoMatchCheck.setSelected(ob.isAdaptivePropertyAutoMatch()); + } + + @Override + public FormMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(FormMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setMobileOnly(mobileOnlyCheck.isSelected()); + mobileAttr.setAdaptivePropertyAutoMatch(adaptivePropertyAutoMatchCheck.isSelected()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Template_Settings"); + } + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index 5174f3bb97..1786337dfe 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -7,6 +7,8 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.event.TargetModifiedEvent; +import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; @@ -16,6 +18,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.scrollruler.*; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.ui.container.WBorderLayout; import com.fr.general.FRScreen; import com.fr.general.Inter; @@ -36,6 +39,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private static final int SHOWVALMAX = 400; private static final int SHOWVALMIN = 10; private static final int RESIZE_PANE_GAP = 8; + private static final int MOBILE_ONLY_WIDTH = 375; + private static final int MOBILE_ONLY_HEIGHT = 560; private FormDesigner designer; private int horizontalValue = 0; private int verticalValue = 0; @@ -62,10 +67,18 @@ public class FormArea extends JComponent implements ScrollRulerComponent { } public FormArea(FormDesigner designer) { - this(designer, true); + this(designer, null, true); + } + + public FormArea(FormDesigner designer, JForm jForm) { + this(designer, jForm, true); } public FormArea(FormDesigner designer, boolean useScrollBar) { + this(designer, null, useScrollBar); + } + + public FormArea(FormDesigner designer, JForm jForm, boolean useScrollBar) { this.designer = designer; this.designer.setParent(this); isValid = useScrollBar; @@ -87,6 +100,27 @@ public class FormArea extends JComponent implements ScrollRulerComponent { } this.setFocusTraversalKeysEnabled(false); this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); + initMobileAttrModifiedListener(jForm); + } + + private void initMobileAttrModifiedListener(JForm jForm) { + if (jForm == null) { + return; + } + jForm.addTargetModifiedListener(new TargetModifiedListener() { + @Override + public void targetModified(TargetModifiedEvent e) { + FormMobileAttr formMobileAttr = jForm.getTarget().getFormMobileAttr(); + if (formMobileAttr.isMobileOnly() && Math.abs(widthPane.getValue() - MOBILE_ONLY_WIDTH) > 0.0000001) { + widthPane.setValue(MOBILE_ONLY_WIDTH); + changeWidthPaneValue(MOBILE_ONLY_WIDTH); + heightPane.setValue(MOBILE_ONLY_HEIGHT); + changeHeightPaneValue(MOBILE_ONLY_HEIGHT); + } + widthPane.setEnabled(!formMobileAttr.isMobileOnly()); + } + }); + widthPane.setEnabled(!jForm.getTarget().getFormMobileAttr().isMobileOnly()); } MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 3581e61ac3..97c0d6ff1f 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.design.DesignState; import com.fr.design.actions.core.WorkBookSupportable; @@ -14,16 +15,10 @@ import com.fr.design.designer.beans.actions.FormDeleteAction; import com.fr.design.designer.beans.actions.PasteAction; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XComponent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ilable.UILabel; @@ -57,21 +52,14 @@ import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.page.PaperSettingProvider; +import com.fr.report.worksheet.FormElementCase; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.bridge.StableFactory; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; @@ -237,7 +225,7 @@ public class JForm extends JTemplate implements BaseJForm { centerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, new Color(85, 85, 85))); formDesign = new FormDesigner(this.getTarget(), new TabChangeAction(BaseJForm.ELEMENTCASE_TAB, this)); WidgetToolBarPane.getInstance(formDesign); - FormArea area = new FormArea(formDesign); + FormArea area = new FormArea(formDesign, this); JPanel areaWrapper = new JPanel(new BorderLayout()); areaWrapper.add(area, BorderLayout.CENTER); areaWrapper.setBackground(Color.white); @@ -810,6 +798,14 @@ public class JForm extends JTemplate implements BaseJForm { } } + /** + * 模板更新 + */ + public void fireTargetModified() { + super.fireTargetModified(); + WidgetPropertyPane.getInstance().refreshDockingView(); + } + /** * 在Form和ElementCase, 以及ElementCase和ElementCase之间切换 * @@ -835,8 +831,13 @@ public class JForm extends JTemplate implements BaseJForm { HashMap designerClass = new HashMap(); designerClass.put(Constants.ARG_0, FormElementCaseProvider.class); - Object[] designerArg = new Object[]{formDesign.getElementCase()}; - return StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class); + Object[] designerArg = new Object[]{formDesign.getElementCase(), getTarget()}; + FormECDesignerProvider formECDesigner = StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class); + // 如果是移动端专属模版,需要修改页面大小并显示边缘线 + PaperSettingProvider paperSetting = ((FormElementCase)formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting(); + paperSetting.setPaperSize(getTarget().getFormMobileAttr().isMobileOnly() ? PaperSize.PAPERSIZE_MOBILE : new PaperSize()); + + return formECDesigner; } /** diff --git a/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java index 4f67187085..bb5bf0ce78 100644 --- a/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java +++ b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java @@ -11,6 +11,9 @@ import com.fr.design.menu.MenuKeySet; import com.fr.form.main.Form; import com.fr.form.main.mobile.FormMobileAttr; import com.fr.general.Inter; +import com.fr.plugin.ExtraClassManager; +import com.fr.stable.ReportFunctionProcessor; +import com.fr.stable.fun.FunctionProcessor; import javax.swing.*; import java.awt.event.ActionEvent; @@ -47,8 +50,15 @@ public class FormMobileAttrAction extends JTemplateAction { BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { - formTpl.setFormMobileAttr(mobileAttrPane.updateBean()); + FormMobileAttr formMobileAttr = mobileAttrPane.updateBean(); + formTpl.setFormMobileAttr(formMobileAttr); jf.fireTargetModified(); + if (formMobileAttr.isMobileOnly()) { + FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); + if (processor != null) { + processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM); + } + } } }); dialog.setVisible(true);