xiaxiang 8 years ago
parent
commit
de747cfbd8
  1. 15
      designer_form/src/com/fr/design/mainframe/JForm.java
  2. 60
      designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java

15
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<Form, FormUndoState> 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();
}
}
/**

60
designer_form/src/com/fr/design/mainframe/actions/TemplateParameterAction.java

@ -0,0 +1,60 @@
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<JForm> {
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[] copyTemplateParameters = wbTpl.getTemplateParameters();
parameterArrayPane.populate(copyTemplateParameters);
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();
jwb.getFormDesign().setParameterArray(parameters);
jwb.getFormDesign().refreshParameter();
}
});
parameterArrayDialog.setVisible(true);
}
}
Loading…
Cancel
Save