Browse Source

KERNEL-10650:改变一下面板类名、面板类对应的action类名,改变一下面板类的结构,去掉原有的并行计算子面板类(后续出现其他并行设置,再重新处理这里)

feature/x
Fly.Li 3 years ago
parent
commit
314b0cb4d7
  1. 14
      designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java
  2. 6
      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

14
designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java → designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java

@ -6,9 +6,9 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.widget.ui.designer.FormParallelSettingPane; import com.fr.design.widget.ui.designer.FormECParallelCalSettingPane;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.parallel.FormParallelAttr; import com.fr.form.main.parallel.FormECParallelCalAttr;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.Dimension; import java.awt.Dimension;
@ -19,7 +19,7 @@ import java.awt.event.ActionEvent;
* @version 10.0 * @version 10.0
* Created on 2022/03/18 * Created on 2022/03/18
*/ */
public class FormParallelAction extends JTemplateAction<JForm> { public class FormECParallelCalAction extends JTemplateAction<JForm> {
private static final MenuKeySet FORM_PARALLEL_SETTING = new MenuKeySet() { private static final MenuKeySet FORM_PARALLEL_SETTING = new MenuKeySet() {
@Override @Override
@ -46,7 +46,7 @@ public class FormParallelAction extends JTemplateAction<JForm> {
this.setSmallIcon("com/fr/design/form/images/parallel.png"); this.setSmallIcon("com/fr/design/form/images/parallel.png");
} }
public FormParallelAction(JForm jForm) { public FormECParallelCalAction(JForm jForm) {
super(jForm); super(jForm);
initMenuStyle(); initMenuStyle();
} }
@ -61,9 +61,9 @@ public class FormParallelAction extends JTemplateAction<JForm> {
} }
private void showParallelSettingDialog(JForm jf) { private void showParallelSettingDialog(JForm jf) {
FormParallelSettingPane attrPane = new FormParallelSettingPane(); FormECParallelCalSettingPane attrPane = new FormECParallelCalSettingPane();
Form form = jf.getTarget(); Form form = jf.getTarget();
FormParallelAttr parallelAttr = form.getParallelAttr(); FormECParallelCalAttr parallelAttr = form.getParallelAttr();
attrPane.populateBean(parallelAttr); attrPane.populateBean(parallelAttr);
UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
@ -74,7 +74,7 @@ public class FormParallelAction extends JTemplateAction<JForm> {
dialog.setVisible(true); dialog.setVisible(true);
} }
private void fireEditingOk(JForm jForm, Form form, FormParallelAttr parallelAttr){ private void fireEditingOk(JForm jForm, Form form, FormECParallelCalAttr parallelAttr){
form.setParallelAttr(parallelAttr); form.setParallelAttr(parallelAttr);
jForm.fireTargetModified(); jForm.fireTargetModified();
} }

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

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