Browse Source

Pull request #8456: KERNEL-10650:报表块并行计算单模板独立开关-界面相关

Merge in DESIGN/design from ~FLY.LI/design:feature/x to feature/x

* commit 'e15faf79b3dc11388c6512a3343d52cfab147b24':
  KERNEL-10650:类名改动后删除
  KERNEL-10650:改变一下面板类名、面板类对应的action类名,改变一下面板类的结构,去掉原有的并行计算子面板类(后续出现其他并行设置,再重新处理这里)
  KERNEL-10650:改变并行计算设置面板风格,跟设计器风格保持一致
  KERNEL-10650:删除不需要的静态资源
  KERNEL-10650:修改兼容原有frm的代码的位置,从FormParallelAction中放到FormParallelSettingPane中
  KERNEL-10650:报表块并行计算单模板独立开关-图片资源
  KERNEL-10650:报表块并行计算单模板独立开关
  KERNEL-10650:模板并行开关面板设计
  REPORT-65090:body直接作为Object添加存在序列化问题,builder里面对body的序列化不能应对所有的对象
feature/x
Fly.Li 3 years ago
parent
commit
f0a631099e
  1. 81
      designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java
  2. 5
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  3. 131
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java
  4. BIN
      designer-form/src/main/resources/com/fr/design/form/images/parallel.png

81
designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java

@ -0,0 +1,81 @@
package com.fr.design.actions;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JForm;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.widget.ui.designer.FormECParallelCalSettingPane;
import com.fr.form.main.Form;
import com.fr.form.main.parallel.FormECParallelCalAttr;
import javax.swing.KeyStroke;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
/**
* @author fly.li
* @version 10.0
* Created on 2022/03/18
*/
public class FormECParallelCalAction extends JTemplateAction<JForm> {
private static final MenuKeySet FORM_PARALLEL_SETTING = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'P';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Designer_Parallel_Setting");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
private void initMenuStyle() {
this.setMenuKeySet(FORM_PARALLEL_SETTING);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("com/fr/design/form/images/parallel.png");
}
public FormECParallelCalAction(JForm jForm) {
super(jForm);
initMenuStyle();
}
@Override
public void actionPerformed(ActionEvent e) {
final JForm jf = getEditingComponent();
if (jf == null) {
return;
}
showParallelSettingDialog(jf);
}
private void showParallelSettingDialog(JForm jf) {
FormECParallelCalSettingPane attrPane = new FormECParallelCalSettingPane();
Form form = jf.getTarget();
FormECParallelCalAttr parallelAttr = form.getParallelAttr();
attrPane.populateBean(parallelAttr);
UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
fireEditingOk(jf, form, attrPane.updateBean());
}
}, new Dimension(600, 600));
dialog.setVisible(true);
}
private void fireEditingOk(JForm jForm, Form form, FormECParallelCalAttr parallelAttr){
form.setParallelAttr(parallelAttr);
jForm.fireTargetModified();
}
}

5
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -15,6 +15,7 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.FormECParallelCalAction;
import com.fr.design.actions.TemplateParameterAction;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
@ -588,9 +589,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override
public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction(), new FormECParallelCalAction(this)}, new ShortCut[0]);
} else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, this.elementCaseDesign.shortcut4TemplateMenu());
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction(), new FormECParallelCalAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu());
}
}

131
designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java

@ -0,0 +1,131 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.main.parallel.FormECParallelCalAttr;
import com.fr.report.core.config.FormParallelCalConfig;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* @author fly.li
* @version 10.0
* Created on 2022/03/18
*/
public class FormECParallelCalSettingPane extends BasicBeanPane<FormECParallelCalAttr> {
private static final String[] CHOOSE_ITEM = new String[] {
Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"),
Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings")
};
protected static final int SINGLE_SET = 0;
protected static final int SERVER_SET = 1;
//并行设置范围的下拉框(服务器设置还是模板设置)
UIComboBox parallelSettingScope;
//并行计算开关
UICheckBox parallelSwitch;
public FormECParallelCalSettingPane(){
initPane();
}
private void initPane(){
JPanel calSettingOutPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Calculate"));
calSettingOutPane.setPreferredSize(new Dimension(550,110));
calSettingOutPane.add(getCalSettingPane());
this.add(calSettingOutPane);
}
private JPanel getCalSettingPane() {
JPanel calSettingPane = new JPanel();
calSettingPane.setLayout(new BorderLayout());
UILabel belowSetLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Setting_Mode"));
belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
JPanel parallelSettingScopePane = GUICoreUtils.createFlowPane(new Component[] {
belowSetLabel, getParallelSettingScope()}, FlowLayout.LEFT, 0, 0);
calSettingPane.add(parallelSettingScopePane, BorderLayout.NORTH);
calSettingPane.add(getSwitchPane(Toolkit.i18nText("Fine-Designer_Enable_Form_Block_Parallel_Calculate")), BorderLayout.CENTER);
return calSettingPane;
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Calculate");
}
private UIComboBox getParallelSettingScope() {
if (this.parallelSettingScope == null){
parallelSettingScope = new UIComboBox(CHOOSE_ITEM);
parallelSettingScope.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (isUsingServerSettings()) {
populateServerSettings();
parallelSwitch.setEnabled(false);
} else {
parallelSwitch.setEnabled(true);
}
}
}
});
}
return this.parallelSettingScope;
}
private JPanel getSwitchPane(String tip){
JPanel innerPane = new JPanel();
innerPane.setLayout(new BorderLayout());
innerPane.setPreferredSize(new Dimension(500, 30));
innerPane.setBorder(BorderFactory.createEmptyBorder(10, 70, 5, 10));
innerPane.add(getParallelSwitch(tip));
return innerPane;
}
private UICheckBox getParallelSwitch(String tip){
if (parallelSwitch == null){
parallelSwitch = new UICheckBox(tip);
}
return parallelSwitch;
}
private boolean isUsingServerSettings(){
return parallelSettingScope.getSelectedIndex() == SERVER_SET;
}
@Override
public void populateBean(FormECParallelCalAttr formParallelAttr){
if (formParallelAttr == null){
formParallelAttr = FormECParallelCalAttr.getDefaultParallelAttr();
}
parallelSettingScope.setSelectedIndex(formParallelAttr.isUseServerSetting() ? SERVER_SET : SINGLE_SET);
if (formParallelAttr.isUseServerSetting()){
populateServerSettings();
} else {
populateSingleTemplateSetting(formParallelAttr);
}
}
private void populateServerSettings(){
parallelSwitch.setSelected(FormParallelCalConfig.getInstance().isParallelCal());
}
private void populateSingleTemplateSetting(FormECParallelCalAttr parallelAttr){
parallelSwitch.setSelected(parallelAttr.isParallelCal());
}
public FormECParallelCalAttr updateBean(){
return new FormECParallelCalAttr(isUsingServerSettings(), parallelSwitch.isSelected());
}
}

BIN
designer-form/src/main/resources/com/fr/design/form/images/parallel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Loading…
Cancel
Save