diff --git a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java index 2bf3856908..f5fd94a321 100644 --- a/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -57,9 +57,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { @Override - public char getMnemonic() { - return 'P'; - } + public char getMnemonic() { return 'P'; } @Override public String getMenuName() { diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 79c60d2dc2..a3df2ba3e8 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.fun.MenuHandler; import com.fr.design.menu.KeySetUtils; -import com.fr.design.parameter.ParameterPropertyPane; import com.fr.general.Inter; import com.fr.page.ReportSettingsProvider; import com.fr.design.file.HistoryTemplateListPane; @@ -103,7 +102,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { // 插入菜单 private MenuDef createInsertMenuDef() { - MenuDef menuDef = new MenuDef(Inter.getLocText("M-Insert"), 'I'); + MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Insert"), 'I'); menuDef.setAnchor(MenuHandler.INSERT); // 单元格菜单 menuDef.addShortCut(DeprecatedActionManager.getCellMenu(this)); diff --git a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java index 43471b751d..2b1f44f389 100644 --- a/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java +++ b/designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java @@ -19,8 +19,6 @@ public class AppFitBrowserPane extends BasicBeanPane { private MobileRadioGroupPane horizionPane; //竖屏设置面板 private MobileRadioGroupPane verticalPane; - //缩放选项面板 - private MobileRadioCheckPane radioCheckPane; //效果预览面板 private AppFitPreviewPane appFitPreviewPane; @@ -36,16 +34,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.CENTER); - fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH); + fitOpsPane.add(verticalPane, BorderLayout.SOUTH); borderPane.add(fitOpsPane); this.add(borderPane); - } public void setAppFitPreviewPane(AppFitPreviewPane appFitPreviewPane) { @@ -54,7 +49,7 @@ public class AppFitBrowserPane extends BasicBeanPane { //纵向和横向独立设置 public int[] getCurrentFitOptions() { - return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()}; + return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()}; } @Override @@ -64,7 +59,7 @@ public class AppFitBrowserPane extends BasicBeanPane { } horizionPane.populateBean(ob.getHorziontalAttr()); verticalPane.populateBean(ob.getVerticalAttr()); - radioCheckPane.populateBean(ob.isZoom()); +// radioCheckPane.populateBean(ob.isZoom()); appFitPreviewPane.refreshPreview(getCurrentFitOptions()); } @@ -73,8 +68,9 @@ public class AppFitBrowserPane extends BasicBeanPane { public ElementCaseMobileAttr updateBean() { MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean(); - boolean isZoom = radioCheckPane.updateBean(); - return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); +// boolean isZoom = radioCheckPane.updateBean(); +// return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); + return new ElementCaseMobileAttr(horizonState, verticalState); } @Override diff --git a/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java b/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java new file mode 100644 index 0000000000..bea0745cb5 --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/MobileToolBarPane.java @@ -0,0 +1,70 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.mobile.MobileRadioCheckPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.report.mobile.ElementCaseMobileAttr; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by 方磊 on 2016/11/8. + */ +public class MobileToolBarPane extends BasicBeanPane { + //缩放选项面板 + private MobileRadioCheckPane zoomCheckPane; + + //刷新选项面板 + private MobileRadioCheckPane refreshCheckPane; + + public MobileToolBarPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + UILabel uiLabel = new UILabel("html5"); + uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15)); + zoomCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom")); + refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh")); + + toobarsPane.add(uiLabel, BorderLayout.WEST); + toobarsPane.add(zoomCheckPane, BorderLayout.CENTER); + toobarsPane.add(refreshCheckPane, BorderLayout.EAST); + borderPane.add(toobarsPane); + this.add(borderPane); + } + + @Override + public void populateBean(ElementCaseMobileAttr ob) { + if (ob == null) { + ob = new ElementCaseMobileAttr(); + } + this.zoomCheckPane.populateBean(ob.isZoom()); + this.refreshCheckPane.populateBean(ob.isRefresh()); + } + + @Override + public ElementCaseMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(ElementCaseMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setZoom(this.zoomCheckPane.updateBean()); + mobileAttr.setRefresh(this.refreshCheckPane.updateBean()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Toolbar"); + } +} diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index 3c00232194..5b97137102 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -1,6 +1,7 @@ package com.fr.design.report.mobile; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.general.Inter; import com.fr.report.mobile.ElementCaseMobileAttr; @@ -16,22 +17,30 @@ public class ReportMobileAttrPane extends BasicBeanPane{ private MobileUseHtmlGroupPane htmlGroupPane; + //工具栏容器 + private MobileToolBarPane mobileToolBarPane; + public ReportMobileAttrPane() { initComponents(); } private void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); AppFitPreviewPane appFitPreviewPane = new AppFitPreviewPane(); - + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + JPanel jPanel = new JPanel(); + jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); + jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); appFitBrowserPane = new AppFitBrowserPane(); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); - this.add(appFitBrowserPane); + jPanel.add(appFitBrowserPane); - this.add(htmlGroupPane = new MobileUseHtmlGroupPane()); + jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane()); - this.add(appFitPreviewPane); + jPanel.add(mobileToolBarPane = new MobileToolBarPane()); + + jPanel.add(appFitPreviewPane); + UIScrollPane scrollPane = new UIScrollPane(jPanel); + this.add(scrollPane); } @Override @@ -40,7 +49,7 @@ public class ReportMobileAttrPane extends BasicBeanPane{ ob = new ElementCaseMobileAttr(); } appFitBrowserPane.populateBean(ob); - + mobileToolBarPane.populateBean(ob); htmlGroupPane.populateBean(ob); } @@ -48,7 +57,7 @@ public class ReportMobileAttrPane extends BasicBeanPane{ @Override public ElementCaseMobileAttr updateBean() { ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); - + mobileToolBarPane.updateBean(caseMobileAttr); htmlGroupPane.updateBean(caseMobileAttr); return caseMobileAttr; diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java similarity index 83% rename from designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java rename to designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java index 9264619d32..ee38557612 100644 --- a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java +++ b/designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java @@ -1,4 +1,4 @@ -package com.fr.design.report.mobile; +package com.fr.design.dialog.mobile; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -13,6 +13,9 @@ import java.awt.*; import java.util.ArrayList; import java.util.List; +/** + * 这个类要被复用,移动到design_base中去 + */ public class MobileRadioCheckPane extends BasicBeanPane { private List checkBoxes = new ArrayList(); @@ -26,16 +29,16 @@ public class MobileRadioCheckPane extends BasicBeanPane { double[] rowSize = {p}; double[] columnSize = {p,p}; - UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open")); - checkBox.setSelected(true); + UICheckBox checkBox = new UICheckBox(title); + checkBox.setSelected(false); checkBoxes.add(checkBox); Component[][] components = new Component[][]{ - new Component[]{new UILabel(title), checkBox} + new Component[]{checkBox} }; JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); this.add(fitOpsPane); } diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java new file mode 100644 index 0000000000..0aafd8258c --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -0,0 +1,55 @@ +package com.fr.design.form.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by fanglei on 2016/11/17. + */ +public class FormMobileAttrPane extends BasicBeanPane{ + //工具栏容器 + private MobileToolBarPane mobileToolBarPane; + + static final int paddingHeight = 10; + + public FormMobileAttrPane() { + this.initComponents(); + } + + private void initComponents() { + JPanel jPanel = new JPanel(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.mobileToolBarPane = new MobileToolBarPane(); + //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 + jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); + jPanel.add("North", mobileToolBarPane); + this.add(jPanel); + } + + @Override + public void populateBean(FormMobileAttr ob) { + if (ob == null) { + ob = new FormMobileAttr(); + } + this.mobileToolBarPane.populateBean(ob); + } + + @Override + public FormMobileAttr updateBean() { + FormMobileAttr caseMobileAttr = new FormMobileAttr(); + this.mobileToolBarPane.updateBean(caseMobileAttr); + return caseMobileAttr; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } +} diff --git a/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java b/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java new file mode 100644 index 0000000000..c46c98ec27 --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java @@ -0,0 +1,64 @@ +package com.fr.design.form.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.mobile.MobileRadioCheckPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by 方磊 on 2016/11/8. + */ +public class MobileToolBarPane extends BasicBeanPane { + //刷新选项面板 + private MobileRadioCheckPane refreshCheckPane; + + public MobileToolBarPane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); + JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + UILabel uiLabel = new UILabel("html5"); + uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15)); + this.refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh")); + + toobarsPane.add(uiLabel, BorderLayout.WEST); + toobarsPane.add(refreshCheckPane, BorderLayout.EAST); + borderPane.add(toobarsPane); + this.add(borderPane); + } + + @Override + public void populateBean(FormMobileAttr ob) { + if (ob == null) { + ob = new FormMobileAttr(); + } + this.refreshCheckPane.populateBean(ob.isRefresh()); + } + + @Override + public FormMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(FormMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setRefresh(this.refreshCheckPane.updateBean()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Mobile-Toolbar"); + } + +} diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 4c015811c0..7c912ede0b 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.DesignState; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.WebPreviewUtils; +import com.fr.design.mainframe.actions.FormMobileAttrAction; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.actions.FormDeleteAction; @@ -71,6 +72,7 @@ public class JForm extends JTemplate implements BaseJForm { private JComponent editingComponent; private FormECCompositeProvider reportComposite; + //FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示 protected int index = FORM_TAB; public JForm() { @@ -383,11 +385,13 @@ public class JForm extends JTemplate implements BaseJForm { public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ - new TemplateParameterAction(this) + new TemplateParameterAction(this), + new FormMobileAttrAction(this) }, new ShortCut[0]); } else { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ - new TemplateParameterAction(this) + new TemplateParameterAction(this), + new FormMobileAttrAction(this) }, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java new file mode 100644 index 0000000000..4f67187085 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java @@ -0,0 +1,73 @@ +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.JTemplateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.form.mobile.FormMobileAttrPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JForm; +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 javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * Created by fanglei on 2016/11/14. + */ +public class FormMobileAttrAction extends JTemplateAction { + + public FormMobileAttrAction(JForm jf) { + super(jf); + this.setMenuKeySet(REPORT_APP_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/mobile.png")); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + @Override + public void actionPerformed(ActionEvent e) { + final JForm jf = getEditingComponent(); + if (jf == null) { + return; + } + final Form formTpl = jf.getTarget(); + FormMobileAttr mobileAttr = formTpl.getFormMobileAttr(); + + final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); + mobileAttrPane.populateBean(mobileAttr); + BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + formTpl.setFormMobileAttr(mobileAttrPane.updateBean()); + jf.fireTargetModified(); + } + }); + dialog.setVisible(true); + } + + private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +}