From f437038ed47075e8805a98bd56674fe2df980a00 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 6 Jan 2022 17:12:45 +0800 Subject: [PATCH 01/16] =?UTF-8?q?REPORT-64445=20=E6=96=B0=E8=80=81?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E9=85=8D=E7=BD=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ilable/UIAutoChangeLineLabel.java | 78 ++++ .../report/fit/AdaptiveFrmFitAttrModel.java | 6 +- .../fr/design/report/fit/BaseFitAttrPane.java | 130 +----- .../fr/design/report/fit/FitAttrModel.java | 9 + .../com/fr/design/report/fit/FitType.java | 11 + .../report/fit/FormFitAttrModelType.java | 128 ++++++ .../design/report/fit/FormFitConfigPane.java | 59 +++ .../fr/design/report/fit/FrmFitAttrModel.java | 9 +- .../design/report/fit/NewFitPreviewPane.java | 71 ++++ .../report/fit/ReportFitConfigPane.java | 172 ++++++++ .../com/fr/design/fit/FormFitAttrAction.java | 85 ++++ .../com/fr/design/fit/FormFitAttrPane.java | 377 ++++++++++++++++++ .../java/com/fr/design/mainframe/JForm.java | 14 +- .../FRAbsoluteBodyLayoutDefinePane.java | 110 +---- .../layout/FRAbsoluteLayoutDefinePane.java | 54 +-- .../layout/FRFitLayoutDefinePane.java | 118 +----- 16 files changed, 1032 insertions(+), 399 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java new file mode 100644 index 0000000000..d2bb0450b1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java @@ -0,0 +1,78 @@ +package com.fr.design.gui.ilable; + +import javax.swing.JLabel; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.util.ArrayList; +import java.util.List; + +public class UIAutoChangeLineLabel extends JLabel { + private final String text; + private final int width; + + + public UIAutoChangeLineLabel(String text, int width) { + super(text); + this.text = text; + this.width = width; + } + + + @Override + public void doLayout() { + super.doLayout(); + this.setText(wrapperHtmlText()); + } + + private String wrapperHtmlText() { + List stringList = autoChangeLine(this.getWidth()); + StringBuilder builder = new StringBuilder(""); + for (String s : stringList) { + //用THML标签进行拼接,以实现自动换行 + builder.append(s).append("
"); + } + builder.append(""); + return builder.toString(); + } + + private List autoChangeLine(int width) { + List result = new ArrayList<>(); + if (width <= 0) { + result.add(this.text); + } else { + + char[] chars = this.text.toCharArray(); + //获取字体计算大小 + FontMetrics fontMetrics = this.getFontMetrics(this.getFont()); + int start = 0; + int len = 0; + while (start + len < this.text.length()) { + while (true) { + len++; + if (start + len > this.text.length()) + break; + if (fontMetrics.charsWidth(chars, start, len) + > width) { + break; + } + } + result.add(String.copyValueOf(chars, start, len - 1)); + start = start + len - 1; + len = 0; + } + if (this.text.length() - start > 0) { + result.add(String.copyValueOf(chars, start, this.text.length() - start)); + } + } + return result; + } + + + @Override + public Dimension getPreferredSize() { + Dimension preferredSize = super.getPreferredSize(); + List stringList = autoChangeLine(width); + FontMetrics fontMetrics = this.getFontMetrics(this.getFont()); + return new Dimension(preferredSize.width, fontMetrics.getHeight() * stringList.size()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java index 9e60c6cc84..8c5e8858ac 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java @@ -13,11 +13,7 @@ import com.fr.report.fit.ReportFitAttr; public class AdaptiveFrmFitAttrModel extends AbstractFitAttrModelProvider { public FitType[] getFitTypes() { - return new FitType[]{ - FitType.DOUBLE_FIT, - FitType.HORIZONTAL_FIT, - FitType.NOT_FIT - }; + return new FitType[0]; } public String getFitName() { diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java index 2c38d597c4..48d6a5686e 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -2,27 +2,17 @@ package com.fr.design.report.fit; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.report.fit.menupane.FitPreviewPane; -import com.fr.design.report.fit.menupane.FitRadioGroup; -import com.fr.design.report.fit.menupane.FontRadioGroup; import com.fr.design.report.fit.provider.FitAttrModelProvider; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.ComparatorUtils; import com.fr.report.fit.ReportFitAttr; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.ItemListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.stream.Collectors; @@ -35,11 +25,8 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected UILabel belowSetLabel; protected UIComboBox itemChoose; protected java.util.List fitAttrModelList = new ArrayList<>(); + private ReportFitConfigPane fitConfigPane; - public FontRadioGroup fontRadioGroup; - public FitRadioGroup adaptRadioGroup; - public JPanel attrJPanel; - public FitPreviewPane previewJPanel; public FitAttrModel fitAttrModel; private static final int BELOW_SET_COMPONENT_HSPACE = 8; @@ -64,128 +51,27 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected void populateModel(FitAttrModel fitAttrModel) { this.fitAttrModel = fitAttrModel; - if (attrJPanel != null) { - contentJPanel.remove(attrJPanel); + if (fitConfigPane != null) { + contentJPanel.remove(fitConfigPane); } - if (previewJPanel != null) { - contentJPanel.remove(previewJPanel); - } - - fontRadioGroup = new FontRadioGroup(); - adaptRadioGroup = new FitRadioGroup(); - initAttrJPanel(); - initPreviewJPanel(); + this.fitConfigPane = fitAttrModel instanceof CptFitAttrModel ? new ReportFitConfigPane(fitAttrModel, true) : new FormFitConfigPane(fitAttrModel, true); + contentJPanel.add(fitConfigPane); } - - protected void initAttrJPanel() { - int colCount = fitAttrModel.getFitTypes().length + 1; - Component[][] components = new Component[2][colCount]; - initFitRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, components[0]); - initFitRadioGroup(adaptRadioGroup, fitAttrModel.getFitName(), Arrays.stream(fitAttrModel.getFitTypes()).map(FitType::description).toArray(String[]::new), components[1]); - - double[] rowSize = new double[2]; - double[] columnSize = new double[colCount]; - for (int i = 0; i < rowSize.length; i++) { - rowSize[i] = 20; - } - for (int i = 0; i < columnSize.length; i++) { - if (i == 0) { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth(); - } else { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); - } - } - - attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - contentJPanel.add(attrJPanel); - } - - private void initFitRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { - components[0] = new UILabel(name); - for (int i = 0; i < options.length; i++) { - - if (options[i] != null) { - UIRadioButton fontFitRadio = new UIRadioButton(options[i]); - fitRadioGroup.add(fontFitRadio); - components[i + 1] = fontFitRadio; - } else { - components[i + 1] = null; - } - } - fitRadioGroup.addActionListener(getPreviewActionListener()); - } - - protected ActionListener getPreviewActionListener() { - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - refreshPreviewJPanel(); - } - }; - } - - protected void refreshPreviewJPanel() { - String previewIndex = getPreviewIndex(); - previewJPanel.refreshPreview(previewIndex, fontRadioGroup.isEnabled()); - } - - protected String getPreviewIndex() { - return getStateInPC(adaptRadioGroup.getSelectRadioIndex()) + "" + fontRadioGroup.getSelectRadioIndex(); - } - - protected void initPreviewJPanel() { - previewJPanel = new FitPreviewPane(); - previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0)); - contentJPanel.add(previewJPanel); - } - - private int getPreviewJPanelLeft() { - int left = 0; - if (belowSetLabel.getPreferredSize() != null) { - left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE; - } - return left; - } - - protected int getStateInPC(int index) { - FitType[] fitTypes = fitAttrModel.getFitTypes(); - return fitTypes[index].getState(); - } - - protected int getOptionIndex(int state) { - FitType[] fitTypes = fitAttrModel.getFitTypes(); - for (int i = 0; i < fitTypes.length; i++) { - if (ComparatorUtils.equals(state, fitTypes[i].getState())) { - return i; - } - } - return 0; - } - - @Override public void populateBean(ReportFitAttr ob) { - fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); - adaptRadioGroup.selectIndexButton(getOptionIndex(ob.fitStateInPC())); - refreshPreviewJPanel(); + this.fitConfigPane.populateBean(ob); } @Override public ReportFitAttr updateBean() { - ReportFitAttr reportFitAttr = new ReportFitAttr(); - reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); - reportFitAttr.setFitStateInPC(getStateInPC(adaptRadioGroup.getSelectRadioIndex())); - return reportFitAttr; + return this.fitConfigPane.updateBean(); } public void setEnabled(boolean enabled) { super.setEnabled(enabled); - fontRadioGroup.setEnabled(enabled); - adaptRadioGroup.setEnabled(enabled); - refreshPreviewJPanel(); + this.fitConfigPane.setEnabled(enabled); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java index 1d1ac02f0d..2a834eebd8 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java @@ -3,6 +3,8 @@ package com.fr.design.report.fit; import com.fr.design.mainframe.JTemplate; import com.fr.report.fit.ReportFitAttr; +import java.util.Arrays; + public interface FitAttrModel { /** * @Description 名称,比如:普通报表、决策报表等 @@ -19,6 +21,12 @@ public interface FitAttrModel { **/ FitType[] getFitTypes(); + /** + * @Description 表格自适应选项名称集合 + **/ + default String[] getFitTypeNames(){ + return Arrays.stream(getFitTypes()).map(FitType::description).toArray(String[]::new); + } /** * @Description 获取全局的自适应属性 @@ -41,4 +49,5 @@ public interface FitAttrModel { * @param: jTemplate **/ boolean isAvailable(JTemplate jTemplate); + } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FitType.java b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java index 00aceb6eb1..dd4888b4e5 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FitType.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java @@ -60,6 +60,17 @@ public enum FitType { return DEFAULT; } + public static FitType parseByFitState(int state) { + + for (FitType attrState : values()) { + if (attrState.state == state) { + return attrState; + } + } + + return DEFAULT; + } + public int getState() { return this.state; } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java b/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java new file mode 100644 index 0000000000..a77566442d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java @@ -0,0 +1,128 @@ +package com.fr.design.report.fit; + + +import com.fr.design.designer.properties.items.Item; +import com.fr.form.fit.common.LightTool; +import com.fr.form.main.BodyScaleAttrTransformer; +import com.fr.form.main.Form; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.form.ui.container.WFitLayout; + +public enum FormFitAttrModelType { + PLAIN_FORM_FIT_ATTR_MODEL { + @Override + public FitAttrModel getFitAttrModel() { + return new FrmFitAttrModel(); + } + + @Override + public Item[] getFitLayoutScaleAttr() { + return new Item[]{ + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN)}; + + } + + @Override + public Item[] getAbsoluteLayoutSaleAttr() { + return new Item[]{ + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) + }; + } + + + @Override + public int getScaleAttrShowIndex(WFitLayout wFitLayout) { + int scale = wFitLayout.getScaleAttr(); + if (wFitLayout.getBodyLayoutType() == WBodyLayoutType.FIT) { + return BodyScaleAttrTransformer.getFitBodyCompStateFromScaleAttr(scale); + } else { + return BodyScaleAttrTransformer.getAbsoluteBodyCompStateFromScaleAttr(scale); + } + } + + @Override + public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { + if (wBodyLayoutType == WBodyLayoutType.FIT) { + if (showIndex == 0) { + return WFitLayout.SCALE_FULL; + } else { + return WFitLayout.SCALE_HOR; + } + } else { + if (showIndex == 0) { + return WFitLayout.SCALE_FULL; + } else { + return WFitLayout.SCALE_NO; + } + } + } + + + }, + NEW_FORM_FIT_ATTR_MODEL { + @Override + public FitAttrModel getFitAttrModel() { + return new AdaptiveFrmFitAttrModel(); + } + + @Override + public Item[] getFitLayoutScaleAttr() { + return new Item[]{ + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), 2)}; + } + + @Override + public Item[] getAbsoluteLayoutSaleAttr() { + return new Item[]{ + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), 2)}; + } + + + @Override + public int getScaleAttrShowIndex(WFitLayout wFitLayout) { + int scale = wFitLayout.getScaleAttr(); + if (scale == WFitLayout.SCALE_NO) { + return 2; + } else if (scale == WFitLayout.SCALE_HOR) { + return 1; + } else { + return 0; + } + } + + @Override + public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { + if (showIndex == 0) { + return WFitLayout.SCALE_FULL; + } else if (showIndex == 1) { + return WFitLayout.SCALE_HOR; + } else { + return WFitLayout.SCALE_NO; + } + } + + + }; + + public abstract FitAttrModel getFitAttrModel(); + + public abstract Item[] getFitLayoutScaleAttr(); + + public abstract Item[] getAbsoluteLayoutSaleAttr(); + + public abstract int getScaleAttrShowIndex(WFitLayout wFitLayout); + + public abstract int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType); + + + public static FormFitAttrModelType parse(Form form) { + return LightTool.containNewFormFlag(form) ? NEW_FORM_FIT_ATTR_MODEL : PLAIN_FORM_FIT_ATTR_MODEL; + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java new file mode 100644 index 0000000000..08b70cb772 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java @@ -0,0 +1,59 @@ +package com.fr.design.report.fit; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; + +public class FormFitConfigPane extends ReportFitConfigPane { + private static final int DEFAULT_ITEM = 0; + private static final int CUSTOM_ITEM = 1; + + public FormFitConfigPane(FitAttrModel fitAttrModel) { + this(fitAttrModel, false); + } + + public FormFitConfigPane(FitAttrModel fitAttrModel, boolean globalConfig) { + super(fitAttrModel, globalConfig); + } + + protected JPanel initECConfigPane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + if (fitAttrModel.getFitTypeNames().length != 0) { + Component[] ecComponents = new Component[fitAttrModel.getFitTypeNames().length + 1]; + initRadioGroup(ecConfigRadioGroup, fitAttrModel.getFitName(), fitAttrModel.getFitTypeNames(), ecComponents); + jPanel.add(createSubAttrPane(ecComponents), BorderLayout.CENTER); + jPanel.add(createTipPane(), BorderLayout.SOUTH); + } + return jPanel; + } + + private JPanel createTipPane() { + JPanel jPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip1")); + jPanel.add(label1); + label1.setForeground(Color.lightGray); + UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip2")); + jPanel.add(label2); + label2.setForeground(Color.lightGray); + return jPanel; + } + + protected void refreshPreviewJPanel() { + previewJPanel.refreshPreview(fontRadioGroup.isFontFit()); + } + + protected void populateECConfigRadioGroup(int fitStateInPC) { + ecConfigRadioGroup.selectIndexButton(fitStateInPC == 0 ? DEFAULT_ITEM : CUSTOM_ITEM); + } + + protected void updateECConfigRadioGroup(ReportFitAttr reportFitAttr) { + reportFitAttr.setFitStateInPC(ecConfigRadioGroup.getSelectRadioIndex()); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java index c4bdaf6de2..81ee474de1 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java @@ -17,7 +17,7 @@ public class FrmFitAttrModel implements FitAttrModel { @Override public String getFitName() { - return Toolkit.i18nText("Fine-Designer_Fit-Element"); + return Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_EC_Label"); } public FitType[] getFitTypes() { @@ -29,6 +29,13 @@ public class FrmFitAttrModel implements FitAttrModel { }; } + @Override + public String[] getFitTypeNames() { + return new String[]{ + Toolkit.i18nText("Fine-Designer_Fit-Default"), Toolkit.i18nText("Fine-Design_Basic_Custom") + }; + } + @Override public ReportFitAttr getGlobalReportFitAttr() { return ReportFitConfig.getInstance().getFrmFitAttr(); diff --git a/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java b/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java new file mode 100644 index 0000000000..8b0710de3f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java @@ -0,0 +1,71 @@ +package com.fr.design.report.fit; + +import com.fr.base.GraphHelper; +import com.fr.general.FRFont; + +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; + + +public class NewFitPreviewPane extends JPanel { + private boolean fitFont = false; + private FitType fitType = FitType.DOUBLE_FIT; + private static final Color DEFAULT_PAINT_COLOR = Color.decode("#419BF9"); + private static final int FIT_FONT_SIZE = 15; + private static final int NO_FIT_FONT_SIZE = 9; + private static final Dimension NO_FIT_CONTAINER_DIMENSION = new Dimension(200, 136); + + @Override + public void paint(Graphics g) { + super.paint(g); + g.setColor(Color.GRAY); + GraphHelper.drawRect(g, 1, 1, this.getWidth() - 2, this.getHeight() - 2); + g.setColor(DEFAULT_PAINT_COLOR); + FRFont textFont = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, fitFont ? FIT_FONT_SIZE : NO_FIT_FONT_SIZE); + g.setFont(textFont); + Dimension dimension = calculateCellDimension(); + GraphHelper.drawLine(g, 1, dimension.height, dimension.width * 2 - 1, dimension.height); + GraphHelper.drawLine(g, dimension.width, 1, dimension.width, dimension.height * 2 - 1); + GraphHelper.drawRect(g, 1, 1, dimension.width * 2 - 2, dimension.height * 2 - 2); + double startX = calculateTextDrawStartX(dimension.width, this.getFontMetrics(textFont), "text1"); + double startY = calculateTextDrawStartY(dimension.height); + GraphHelper.drawString(g, "text1", startX, startY); + GraphHelper.drawString(g, "text2", dimension.width + startX, startY); + GraphHelper.drawString(g, "text3", startX, dimension.height + startY); + GraphHelper.drawString(g, "text4", dimension.width + startX, dimension.height + startY); + } + + private Dimension calculateCellDimension() { + if (fitType == FitType.DOUBLE_FIT) { + return new Dimension(this.getWidth() / 2, this.getHeight() / 2); + } else if (fitType == FitType.NOT_FIT) { + return new Dimension(NO_FIT_CONTAINER_DIMENSION.width / 2, NO_FIT_CONTAINER_DIMENSION.height / 2); + } else { + return new Dimension(this.getWidth() / 2, NO_FIT_CONTAINER_DIMENSION.height / 2); + } + } + + private double calculateTextDrawStartX(int containerWidth, FontMetrics fontMetrics, String text) { + return (containerWidth - fontMetrics.stringWidth(text)) / 2.0D; + } + + private double calculateTextDrawStartY(int containerHeight) { + return containerHeight / 2.0D; + } + + public void refreshPreview(boolean fitFont, FitType fitType) { + this.fitFont = fitFont; + this.fitType = fitType; + repaint(); + } + + public void refreshPreview(boolean fitFont) { + this.fitFont = fitFont; + repaint(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java new file mode 100644 index 0000000000..399e7fef93 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java @@ -0,0 +1,172 @@ +package com.fr.design.report.fit; + +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.DesignSizeI18nManager; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.report.fit.menupane.FitRadioGroup; +import com.fr.design.report.fit.menupane.FontRadioGroup; +import com.fr.general.ComparatorUtils; +import com.fr.report.fit.ReportFitAttr; + +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.ActionEvent; +import java.awt.event.ActionListener; + +import static com.fr.design.i18n.Toolkit.i18nText; + +public class ReportFitConfigPane extends JPanel { + public FontRadioGroup fontRadioGroup; + public FitRadioGroup ecConfigRadioGroup; + protected NewFitPreviewPane previewJPanel; + protected FitAttrModel fitAttrModel; + protected boolean globalConfig; + + + public ReportFitConfigPane(FitAttrModel fitAttrModel, boolean globalConfig) { + this.fitAttrModel = fitAttrModel; + this.globalConfig = globalConfig; + initComponent(); + } + + private void initComponent() { + JPanel contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); + this.add(contentJPanel); + fontRadioGroup = new FontRadioGroup(); + ecConfigRadioGroup = new FitRadioGroup(); + contentJPanel.add(initAttrJPanel()); + contentJPanel.add(initPreviewJPanel()); + } + + private JPanel initAttrJPanel() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + Component[] fontComponents = new Component[3]; + initRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, fontComponents); + jPanel.add(createSubAttrPane(fontComponents), BorderLayout.NORTH); + jPanel.add(initECConfigPane(), BorderLayout.CENTER); + return jPanel; + } + + protected JPanel initECConfigPane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + Component[] ecComponents = new Component[fitAttrModel.getFitTypeNames().length + 1]; + initRadioGroup(ecConfigRadioGroup, fitAttrModel.getFitName(), fitAttrModel.getFitTypeNames(), ecComponents); + jPanel.add(createSubAttrPane(ecComponents), BorderLayout.CENTER); + return jPanel; + } + + + protected JPanel createSubAttrPane(Component[] components) { + double[] rowSize = new double[]{20}; + double[] columnSize = new double[components.length]; + for (int i = 0; i < columnSize.length; i++) { + if (i == 0) { + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth(); + } else { + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); + } + } + + JPanel attrJPanel = TableLayoutHelper.createTableLayoutPane(new Component[][]{components}, rowSize, columnSize); + attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); + return attrJPanel; + } + + protected void initRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { + components[0] = new UILabel(name); + for (int i = 0; i < options.length; i++) { + + if (options[i] != null) { + UIRadioButton fontFitRadio = new UIRadioButton(options[i]); + fitRadioGroup.add(fontFitRadio); + components[i + 1] = fontFitRadio; + } else { + components[i + 1] = null; + } + } + fitRadioGroup.addActionListener(getPreviewActionListener()); + } + + private ActionListener getPreviewActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshPreviewJPanel(); + } + }; + } + + public void refreshPreviewJPanel(FitType fitType) { + previewJPanel.refreshPreview(fontRadioGroup.isFontFit(), fitType); + } + + protected void refreshPreviewJPanel() { + previewJPanel.refreshPreview(fontRadioGroup.isFontFit(), FitType.parse(updateBean())); + } + + private JPanel initPreviewJPanel() { + JPanel wrapperPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + previewJPanel = new NewFitPreviewPane(); + wrapperPane.add(previewJPanel, BorderLayout.CENTER); + int leftIndent = globalConfig ? (int) DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth() : 0; + wrapperPane.setBorder(BorderFactory.createEmptyBorder(0, leftIndent, 0, 0)); + wrapperPane.setPreferredSize(new Dimension(300 + leftIndent, 204)); + return wrapperPane; + } + + + public void populateBean(ReportFitAttr ob) { + fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); + populateECConfigRadioGroup(ob.fitStateInPC()); + refreshPreviewJPanel(); + } + + protected void populateECConfigRadioGroup(int fitStateInPC){ + ecConfigRadioGroup.selectIndexButton(getOptionIndex(fitStateInPC)); + } + + + protected void updateECConfigRadioGroup(ReportFitAttr reportFitAttr){ + reportFitAttr.setFitStateInPC(getStateInPC(ecConfigRadioGroup.getSelectRadioIndex())); + } + + public ReportFitAttr updateBean() { + ReportFitAttr reportFitAttr = new ReportFitAttr(); + reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); + updateECConfigRadioGroup(reportFitAttr); + return reportFitAttr; + } + + + protected int getStateInPC(int index) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + if (index > fitTypes.length - 1) { + return index; + } + return fitTypes[index].getState(); + } + + protected int getOptionIndex(int state) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + for (int i = 0; i < fitTypes.length; i++) { + if (ComparatorUtils.equals(state, fitTypes[i].getState())) { + return i; + } + } + return 0; + } + + + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + fontRadioGroup.setEnabled(enabled); + ecConfigRadioGroup.setEnabled(enabled); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java new file mode 100644 index 0000000000..dad6e9be9c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java @@ -0,0 +1,85 @@ +package com.fr.design.fit; + +import com.fr.design.actions.JTemplateAction; +import com.fr.design.beans.BasicBeanPane; +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.mainframe.JTemplate; +import com.fr.design.menu.MenuKeySet; +import com.fr.design.report.fit.FormFitAttrModelType; +import com.fr.form.main.Form; +import com.fr.report.fit.FitProvider; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.KeyStroke; +import java.awt.Dimension; +import java.awt.event.ActionEvent; + +public class FormFitAttrAction extends JTemplateAction { + private static final MenuKeySet REPORT_FIT_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + public FormFitAttrAction(JTemplate jTemplate) { + super(jTemplate); + initMenuStyle(); + } + + private void initMenuStyle() { + this.setMenuKeySet(REPORT_FIT_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon("/com/fr/design/images/reportfit/fit"); + } + + /** + * Action触发事件 + * + * @param e 事件 + */ + @Override + public void actionPerformed(ActionEvent e) { + final JTemplate jwb = getEditingComponent(); + if (jwb == null || !(jwb.getTarget() instanceof Form)) { + return; + } + JForm jForm = (JForm) jwb; + Form wbTpl = jForm.getTarget(); + ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); + FormFitAttrPane formFitAttrPane = new FormFitAttrPane(jForm, FormFitAttrModelType.parse(wbTpl)); + showReportFitDialog(fitAttr, jwb, wbTpl, formFitAttrPane); + } + + private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { + attrPane.populateBean(fitAttr); + UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + fireEditingOk(jwb, wbTpl, attrPane.updateBean(), fitAttr); + } + }, new Dimension(660, 600)); + dialog.setVisible(true); + } + + private void fireEditingOk(final JTemplate jwb, final FitProvider wbTpl, ReportFitAttr newReportFitAttr, ReportFitAttr oldReportFitAttr) { + wbTpl.setReportFitAttr(newReportFitAttr); + jwb.fireTargetModified(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java new file mode 100644 index 0000000000..51eda6d36e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java @@ -0,0 +1,377 @@ +package com.fr.design.fit; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XOccupiedLayout; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWScaleLayout; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.dialog.FineJOptionPane; +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.layout.TableLayoutHelper; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelectionUtils; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.report.fit.FitType; +import com.fr.design.report.fit.FormFitAttrModelType; +import com.fr.design.report.fit.FormFitConfigPane; +import com.fr.design.report.fit.ReportFitConfigPane; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.main.Form; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WSortLayout; +import com.fr.general.ComparatorUtils; +import com.fr.general.act.BorderPacker; +import com.fr.log.FineLoggerFactory; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +import static com.fr.design.i18n.Toolkit.i18nText; +import static javax.swing.JOptionPane.*; + +public class FormFitAttrPane extends BasicBeanPane { + + private UIComboBox layoutComboBox; + private UIComboBox scaleComboBox; + private FormFitAttrModelType fitAttrModelType; + + protected UIComboBox itemChoose; + + private JForm jForm; + private ReportFitConfigPane fitConfigPane; + + public FormFitAttrPane(JForm jForm, FormFitAttrModelType fitAttrModelType) { + this.fitAttrModelType = fitAttrModelType; + this.jForm = jForm; + initComponents(); + } + + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 5)); + this.add(createReportFitSettingPane(), BorderLayout.CENTER); + this.add(createReportLayoutSettingPane(), BorderLayout.NORTH); + + } + + + private JPanel createReportLayoutSettingPane() { + JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Layout")); + jPanel.add(createAreaScalePane(), BorderLayout.CENTER); + jPanel.setPreferredSize(new Dimension(640, 84)); + return jPanel; + } + + protected String[] getItemNames() { + return new String[]{Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"), + Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")}; + } + + + private JPanel createReportFitSettingPane() { + JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Content_Attr")); + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.add(contentPane, BorderLayout.CENTER); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Settings")); + label.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); + contentPane.add(label, BorderLayout.WEST); + label.setPreferredSize(new Dimension(100, 0)); + label.setVerticalAlignment(SwingConstants.TOP); + itemChoose = new UIComboBox(getItemNames()); + itemChoose.setPreferredSize(new Dimension(160, 20)); + Form form = jForm.getTarget(); + itemChoose.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (isTemplateSingleSet()) { + if (form != null) { + ReportFitAttr fitAttr = form.getReportFitAttr(); + populate(fitAttr); + } + } else { + populate(fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr()); + } + } + } + }); + JPanel centerPane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + centerPane.add(itemChoose); + centerPane.add(fitConfigPane = new FormFitConfigPane(this.fitAttrModelType.getFitAttrModel())); + contentPane.add(centerPane, BorderLayout.CENTER); + return jPanel; + } + + public void populate(ReportFitAttr reportFitAttr) { + if (reportFitAttr == null) { + reportFitAttr = fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr(); + } + + this.setEnabled(isTemplateSingleSet()); + fitConfigPane.populateBean(reportFitAttr); + } + + + public ReportFitAttr updateBean() { + updateLayoutType(); + if (!isTemplateSingleSet()) { + return null; + } else { + return fitConfigPane.updateBean(); + } + } + + private void updateLayoutType() { + XLayoutContainer xLayoutContainer = this.jForm.getRootComponent(); + if (xLayoutContainer == null || !xLayoutContainer.acceptType(XWFitLayout.class)) { + return; + } + XWFitLayout xwFitLayout = (XWFitLayout) xLayoutContainer; + WFitLayout wFitLayout = xwFitLayout.toData(); + int state = layoutComboBox.getSelectedIndex(); + WBodyLayoutType selectType = WBodyLayoutType.parse(state); + if (selectType != wFitLayout.getBodyLayoutType()) { + wFitLayout.setLayoutType(selectType); + //从自适应布局切换到绝对布局 + if (selectType == WBodyLayoutType.ABSOLUTE) { + switchLayoutFromFit2Absolute(xwFitLayout); + } else { + //从绝对布局切换到自适应布局 + switchLayoutFromAbsolute2Fit(xwFitLayout); + } + } + wFitLayout.setCompatibleScaleAttr(fitAttrModelType.parseScaleAttrFromShowIndex(this.scaleComboBox.getSelectedIndex(), wFitLayout.getBodyLayoutType())); + } + + + private void switchLayoutFromFit2Absolute(XWFitLayout xWFitLayout) { + try { + WFitLayout layout = xWFitLayout.toData(); + WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); + wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); + // 切换布局类型时,保留body背景样式 + wAbsoluteBodyLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); + wAbsoluteBodyLayout.setBorderStyle((BorderPacker) (layout.getBorderStyle().clone())); + Component[] components = xWFitLayout.getComponents(); + Rectangle[] backupBounds = getBackupBoundsFromFitLayout(xWFitLayout); + xWFitLayout.removeAll(); + layout.resetStyle(); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); + xWFitLayout.setFixLayout(false); + xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); + for (int i = 0; i < components.length; i++) { + XCreator xCreator = (XCreator) components[i]; + xCreator.setBounds(backupBounds[i]); + //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + Component component = xCreator.getComponent(0); + component.setBounds(xCreator.getBounds()); + } + } + if (!xCreator.acceptType(XOccupiedLayout.class)) { + xwAbsoluteBodyLayout.add(xCreator); + } + + } + copyLayoutAttr(layout, xwAbsoluteBodyLayout.toData()); + xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); + if (xwAbsoluteBodyLayout.toData() != null) { + xwAbsoluteBodyLayout.toData().setBorderStyleFollowingTheme(wAbsoluteBodyLayout.isBorderStyleFollowingTheme()); + xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle()); + } + xwAbsoluteBodyLayout.refreshStylePreviewEffect(); + if (xWFitLayout.toData() != null) { + xWFitLayout.toData().resetStyle(); + } + xWFitLayout.refreshStylePreviewEffect(); + formDesigner.switchBodyLayout(xwAbsoluteBodyLayout); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + + } + } + + private Rectangle[] getBackupBoundsFromFitLayout(XWFitLayout xWFitLayout) { + int count = xWFitLayout.getComponentCount(); + Rectangle[] rectangles = new Rectangle[count]; + for (int i = 0; i < count; i++) { + rectangles[i] = xWFitLayout.getComponent(i).getBounds(); + } + return rectangles; + } + + protected void copyLayoutAttr(WSortLayout srcLayout, WSortLayout destLayout) { + destLayout.clearListeners(); + destLayout.clearMobileWidgetList(); + for (int i = 0, len = srcLayout.getMobileWidgetListSize(); i < len; i++) { + destLayout.addMobileWidget(srcLayout.getMobileWidget(i)); + } + destLayout.setSorted(true); + for (int i = 0, len = srcLayout.getListenerSize(); i < len; i++) { + destLayout.addListener(srcLayout.getListener(i)); + } + srcLayout.clearListeners(); + srcLayout.clearMobileWidgetList(); + } + + + private void switchLayoutFromAbsolute2Fit(XWFitLayout xwFitLayout) { + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = getAbsoluteBodyLayout(xwFitLayout); + if (xwAbsoluteBodyLayout == null) { + return; + } + WAbsoluteBodyLayout layout = xwAbsoluteBodyLayout.toData(); + WFitLayout wFitLayout = xwFitLayout.toData(); + wFitLayout.resetStyle(); + xwFitLayout.switch2FitBodyLayout(xwAbsoluteBodyLayout); + // 切换布局类型时,保留body背景样式 + if (wFitLayout != null) { + wFitLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); + wFitLayout.setBorderStyle(layout.getBorderStyle()); + } + copyLayoutAttr(layout, xwFitLayout.toData()); + + copyLayoutAttr(layout, xwFitLayout.toData()); + xwFitLayout.refreshStylePreviewEffect(); + } + + private XWAbsoluteBodyLayout getAbsoluteBodyLayout(XWFitLayout xwFitLayout) { + if (xwFitLayout != null && xwFitLayout.getComponentCount() > 0) { + Component component = xwFitLayout.getComponent(0); + if (component instanceof XWAbsoluteBodyLayout) { + return (XWAbsoluteBodyLayout) component; + } + } + return null; + } + + private JPanel createAreaScalePane() { + initLayoutComboBox(); + + UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); + UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Scale_Setting")); + Component[][] components = new Component[][]{ + {layoutTypeLabel, layoutComboBox}, + {scaleModeLabel, scaleComboBox} + }; + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, + TableLayoutHelper.FILL_LASTCOLUMN, 20, IntervalConstants.INTERVAL_L1); + JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + containerPane.add(contentPane, BorderLayout.CENTER); + + return containerPane; + } + + + public void initLayoutComboBox() { + Item[] items = FRLayoutTypeItems.ITEMS; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + for (Item item : items) { + model.addElement(item); + } + scaleComboBox = new UIComboBox(model); + scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getFitLayoutScaleAttr())); + layoutComboBox = new UIComboBox(model); + layoutComboBox.setPreferredSize(new Dimension(160, 20)); + scaleComboBox.setPreferredSize(new Dimension(160, 20)); + WFitLayout wFitLayout = jForm.getTarget().getWFitLayout(); + layoutComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int selectIndex = layoutComboBox.getSelectedIndex(); + if (selectIndex == 0) { + if (wFitLayout.getBodyLayoutType() == WBodyLayoutType.ABSOLUTE) { + int selVal = FineJOptionPane.showConfirmDialog( + FormFitAttrPane.this, + Toolkit.i18nText("Fine-Design_Form_Layout_Switch_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + OK_CANCEL_OPTION, + WARNING_MESSAGE + ); + if (OK_OPTION != selVal) { + layoutComboBox.setSelectedIndex(1); + return; + } + } + scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getFitLayoutScaleAttr())); + } else { + scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getAbsoluteLayoutSaleAttr())); + } + scaleComboBox.setSelectedIndex(0); + } + }); + + scaleComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + WBodyLayoutType selectBodyType = WBodyLayoutType.parse(layoutComboBox.getSelectedIndex()); + int state = fitAttrModelType.parseScaleAttrFromShowIndex(scaleComboBox.getSelectedIndex(), selectBodyType); + fitConfigPane.refreshPreviewJPanel(FitType.parseByFitState(state)); + } + }); + } + + + @Override + public void populateBean(ReportFitAttr reportFitAttr) { + WFitLayout wFitLayout = jForm.getTarget().getWFitLayout(); + layoutComboBox.setSelectedIndex(wFitLayout.getBodyLayoutType().getTypeValue()); + scaleComboBox.setSelectedIndex(fitAttrModelType.getScaleAttrShowIndex(wFitLayout)); + + if (reportFitAttr == null) { + itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings")); + } else { + itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")); + } + if (reportFitAttr == null) { + reportFitAttr = fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr(); + } + setEnabled(isTemplateSingleSet()); + fitConfigPane.populateBean(reportFitAttr); + } + + private boolean isTemplateSingleSet() { + return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), itemChoose.getSelectedItem()); + } + + + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + fitConfigPane.setEnabled(enabled); + } + + @Override + protected String title4PopupWindow() { + return i18nText("Fine-Designer_PC_Fit_Attr"); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 8d2748eb39..ec3852437b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -14,7 +14,6 @@ import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; -import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; @@ -37,7 +36,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.FormAdaptiveConfigUIProcessor; +import com.fr.design.fit.FormFitAttrAction; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -66,7 +65,6 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.preview.FormPreview; import com.fr.design.preview.MobilePreview; -import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -597,11 +595,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm { - protected UIComboBox comboBox; public FRAbsoluteLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -34,40 +19,8 @@ public class FRAbsoluteLayoutDefinePane extends AbstractFRLayoutDefinePane { - private static final int ADAPT_LABEL_MAX_WIDTH = 80; private XWFitLayout xWFitLayout; private WFitLayout wFitLayout; - private UIComboBox layoutComboBox; - private UIComboBox adaptComboBox; private UISpinner componentIntervel; private PaddingBoundPane paddingBound; private FollowingThemePane themePane; @@ -119,11 +106,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { - Component component = xCreator.getComponent(0); - component.setBounds(xCreator.getBounds()); - } - } - if (!xCreator.acceptType(XOccupiedLayout.class)){ - xwAbsoluteBodyLayout.add(xCreator); - } - - } - copyLayoutAttr(wFitLayout, xwAbsoluteBodyLayout.toData()); - xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); - if (xwAbsoluteBodyLayout.toData() != null) { - xwAbsoluteBodyLayout.toData().setBorderStyleFollowingTheme(wAbsoluteBodyLayout.isBorderStyleFollowingTheme()); - xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle()); - } - xwAbsoluteBodyLayout.refreshStylePreviewEffect(); - if (xWFitLayout.toData() != null) { - xWFitLayout.toData().resetStyle(); - } - xWFitLayout.refreshStylePreviewEffect(); - formDesigner.switchBodyLayout(xwAbsoluteBodyLayout); - return layout; - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - - } - int intervelValue = (int) componentIntervel.getValue(); if (xWFitLayout.canAddInterval(intervelValue)) { // 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 @@ -302,14 +210,6 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Thu, 6 Jan 2022 17:19:17 +0800 Subject: [PATCH 02/16] =?UTF-8?q?Revert=20"REPORT-64445=20=E6=96=B0?= =?UTF-8?q?=E8=80=81=E8=87=AA=E9=80=82=E5=BA=94=E9=85=8D=E7=BD=AE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E4=BF=AE=E6=94=B9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 510117c2a75a9bcb6229832a3bc84f08c047e92c. --- .../gui/ilable/UIAutoChangeLineLabel.java | 78 ---- .../report/fit/AdaptiveFrmFitAttrModel.java | 6 +- .../fr/design/report/fit/BaseFitAttrPane.java | 130 +++++- .../fr/design/report/fit/FitAttrModel.java | 9 - .../com/fr/design/report/fit/FitType.java | 11 - .../report/fit/FormFitAttrModelType.java | 128 ------ .../design/report/fit/FormFitConfigPane.java | 59 --- .../fr/design/report/fit/FrmFitAttrModel.java | 9 +- .../design/report/fit/NewFitPreviewPane.java | 71 ---- .../report/fit/ReportFitConfigPane.java | 172 -------- .../com/fr/design/fit/FormFitAttrAction.java | 85 ---- .../com/fr/design/fit/FormFitAttrPane.java | 377 ------------------ .../java/com/fr/design/mainframe/JForm.java | 14 +- .../FRAbsoluteBodyLayoutDefinePane.java | 110 ++++- .../layout/FRAbsoluteLayoutDefinePane.java | 54 ++- .../layout/FRFitLayoutDefinePane.java | 118 +++++- 16 files changed, 399 insertions(+), 1032 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java deleted file mode 100644 index d2bb0450b1..0000000000 --- a/designer-base/src/main/java/com/fr/design/gui/ilable/UIAutoChangeLineLabel.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fr.design.gui.ilable; - -import javax.swing.JLabel; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.util.ArrayList; -import java.util.List; - -public class UIAutoChangeLineLabel extends JLabel { - private final String text; - private final int width; - - - public UIAutoChangeLineLabel(String text, int width) { - super(text); - this.text = text; - this.width = width; - } - - - @Override - public void doLayout() { - super.doLayout(); - this.setText(wrapperHtmlText()); - } - - private String wrapperHtmlText() { - List stringList = autoChangeLine(this.getWidth()); - StringBuilder builder = new StringBuilder(""); - for (String s : stringList) { - //用THML标签进行拼接,以实现自动换行 - builder.append(s).append("
"); - } - builder.append(""); - return builder.toString(); - } - - private List autoChangeLine(int width) { - List result = new ArrayList<>(); - if (width <= 0) { - result.add(this.text); - } else { - - char[] chars = this.text.toCharArray(); - //获取字体计算大小 - FontMetrics fontMetrics = this.getFontMetrics(this.getFont()); - int start = 0; - int len = 0; - while (start + len < this.text.length()) { - while (true) { - len++; - if (start + len > this.text.length()) - break; - if (fontMetrics.charsWidth(chars, start, len) - > width) { - break; - } - } - result.add(String.copyValueOf(chars, start, len - 1)); - start = start + len - 1; - len = 0; - } - if (this.text.length() - start > 0) { - result.add(String.copyValueOf(chars, start, this.text.length() - start)); - } - } - return result; - } - - - @Override - public Dimension getPreferredSize() { - Dimension preferredSize = super.getPreferredSize(); - List stringList = autoChangeLine(width); - FontMetrics fontMetrics = this.getFontMetrics(this.getFont()); - return new Dimension(preferredSize.width, fontMetrics.getHeight() * stringList.size()); - } -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java index 8c5e8858ac..9e60c6cc84 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/AdaptiveFrmFitAttrModel.java @@ -13,7 +13,11 @@ import com.fr.report.fit.ReportFitAttr; public class AdaptiveFrmFitAttrModel extends AbstractFitAttrModelProvider { public FitType[] getFitTypes() { - return new FitType[0]; + return new FitType[]{ + FitType.DOUBLE_FIT, + FitType.HORIZONTAL_FIT, + FitType.NOT_FIT + }; } public String getFitName() { diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java index 48d6a5686e..2c38d597c4 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -2,17 +2,27 @@ package com.fr.design.report.fit; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.report.fit.menupane.FitPreviewPane; +import com.fr.design.report.fit.menupane.FitRadioGroup; +import com.fr.design.report.fit.menupane.FontRadioGroup; import com.fr.design.report.fit.provider.FitAttrModelProvider; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; import com.fr.report.fit.ReportFitAttr; import javax.swing.*; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemListener; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.stream.Collectors; @@ -25,8 +35,11 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected UILabel belowSetLabel; protected UIComboBox itemChoose; protected java.util.List fitAttrModelList = new ArrayList<>(); - private ReportFitConfigPane fitConfigPane; + public FontRadioGroup fontRadioGroup; + public FitRadioGroup adaptRadioGroup; + public JPanel attrJPanel; + public FitPreviewPane previewJPanel; public FitAttrModel fitAttrModel; private static final int BELOW_SET_COMPONENT_HSPACE = 8; @@ -51,27 +64,128 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected void populateModel(FitAttrModel fitAttrModel) { this.fitAttrModel = fitAttrModel; - if (fitConfigPane != null) { - contentJPanel.remove(fitConfigPane); + if (attrJPanel != null) { + contentJPanel.remove(attrJPanel); } - this.fitConfigPane = fitAttrModel instanceof CptFitAttrModel ? new ReportFitConfigPane(fitAttrModel, true) : new FormFitConfigPane(fitAttrModel, true); - contentJPanel.add(fitConfigPane); + if (previewJPanel != null) { + contentJPanel.remove(previewJPanel); + } + + fontRadioGroup = new FontRadioGroup(); + adaptRadioGroup = new FitRadioGroup(); + initAttrJPanel(); + initPreviewJPanel(); } + + protected void initAttrJPanel() { + int colCount = fitAttrModel.getFitTypes().length + 1; + Component[][] components = new Component[2][colCount]; + initFitRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, components[0]); + initFitRadioGroup(adaptRadioGroup, fitAttrModel.getFitName(), Arrays.stream(fitAttrModel.getFitTypes()).map(FitType::description).toArray(String[]::new), components[1]); + + double[] rowSize = new double[2]; + double[] columnSize = new double[colCount]; + for (int i = 0; i < rowSize.length; i++) { + rowSize[i] = 20; + } + for (int i = 0; i < columnSize.length; i++) { + if (i == 0) { + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth(); + } else { + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); + } + } + + attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); + contentJPanel.add(attrJPanel); + } + + private void initFitRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { + components[0] = new UILabel(name); + for (int i = 0; i < options.length; i++) { + + if (options[i] != null) { + UIRadioButton fontFitRadio = new UIRadioButton(options[i]); + fitRadioGroup.add(fontFitRadio); + components[i + 1] = fontFitRadio; + } else { + components[i + 1] = null; + } + } + fitRadioGroup.addActionListener(getPreviewActionListener()); + } + + protected ActionListener getPreviewActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshPreviewJPanel(); + } + }; + } + + protected void refreshPreviewJPanel() { + String previewIndex = getPreviewIndex(); + previewJPanel.refreshPreview(previewIndex, fontRadioGroup.isEnabled()); + } + + protected String getPreviewIndex() { + return getStateInPC(adaptRadioGroup.getSelectRadioIndex()) + "" + fontRadioGroup.getSelectRadioIndex(); + } + + protected void initPreviewJPanel() { + previewJPanel = new FitPreviewPane(); + previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0)); + contentJPanel.add(previewJPanel); + } + + private int getPreviewJPanelLeft() { + int left = 0; + if (belowSetLabel.getPreferredSize() != null) { + left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE; + } + return left; + } + + protected int getStateInPC(int index) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + return fitTypes[index].getState(); + } + + protected int getOptionIndex(int state) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + for (int i = 0; i < fitTypes.length; i++) { + if (ComparatorUtils.equals(state, fitTypes[i].getState())) { + return i; + } + } + return 0; + } + + @Override public void populateBean(ReportFitAttr ob) { - this.fitConfigPane.populateBean(ob); + fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); + adaptRadioGroup.selectIndexButton(getOptionIndex(ob.fitStateInPC())); + refreshPreviewJPanel(); } @Override public ReportFitAttr updateBean() { - return this.fitConfigPane.updateBean(); + ReportFitAttr reportFitAttr = new ReportFitAttr(); + reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); + reportFitAttr.setFitStateInPC(getStateInPC(adaptRadioGroup.getSelectRadioIndex())); + return reportFitAttr; } public void setEnabled(boolean enabled) { super.setEnabled(enabled); - this.fitConfigPane.setEnabled(enabled); + fontRadioGroup.setEnabled(enabled); + adaptRadioGroup.setEnabled(enabled); + refreshPreviewJPanel(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java index 2a834eebd8..1d1ac02f0d 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java @@ -3,8 +3,6 @@ package com.fr.design.report.fit; import com.fr.design.mainframe.JTemplate; import com.fr.report.fit.ReportFitAttr; -import java.util.Arrays; - public interface FitAttrModel { /** * @Description 名称,比如:普通报表、决策报表等 @@ -21,12 +19,6 @@ public interface FitAttrModel { **/ FitType[] getFitTypes(); - /** - * @Description 表格自适应选项名称集合 - **/ - default String[] getFitTypeNames(){ - return Arrays.stream(getFitTypes()).map(FitType::description).toArray(String[]::new); - } /** * @Description 获取全局的自适应属性 @@ -49,5 +41,4 @@ public interface FitAttrModel { * @param: jTemplate **/ boolean isAvailable(JTemplate jTemplate); - } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FitType.java b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java index dd4888b4e5..00aceb6eb1 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FitType.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitType.java @@ -60,17 +60,6 @@ public enum FitType { return DEFAULT; } - public static FitType parseByFitState(int state) { - - for (FitType attrState : values()) { - if (attrState.state == state) { - return attrState; - } - } - - return DEFAULT; - } - public int getState() { return this.state; } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java b/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java deleted file mode 100644 index a77566442d..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/FormFitAttrModelType.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.fr.design.report.fit; - - -import com.fr.design.designer.properties.items.Item; -import com.fr.form.fit.common.LightTool; -import com.fr.form.main.BodyScaleAttrTransformer; -import com.fr.form.main.Form; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WBodyLayoutType; -import com.fr.form.ui.container.WFitLayout; - -public enum FormFitAttrModelType { - PLAIN_FORM_FIT_ATTR_MODEL { - @Override - public FitAttrModel getFitAttrModel() { - return new FrmFitAttrModel(); - } - - @Override - public Item[] getFitLayoutScaleAttr() { - return new Item[]{ - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN)}; - - } - - @Override - public Item[] getAbsoluteLayoutSaleAttr() { - return new Item[]{ - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) - }; - } - - - @Override - public int getScaleAttrShowIndex(WFitLayout wFitLayout) { - int scale = wFitLayout.getScaleAttr(); - if (wFitLayout.getBodyLayoutType() == WBodyLayoutType.FIT) { - return BodyScaleAttrTransformer.getFitBodyCompStateFromScaleAttr(scale); - } else { - return BodyScaleAttrTransformer.getAbsoluteBodyCompStateFromScaleAttr(scale); - } - } - - @Override - public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { - if (wBodyLayoutType == WBodyLayoutType.FIT) { - if (showIndex == 0) { - return WFitLayout.SCALE_FULL; - } else { - return WFitLayout.SCALE_HOR; - } - } else { - if (showIndex == 0) { - return WFitLayout.SCALE_FULL; - } else { - return WFitLayout.SCALE_NO; - } - } - } - - - }, - NEW_FORM_FIT_ATTR_MODEL { - @Override - public FitAttrModel getFitAttrModel() { - return new AdaptiveFrmFitAttrModel(); - } - - @Override - public Item[] getFitLayoutScaleAttr() { - return new Item[]{ - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), 2)}; - } - - @Override - public Item[] getAbsoluteLayoutSaleAttr() { - return new Item[]{ - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), - new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode_Fixed"), 2)}; - } - - - @Override - public int getScaleAttrShowIndex(WFitLayout wFitLayout) { - int scale = wFitLayout.getScaleAttr(); - if (scale == WFitLayout.SCALE_NO) { - return 2; - } else if (scale == WFitLayout.SCALE_HOR) { - return 1; - } else { - return 0; - } - } - - @Override - public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { - if (showIndex == 0) { - return WFitLayout.SCALE_FULL; - } else if (showIndex == 1) { - return WFitLayout.SCALE_HOR; - } else { - return WFitLayout.SCALE_NO; - } - } - - - }; - - public abstract FitAttrModel getFitAttrModel(); - - public abstract Item[] getFitLayoutScaleAttr(); - - public abstract Item[] getAbsoluteLayoutSaleAttr(); - - public abstract int getScaleAttrShowIndex(WFitLayout wFitLayout); - - public abstract int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType); - - - public static FormFitAttrModelType parse(Form form) { - return LightTool.containNewFormFlag(form) ? NEW_FORM_FIT_ATTR_MODEL : PLAIN_FORM_FIT_ATTR_MODEL; - } -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java deleted file mode 100644 index 08b70cb772..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/FormFitConfigPane.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fr.design.report.fit; - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; - -public class FormFitConfigPane extends ReportFitConfigPane { - private static final int DEFAULT_ITEM = 0; - private static final int CUSTOM_ITEM = 1; - - public FormFitConfigPane(FitAttrModel fitAttrModel) { - this(fitAttrModel, false); - } - - public FormFitConfigPane(FitAttrModel fitAttrModel, boolean globalConfig) { - super(fitAttrModel, globalConfig); - } - - protected JPanel initECConfigPane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - if (fitAttrModel.getFitTypeNames().length != 0) { - Component[] ecComponents = new Component[fitAttrModel.getFitTypeNames().length + 1]; - initRadioGroup(ecConfigRadioGroup, fitAttrModel.getFitName(), fitAttrModel.getFitTypeNames(), ecComponents); - jPanel.add(createSubAttrPane(ecComponents), BorderLayout.CENTER); - jPanel.add(createTipPane(), BorderLayout.SOUTH); - } - return jPanel; - } - - private JPanel createTipPane() { - JPanel jPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip1")); - jPanel.add(label1); - label1.setForeground(Color.lightGray); - UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_Tip2")); - jPanel.add(label2); - label2.setForeground(Color.lightGray); - return jPanel; - } - - protected void refreshPreviewJPanel() { - previewJPanel.refreshPreview(fontRadioGroup.isFontFit()); - } - - protected void populateECConfigRadioGroup(int fitStateInPC) { - ecConfigRadioGroup.selectIndexButton(fitStateInPC == 0 ? DEFAULT_ITEM : CUSTOM_ITEM); - } - - protected void updateECConfigRadioGroup(ReportFitAttr reportFitAttr) { - reportFitAttr.setFitStateInPC(ecConfigRadioGroup.getSelectRadioIndex()); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java index 81ee474de1..c4bdaf6de2 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java @@ -17,7 +17,7 @@ public class FrmFitAttrModel implements FitAttrModel { @Override public String getFitName() { - return Toolkit.i18nText("Fine-Design_Form_PC_FIT_Config_EC_Label"); + return Toolkit.i18nText("Fine-Designer_Fit-Element"); } public FitType[] getFitTypes() { @@ -29,13 +29,6 @@ public class FrmFitAttrModel implements FitAttrModel { }; } - @Override - public String[] getFitTypeNames() { - return new String[]{ - Toolkit.i18nText("Fine-Designer_Fit-Default"), Toolkit.i18nText("Fine-Design_Basic_Custom") - }; - } - @Override public ReportFitAttr getGlobalReportFitAttr() { return ReportFitConfig.getInstance().getFrmFitAttr(); diff --git a/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java b/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java deleted file mode 100644 index 8b0710de3f..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/NewFitPreviewPane.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.fr.design.report.fit; - -import com.fr.base.GraphHelper; -import com.fr.general.FRFont; - -import javax.swing.JPanel; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; - - -public class NewFitPreviewPane extends JPanel { - private boolean fitFont = false; - private FitType fitType = FitType.DOUBLE_FIT; - private static final Color DEFAULT_PAINT_COLOR = Color.decode("#419BF9"); - private static final int FIT_FONT_SIZE = 15; - private static final int NO_FIT_FONT_SIZE = 9; - private static final Dimension NO_FIT_CONTAINER_DIMENSION = new Dimension(200, 136); - - @Override - public void paint(Graphics g) { - super.paint(g); - g.setColor(Color.GRAY); - GraphHelper.drawRect(g, 1, 1, this.getWidth() - 2, this.getHeight() - 2); - g.setColor(DEFAULT_PAINT_COLOR); - FRFont textFont = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, fitFont ? FIT_FONT_SIZE : NO_FIT_FONT_SIZE); - g.setFont(textFont); - Dimension dimension = calculateCellDimension(); - GraphHelper.drawLine(g, 1, dimension.height, dimension.width * 2 - 1, dimension.height); - GraphHelper.drawLine(g, dimension.width, 1, dimension.width, dimension.height * 2 - 1); - GraphHelper.drawRect(g, 1, 1, dimension.width * 2 - 2, dimension.height * 2 - 2); - double startX = calculateTextDrawStartX(dimension.width, this.getFontMetrics(textFont), "text1"); - double startY = calculateTextDrawStartY(dimension.height); - GraphHelper.drawString(g, "text1", startX, startY); - GraphHelper.drawString(g, "text2", dimension.width + startX, startY); - GraphHelper.drawString(g, "text3", startX, dimension.height + startY); - GraphHelper.drawString(g, "text4", dimension.width + startX, dimension.height + startY); - } - - private Dimension calculateCellDimension() { - if (fitType == FitType.DOUBLE_FIT) { - return new Dimension(this.getWidth() / 2, this.getHeight() / 2); - } else if (fitType == FitType.NOT_FIT) { - return new Dimension(NO_FIT_CONTAINER_DIMENSION.width / 2, NO_FIT_CONTAINER_DIMENSION.height / 2); - } else { - return new Dimension(this.getWidth() / 2, NO_FIT_CONTAINER_DIMENSION.height / 2); - } - } - - private double calculateTextDrawStartX(int containerWidth, FontMetrics fontMetrics, String text) { - return (containerWidth - fontMetrics.stringWidth(text)) / 2.0D; - } - - private double calculateTextDrawStartY(int containerHeight) { - return containerHeight / 2.0D; - } - - public void refreshPreview(boolean fitFont, FitType fitType) { - this.fitFont = fitFont; - this.fitType = fitType; - repaint(); - } - - public void refreshPreview(boolean fitFont) { - this.fitFont = fitFont; - repaint(); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java b/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java deleted file mode 100644 index 399e7fef93..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/ReportFitConfigPane.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.fr.design.report.fit; - -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.report.fit.menupane.FitRadioGroup; -import com.fr.design.report.fit.menupane.FontRadioGroup; -import com.fr.general.ComparatorUtils; -import com.fr.report.fit.ReportFitAttr; - -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.ActionEvent; -import java.awt.event.ActionListener; - -import static com.fr.design.i18n.Toolkit.i18nText; - -public class ReportFitConfigPane extends JPanel { - public FontRadioGroup fontRadioGroup; - public FitRadioGroup ecConfigRadioGroup; - protected NewFitPreviewPane previewJPanel; - protected FitAttrModel fitAttrModel; - protected boolean globalConfig; - - - public ReportFitConfigPane(FitAttrModel fitAttrModel, boolean globalConfig) { - this.fitAttrModel = fitAttrModel; - this.globalConfig = globalConfig; - initComponent(); - } - - private void initComponent() { - JPanel contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); - this.add(contentJPanel); - fontRadioGroup = new FontRadioGroup(); - ecConfigRadioGroup = new FitRadioGroup(); - contentJPanel.add(initAttrJPanel()); - contentJPanel.add(initPreviewJPanel()); - } - - private JPanel initAttrJPanel() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - Component[] fontComponents = new Component[3]; - initRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, fontComponents); - jPanel.add(createSubAttrPane(fontComponents), BorderLayout.NORTH); - jPanel.add(initECConfigPane(), BorderLayout.CENTER); - return jPanel; - } - - protected JPanel initECConfigPane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - Component[] ecComponents = new Component[fitAttrModel.getFitTypeNames().length + 1]; - initRadioGroup(ecConfigRadioGroup, fitAttrModel.getFitName(), fitAttrModel.getFitTypeNames(), ecComponents); - jPanel.add(createSubAttrPane(ecComponents), BorderLayout.CENTER); - return jPanel; - } - - - protected JPanel createSubAttrPane(Component[] components) { - double[] rowSize = new double[]{20}; - double[] columnSize = new double[components.length]; - for (int i = 0; i < columnSize.length; i++) { - if (i == 0) { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth(); - } else { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); - } - } - - JPanel attrJPanel = TableLayoutHelper.createTableLayoutPane(new Component[][]{components}, rowSize, columnSize); - attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - return attrJPanel; - } - - protected void initRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { - components[0] = new UILabel(name); - for (int i = 0; i < options.length; i++) { - - if (options[i] != null) { - UIRadioButton fontFitRadio = new UIRadioButton(options[i]); - fitRadioGroup.add(fontFitRadio); - components[i + 1] = fontFitRadio; - } else { - components[i + 1] = null; - } - } - fitRadioGroup.addActionListener(getPreviewActionListener()); - } - - private ActionListener getPreviewActionListener() { - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - refreshPreviewJPanel(); - } - }; - } - - public void refreshPreviewJPanel(FitType fitType) { - previewJPanel.refreshPreview(fontRadioGroup.isFontFit(), fitType); - } - - protected void refreshPreviewJPanel() { - previewJPanel.refreshPreview(fontRadioGroup.isFontFit(), FitType.parse(updateBean())); - } - - private JPanel initPreviewJPanel() { - JPanel wrapperPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewJPanel = new NewFitPreviewPane(); - wrapperPane.add(previewJPanel, BorderLayout.CENTER); - int leftIndent = globalConfig ? (int) DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth() : 0; - wrapperPane.setBorder(BorderFactory.createEmptyBorder(0, leftIndent, 0, 0)); - wrapperPane.setPreferredSize(new Dimension(300 + leftIndent, 204)); - return wrapperPane; - } - - - public void populateBean(ReportFitAttr ob) { - fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); - populateECConfigRadioGroup(ob.fitStateInPC()); - refreshPreviewJPanel(); - } - - protected void populateECConfigRadioGroup(int fitStateInPC){ - ecConfigRadioGroup.selectIndexButton(getOptionIndex(fitStateInPC)); - } - - - protected void updateECConfigRadioGroup(ReportFitAttr reportFitAttr){ - reportFitAttr.setFitStateInPC(getStateInPC(ecConfigRadioGroup.getSelectRadioIndex())); - } - - public ReportFitAttr updateBean() { - ReportFitAttr reportFitAttr = new ReportFitAttr(); - reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); - updateECConfigRadioGroup(reportFitAttr); - return reportFitAttr; - } - - - protected int getStateInPC(int index) { - FitType[] fitTypes = fitAttrModel.getFitTypes(); - if (index > fitTypes.length - 1) { - return index; - } - return fitTypes[index].getState(); - } - - protected int getOptionIndex(int state) { - FitType[] fitTypes = fitAttrModel.getFitTypes(); - for (int i = 0; i < fitTypes.length; i++) { - if (ComparatorUtils.equals(state, fitTypes[i].getState())) { - return i; - } - } - return 0; - } - - - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - fontRadioGroup.setEnabled(enabled); - ecConfigRadioGroup.setEnabled(enabled); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java deleted file mode 100644 index dad6e9be9c..0000000000 --- a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrAction.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.fr.design.fit; - -import com.fr.design.actions.JTemplateAction; -import com.fr.design.beans.BasicBeanPane; -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.mainframe.JTemplate; -import com.fr.design.menu.MenuKeySet; -import com.fr.design.report.fit.FormFitAttrModelType; -import com.fr.form.main.Form; -import com.fr.report.fit.FitProvider; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.KeyStroke; -import java.awt.Dimension; -import java.awt.event.ActionEvent; - -public class FormFitAttrAction extends JTemplateAction { - private static final MenuKeySet REPORT_FIT_ATTR = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'T'; - } - - @Override - public String getMenuName() { - return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - public FormFitAttrAction(JTemplate jTemplate) { - super(jTemplate); - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(REPORT_FIT_ATTR); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon("/com/fr/design/images/reportfit/fit"); - } - - /** - * Action触发事件 - * - * @param e 事件 - */ - @Override - public void actionPerformed(ActionEvent e) { - final JTemplate jwb = getEditingComponent(); - if (jwb == null || !(jwb.getTarget() instanceof Form)) { - return; - } - JForm jForm = (JForm) jwb; - Form wbTpl = jForm.getTarget(); - ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); - FormFitAttrPane formFitAttrPane = new FormFitAttrPane(jForm, FormFitAttrModelType.parse(wbTpl)); - showReportFitDialog(fitAttr, jwb, wbTpl, formFitAttrPane); - } - - private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { - attrPane.populateBean(fitAttr); - UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - fireEditingOk(jwb, wbTpl, attrPane.updateBean(), fitAttr); - } - }, new Dimension(660, 600)); - dialog.setVisible(true); - } - - private void fireEditingOk(final JTemplate jwb, final FitProvider wbTpl, ReportFitAttr newReportFitAttr, ReportFitAttr oldReportFitAttr) { - wbTpl.setReportFitAttr(newReportFitAttr); - jwb.fireTargetModified(); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java deleted file mode 100644 index 51eda6d36e..0000000000 --- a/designer-form/src/main/java/com/fr/design/fit/FormFitAttrPane.java +++ /dev/null @@ -1,377 +0,0 @@ -package com.fr.design.fit; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XOccupiedLayout; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWScaleLayout; -import com.fr.design.designer.properties.items.FRLayoutTypeItems; -import com.fr.design.designer.properties.items.Item; -import com.fr.design.dialog.FineJOptionPane; -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.layout.TableLayoutHelper; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.report.fit.FitType; -import com.fr.design.report.fit.FormFitAttrModelType; -import com.fr.design.report.fit.FormFitConfigPane; -import com.fr.design.report.fit.ReportFitConfigPane; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.form.main.Form; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WAbsoluteBodyLayout; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WBodyLayoutType; -import com.fr.form.ui.container.WFitLayout; -import com.fr.form.ui.container.WSortLayout; -import com.fr.general.ComparatorUtils; -import com.fr.general.act.BorderPacker; -import com.fr.log.FineLoggerFactory; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -import static com.fr.design.i18n.Toolkit.i18nText; -import static javax.swing.JOptionPane.*; - -public class FormFitAttrPane extends BasicBeanPane { - - private UIComboBox layoutComboBox; - private UIComboBox scaleComboBox; - private FormFitAttrModelType fitAttrModelType; - - protected UIComboBox itemChoose; - - private JForm jForm; - private ReportFitConfigPane fitConfigPane; - - public FormFitAttrPane(JForm jForm, FormFitAttrModelType fitAttrModelType) { - this.fitAttrModelType = fitAttrModelType; - this.jForm = jForm; - initComponents(); - } - - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 5)); - this.add(createReportFitSettingPane(), BorderLayout.CENTER); - this.add(createReportLayoutSettingPane(), BorderLayout.NORTH); - - } - - - private JPanel createReportLayoutSettingPane() { - JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Layout")); - jPanel.add(createAreaScalePane(), BorderLayout.CENTER); - jPanel.setPreferredSize(new Dimension(640, 84)); - return jPanel; - } - - protected String[] getItemNames() { - return new String[]{Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"), - Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")}; - } - - - private JPanel createReportFitSettingPane() { - JPanel jPanel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Content_Attr")); - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(contentPane, BorderLayout.CENTER); - UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Settings")); - label.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); - contentPane.add(label, BorderLayout.WEST); - label.setPreferredSize(new Dimension(100, 0)); - label.setVerticalAlignment(SwingConstants.TOP); - itemChoose = new UIComboBox(getItemNames()); - itemChoose.setPreferredSize(new Dimension(160, 20)); - Form form = jForm.getTarget(); - itemChoose.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (isTemplateSingleSet()) { - if (form != null) { - ReportFitAttr fitAttr = form.getReportFitAttr(); - populate(fitAttr); - } - } else { - populate(fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr()); - } - } - } - }); - JPanel centerPane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); - centerPane.add(itemChoose); - centerPane.add(fitConfigPane = new FormFitConfigPane(this.fitAttrModelType.getFitAttrModel())); - contentPane.add(centerPane, BorderLayout.CENTER); - return jPanel; - } - - public void populate(ReportFitAttr reportFitAttr) { - if (reportFitAttr == null) { - reportFitAttr = fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr(); - } - - this.setEnabled(isTemplateSingleSet()); - fitConfigPane.populateBean(reportFitAttr); - } - - - public ReportFitAttr updateBean() { - updateLayoutType(); - if (!isTemplateSingleSet()) { - return null; - } else { - return fitConfigPane.updateBean(); - } - } - - private void updateLayoutType() { - XLayoutContainer xLayoutContainer = this.jForm.getRootComponent(); - if (xLayoutContainer == null || !xLayoutContainer.acceptType(XWFitLayout.class)) { - return; - } - XWFitLayout xwFitLayout = (XWFitLayout) xLayoutContainer; - WFitLayout wFitLayout = xwFitLayout.toData(); - int state = layoutComboBox.getSelectedIndex(); - WBodyLayoutType selectType = WBodyLayoutType.parse(state); - if (selectType != wFitLayout.getBodyLayoutType()) { - wFitLayout.setLayoutType(selectType); - //从自适应布局切换到绝对布局 - if (selectType == WBodyLayoutType.ABSOLUTE) { - switchLayoutFromFit2Absolute(xwFitLayout); - } else { - //从绝对布局切换到自适应布局 - switchLayoutFromAbsolute2Fit(xwFitLayout); - } - } - wFitLayout.setCompatibleScaleAttr(fitAttrModelType.parseScaleAttrFromShowIndex(this.scaleComboBox.getSelectedIndex(), wFitLayout.getBodyLayoutType())); - } - - - private void switchLayoutFromFit2Absolute(XWFitLayout xWFitLayout) { - try { - WFitLayout layout = xWFitLayout.toData(); - WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); - wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); - // 切换布局类型时,保留body背景样式 - wAbsoluteBodyLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); - wAbsoluteBodyLayout.setBorderStyle((BorderPacker) (layout.getBorderStyle().clone())); - Component[] components = xWFitLayout.getComponents(); - Rectangle[] backupBounds = getBackupBoundsFromFitLayout(xWFitLayout); - xWFitLayout.removeAll(); - layout.resetStyle(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); - xWFitLayout.setFixLayout(false); - xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); - for (int i = 0; i < components.length; i++) { - XCreator xCreator = (XCreator) components[i]; - xCreator.setBounds(backupBounds[i]); - //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 - if (xCreator.acceptType(XWScaleLayout.class)) { - if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { - Component component = xCreator.getComponent(0); - component.setBounds(xCreator.getBounds()); - } - } - if (!xCreator.acceptType(XOccupiedLayout.class)) { - xwAbsoluteBodyLayout.add(xCreator); - } - - } - copyLayoutAttr(layout, xwAbsoluteBodyLayout.toData()); - xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); - if (xwAbsoluteBodyLayout.toData() != null) { - xwAbsoluteBodyLayout.toData().setBorderStyleFollowingTheme(wAbsoluteBodyLayout.isBorderStyleFollowingTheme()); - xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle()); - } - xwAbsoluteBodyLayout.refreshStylePreviewEffect(); - if (xWFitLayout.toData() != null) { - xWFitLayout.toData().resetStyle(); - } - xWFitLayout.refreshStylePreviewEffect(); - formDesigner.switchBodyLayout(xwAbsoluteBodyLayout); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - - } - } - - private Rectangle[] getBackupBoundsFromFitLayout(XWFitLayout xWFitLayout) { - int count = xWFitLayout.getComponentCount(); - Rectangle[] rectangles = new Rectangle[count]; - for (int i = 0; i < count; i++) { - rectangles[i] = xWFitLayout.getComponent(i).getBounds(); - } - return rectangles; - } - - protected void copyLayoutAttr(WSortLayout srcLayout, WSortLayout destLayout) { - destLayout.clearListeners(); - destLayout.clearMobileWidgetList(); - for (int i = 0, len = srcLayout.getMobileWidgetListSize(); i < len; i++) { - destLayout.addMobileWidget(srcLayout.getMobileWidget(i)); - } - destLayout.setSorted(true); - for (int i = 0, len = srcLayout.getListenerSize(); i < len; i++) { - destLayout.addListener(srcLayout.getListener(i)); - } - srcLayout.clearListeners(); - srcLayout.clearMobileWidgetList(); - } - - - private void switchLayoutFromAbsolute2Fit(XWFitLayout xwFitLayout) { - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = getAbsoluteBodyLayout(xwFitLayout); - if (xwAbsoluteBodyLayout == null) { - return; - } - WAbsoluteBodyLayout layout = xwAbsoluteBodyLayout.toData(); - WFitLayout wFitLayout = xwFitLayout.toData(); - wFitLayout.resetStyle(); - xwFitLayout.switch2FitBodyLayout(xwAbsoluteBodyLayout); - // 切换布局类型时,保留body背景样式 - if (wFitLayout != null) { - wFitLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); - wFitLayout.setBorderStyle(layout.getBorderStyle()); - } - copyLayoutAttr(layout, xwFitLayout.toData()); - - copyLayoutAttr(layout, xwFitLayout.toData()); - xwFitLayout.refreshStylePreviewEffect(); - } - - private XWAbsoluteBodyLayout getAbsoluteBodyLayout(XWFitLayout xwFitLayout) { - if (xwFitLayout != null && xwFitLayout.getComponentCount() > 0) { - Component component = xwFitLayout.getComponent(0); - if (component instanceof XWAbsoluteBodyLayout) { - return (XWAbsoluteBodyLayout) component; - } - } - return null; - } - - private JPanel createAreaScalePane() { - initLayoutComboBox(); - - UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); - UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_PC_Fit_Config_Scale_Setting")); - Component[][] components = new Component[][]{ - {layoutTypeLabel, layoutComboBox}, - {scaleModeLabel, scaleComboBox} - }; - JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, - TableLayoutHelper.FILL_LASTCOLUMN, 20, IntervalConstants.INTERVAL_L1); - JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - containerPane.add(contentPane, BorderLayout.CENTER); - - return containerPane; - } - - - public void initLayoutComboBox() { - Item[] items = FRLayoutTypeItems.ITEMS; - DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (Item item : items) { - model.addElement(item); - } - scaleComboBox = new UIComboBox(model); - scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getFitLayoutScaleAttr())); - layoutComboBox = new UIComboBox(model); - layoutComboBox.setPreferredSize(new Dimension(160, 20)); - scaleComboBox.setPreferredSize(new Dimension(160, 20)); - WFitLayout wFitLayout = jForm.getTarget().getWFitLayout(); - layoutComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - int selectIndex = layoutComboBox.getSelectedIndex(); - if (selectIndex == 0) { - if (wFitLayout.getBodyLayoutType() == WBodyLayoutType.ABSOLUTE) { - int selVal = FineJOptionPane.showConfirmDialog( - FormFitAttrPane.this, - Toolkit.i18nText("Fine-Design_Form_Layout_Switch_Tip"), - Toolkit.i18nText("Fine-Design_Basic_Alert"), - OK_CANCEL_OPTION, - WARNING_MESSAGE - ); - if (OK_OPTION != selVal) { - layoutComboBox.setSelectedIndex(1); - return; - } - } - scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getFitLayoutScaleAttr())); - } else { - scaleComboBox.setModel(new DefaultComboBoxModel(fitAttrModelType.getAbsoluteLayoutSaleAttr())); - } - scaleComboBox.setSelectedIndex(0); - } - }); - - scaleComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - WBodyLayoutType selectBodyType = WBodyLayoutType.parse(layoutComboBox.getSelectedIndex()); - int state = fitAttrModelType.parseScaleAttrFromShowIndex(scaleComboBox.getSelectedIndex(), selectBodyType); - fitConfigPane.refreshPreviewJPanel(FitType.parseByFitState(state)); - } - }); - } - - - @Override - public void populateBean(ReportFitAttr reportFitAttr) { - WFitLayout wFitLayout = jForm.getTarget().getWFitLayout(); - layoutComboBox.setSelectedIndex(wFitLayout.getBodyLayoutType().getTypeValue()); - scaleComboBox.setSelectedIndex(fitAttrModelType.getScaleAttrShowIndex(wFitLayout)); - - if (reportFitAttr == null) { - itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings")); - } else { - itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")); - } - if (reportFitAttr == null) { - reportFitAttr = fitAttrModelType.getFitAttrModel().getGlobalReportFitAttr(); - } - setEnabled(isTemplateSingleSet()); - fitConfigPane.populateBean(reportFitAttr); - } - - private boolean isTemplateSingleSet() { - return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), itemChoose.getSelectedItem()); - } - - - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - fitConfigPane.setEnabled(enabled); - } - - @Override - protected String title4PopupWindow() { - return i18nText("Fine-Designer_PC_Fit_Attr"); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ec3852437b..8d2748eb39 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -14,6 +14,7 @@ import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; @@ -36,7 +37,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fit.FormFitAttrAction; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -65,6 +66,7 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.preview.FormPreview; import com.fr.design.preview.MobilePreview; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -595,7 +597,11 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm { + protected UIComboBox comboBox; public FRAbsoluteLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -19,8 +34,40 @@ public class FRAbsoluteLayoutDefinePane extends AbstractFRLayoutDefinePane { + private static final int ADAPT_LABEL_MAX_WIDTH = 80; private XWFitLayout xWFitLayout; private WFitLayout wFitLayout; + private UIComboBox layoutComboBox; + private UIComboBox adaptComboBox; private UISpinner componentIntervel; private PaddingBoundPane paddingBound; private FollowingThemePane themePane; @@ -106,7 +119,11 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + Component component = xCreator.getComponent(0); + component.setBounds(xCreator.getBounds()); + } + } + if (!xCreator.acceptType(XOccupiedLayout.class)){ + xwAbsoluteBodyLayout.add(xCreator); + } + + } + copyLayoutAttr(wFitLayout, xwAbsoluteBodyLayout.toData()); + xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); + if (xwAbsoluteBodyLayout.toData() != null) { + xwAbsoluteBodyLayout.toData().setBorderStyleFollowingTheme(wAbsoluteBodyLayout.isBorderStyleFollowingTheme()); + xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle()); + } + xwAbsoluteBodyLayout.refreshStylePreviewEffect(); + if (xWFitLayout.toData() != null) { + xWFitLayout.toData().resetStyle(); + } + xWFitLayout.refreshStylePreviewEffect(); + formDesigner.switchBodyLayout(xwAbsoluteBodyLayout); + return layout; + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + + } + int intervelValue = (int) componentIntervel.getValue(); if (xWFitLayout.canAddInterval(intervelValue)) { // 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 @@ -210,6 +302,14 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Fri, 14 Jan 2022 10:14:54 +0800 Subject: [PATCH 03/16] =?UTF-8?q?REPORT-65194=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=AE=A1=E7=AE=97=E8=AE=A1=E7=AE=97=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E6=8F=90=E7=A4=BA=E6=A1=86=E5=86=85=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=B8=8D=E6=AD=A3=E7=A1=AE=201.=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=BC=82=E5=B8=B8=E7=9A=84=E6=97=B6=E5=80=99=E7=BB=99?= =?UTF-8?q?warn=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FormulaPane.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index a4354ee9d1..795ff721f0 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -814,10 +814,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String formulaText = formulaTextArea.getText().trim(); String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); if (unSupportFormula != null) { - showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); + showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false, true); return; } + boolean calException = false; String messageTips; FormulaCheckResult checkResult = FormulaChecker.check(formulaText); if (checkResult.grammarValid()) { @@ -846,6 +847,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } catch (Exception ce) { //模拟计算如果出现错误,则抛出错误 calResult = ce.getMessage(); + calException = true; FineLoggerFactory.getLogger().error(ce.getMessage(), ce); messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } @@ -854,7 +856,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { messageTips = checkResult.getTips(); } if (checkResult.isValid()) { - showMessageDialog(messageTips, checkResult.isValid()); + showMessageDialog(messageTips, checkResult.isValid(), calException); } else { confirmCheckResult(checkResult, messageTips); } @@ -871,7 +873,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { if (checkResult.isValid()) { - showMessageDialog(checkResult.getTips(), checkResult.isValid()); + showMessageDialog(checkResult.getTips(), checkResult.isValid(), false); } else { int columns = checkResult.getFormulaCoordinates().getColumns(); String position = StringUtils.EMPTY; @@ -897,8 +899,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return true; } - private void showMessageDialog(String message, boolean formulaValid) { - if (formulaValid) { + private void showMessageDialog(String message, boolean formulaValid, boolean calException) { + if (formulaValid && !calException) { FineJOptionPane.showMessageDialog( FormulaPane.this, message); From b38f99515f5e80fbbcba36d17b620309647c8632 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Jan 2022 11:46:00 +0800 Subject: [PATCH 04/16] =?UTF-8?q?REPORT-65976=20=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6-=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=8B=96=E5=85=A5=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E7=BB=84=E4=BB=B6=EF=BC=8C=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=E9=87=8C=E7=9A=84=E5=AD=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=9A=8F=E7=9D=80=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=E7=9A=84=E5=B0=BA=E5=AF=B8=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=EF=BC=8C=E6=AF=94=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=E5=B0=8F=EF=BC=9B=E6=8B=96=E5=85=A5=E5=88=B0?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E5=9D=97=E9=87=8C=E6=98=AF=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E5=85=85=E6=BB=A1=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/ui/block/LocalWidgetBlock.java | 1 + .../share/ui/block/OnlineWidgetBlock.java | 1 + .../share/ui/block/PreviewWidgetBlock.java | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index 72eb35d000..c23c82f109 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -252,6 +252,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); return null; } + compatibleProcessAbsoluteLayoutResolution(creatorSource); creatorSource.setWidgetID(UUID.randomUUID().toString()); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); //tab布局WCardMainBorderLayout通过反射出来的大小是960*480 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java index 38bcd99826..7f0e369f90 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java @@ -189,6 +189,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); return; } + compatibleProcessAbsoluteLayoutResolution(creatorSource); creatorSource.setWidgetID(UUID.randomUUID().toString()); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); SharableWidgetProvider bindInfo = ShareUtils.getElCaseBindInfoById(shareId); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index 5a19d0216f..6024a0b709 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.share.ui.block; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; +import com.fr.design.fit.common.TemplateTool; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.EastRegionContainerPane; @@ -12,7 +13,12 @@ import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.online.CarouselStateManger; import com.fr.design.mainframe.share.ui.online.embed.AnimatePopupDialog; import com.fr.design.mainframe.share.ui.online.embed.FirstDragAnimateStateManager; +import com.fr.form.main.Form; +import com.fr.form.main.WidgetGather; import com.fr.form.share.constants.ShareComponentConstants; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.FRScreen; import com.fr.module.ModuleContext; import org.jetbrains.annotations.NotNull; import javax.swing.ImageIcon; @@ -285,4 +291,22 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } + //新自适应的模板由于内部的尺寸都是未经过缩放过的值,所以对应的设计分辨率值也要保持正常分辨率p1440 + protected void compatibleProcessAbsoluteLayoutResolution(Widget widget) { + if (!TemplateTool.isCurrentEditingNewJForm()) { + return; + } + Form.traversalWidget(widget, new WidgetGather() { + @Override + public void dealWith(Widget widget) { + ((WAbsoluteLayout) widget).setDesigningResolution(FRScreen.p1440.getDimension()); + } + + @Override + public boolean dealWithAllCards() { + return true; + } + }, WAbsoluteLayout.class); + } + } From f2810dff76fc321ce69f1fa6c5be283399b95e24 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Jan 2022 18:05:57 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/share/ui/block/PreviewWidgetBlock.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index 6024a0b709..93b9f93403 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.share.ui.block; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; -import com.fr.design.fit.common.TemplateTool; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.EastRegionContainerPane; @@ -291,11 +290,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } - //新自适应的模板由于内部的尺寸都是未经过缩放过的值,所以对应的设计分辨率值也要保持正常分辨率p1440 protected void compatibleProcessAbsoluteLayoutResolution(Widget widget) { - if (!TemplateTool.isCurrentEditingNewJForm()) { - return; - } Form.traversalWidget(widget, new WidgetGather() { @Override public void dealWith(Widget widget) { From f949a8e54cd25f8f86ff982b4e74e4b51778dbe7 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 20 Jan 2022 11:10:16 +0800 Subject: [PATCH 06/16] =?UTF-8?q?REPORT-65976=20final=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BC=A0=E4=B8=80=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/ui/block/LocalWidgetBlock.java | 1 + .../share/ui/block/OnlineWidgetBlock.java | 1 + .../share/ui/block/PreviewWidgetBlock.java | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index 72eb35d000..c23c82f109 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -252,6 +252,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); return null; } + compatibleProcessAbsoluteLayoutResolution(creatorSource); creatorSource.setWidgetID(UUID.randomUUID().toString()); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); //tab布局WCardMainBorderLayout通过反射出来的大小是960*480 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java index 38bcd99826..7f0e369f90 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java @@ -189,6 +189,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); return; } + compatibleProcessAbsoluteLayoutResolution(creatorSource); creatorSource.setWidgetID(UUID.randomUUID().toString()); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); SharableWidgetProvider bindInfo = ShareUtils.getElCaseBindInfoById(shareId); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index 5a19d0216f..93b9f93403 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -12,7 +12,12 @@ import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.online.CarouselStateManger; import com.fr.design.mainframe.share.ui.online.embed.AnimatePopupDialog; import com.fr.design.mainframe.share.ui.online.embed.FirstDragAnimateStateManager; +import com.fr.form.main.Form; +import com.fr.form.main.WidgetGather; import com.fr.form.share.constants.ShareComponentConstants; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.FRScreen; import com.fr.module.ModuleContext; import org.jetbrains.annotations.NotNull; import javax.swing.ImageIcon; @@ -285,4 +290,18 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } + protected void compatibleProcessAbsoluteLayoutResolution(Widget widget) { + Form.traversalWidget(widget, new WidgetGather() { + @Override + public void dealWith(Widget widget) { + ((WAbsoluteLayout) widget).setDesigningResolution(FRScreen.p1440.getDimension()); + } + + @Override + public boolean dealWithAllCards() { + return true; + } + }, WAbsoluteLayout.class); + } + } From eaf85709ca1703c142d669e6d26ffe85c1e169c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 20 Jan 2022 16:36:08 +0800 Subject: [PATCH 07/16] =?UTF-8?q?CHART-22545=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E8=8B=B1=E8=AF=AD-=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE-=E6=A0=87=E7=AD=BE=E6=A0=BC=E5=BC=8F-=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=AE=BD=E5=BA=A6=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/tooltip/VanChartFormatComBoxWithCheckBox.java | 2 +- .../java/com/fr/design/report/NewReportBackgroundPane.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java index 95da8ea986..f17d07a249 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java @@ -53,7 +53,7 @@ public class VanChartFormatComBoxWithCheckBox extends JPanel { } }); - formatComBox.setPreferredSize(new Dimension(40, 20)); + formatComBox.setPreferredSize(new Dimension(55, 20)); if (showSelectBox()) { this.add(isSelectedBox, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java b/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java index cf514512da..928d863656 100644 --- a/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java @@ -2,7 +2,6 @@ package com.fr.design.report; import com.fr.base.theme.ReportTheme; import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedReportBodyStyle; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; @@ -10,21 +9,19 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.style.ReportBackgroundSpecialPane; import com.fr.design.gui.style.FollowingThemePane; +import com.fr.design.gui.style.ReportBackgroundSpecialPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.theme.ui.BorderUtils; -import com.fr.form.ui.PaddingMargin; import com.fr.general.Background; import com.fr.page.ReportSettingsProvider; import com.fr.report.stable.ReportSettings; import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.SwingConstants; import javax.swing.border.CompoundBorder; import java.awt.BorderLayout; import java.awt.Color; @@ -168,7 +165,7 @@ public class NewReportBackgroundPane extends BasicPane { container.setBorder(BorderFactory.createEmptyBorder()); JPanel titledPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); titledPane.setBorder(new CompoundBorder( - BorderUtils.createTitleBorder("预览", 12), + BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Preview"), 12), BorderFactory.createEmptyBorder(5, 5, 4, 5) )); titledPane.setPreferredSize(new Dimension(377, 502)); From 5efe0fc83dfd429a7aa486623e238e4306a9cd7c Mon Sep 17 00:00:00 2001 From: wtianye <10320502+wtianye@user.noreply.gitee.com> Date: Thu, 20 Jan 2022 16:53:29 +0800 Subject: [PATCH 08/16] =?UTF-8?q?REPORT-66044=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E5=A4=8D=E5=88=B6=E4=BB=A5=E5=90=8E=EF=BC=8C=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=B8=A4=E4=B8=AA=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=90=8C=E4=B8=80=E4=B8=AA=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=20&&=20REPORT-66020=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E6=A1=86=E9=80=89=E5=90=8E=E6=92=A4=E9=94=80?= =?UTF-8?q?=EF=BC=8C=E9=BC=A0=E6=A0=87=E7=8A=B6=E6=80=81=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4=20&&=20REPORT-65994=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F=E6=8C=89=E9=92=AE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BA=A4=E4=BA=92=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=20&&=20REPORT-65993=20=E8=A1=A8=E5=A4=B4=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E9=A2=9C=E8=89=B2=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sort/common/AbstractSortGroupPane.java | 19 ++++++ .../design/sort/common/AbstractSortPane.java | 2 +- .../design/sort/common/SortColumnRowPane.java | 44 ++++++------- .../sort/common/SortUIExpandablePane.java | 9 ++- .../com/fr/design/sort/common/SortUtils.java | 24 ++++++++ .../fr/design/sort/header/HeaderAreaPane.java | 61 +++++++++---------- .../sort/header/HeaderSortRulePane.java | 1 + .../fr/design/sort/header/SortHeaderPane.java | 4 +- 8 files changed, 106 insertions(+), 58 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java index db6f574bd6..8a90b960e0 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java @@ -123,11 +123,30 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC } protected void refresh() { + freshAddSortItemBarTip(); + freshSortUIExpandablePaneTip(); validate(); repaint(); revalidate(); } + void freshAddSortItemBarTip() { + if (sortUIExpandablePanes != null) { + int itemCount = sortUIExpandablePanes.size(); + uiButton.setText(itemCount == 0 ? Toolkit.i18nText("Fine-Design_Sort_Add_Main_Sort") : Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort")); + } + } + + void freshSortUIExpandablePaneTip() { + for (int i = 0; i < sortUIExpandablePanes.size(); i++) { + if (i == 0) { + sortUIExpandablePanes.get(i).freshHeaderPaneTip(Toolkit.i18nText("Fine-Design_Sort_Main_Sort")); + } else { + sortUIExpandablePanes.get(i).freshHeaderPaneTip(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); + } + } + } + class AddSortItemBar extends JPanel { AbstractSortGroupPane sortGroupPane; diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java index 6491d04a8e..227708e7a1 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -65,7 +65,7 @@ public abstract class AbstractSortPane extends JPanel { if (cellSortAttr != null) { sortHeader = cellSortAttr.getSortHeader(); } - sortHeaderPane.populateBean(sortHeader, defaultHeaderArea); + sortHeaderPane.populateBean(sortHeader, defaultHeaderArea, cellElement); } refresh(); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java index 653ce86c8c..e9ebbd882c 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java @@ -50,6 +50,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver { private final static Icon DISABLED_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_disabled.svg"); private final static Icon ENABLE_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_normal.svg"); private boolean enabled; + SelectActionListener selectActionListener; HeaderAreaPane.CellSelectionManager cellSelectionManager; @@ -94,7 +95,8 @@ public class SortColumnRowPane extends JPanel implements UIObserver { void initSelectButton() { selectButton = new UIButton(ENABLE_ICON); - selectButton.addMouseListener(new SelectActionListener(this)); + selectActionListener = new SelectActionListener(this); + selectButton.addMouseListener(selectActionListener); this.add(selectButton); } @@ -147,6 +149,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver { return true; } + + public void cancelSelectState() { + selectActionListener.recoverSelectHeader(SortUtils.getCurrentElementCase()); + } + class SelectActionListener extends MouseAdapter { SortColumnRowPane columnRowPane; ColumnRow oldColumnRow; @@ -161,7 +168,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver { @Override public void mouseClicked(MouseEvent e) { if (enabled) { - ElementCasePane elementCasePane = getCurrentElementCase(); + ElementCasePane elementCasePane = SortUtils.getCurrentElementCase(); if (elementCasePane == null || isAlreadyAddListener) { return; } @@ -201,15 +208,21 @@ public class SortColumnRowPane extends JPanel implements UIObserver { } columnRowPane.setColumnRow(columnRow); } + } + recoverSelectHeader(elementCasePane); + } + + private void recoverSelectHeader(ElementCasePane elementCasePane) { + if (isAlreadyAddListener) { restoreDisableHeaderCellsStyle(elementCasePane.getEditingElementCase()); + elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); + isAlreadyAddListener = false; + elementCasePane.getGrid().setNotShowingTableSelectPane(true); + elementCasePane.setRepeatSelection(false); + elementCasePane.setEditable(true); + elementCasePane.repaint(); + oldColumnRow = null; } - elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); - isAlreadyAddListener = false; - elementCasePane.getGrid().setNotShowingTableSelectPane(true); - elementCasePane.setRepeatSelection(false); - elementCasePane.setEditable(true); - elementCasePane.repaint(); - oldColumnRow = null; } private void ashDisableHeaderCellsStyle(TemplateElementCase elementCase) { @@ -263,17 +276,4 @@ public class SortColumnRowPane extends JPanel implements UIObserver { repaint(); revalidate(); } - - public static ElementCasePane getCurrentElementCase() { - try { - TargetComponent targetComponent - = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); - if (targetComponent instanceof ElementCasePane) { - return (ElementCasePane) targetComponent; - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return null; - } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index 6de6636f4c..eef21bb060 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -63,7 +63,12 @@ public class SortUIExpandablePane extends JPanel { headerPane.setShow(show); } + public void freshHeaderPaneTip(String tip) { + headerPane.tipUILabel.setText(tip); + } + class HeaderPane extends JPanel implements UIObserver { + UILabel tipUILabel; UILabel iconUiLabel; UILabel closeButton; AbstractSortGroupPane sortGroupPane; @@ -78,8 +83,8 @@ public class SortUIExpandablePane extends JPanel { private void initComponents() { iconUiLabel = new UILabel(); this.add(iconUiLabel); - UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); - this.add(uiLabel); + tipUILabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); + this.add(tipUILabel); this.add(AbstractSortPane.createIntervalUILabel(108)); closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png")); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java new file mode 100644 index 0000000000..32ee1a764c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java @@ -0,0 +1,24 @@ +package com.fr.design.sort.common; + +import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JTemplate; +import com.fr.log.FineLoggerFactory; + +public class SortUtils { + public static ElementCasePane getCurrentElementCase() { + try { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate != null) { + TargetComponent targetComponent = jTemplate.getCurrentElementCasePane(); + if (targetComponent instanceof ElementCasePane) { + return (ElementCasePane) targetComponent; + } + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + return null; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java index 95da80c8ca..25641340cb 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java @@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.SortColumnRowPane; +import com.fr.design.sort.common.SortUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; @@ -35,6 +36,7 @@ public class HeaderAreaPane extends JPanel { protected int headerAreaPaneWidth; protected int headerAreaPaneRightWidth; private CellSelectionManager cellSelectionManager = new CellSelectionManager(); + TemplateCellElement cellElement; AreaJLayeredPane areaJLayeredPane; @@ -62,9 +64,10 @@ public class HeaderAreaPane extends JPanel { this.add(areaJLayeredPane); } - public void populateBean(ColumnRow columnRow, boolean showHeaderArea) { + public void populateBean(ColumnRow columnRow, boolean showHeaderArea, TemplateCellElement cellElement) { + this.cellElement = cellElement; boolean enabled = true; - ElementCasePane elementCasePane = getCurrentElementCase(); + ElementCasePane elementCasePane = SortUtils.getCurrentElementCase(); if (elementCasePane != null) { enabled = elementCasePane.isSelectedOneCell(); } @@ -72,7 +75,7 @@ public class HeaderAreaPane extends JPanel { } public ColumnRow updateBean(TemplateCellElement cellElement) { - ElementCasePane elementCasePane = getCurrentElementCase(); + ElementCasePane elementCasePane = SortUtils.getCurrentElementCase(); if (elementCasePane != null) { if (!elementCasePane.isSelectedOneCell()) { return getOldColumnRow(cellElement); @@ -96,19 +99,6 @@ public class HeaderAreaPane extends JPanel { } } - private ElementCasePane getCurrentElementCase() { - try { - TargetComponent targetComponent - = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); - if (targetComponent instanceof ElementCasePane) { - return (ElementCasePane) targetComponent; - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return null; - } - class AreaJLayeredPane extends JPanel { SortColumnRowPane columnRowPane; JLayeredPane jLayeredPane; @@ -151,6 +141,7 @@ public class HeaderAreaPane extends JPanel { } } else { cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); + columnRowPane.cancelSelectState(); } } @@ -176,7 +167,8 @@ public class HeaderAreaPane extends JPanel { } public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { - cellSelectionManager.build(); + cellSelectionManager.build(cellElement, columnRow); + columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow); columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); setSortColumnRowPaneShow(showHeaderArea); uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); @@ -203,15 +195,26 @@ public class HeaderAreaPane extends JPanel { ElementCasePane elementCase; java.util.List notSelectables = new ArrayList<>(); - void build() { - ElementCasePane elementCase = SortColumnRowPane.getCurrentElementCase(); + void build(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) { + ElementCasePane elementCase = SortUtils.getCurrentElementCase(); if (elementCase != null) { this.elementCase = elementCase; notSelectables = new ArrayList<>(); - buildNotSelectables(elementCase.getEditingElementCase()); + buildNotSelectables(elementCase.getEditingElementCase(), templateCellElement); } } + private ColumnRow buildCurrentCell(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) { + if (isNotSelectables(headerColumnRow)) { + SortHeader sortHeader = templateCellElement.getCellExpandAttr().getCellSortAttr().getSortHeader(); + headerColumnRow = ColumnRow.ERROR; + sortHeader.setHeaderArea(headerColumnRow.toString()); + } else { + handleDisableHeaderCell(templateCellElement); + } + return headerColumnRow; + } + public java.util.List getNotSelectables() { return this.notSelectables; } @@ -232,24 +235,20 @@ public class HeaderAreaPane extends JPanel { notSelectables.remove(columnRow); } - private void buildNotSelectables(TemplateElementCase elementCase) { + private void buildNotSelectables(TemplateElementCase elementCase, TemplateCellElement excludeTemplateCellElement) { Iterator iterator = elementCase.cellIterator(); while (iterator.hasNext()) { TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next(); - CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr(); - if (cellExpandAttr != null) { - handleDisableHeaderCell(cellExpandAttr); - } - Object value = templateCellElement.getValue(); - if (value instanceof DSColumn) { - handleDisableHeaderCell((DSColumn) value); + if (templateCellElement != excludeTemplateCellElement) { + handleDisableHeaderCell(templateCellElement); } } } - private void handleDisableHeaderCell(CellSortable cellSortable) { - if (cellSortable.getCellSortAttr() != null) { - SortHeader sortHeader = cellSortable.getCellSortAttr().getSortHeader(); + private void handleDisableHeaderCell(TemplateCellElement templateCellElement) { + CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr(); + if (cellExpandAttr != null && cellExpandAttr.getCellSortAttr() != null) { + SortHeader sortHeader = cellExpandAttr.getCellSortAttr().getSortHeader(); if (sortHeader != null) { String headerArea = sortHeader.getHeaderArea(); if (headerArea != null) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java index 172db28aec..27c03e9e01 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java @@ -135,6 +135,7 @@ public class HeaderSortRulePane extends JPanel { } void refreshIconLabelColor(FineColor fineColor) { + this.fineColor = fineColor; Icon icon = getIcon(fineColor); refreshIconLabel(icon); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java index a68d0eebe6..77802429ca 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java @@ -34,7 +34,7 @@ public class SortHeaderPane extends JPanel { this.add(headerSettingPane); } - public void populateBean(SortHeader sortHeader, String defaultHeaderArea) { + public void populateBean(SortHeader sortHeader, String defaultHeaderArea,TemplateCellElement cellElement) { this.sortHeader = sortHeader; boolean showHeaderArea = false; SortHeader.SortItem[] sortItems = null; @@ -48,7 +48,7 @@ public class SortHeaderPane extends JPanel { columnRow = ColumnRow.valueOf(headerArea); } } - headerAreaPane.populateBean(columnRow, showHeaderArea); + headerAreaPane.populateBean(columnRow, showHeaderArea, cellElement); headerSettingPane.populateBean(sortItems); } From dbd5cd66491a32c96375a64092491a991f9cea7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 20 Jan 2022 17:38:52 +0800 Subject: [PATCH 09/16] =?UTF-8?q?REPORT-65373=20JDK11=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=96=87=E4=BB=B6-?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E5=BC=B9=E7=AA=97=E8=BE=B9=E6=A1=86=E8=A2=AB?= =?UTF-8?q?=E6=88=AA=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/PreferencePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 5a777b895d..2fa06a5642 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -108,7 +108,7 @@ public class PreferencePane extends BasicPane { private static final int CACHING_DEFAULT = 5; private static final int CACHING_GAP = 5; private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; - private static final int OFFSET_HEIGHT = 50; + private static final int OFFSET_HEIGHT = 60; private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; From a619cde823965708a94089799e42c2627e3c6a35 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 21 Jan 2022 14:34:36 +0800 Subject: [PATCH 10/16] =?UTF-8?q?REPORT-66169=20mac=E5=8F=8C=E5=87=BB?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=E6=97=B6=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E5=94=A4=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Arrays.asList返回的列表类型不支持add操作,导致出现异常 【改动思路】 同上 --- .../src/main/java/com/fr/design/deeplink/DeepLinkManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java b/designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java index a1de69db4f..9cef24dcc8 100644 --- a/designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java +++ b/designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java @@ -138,7 +138,7 @@ public class DeepLinkManager { public String[] createNewArgs(String[] args) { String filePath = this.pendingURL; if (OperatingSystem.isMacos() && StringUtils.isNotEmpty(filePath) && new File(filePath).exists()) { - List argList = Arrays.asList(args); + List argList = new ArrayList<>(Arrays.asList(args)); argList.add(filePath); markPendingURLConsumed(); return argList.toArray(new String[]{}); From c03b4f162f49b9197dcd95ff58938496a2d99640 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 21 Jan 2022 15:31:19 +0800 Subject: [PATCH 11/16] =?UTF-8?q?REPORT-65778=2011.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=8D=95=E5=85=83=E6=A0=BC=E9=BB=98=E8=AE=A4=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=97=AE=E9=A2=98-=E6=96=B0=E5=BB=BA=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=E5=B7=A5=E5=85=B7=E9=A2=84=E8=A7=88=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=BB=98=E8=AE=A4=E6=98=AF=E5=AD=97=E4=BD=93=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E5=9C=A8=E5=8D=95=E5=85=83=E6=A0=BC=E9=87=8C=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E4=BB=BB=E6=84=8F=E5=86=85=E5=AE=B9=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=8F=98=E6=88=90=E4=BA=86=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=E9=BB=91=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 若未选中任何单元格,则报表块工具栏上的字体相关配置应跟随当前模版主题中的 默认单元格样式 【改动思路】 同上 --- .../java/com/fr/design/actions/utils/ReportActionUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java b/designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java index 6206148930..b003613ba5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java @@ -114,7 +114,8 @@ public class ReportActionUtils { CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); if (editCellElement == null) { - return AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE); + editCellElement = DefaultThemedTemplateCellElementCase.createInstance(); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement); } //peter:直接返回当前编辑元素的Style From f51ab9490486b3e104a65a60b184abee567e2687 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 24 Jan 2022 11:21:23 +0800 Subject: [PATCH 12/16] =?UTF-8?q?REPORT-65724=20=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=80=A7-=E6=B0=B4=E5=8D=B0-=E6=B0=B4=E5=8D=B0=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E8=A7=A3=E6=9E=90=201.=E6=89=80=E6=9C=89?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E4=BB=8E=E5=85=A8=E5=B1=80=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteBodyLayoutDefinePane.java | 4 +++- .../ui/designer/layout/FRFitLayoutDefinePane.java | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 7998c1d0c3..66235cfdde 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -38,6 +38,7 @@ import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; + import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -163,7 +164,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); boundPane.populate(); - watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); + //从全局读取水印 + watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile())); } public WAbsoluteBodyLayout updateSubPane() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 1f1fbd4199..94040ac4a3 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -44,8 +44,14 @@ import com.fr.general.act.BorderPacker; import com.fr.log.FineLoggerFactory; import com.fr.report.core.ReportUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Rectangle; /** * Created by ibm on 2017/8/2. @@ -200,7 +206,8 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Mon, 24 Jan 2022 15:42:04 +0800 Subject: [PATCH 13/16] =?UTF-8?q?REPORT-66196=20=E3=80=90=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=A4=A7=E6=96=87=E6=9C=AC=E3=80=91=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E8=AE=BE=E7=BD=AE=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=AE=BE=E7=BD=AE=E5=AD=97=E7=AC=A6=E9=95=BF?= =?UTF-8?q?=E5=BA=A65=EF=BC=8C=E7=82=B9=E5=87=BB=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=9F=A5=E7=9C=8B=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellOtherSetPane.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 8bd6dcac11..99a0d9bf48 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -318,16 +318,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane { public void itemStateChanged(ItemEvent e) { textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED); if (e.getStateChange() == ItemEvent.SELECTED) { - noAutoRadioButton.setSelected(true); - textOverflowComPane.setVisible(true); if (showPartComboBox.getSelectedIndex() == 0) { + showPartPane.setPreferredSize(new Dimension(70, 20)); showPartLayout.show(showPartPane, "content"); } else { showPartLayout.show(showPartPane, "none"); showPartPane.setPreferredSize(new Dimension(0, 0)); } - } else { - textOverflowComPane.setVisible(false); + noAutoRadioButton.setSelected(true); } } }); @@ -543,11 +541,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { if (cellGUIAttr.isHideTextWhenOverflow()) { textOverflowCheckBox.setSelected(true); if (cellGUIAttr.isShowCharNum()) { - showPartLayout.show(showPartPane, "content"); + showPartComboBox.setSelectedIndex(0); showCharNums.setValue(cellGUIAttr.getShowCharNums()); } else { - showPartLayout.show(showPartPane, "none"); - showPartPane.setPreferredSize(new Dimension(0, 0)); + showPartComboBox.setSelectedIndex(1); } showPartPane.setVisible(true); if (cellGUIAttr.isTextOverflowEllipsis()) { @@ -556,6 +553,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane { textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")); } } else { + showPartComboBox.setSelectedIndex(0); + showCharNums.setValue(cellGUIAttr.getShowCharNums()); + textOverflowTypeComboBox.setSelectedIndex(0); textOverflowCheckBox.setSelected(false); } CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 From 77bb107cf3d87a79861b1d2d3e22227ffeb58224 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 25 Jan 2022 10:35:56 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E6=97=A0jira=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/designer/layout/FRFitLayoutDefinePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 0e146d491e..205ad01ffb 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -39,6 +39,7 @@ import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Rectangle; From 6817435ff6f987fe4b748fc3716ab51832e9648d Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 25 Jan 2022 13:40:19 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E6=97=A0jira=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=89=93=E5=8C=85=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FRAbsoluteBodyLayoutDefinePane.java | 109 ++++++++++++++++-- 1 file changed, 99 insertions(+), 10 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index fe8dc15b97..768fbb8cfc 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -7,27 +7,38 @@ import com.fr.base.theme.TemplateTheme; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.fit.common.TemplateTool; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.ilable.UIAutoChangeLineLabel; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FollowingThemePane; import com.fr.design.gui.xpane.LayoutStylePane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.form.ui.container.WFitLayout; import com.fr.general.act.BorderPacker; import com.fr.report.core.ReportUtils; import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; + import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -36,10 +47,15 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; * Created by ibm on 2017/8/2. */ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { + private static final int MAX_LABEL_WIDTH = 80; protected FollowingThemePane themePane; private LayoutStylePane stylePane; private AccessibleBodyWatermarkEditor watermarkEditor; + private WidgetBoundPane boundPane; + + private UIComboBox layoutCombox; + private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -48,8 +64,20 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + boundPane = new WidgetBoundPane(creator); + if (!TemplateTool.isCurrentEditingNewJForm()) { + this.add(boundPane, BorderLayout.NORTH); + } JPanel panel1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(panel1, BorderLayout.CENTER); + + UIExpandablePane scalePane = new UIExpandablePane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Area_Scaling"), + 280, 20, + createAreaScalePane() + ); + panel1.add(scalePane, BorderLayout.NORTH); + UIExpandablePane advancedPane = new UIExpandablePane( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, @@ -87,15 +115,41 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); watermarkPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); advancedContentPane.add(watermarkPane, BorderLayout.CENTER); - UIAutoChangeLineLabel tip = new UIAutoChangeLineLabel(Toolkit.i18nText("Fine-Design_Form_Body_Layout_Setting_Tip"), 216); - tip.setForeground(Color.lightGray); - advancedContentPane.add(tip, BorderLayout.SOUTH); + return advancedContentPane; } - @Override - public void doLayout() { - super.doLayout(); + public JPanel createAreaScalePane() { + initLayoutComboBox(); + + UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); + UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode")); + Component[][] components = TemplateTool.isCurrentEditingNewJForm() ? new Component[][]{ + {layoutTypeLabel, layoutCombox} + } : new Component[][]{ + {layoutTypeLabel, layoutCombox}, + {scaleModeLabel} + }; + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + + contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + + JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + containerPane.add(contentPane, BorderLayout.CENTER); + containerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + return containerPane; + } + + public void initLayoutComboBox() { + Item[] items = FRLayoutTypeItems.ITEMS; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + for (Item item : items) { + model.addElement(item); + } + layoutCombox = new UIComboBox(model); + layoutCombox.setSelectedIndex(1); } @Override @@ -104,16 +158,51 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } public void populateSubPane(WAbsoluteLayout ob) { + layoutCombox.setSelectedIndex(1); themePane.supportFollowingTheme(ob.supportThemed()); themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); boundPane.populate(); - //从全局读取水印 watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile())); } public WAbsoluteBodyLayout updateSubPane() { WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData(); + boundPane.update(); + Item item = (Item) layoutCombox.getSelectedItem(); + Object value = item.getValue(); + int state = 0; + if (value instanceof Integer) { + state = (Integer) value; + } + + if (layoutType == WBodyLayoutType.ABSOLUTE) { + ((XWFitLayout) creator.getBackupParent()).toData().resetStyle(); + if (state == WBodyLayoutType.FIT.getTypeValue()) { + XWFitLayout xwFitLayout = ((XWFitLayout) creator.getBackupParent()); + int selVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Form_Layout_Switch_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + OK_CANCEL_OPTION, + WARNING_MESSAGE + ); + if (OK_OPTION == selVal) { + xwFitLayout.switch2FitBodyLayout(creator); + WFitLayout wFitLayout = xwFitLayout.toData(); + // 切换布局类型时,保留body背景样式 + if (wFitLayout != null) { + wFitLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); + wFitLayout.setBorderStyle(layout.getBorderStyle()); + } + copyLayoutAttr(layout, xwFitLayout.toData()); + } else { + this.layoutCombox.setSelectedIndex(1); + } + copyLayoutAttr(layout, xwFitLayout.toData()); + xwFitLayout.refreshStylePreviewEffect(); + } + } layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme()); layout.setBorderStyle(stylePane.updateBean()); updateWatermark(); @@ -138,4 +227,4 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } -} +} \ No newline at end of file From 6b4e08cfde0fe8f0c145d8077d29d92d30b890df Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 25 Jan 2022 14:15:03 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E6=97=A0jira=20=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FRAbsoluteBodyLayoutDefinePane.java | 113 ++---------------- 1 file changed, 10 insertions(+), 103 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 768fbb8cfc..d0e9f1ae61 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -7,55 +7,36 @@ import com.fr.base.theme.TemplateTheme; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.properties.items.FRLayoutTypeItems; -import com.fr.design.designer.properties.items.Item; -import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.fit.common.TemplateTool; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UIAutoChangeLineLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FollowingThemePane; import com.fr.design.gui.xpane.LayoutStylePane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WBodyLayoutType; -import com.fr.form.ui.container.WFitLayout; import com.fr.general.act.BorderPacker; import com.fr.report.core.ReportUtils; import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; - /** * Created by ibm on 2017/8/2. */ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { - private static final int MAX_LABEL_WIDTH = 80; protected FollowingThemePane themePane; private LayoutStylePane stylePane; private AccessibleBodyWatermarkEditor watermarkEditor; - private WidgetBoundPane boundPane; - - private UIComboBox layoutCombox; - private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -64,20 +45,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - boundPane = new WidgetBoundPane(creator); - if (!TemplateTool.isCurrentEditingNewJForm()) { - this.add(boundPane, BorderLayout.NORTH); - } JPanel panel1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(panel1, BorderLayout.CENTER); - - UIExpandablePane scalePane = new UIExpandablePane( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Area_Scaling"), - 280, 20, - createAreaScalePane() - ); - panel1.add(scalePane, BorderLayout.NORTH); - UIExpandablePane advancedPane = new UIExpandablePane( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, @@ -115,41 +84,15 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); watermarkPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); advancedContentPane.add(watermarkPane, BorderLayout.CENTER); - + UIAutoChangeLineLabel tip = new UIAutoChangeLineLabel(Toolkit.i18nText("Fine-Design_Form_Body_Layout_Setting_Tip"), 216); + tip.setForeground(Color.lightGray); + advancedContentPane.add(tip, BorderLayout.SOUTH); return advancedContentPane; } - public JPanel createAreaScalePane() { - initLayoutComboBox(); - - UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); - UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode")); - Component[][] components = TemplateTool.isCurrentEditingNewJForm() ? new Component[][]{ - {layoutTypeLabel, layoutCombox} - } : new Component[][]{ - {layoutTypeLabel, layoutCombox}, - {scaleModeLabel} - }; - JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, - TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - - contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); - - JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - containerPane.add(contentPane, BorderLayout.CENTER); - containerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - - return containerPane; - } - - public void initLayoutComboBox() { - Item[] items = FRLayoutTypeItems.ITEMS; - DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (Item item : items) { - model.addElement(item); - } - layoutCombox = new UIComboBox(model); - layoutCombox.setSelectedIndex(1); + @Override + public void doLayout() { + super.doLayout(); } @Override @@ -158,51 +101,15 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } public void populateSubPane(WAbsoluteLayout ob) { - layoutCombox.setSelectedIndex(1); themePane.supportFollowingTheme(ob.supportThemed()); themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); - boundPane.populate(); + //从全局读取水印 watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile())); } public WAbsoluteBodyLayout updateSubPane() { WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData(); - boundPane.update(); - Item item = (Item) layoutCombox.getSelectedItem(); - Object value = item.getValue(); - int state = 0; - if (value instanceof Integer) { - state = (Integer) value; - } - - if (layoutType == WBodyLayoutType.ABSOLUTE) { - ((XWFitLayout) creator.getBackupParent()).toData().resetStyle(); - if (state == WBodyLayoutType.FIT.getTypeValue()) { - XWFitLayout xwFitLayout = ((XWFitLayout) creator.getBackupParent()); - int selVal = FineJOptionPane.showConfirmDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Form_Layout_Switch_Tip"), - Toolkit.i18nText("Fine-Design_Basic_Alert"), - OK_CANCEL_OPTION, - WARNING_MESSAGE - ); - if (OK_OPTION == selVal) { - xwFitLayout.switch2FitBodyLayout(creator); - WFitLayout wFitLayout = xwFitLayout.toData(); - // 切换布局类型时,保留body背景样式 - if (wFitLayout != null) { - wFitLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme()); - wFitLayout.setBorderStyle(layout.getBorderStyle()); - } - copyLayoutAttr(layout, xwFitLayout.toData()); - } else { - this.layoutCombox.setSelectedIndex(1); - } - copyLayoutAttr(layout, xwFitLayout.toData()); - xwFitLayout.refreshStylePreviewEffect(); - } - } layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme()); layout.setBorderStyle(stylePane.updateBean()); updateWatermark(); @@ -227,4 +134,4 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } -} \ No newline at end of file +}