From bd74f8fd7fd63668e401413e8abbb400d5468b82 Mon Sep 17 00:00:00 2001 From: xiaxiang <1438003374@qq.com> Date: Sat, 18 Jun 2016 15:52:44 +0800 Subject: [PATCH 1/3] rt --- .../src/com/fr/design/mainframe/JForm.java | 15 +++-- .../actions/TemplateParameterAction.java | 58 +++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index e7342fc875..0ab170429b 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -20,14 +20,12 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.xpane.FormHyperlinkGroupPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; +import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.KeySetUtils; -import com.fr.design.menu.MenuDef; -import com.fr.design.menu.ShortCut; -import com.fr.design.menu.ToolBarDef; +import com.fr.design.menu.*; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -378,8 +376,13 @@ public class JForm extends JTemplate implements BaseJForm { * @return 返回菜单 */ public ShortCut[] shortcut4TemplateMenu() { - return this.index == FORM_TAB ? new ShortCut[0] : - this.elementCaseDesign.shortcut4TemplateMenu(); + if (this.index == FORM_TAB) { + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ + new TemplateParameterAction(this) + }, new ShortCut[0]); + } else { + return this.elementCaseDesign.shortcut4TemplateMenu(); + } } /** diff --git a/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java new file mode 100644 index 0000000000..743059ab4d --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java @@ -0,0 +1,58 @@ +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.base.Parameter; +import com.fr.design.actions.JTemplateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.JForm; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.parameter.ParameterArrayPane; +import com.fr.form.main.Form; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * Created by 夏翔 on 2016/6/18. + */ +public class TemplateParameterAction extends JTemplateAction { + public TemplateParameterAction(JForm jwb) { + super(jwb); + this.setMenuKeySet(KeySetUtils.REPORT_PARAMETER_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + final JForm jwb = getEditingComponent(); + if (jwb == null) { + return; + } + final Form wbTpl = jwb.getTarget(); + + final ParameterArrayPane parameterArrayPane = new ParameterArrayPane(); + BasicDialog parameterArrayDialog = parameterArrayPane.showWindow(SwingUtilities.getWindowAncestor(jwb)); + parameterArrayDialog.setModal(true); + + final Parameter[] copyReportParameterAttr = (Parameter[]) wbTpl.getTemplateParameters(); + parameterArrayPane.populate(copyReportParameterAttr); + parameterArrayDialog.addDialogActionListener(new DialogActionAdapter() { + + @Override + public void doOk() { + wbTpl.clearParameters(); + Parameter[] parameters = parameterArrayPane.updateParameters(); + for (int i = 0; i < parameters.length; i++) { + wbTpl.addParameter(parameters[i]); + } + jwb.fireTargetModified(); + } + }); + parameterArrayDialog.setVisible(true); + + } + +} From d4945b4957f56b642227fd025e1369c9be359f40 Mon Sep 17 00:00:00 2001 From: xiaxiang <1438003374@qq.com> Date: Sat, 18 Jun 2016 16:11:38 +0800 Subject: [PATCH 2/3] RT --- .../fr/design/mainframe/actions/TemplateParameterAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java index 743059ab4d..f0385f5a5e 100644 --- a/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java +++ b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java @@ -37,8 +37,8 @@ public class TemplateParameterAction extends JTemplateAction { BasicDialog parameterArrayDialog = parameterArrayPane.showWindow(SwingUtilities.getWindowAncestor(jwb)); parameterArrayDialog.setModal(true); - final Parameter[] copyReportParameterAttr = (Parameter[]) wbTpl.getTemplateParameters(); - parameterArrayPane.populate(copyReportParameterAttr); + final Parameter[] copyTemplateParameterAttr = (Parameter[]) wbTpl.getTemplateParameters(); + parameterArrayPane.populate(copyTemplateParameterAttr); parameterArrayDialog.addDialogActionListener(new DialogActionAdapter() { @Override From 7371feb14d452979e6d7dc4a00e62475c7d8f061 Mon Sep 17 00:00:00 2001 From: xiaxiang <1438003374@qq.com> Date: Sun, 19 Jun 2016 23:59:57 +0800 Subject: [PATCH 3/3] rt --- .../fr/design/mainframe/actions/TemplateParameterAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java index f0385f5a5e..199f0bc6ab 100644 --- a/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java +++ b/designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java @@ -37,8 +37,8 @@ public class TemplateParameterAction extends JTemplateAction { BasicDialog parameterArrayDialog = parameterArrayPane.showWindow(SwingUtilities.getWindowAncestor(jwb)); parameterArrayDialog.setModal(true); - final Parameter[] copyTemplateParameterAttr = (Parameter[]) wbTpl.getTemplateParameters(); - parameterArrayPane.populate(copyTemplateParameterAttr); + final Parameter[] copyTemplateParameters = (Parameter[]) wbTpl.getTemplateParameters(); + parameterArrayPane.populate(copyTemplateParameters); parameterArrayDialog.addDialogActionListener(new DialogActionAdapter() { @Override