From 87e10003489d0097a2c1ba1af609a4dc0c80984e Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 27 Dec 2021 12:01:51 +0800 Subject: [PATCH 001/113] =?UTF-8?q?REPORT-64609=20=E7=A3=81=E7=9B=98?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E6=BB=A1=E6=97=B6=20=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=80=A0=E6=88=90=E6=A8=A1=E6=9D=BF=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/common/exception/ThrowableHandler.java | 12 ++++ .../com/fr/design/mainframe/JTemplate.java | 3 +- .../worker/save/SaveFailureHandler.java | 70 +++++++++++++++++++ .../com/fr/design/worker/save/SaveWorker.java | 7 +- 4 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java create mode 100644 designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java diff --git a/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java b/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java new file mode 100644 index 0000000000..225d90e791 --- /dev/null +++ b/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java @@ -0,0 +1,12 @@ +package com.fr.common.exception; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/27 + */ +public interface ThrowableHandler { + + boolean process(Throwable e); + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index f1f72b48c0..3e6ec08197 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -50,6 +50,7 @@ import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker; +import com.fr.design.worker.save.SaveFailureHandler; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.event.EventDispatcher; @@ -882,7 +883,7 @@ public abstract class JTemplate> export(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); + SaveFailureHandler.getInstance().process(e); return false; } this.editingFILE = editingFILE; diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java new file mode 100644 index 0000000000..31c622ab3a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java @@ -0,0 +1,70 @@ +package com.fr.design.worker.save; + +import com.fr.common.exception.ThrowableHandler; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.general.IOUtils; +import com.fr.workspace.exception.DiskSpaceFullException; +import java.awt.Frame; +import javax.swing.JOptionPane; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/7 + */ +public class SaveFailureHandler implements ThrowableHandler { + + private static final SaveFailureHandler INSTANCE = new SaveFailureHandler(); + + public static SaveFailureHandler getInstance() { + return INSTANCE; + } + + @Override + public boolean process(Throwable e) { + for (Handler handler : Handler.values()) { + if (handler.process(e)) { + break; + } + } + return true; + } + + public enum Handler implements ThrowableHandler { + + FullDisk { + @Override + public boolean process(Throwable e) { + if (e.getCause() instanceof DiskSpaceFullException + || e instanceof DiskSpaceFullException + || e.getCause().getCause() instanceof DiskSpaceFullException) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE, + IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png")); + return true; + } + return false; + } + }, + + Other { + @Override + public boolean process(Throwable e) { + boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; + FineJOptionPane.showMessageDialog( + minimized ? null : DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.ERROR_MESSAGE); + return true; + } + }; + + + + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java index f47a4f88e7..c7a962c259 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java @@ -55,12 +55,7 @@ public class SaveWorker extends SwingWorker { } catch (Exception e) { processResult(); FineLoggerFactory.getLogger().error(e.getMessage(), e); - boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; - FineJOptionPane.showMessageDialog( - minimized ? null : DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.ERROR_MESSAGE); + SaveFailureHandler.getInstance().process(e); return; } processResult(); From f437038ed47075e8805a98bd56674fe2df980a00 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 6 Jan 2022 17:12:45 +0800 Subject: [PATCH 002/113] =?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 003/113] =?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, 7 Jan 2022 09:49:13 +0800 Subject: [PATCH 004/113] =?UTF-8?q?REPORT-65515=E3=80=90=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E3=80=91=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8-=E5=AD=98=E5=9C=A8=E6=8F=92=E4=BB=B6=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=97=B6=EF=BC=8C=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=8F=82=E6=95=B0=E5=87=BD=E6=95=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=201.=E9=80=89=E4=B8=AD=E5=8F=82=E6=95=B0=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=BB=98=E8=AE=A4=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FormulaPane.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 904cdf00b0..a4354ee9d1 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 @@ -555,6 +555,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void fixFunctionNameList(String functionName) { int signOfContinue = 1; int indexOfFunction = 0; + boolean found = false; for (int i = 0; i < functionTypeListModel.size(); i++) { int signOfType = 0; FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); @@ -568,6 +569,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { signOfType = 1; signOfContinue = 0; indexOfFunction = k; + found = true; } } @@ -577,8 +579,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } } - functionNameList.setSelectedIndex(indexOfFunction); - functionNameList.ensureIndexIsVisible(indexOfFunction); + if (found) { + functionNameList.setSelectedIndex(indexOfFunction); + functionNameList.ensureIndexIsVisible(indexOfFunction); + } else { + functionTypeList.setSelectedIndex(0); + } } private int getBeginPosition() { From 95dadd063a69dfbd3b5cabdf5b59cf8deefc124b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 10 Jan 2022 15:26:22 +0800 Subject: [PATCH 005/113] =?UTF-8?q?REPORT-65475=20AlphaFine=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/impl/FileSearchManager.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 0497828c7e..327d0555c2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -11,10 +11,14 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.file.filetree.FileNode; +import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; /** @@ -74,7 +78,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { return lessModelList; } AlphaFineHelper.checkCancel(); - fileNodes = FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); + fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); + } + }).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false); isContainCpt = true; isContainFrm = true; doSearch(this.searchText); @@ -128,7 +137,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { */ private void doFileContentSearch(String searchText) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); + FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); + } + }).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false); for (FileNode node : fileNodes) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { From 152b2890ccb3aab8efdeeb7a1c47c4b3bca60bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 10 Jan 2022 20:22:56 +0800 Subject: [PATCH 006/113] =?UTF-8?q?CHART-22247=20=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE=E8=BE=B9=E6=A1=86/=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=97=B6=E9=97=B4=E6=A0=87=E8=AF=86=E7=BA=BF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartGanttTimeLinePane.java | 97 +++++++++++++++++ .../component/VanChartGuideLinesPane.java | 4 - .../background/VanChartGantAreaPane.java | 15 +++ .../VanChartGantPlotAreaBackgroundPane.java | 102 ++++++++++++++++++ .../style/VanChartGanttStylePane.java | 6 ++ .../style/series/VanChartGanttSeriesPane.java | 15 ++- 6 files changed, 233 insertions(+), 6 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java new file mode 100644 index 0000000000..f6fb41edbc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java @@ -0,0 +1,97 @@ +package com.fr.van.chart.designer.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; + +public class VanChartGanttTimeLinePane extends JPanel { + private UIButtonGroup switchButton; + private ColorSelectBoxWithOutTransparent colorSelect; + private UINumberDragPaneWithPercent opacity; + + public VanChartGanttTimeLinePane() { + this.setLayout(new BorderLayout()); + this.add(createSwitchButtonPane(), BorderLayout.NORTH); + this.add(createCenterPane(), BorderLayout.CENTER); + } + + private JPanel createSwitchButtonPane() { + double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED}; + String[] array = new String[]{Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Not_Show"), Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Show")}; + switchButton = new UIButtonGroup<>(array); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT); + return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + new Component[]{null, null}, + new Component[] {text, switchButton} + }, rowSize, columnSize); + } + + private JPanel createCenterPane() { + double[] columnSize = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + + colorSelect = new ColorSelectBoxWithOutTransparent(100); + opacity = new UINumberDragPaneWithPercent(0, 100); + + return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + new Component[]{null, null}, + new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect}, + new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity} + }, rowSize, columnSize); + } + + public void populateBean(Plot plot) { + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + setShowTimeLine(ganttPlot.isShowTimeLine()); + setTimeLineColor(ganttPlot.getTimeLineColor()); + setTimeLineOpacity(ganttPlot.getTimeLineOpacity()); + } + } + + public void updateBean(Plot plot) { + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + ganttPlot.setShowTimeLine(isShowTimeLine()); + ganttPlot.setTimeLineColor(getTimeLineColor()); + ganttPlot.setTimeLineOpacity(getTimeLineOpacity()); + } + } + + public boolean isShowTimeLine() { + return switchButton.getSelectedIndex() == 1; + } + + public void setShowTimeLine(boolean showTimeLine) { + switchButton.setSelectedIndex(showTimeLine ? 1 : 0); + } + + public Color getTimeLineColor() { + return colorSelect.getSelectObject(); + } + + public void setTimeLineColor(Color timeLineColor) { + colorSelect.setSelectObject(timeLineColor); + } + + public double getTimeLineOpacity() { + return opacity.updateBean(); + } + + public void setTimeLineOpacity(double timeLineOpacity) { + opacity.populateBean(timeLineOpacity); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java deleted file mode 100644 index 4b7b140cdf..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fr.van.chart.designer.component; - -public class VanChartGuideLinesPane { -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java new file mode 100644 index 0000000000..382a918270 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java @@ -0,0 +1,15 @@ +package com.fr.van.chart.designer.style.background; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.van.chart.designer.style.VanChartStylePane; + +public class VanChartGantAreaPane extends VanChartAreaPane { + public VanChartGantAreaPane(Plot plot, VanChartStylePane parent) { + super(plot, parent); + } + + protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { + plotPane = new VanChartGantPlotAreaBackgroundPane(parent); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java new file mode 100644 index 0000000000..fbea849909 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java @@ -0,0 +1,102 @@ +package com.fr.van.chart.designer.style.background; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class VanChartGantPlotAreaBackgroundPane extends VanChartAreaBackgroundPane { + private ColorSelectBoxWithOutTransparent axisColorPane; + private ColorSelectBoxWithOutTransparent contentColorPane; + + public VanChartGantPlotAreaBackgroundPane(AbstractAttrNoScrollPane parent) { + super(true, parent); + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{createAxisBorderPane()}, + new Component[]{createContentBorderPane()} + }; + + contentPane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); + return contentPane; + } + + @Override + public void updateBean(Chart chart) { + if (chart == null) { + chart = new Chart(); + } + + Plot plot = chart.getPlot(); + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + ganttPlot.setAxisBorderColor(axisColorPane.getSelectObject()); + ganttPlot.setContentBorderColor(contentColorPane.getSelectObject()); + } + } + + @Override + public void populateBean(Chart chart) { + if (chart == null) { + chart = new Chart(); + } + + Plot plot = chart.getPlot(); + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + axisColorPane.setSelectObject(ganttPlot.getAxisBorderColor()); + contentColorPane.setSelectObject(ganttPlot.getContentBorderColor()); + } + } + + private JPanel createAxisBorderPane() { + axisColorPane = new ColorSelectBoxWithOutTransparent(100); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle( + Toolkit.i18nText("Fine-Design_Chart_Gant_Axis_Border"), + createBorderPane(axisColorPane) + ); + } + + private JPanel createContentBorderPane() { + contentColorPane = new ColorSelectBoxWithOutTransparent(100); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle( + Toolkit.i18nText("Fine-Design_Chart_Gant_Content_Border"), + createBorderPane(contentColorPane) + ); + } + + private JPanel createBorderPane(ColorSelectBoxWithOutTransparent colorPane) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{ + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), + colorPane + } + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java index b12e0579fa..7d1de704fc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java @@ -4,6 +4,8 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.background.VanChartAreaPane; +import com.fr.van.chart.designer.style.background.VanChartGantAreaPane; import com.fr.van.chart.gantt.designer.style.axis.GanttProcessAxisPane; import com.fr.van.chart.gantt.designer.style.axis.GanttTimeAxisPane; @@ -31,4 +33,8 @@ public class VanChartGanttStylePane extends VanChartStylePane { private void addProjectAxisPane(List paneList, Plot plot) { paneList.add(new GanttProcessAxisPane()); } + + protected VanChartAreaPane createVanChartAreaPane() { + return new VanChartGantAreaPane(getChart().getPlot(), VanChartGanttStylePane.this); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java index 9236773e71..a62f054e7f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java @@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -14,6 +15,7 @@ import com.fr.plugin.chart.gantt.VanChartGanttPlot; import com.fr.stable.CoreConstants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartGanttTimeLinePane; import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; @@ -30,6 +32,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { private LineComboBox lineWidth;//线型 private ColorSelectBoxWithOutTransparent colorSelect;//颜色 + private VanChartGanttTimeLinePane timeLinePane; + public VanChartGanttSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -45,7 +49,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{createGanntStylePane()}, new Component[]{createLinkLinePane()}, new Component[]{createMarkerPane()}, - new Component[]{createLargeDataModelPane()} + new Component[]{createLargeDataModelPane()}, + new Component[]{createGuideLinePane()} }; contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -96,6 +101,11 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gannt_Marker"), markerPane); } + protected JPanel createGuideLinePane() { + timeLinePane = new VanChartGanttTimeLinePane(); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Identify"), timeLinePane); + } + @Override public void populateBean(Plot plot) { super.populateBean(plot); @@ -104,10 +114,10 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { VanChartGanttPlot ganttPlot = (VanChartGanttPlot)plot; seriesNewLine.setSelectedIndex(ganttPlot.isSeriesNewLineEnable() ? 0 : 1); - lineWidth.setSelectedLineStyle(ganttPlot.getLineWidth()); colorSelect.setSelectObject(ganttPlot.getLineColor()); + timeLinePane.populateBean(plot); } } @@ -121,6 +131,7 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { ganttPlot.setLineWidth(lineWidth.getSelectedLineStyle()); ganttPlot.setLineColor(colorSelect.getSelectObject()); + timeLinePane.updateBean(plot); } } From c38b2329dddb36bd640356cbb237c7ce162f4c31 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 10 Jan 2022 20:55:11 +0800 Subject: [PATCH 007/113] =?UTF-8?q?REPORT-64487=20=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E9=A2=9C=E8=89=B2=E9=85=8D=E7=BD=AE=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E8=89=B2=E4=BB=A5=E5=90=8E=EF=BC=8C=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconUtils.java | 148 -------------- .../main/java/com/fr/base/svg/SVGIcon.java | 101 ---------- .../main/java/com/fr/base/svg/SVGLoader.java | 92 --------- .../java/com/fr/base/svg/SVGTranscoder.java | 181 ------------------ .../com/fr/base/svg/SystemScaleUtils.java | 101 ---------- .../com/fr/design/images/sort/asc.svg | 19 -- .../com/fr/design/images/sort/des.svg | 17 -- .../com/fr/design/images/sort/nosort.svg | 41 ---- .../sort/header/HeaderSortRulePane.java | 169 +++++++--------- 9 files changed, 70 insertions(+), 799 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/base/svg/IconUtils.java delete mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGIcon.java delete mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGLoader.java delete mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java delete mode 100644 designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java delete mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/asc.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/des.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java deleted file mode 100644 index 79d3cef76b..0000000000 --- a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.fr.base.svg; - -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.bridge.StableFactory; -import com.fr.stable.fun.ResourcePathTransformer; -import com.fr.stable.plugin.ExtraClassManagerProvider; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * 主要是用来读取svgIcon的工具类 - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/23 - */ -public class IconUtils { - - private static final String ICON_SUFFIX_SVG = ".svg"; - private static final String ICON_SUFFIX_PNG = ".png"; - private static final String ICON_SUFFIX_GIF = ".gif"; - private static final String SUFFIX_SEPARATOR = "."; - - public static final String ICON_TYPE_NORMAL= "_normal.svg"; - public static final String ICON_TYPE_DISABLED= "_disabled.svg"; - public static final String ICON_TYPE_PRESSED= "_pressed.svg"; - - - /** - * 可以读取SVG图标或者普通图标,并且可以读取不带扩展名的文件 - * 不带扩展名时以svg优先、其次png,最后gif - * @param resource 图片路径 - * @return 图标 - */ - public static Icon readIcon(String resource) { - // 判断是否有.XXX文件后缀 - if (resource.contains(SUFFIX_SEPARATOR)) { - // 判断是否以.svg结尾 - if (resource.endsWith(ICON_SUFFIX_SVG)) { - if (IOUtils.readResource(resource) != null) { - return SVGIcon.readSVGIcon(transformPath(resource)); - } - // 适配插件 - return adjustPluginsPng(resource); - } - return IOUtils.readIcon(resource); - } - // 文件无后缀时 - return readNoSuffixResource(resource, ICON_TYPE_NORMAL); - } - - /** - * 适配插件中使用_normal.png、_selected.png、_disabled.png的情况 - * @param resource 图片路径 - * @return Icon - */ - private static Icon adjustPluginsPng(String resource) { - String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); - // 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错 - return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource); - } - - /** - * 尝试读取不带扩展名的图标,svg优先,其次png,最后gif,都没读到就打印错误日志,返回空白Icon - * @param resource 图片路径 - * @param svgIconType 针对svg来说的图标类型 - * 取值为:ICON_TYPE_NORMAL、ICON_TYPE_DISABLED、ICON_TYPE_PRESSED - * @return 图标 - */ - private static Icon readNoSuffixResource(String resource, String svgIconType) { - String svgPath = resource + svgIconType; - if (IOUtils.readResource(svgPath) != null) { - return SVGIcon.readSVGIcon(transformPath(svgPath)); - } - String pngPath = resource + ICON_SUFFIX_PNG; - if (IOUtils.readResource(pngPath) != null) { - return IOUtils.readIcon(transformPath(pngPath)); - } - String gifPath = resource + ICON_SUFFIX_GIF; - if (IOUtils.readResource(gifPath) != null) { - return IOUtils.readIcon(transformPath(gifPath)); - } - FineLoggerFactory.getLogger().error("File not exists:{}", resource); - return new ImageIcon(); - } - - /** - * 读取指定类型的svgIcon - * @param resource - * @param svgIconType - * @return - */ - public static Icon readSVGIcon(String resource, String svgIconType) { - // 判断下是否有后缀 - if (!resource.contains(SUFFIX_SEPARATOR)) { - return readNoSuffixResource(resource, svgIconType); - } - // 如果是".png"后缀,就替换为传入的svgIconType,然后读取图标 - if (resource.endsWith(ICON_SUFFIX_PNG)) { - return readSpecifiedTypeIcon(resource, ICON_SUFFIX_PNG, svgIconType); - } - // 如果是"_XXXXXX.svg"后缀 - if (resource.endsWith(ICON_TYPE_NORMAL)) { - return readSpecifiedTypeIcon(resource, ICON_TYPE_NORMAL, svgIconType); - } - if (resource.endsWith(ICON_TYPE_DISABLED)) { - return readSpecifiedTypeIcon(resource, ICON_TYPE_DISABLED, svgIconType); - } - if (resource.endsWith(ICON_TYPE_PRESSED)) { - return readSpecifiedTypeIcon(resource, ICON_TYPE_PRESSED, svgIconType); - } - return readIcon(resource); - } - - private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) { - String iconPath = resource.replace(oldSuffix, newSuffix); - if (IOUtils.readResource(iconPath) != null) { - return SVGIcon.readSVGIcon(transformPath(iconPath)); - } - return readIcon(resource); - } - - private static String transformPath(String path) { - Set set = getResourcePathTransformers(); - for (ResourcePathTransformer transformer : set) { - if (transformer.accept(path)) { - return transformer.transform(path); - } - } - return path; - } - - private static Set getResourcePathTransformers() { - Set set = new HashSet(); - ExtraClassManagerProvider provider = StableFactory.getExtraClassManager(); - if (provider != null) { - Set pluginProvided = provider.getArray(ResourcePathTransformer.MARK_STRING); - set.addAll(pluginProvided); - } - ResourcePathTransformer[] oemSet = StableFactory.getMarkedObjectsFromCollection(ResourcePathTransformer.MARK_STRING, ResourcePathTransformer.class); - set.addAll(Arrays.asList(oemSet)); - return set; - } -} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java deleted file mode 100644 index 9667895eec..0000000000 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.fr.base.svg; - -import com.fr.general.IOUtils; - -import javax.swing.Icon; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * SVG转化而来的Icon - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/17 - */ -public class SVGIcon implements Icon { - - private BufferedImage image; - - private static final boolean HI_DPI_SURPORT = SystemScaleUtils.isJreHiDPIEnabled(); - - public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale(); - - private static final String ICON_PREFIX = "/"; - - public SVGIcon(BufferedImage image) { - this.image = image; - } - - private static Map iconCache = new ConcurrentHashMap<>(); - - @Override - public void paintIcon(Component c, Graphics g, int x, int y) { - if (HI_DPI_SURPORT) { - Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null)); - float scale = SYSTEM_SCALE; - graphics.scale(1 / scale, 1 / scale); - graphics.drawImage(image, 0, 0, null); - graphics.scale(1.0D, 1.0D); - graphics.dispose(); - } else { - g.drawImage(image, x, y, null); - } - } - - @Override - public int getIconWidth() { - return HI_DPI_SURPORT ? (int) (image.getWidth() / SYSTEM_SCALE) : image.getWidth(); - } - - @Override - public int getIconHeight() { - return HI_DPI_SURPORT ? (int) (image.getHeight() / SYSTEM_SCALE) : image.getHeight(); - } - - /** - * 读取高清图标 - * @param url - * @return - */ - public static Icon readSVGIcon(String url) { - return readSVGIconWithCache(url, true); - } - - public static Icon readSVGIconWithCache(String url, boolean cacheRead) { - Icon icon = null; - if (cacheRead) { - icon = iconCache.get(url); - } - if (icon == null) { - if (!url.startsWith(ICON_PREFIX)) { - url = ICON_PREFIX + url; - } - BufferedImage image = (BufferedImage) SVGLoader.load(url); - icon = image == null ? IOUtils.readIcon(url) : new SVGIcon(image); - //只缓存svg图标 - if (image != null){ - iconCache.put(url, icon); - } - } - return icon; - } - - /** - * 读取指定尺寸的图标 - * @param url 资源路径 - * @param width 宽度 - * @param height 高度 - * @return - */ - public static Icon readSVGIcon(String url, float width, float height) { - if (!url.startsWith(ICON_PREFIX)) { - url = ICON_PREFIX + url; - } - BufferedImage image = (BufferedImage) SVGLoader.load(url, width, height); - return image == null ? IOUtils.readIcon(url) : new SVGIcon(image); - } -} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java deleted file mode 100644 index 3c0b7a0363..0000000000 --- a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fr.base.svg; - -import com.fr.general.IOUtils; -import org.apache.batik.transcoder.TranscoderException; -import org.apache.batik.transcoder.TranscoderInput; -import org.apache.xmlgraphics.java2d.Dimension2DDouble; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.awt.Image; -import java.io.IOException; -import java.net.URL; - -/** - * SVG图标加载器 - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/17 - */ -public class SVGLoader { - public static final int ICON_DEFAULT_SIZE = 16; - - public SVGLoader() { - } - - @Nullable - public static Image load(@NotNull String url) { - try { - URL resource = IOUtils.getResource(url, SVGLoader.class); - if (resource == null) { - return null; - } - return load(resource, SVGIcon.SYSTEM_SCALE); - } catch (IOException ignore) { - return null; - } - } - - @Nullable - public static Image load(@NotNull URL url) throws IOException { - return load(url, SVGIcon.SYSTEM_SCALE); - } - - @Nullable - public static Image load(@NotNull URL url, double scale) throws IOException { - try { - String svgUri = url.toString(); - TranscoderInput input = new TranscoderInput(svgUri); - return SVGTranscoder.createImage(scale, input).getImage(); - } catch (TranscoderException ignore) { - return null; - } - } - - @Nullable - public static Image load(@NotNull URL url, double scale, Dimension2DDouble dimension) throws IOException { - try { - String svgUri = url.toString(); - TranscoderInput input = new TranscoderInput(svgUri); - return SVGTranscoder.createImage(scale, input, - (float) (dimension.getWidth() * scale), (float) (dimension.getHeight() * scale)).getImage(); - } catch (TranscoderException ignore) { - return null; - } - } - - - @Nullable - public static Image load(@NotNull URL url, double scale, double overriddenWidth, double overriddenHeight) throws IOException { - try { - String svgUri = url.toString(); - TranscoderInput input = new TranscoderInput(svgUri); - return SVGTranscoder.createImage(scale, input, (float) (overriddenWidth * scale), (float) (overriddenHeight * scale)).getImage(); - } catch (TranscoderException ignore) { - return null; - } - } - - @Nullable - public static Image load(@NotNull String url, float width, float height) { - try { - URL resource = IOUtils.getResource(url, SVGLoader.class); - if (resource == null) { - return null; - } - TranscoderInput input = new TranscoderInput(resource.toString()); - return SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input, -1, -1, width, height).getImage(); - } catch (TranscoderException ignore) { - return null; - } - } -} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java deleted file mode 100644 index dd47bc5757..0000000000 --- a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.fr.base.svg; - -import com.fr.stable.AssistUtils; -import com.fr.value.AtomicNotNullLazyValue; -import org.apache.batik.anim.dom.SAXSVGDocumentFactory; -import org.apache.batik.anim.dom.SVGOMDocument; -import org.apache.batik.bridge.BridgeContext; -import org.apache.batik.bridge.UserAgent; -import org.apache.batik.transcoder.SVGAbstractTranscoder; -import org.apache.batik.transcoder.TranscoderException; -import org.apache.batik.transcoder.TranscoderInput; -import org.apache.batik.transcoder.TranscoderOutput; -import org.apache.batik.transcoder.image.ImageTranscoder; -import org.apache.batik.util.XMLResourceDescriptor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Element; -import org.w3c.dom.svg.SVGDocument; - -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.StringReader; - -/** - * 可以根据某个缩放倍数scale,将SVG图片转化为Image对象 - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/17 - */ -public class SVGTranscoder extends ImageTranscoder { - - private static final float DEFAULT_VALUE = -1.0F; - public static final float ICON_DEFAULT_SIZE = 16F; - private float origDocWidth; - private float origDocHeight; - @Nullable - private BufferedImage image; - private final double scale; - - @NotNull - private static AtomicNotNullLazyValue iconMaxSize = new AtomicNotNullLazyValue() { - @NotNull - @Override - protected Double compute() { - double maxSize = Double.MAX_VALUE; - if (!GraphicsEnvironment.isHeadless()) { - GraphicsDevice defaultScreenDevice = GraphicsEnvironment - .getLocalGraphicsEnvironment() - .getDefaultScreenDevice(); - Rectangle bounds = defaultScreenDevice.getDefaultConfiguration().getBounds(); - AffineTransform tx = defaultScreenDevice - .getDefaultConfiguration() - .getDefaultTransform(); - maxSize = Math.max(bounds.width * tx.getScaleX(), bounds.height * tx.getScaleY()); - } - return maxSize; - } - }; - - public SVGTranscoder(double scale) { - this.scale = scale; - this.width = ICON_DEFAULT_SIZE; - this.height = ICON_DEFAULT_SIZE; - } - - public SVGTranscoder(double scale, float width, float height) { - this.scale = scale; - this.width = width; - this.height = height; - } - - public final float getOrigDocWidth() { - return this.origDocWidth; - } - - public final void setOrigDocWidth(float origDocWidth) { - this.origDocWidth = origDocWidth; - } - - public final float getOrigDocHeight() { - return this.origDocHeight; - } - - public final void setOrigDocHeight(float origDocHeight) { - this.origDocHeight = origDocHeight; - } - - public static double getIconMaxSize() { - return iconMaxSize.getValue(); - } - - @Nullable - public final BufferedImage getImage() { - return this.image; - } - - @NotNull - public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input) throws TranscoderException { - return createImage(scale, input, -1, -1); - } - - @NotNull - public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight) throws TranscoderException { - return createImage(scale, input, overriddenWidth, overriddenHeight, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE); - } - - @NotNull - public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight, float width, float height) throws TranscoderException { - SVGTranscoder transcoder = new SVGTranscoder(scale, width, height); - if (!AssistUtils.equals(overriddenWidth, DEFAULT_VALUE)) { - transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, overriddenWidth); - } - - if (!AssistUtils.equals(overriddenHeight, DEFAULT_VALUE)) { - transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, overriddenHeight); - } - - double iconMaxSize = SVGTranscoder.iconMaxSize.getValue(); - transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_WIDTH, (float) iconMaxSize); - transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_HEIGHT, (float) iconMaxSize); - transcoder.transcode(input, null); - return transcoder; - } - - private static SVGDocument createFallbackPlaceholder() { - try { - String fallbackIcon = "\n" + - " \n" + - " \n" + - " \n" + - "\n"; - - SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName()); - return (SVGDocument) factory.createDocument(null, new StringReader(fallbackIcon)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - protected void setImageSize(float docWidth, float docHeight) { - super.setImageSize((float) (docWidth * this.scale), (float) (docHeight * this.scale)); - this.origDocWidth = docWidth; - this.origDocHeight = docHeight; - } - - @Override - @NotNull - public BufferedImage createImage(int width, int height) { - return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - } - - @Override - public void writeImage(@NotNull BufferedImage image, @Nullable TranscoderOutput output) { - this.image = image; - } - - @Override - @NotNull - protected UserAgent createUserAgent() { - return new SVGAbstractTranscoderUserAgent() { - @Override - @NotNull - public SVGDocument getBrokenLinkDocument(@NotNull Element e, @NotNull String url, @NotNull String message) { - return createFallbackPlaceholder(); - } - }; - } - - /** - * 开放访问权限 - */ - @Override - public BridgeContext createBridgeContext(SVGOMDocument doc) { - return super.createBridgeContext(doc); - } -} diff --git a/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java b/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java deleted file mode 100644 index 4b79748065..0000000000 --- a/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.fr.base.svg; - -import com.bulenkov.iconloader.util.UIUtil; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.StableUtils; -import com.fr.stable.os.OperatingSystem; -import org.jetbrains.annotations.NotNull; - -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.lang.reflect.Method; -import java.util.concurrent.atomic.AtomicReference; - -/** - * 获取系统Scale相关的工具类 - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/17 - */ -public class SystemScaleUtils { - - private static final AtomicReference JRE_HIDPI = new AtomicReference<>(); - - private static final String HI_DPI = "hidpi"; - - /** - * 判断是否支持高清 - * @return - */ - public static boolean isJreHiDPIEnabled() { - if (JRE_HIDPI.get() != null) { - return JRE_HIDPI.get(); - } - if (OperatingSystem.isMacos()) { - // 如果是mac os系统,直接返回true - return true; - } - if (OperatingSystem.isWindows() && StableUtils.getMajorJavaVersion() <= 8) { - // 如果是jdk8 + Windows系统,直接返回false - return false; - } - synchronized (JRE_HIDPI) { - if (JRE_HIDPI.get() != null) { - return JRE_HIDPI.get(); - } - boolean result = false; - if (getBooleanProperty(HI_DPI, true)) { - try { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - Class sunGraphicsEnvironmentClass = Class.forName("sun.java2d.SunGraphicsEnvironment"); - if (sunGraphicsEnvironmentClass.isInstance(ge)) { - try { - Method method = sunGraphicsEnvironmentClass.getDeclaredMethod("isUIScaleEnabled"); - method.setAccessible(true); - result = (Boolean)method.invoke(ge); - } - catch (NoSuchMethodException e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - } - } - catch (Throwable ignore) { - } - } - JRE_HIDPI.set(result); - return result; - } - } - - public static boolean getBooleanProperty(@NotNull final String key, final boolean defaultValue) { - final String value = System.getProperty(key); - return value == null ? defaultValue : Boolean.parseBoolean(value); - } - - /** - * 获取系统Scale - * @return - */ - public static float sysScale() { - // 如果检测到是retina,直接返回2 - if (UIUtil.isRetina()) { - return 2.0f; - } - float scale = 1.0f; - // 先判断是否支持高清,不支持代表此时是Windows + jdk8 的设计器,返回的scale值为1.0 - if (isJreHiDPIEnabled()) { - // 获取屏幕图形设备对象 - GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); - if (graphicsDevice != null) { - // 获取图形配置对象 - GraphicsConfiguration configuration = graphicsDevice.getDefaultConfiguration(); - if (configuration != null && configuration.getDevice().getType() != GraphicsDevice.TYPE_PRINTER) { - // 获取屏幕缩放率,Windows+jdk11环境下会得到用户设置的dpi值 - scale = (float) configuration.getDefaultTransform().getScaleX(); - } - } - } - return scale; - } -} diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg b/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg deleted file mode 100644 index 67dd9e829e..0000000000 --- a/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - 升序备份 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/des.svg b/designer-base/src/main/resources/com/fr/design/images/sort/des.svg deleted file mode 100644 index 2fcef077e6..0000000000 --- a/designer-base/src/main/resources/com/fr/design/images/sort/des.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - 降序 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg b/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg deleted file mode 100644 index ca04928fc8..0000000000 --- a/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - 不排序 - - - - - - - - - - - - - - - - - - - - \ No newline at end of file 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 79f939639e..172db28aec 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 @@ -1,45 +1,37 @@ package com.fr.design.sort.header; +import com.fr.base.FineColor; import com.fr.base.svg.SVGIcon; -import com.fr.base.svg.SVGTranscoder; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ipoppane.PopupHider; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.theme.edit.ui.ColorListPane; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; +import com.fr.design.style.color.ColorControlWindow; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.report.core.sort.header.HeaderIconBuilder; import com.fr.report.core.sort.header.SortHeader; import com.fr.report.core.sort.common.SortRule; -import org.apache.batik.transcoder.TranscoderInput; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; public class HeaderSortRulePane extends JPanel { - private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg"; - private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg"; - private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg"; - private static final double ICON_SCALE = SVGIcon.SYSTEM_SCALE * 1.25; - private static final int ICON_LENGTH = (int) Math.ceil(16 * ICON_SCALE); IconButton ascIconButton; IconButton desIconButton; IconButton nosortIconButton; UICheckBox ascUICheckBox; UICheckBox desUICheckBox; UICheckBox nosortUICheckBox; - static Map originalSvgTextMap = new HashMap<>(); + Color defaultColor = new Color(33, 33, 34); HeaderSortRulePane() { initComponents(); @@ -61,12 +53,12 @@ public class HeaderSortRulePane extends JPanel { void initSortRuleItem() { Component[][] components = new Component[][]{ - new Component[]{ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()), ascIconButton = new IconButton(ASC_ICON_TEMPLATE_PATH)}, - new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)}, - new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)}, + new Component[]{ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()), ascIconButton = new IconButton(SortRule.ASC)}, + new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(SortRule.DES)}, + new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(SortRule.NO_SORT)}, }; - double[] rowSize = {ICON_LENGTH + 10, ICON_LENGTH + 10, ICON_LENGTH + 10}; - double[] columnSize = {80, ICON_LENGTH + 10}; + double[] rowSize = {HeaderIconBuilder.ICON_LENGTH + 10, HeaderIconBuilder.ICON_LENGTH + 10, HeaderIconBuilder.ICON_LENGTH + 10}; + double[] columnSize = {80, HeaderIconBuilder.ICON_LENGTH + 10}; JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0); this.add(sortRuleItem, BorderLayout.CENTER); initUICheckBoxChange(ascUICheckBox, ascIconButton); @@ -87,24 +79,23 @@ public class HeaderSortRulePane extends JPanel { ascUICheckBox.setSelected(selected); desUICheckBox.setSelected(selected); nosortUICheckBox.setSelected(selected); - ascIconButton.refreshIconLabelColor(new Color(33, 33, 34)); - desIconButton.refreshIconLabelColor(new Color(33, 33, 34)); - nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34)); + ascIconButton.refreshIconLabelColor(new FineColor(defaultColor)); + desIconButton.refreshIconLabelColor(new FineColor(defaultColor)); + nosortIconButton.refreshIconLabelColor(new FineColor(defaultColor)); } - class IconButton extends JPanel implements UIObserver { + class IconButton extends JPanel implements UIObserver, PopupHider { + SortRule sortRule; JLayeredPane jLayeredPane; - String iconTemplatePath; UILabel iconLabel; - ColorListPane.ColorButton colorButton; - Color color; - BufferedImage bufferedImage; + FineColor fineColor = new FineColor(defaultColor); UIObserverListener uiObserverListener; boolean activeState; UILabel borderUiLabel; + private ColorControlWindow colorSelector; - IconButton(String iconTemplatePath) { - this.iconTemplatePath = iconTemplatePath; + IconButton(SortRule sortRule) { + this.sortRule = sortRule; initComponents(); } @@ -115,48 +106,47 @@ public class HeaderSortRulePane extends JPanel { public void setActiveState(boolean activeState) { if (activeState) { borderUiLabel.setBorder(BorderFactory.createLineBorder(Color.gray, 1)); - colorButton.setVisible(true); } else { borderUiLabel.setBorder(null); - colorButton.setVisible(false); } this.activeState = activeState; } void initComponents() { jLayeredPane = new JLayeredPane(); - iconLabel = getIconLabel(iconTemplatePath); + iconLabel = getIconLabel(); borderUiLabel = new UILabel(); - borderUiLabel.setSize(ICON_LENGTH, ICON_LENGTH); + borderUiLabel.setSize(HeaderIconBuilder.ICON_LENGTH, HeaderIconBuilder.ICON_LENGTH); borderUiLabel.setOpaque(true); borderUiLabel.setBackground(Color.WHITE); - iconLabel.setSize(ICON_LENGTH, ICON_LENGTH); - colorButton = new ColorListPane.ColorButton(Color.CYAN); - colorButton.setSize(ICON_LENGTH, ICON_LENGTH); - colorButton.addChangeListener(new ChangeListener() { + iconLabel.setSize(HeaderIconBuilder.ICON_LENGTH, HeaderIconBuilder.ICON_LENGTH); + iconLabel.addMouseListener(new MouseAdapter() { @Override - public void stateChanged(ChangeEvent e) { - color = colorButton.getSelectObject(); - refreshIconLabelColor(color); - uiObserverListener.doChange(); + public void mouseClicked(MouseEvent e) { + if (activeState) { + showPopupMenu(); + } } }); - jLayeredPane.setPreferredSize(new Dimension(ICON_LENGTH, ICON_LENGTH)); - + jLayeredPane.setPreferredSize(new Dimension(HeaderIconBuilder.ICON_LENGTH, HeaderIconBuilder.ICON_LENGTH)); jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER); jLayeredPane.add(borderUiLabel, JLayeredPane.MODAL_LAYER); - jLayeredPane.add(colorButton, JLayeredPane.PALETTE_LAYER); this.add(jLayeredPane); } - void refreshIconLabelColor(Color color) { - Icon icon = getIcon(iconTemplatePath, color); + void refreshIconLabelColor(FineColor fineColor) { + Icon icon = getIcon(fineColor); refreshIconLabel(icon); } + Icon getIcon(FineColor fineColor) { + BufferedImage bufferedImage = HeaderIconBuilder.getIcon(sortRule, fineColor); + Icon icon = new ImageIcon(bufferedImage); + return icon; + } + void refreshIconLabel(BufferedImage bufferedImage) { if (bufferedImage != null) { - this.bufferedImage = bufferedImage; Icon icon = new SVGIcon(bufferedImage); refreshIconLabel(icon); } @@ -170,64 +160,46 @@ public class HeaderSortRulePane extends JPanel { } } - UILabel getIconLabel(String iconPath) { - return getIconLabel(iconPath, new Color(33, 33, 34)); + UILabel getIconLabel() { + return getIconLabel(new FineColor(defaultColor)); } - UILabel getIconLabel(String iconPath, Color color) { - Icon svgIcon = getIcon(iconPath, color); + UILabel getIconLabel(FineColor fineColor) { + Icon svgIcon = getIcon(fineColor); return new UILabel(svgIcon); } - Icon getIcon(String iconPath, Color color) { - try { - String originalSvgText = getOriginalSvgText(iconPath); - String svgText = originalSvgText.replaceAll("\\{fillColor\\}", shiftColor(color)); - InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes(StandardCharsets.UTF_8)); - TranscoderInput input = new TranscoderInput(svgInputStream); - bufferedImage = SVGTranscoder.createImage(ICON_SCALE, input).getImage(); - SVGIcon svgIcon = new SVGIcon(bufferedImage); - return svgIcon; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return null; + private void showPopupMenu() { + hidePopupMenu(); + colorSelector = this.getColorSelector(); + GUICoreUtils.showPopupMenu(colorSelector, this, 0, this.getSize().height); } - String getOriginalSvgText(String iconPath) throws Exception { - String originalSvgText = originalSvgTextMap.get(iconPath); - if (originalSvgText == null) { - InputStream inputStream = IOUtils.getResourceAsStream(iconPath, HeaderSortRulePane.class); - originalSvgText = getSvgText(inputStream); - originalSvgTextMap.put(iconPath, originalSvgText); + @Override + public void hidePopupMenu() { + if (colorSelector != null) { + colorSelector.setVisible(false); } - return originalSvgText; - } - - String shiftColor(Color color) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(shiftValue(color.getRed())); - stringBuilder.append(shiftValue(color.getGreen())); - stringBuilder.append(shiftValue(color.getBlue())); - return stringBuilder.toString(); + colorSelector = null; } - String shiftValue(int value) { - String resultValue = Integer.toHexString(value); - if (resultValue.length() == 1) { - resultValue = "0" + resultValue; - } - return resultValue; + private ColorControlWindow getColorSelector() { + return new ColorControlWindow(false, IconButton.this) { + @Override + protected void colorChanged() { + Color color = this.getColor(); + if (color instanceof FineColor) { + fineColor = (FineColor) color; + } else { + fineColor = new FineColor(color); + } + refreshIconLabelColor(fineColor); + hidePopupMenu(); + uiObserverListener.doChange(); + } + }; } - private String getSvgText(InputStream inputStream) throws Exception { - StringBuffer stringBuffer = new StringBuffer(); - byte[] b = new byte[1024]; - for (int n; (n = inputStream.read(b)) != -1; ) { - stringBuffer.append(new String(b, 0, n)); - } - return stringBuffer.toString(); - } @Override public void registerChangeListener(UIObserverListener uiObserverListener) { @@ -256,7 +228,6 @@ public class HeaderSortRulePane extends JPanel { nosortIconButton.refreshIconLabel(bufferedImage); nosortUICheckBox.setSelected(true); } - } } } @@ -264,13 +235,13 @@ public class HeaderSortRulePane extends JPanel { public SortHeader.SortItem[] updateBean() { java.util.List items = new ArrayList<>(); if (ascUICheckBox.isSelected()) { - items.add(new SortHeader.SortItem(SortRule.ASC, ascIconButton.bufferedImage)); + items.add(new SortHeader.SortItem(SortRule.ASC, ascIconButton.fineColor)); } if (desUICheckBox.isSelected()) { - items.add(new SortHeader.SortItem(SortRule.DES, desIconButton.bufferedImage)); + items.add(new SortHeader.SortItem(SortRule.DES, desIconButton.fineColor)); } if (nosortUICheckBox.isSelected()) { - items.add(new SortHeader.SortItem(SortRule.NO_SORT, nosortIconButton.bufferedImage)); + items.add(new SortHeader.SortItem(SortRule.NO_SORT, nosortIconButton.fineColor)); } SortHeader.SortItem[] resultItems = new SortHeader.SortItem[items.size()]; return items.toArray(resultItems); From b8eb6e881f2a96d24fd4b3cafa40dc0b69073f86 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 11 Jan 2022 09:46:02 +0800 Subject: [PATCH 008/113] =?UTF-8?q?REPORT-64679=20=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A1=8C=E4=BB=A5=E5=90=8E=EF=BC=8C=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=8C=BA=E5=9F=9F=E5=92=8C=E8=A1=A8=E5=A4=B4=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E7=9A=84=E5=8D=95=E5=85=83=E6=A0=BC=E5=80=BC=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=81=94=E5=8A=A8=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconUtils.java | 147 ++++++++++++++++++ .../main/java/com/fr/base/svg/SVGIcon.java | 99 ++++++++++++ 2 files changed, 246 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/base/svg/IconUtils.java create mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGIcon.java diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java new file mode 100644 index 0000000000..fd99f0e994 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -0,0 +1,147 @@ +package com.fr.base.svg; + +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.fun.ResourcePathTransformer; +import com.fr.stable.plugin.ExtraClassManagerProvider; + +import javax.swing.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * 主要是用来读取svgIcon的工具类 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/23 + */ +public class IconUtils { + + private static final String ICON_SUFFIX_SVG = ".svg"; + private static final String ICON_SUFFIX_PNG = ".png"; + private static final String ICON_SUFFIX_GIF = ".gif"; + private static final String SUFFIX_SEPARATOR = "."; + + public static final String ICON_TYPE_NORMAL= "_normal.svg"; + public static final String ICON_TYPE_DISABLED= "_disabled.svg"; + public static final String ICON_TYPE_PRESSED= "_pressed.svg"; + + + /** + * 可以读取SVG图标或者普通图标,并且可以读取不带扩展名的文件 + * 不带扩展名时以svg优先、其次png,最后gif + * @param resource 图片路径 + * @return 图标 + */ + public static Icon readIcon(String resource) { + // 判断是否有.XXX文件后缀 + if (resource.contains(SUFFIX_SEPARATOR)) { + // 判断是否以.svg结尾 + if (resource.endsWith(ICON_SUFFIX_SVG)) { + if (IOUtils.readResource(resource) != null) { + return SVGIcon.readSVGIcon(transformPath(resource)); + } + // 适配插件 + return adjustPluginsPng(resource); + } + return IOUtils.readIcon(resource); + } + // 文件无后缀时 + return readNoSuffixResource(resource, ICON_TYPE_NORMAL); + } + + /** + * 适配插件中使用_normal.png、_selected.png、_disabled.png的情况 + * @param resource 图片路径 + * @return Icon + */ + private static Icon adjustPluginsPng(String resource) { + String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); + // 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错 + return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource); + } + + /** + * 尝试读取不带扩展名的图标,svg优先,其次png,最后gif,都没读到就打印错误日志,返回空白Icon + * @param resource 图片路径 + * @param svgIconType 针对svg来说的图标类型 + * 取值为:ICON_TYPE_NORMAL、ICON_TYPE_DISABLED、ICON_TYPE_PRESSED + * @return 图标 + */ + private static Icon readNoSuffixResource(String resource, String svgIconType) { + String svgPath = resource + svgIconType; + if (IOUtils.readResource(svgPath) != null) { + return SVGIcon.readSVGIcon(transformPath(svgPath)); + } + String pngPath = resource + ICON_SUFFIX_PNG; + if (IOUtils.readResource(pngPath) != null) { + return IOUtils.readIcon(transformPath(pngPath)); + } + String gifPath = resource + ICON_SUFFIX_GIF; + if (IOUtils.readResource(gifPath) != null) { + return IOUtils.readIcon(transformPath(gifPath)); + } + FineLoggerFactory.getLogger().error("File not exists:{}", resource); + return new ImageIcon(); + } + + /** + * 读取指定类型的svgIcon + * @param resource + * @param svgIconType + * @return + */ + public static Icon readSVGIcon(String resource, String svgIconType) { + // 判断下是否有后缀 + if (!resource.contains(SUFFIX_SEPARATOR)) { + return readNoSuffixResource(resource, svgIconType); + } + // 如果是".png"后缀,就替换为传入的svgIconType,然后读取图标 + if (resource.endsWith(ICON_SUFFIX_PNG)) { + return readSpecifiedTypeIcon(resource, ICON_SUFFIX_PNG, svgIconType); + } + // 如果是"_XXXXXX.svg"后缀 + if (resource.endsWith(ICON_TYPE_NORMAL)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_NORMAL, svgIconType); + } + if (resource.endsWith(ICON_TYPE_DISABLED)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_DISABLED, svgIconType); + } + if (resource.endsWith(ICON_TYPE_PRESSED)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_PRESSED, svgIconType); + } + return readIcon(resource); + } + + private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) { + String iconPath = resource.replace(oldSuffix, newSuffix); + if (IOUtils.readResource(iconPath) != null) { + return SVGIcon.readSVGIcon(transformPath(iconPath)); + } + return readIcon(resource); + } + + private static String transformPath(String path) { + Set set = getResourcePathTransformers(); + for (ResourcePathTransformer transformer : set) { + if (transformer.accept(path)) { + return transformer.transform(path); + } + } + return path; + } + + private static Set getResourcePathTransformers() { + Set set = new HashSet(); + ExtraClassManagerProvider provider = StableFactory.getExtraClassManager(); + if (provider != null) { + Set pluginProvided = provider.getArray(ResourcePathTransformer.MARK_STRING); + set.addAll(pluginProvided); + } + ResourcePathTransformer[] oemSet = StableFactory.getMarkedObjectsFromCollection(ResourcePathTransformer.MARK_STRING, ResourcePathTransformer.class); + set.addAll(Arrays.asList(oemSet)); + return set; + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java new file mode 100644 index 0000000000..172b10dac5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -0,0 +1,99 @@ +package com.fr.base.svg; + +import com.fr.general.IOUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * SVG转化而来的Icon + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/17 + */ +public class SVGIcon implements Icon { + + private BufferedImage image; + + private static final boolean HI_DPI_SURPORT = SystemScaleUtils.isJreHiDPIEnabled(); + + public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale(); + + private static final String ICON_PREFIX = "/"; + + public SVGIcon(BufferedImage image) { + this.image = image; + } + + private static Map iconCache = new ConcurrentHashMap<>(); + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + if (HI_DPI_SURPORT) { + Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null)); + float scale = SYSTEM_SCALE; + graphics.scale(1 / scale, 1 / scale); + graphics.drawImage(image, 0, 0, null); + graphics.scale(1.0D, 1.0D); + graphics.dispose(); + } else { + g.drawImage(image, x, y, null); + } + } + + @Override + public int getIconWidth() { + return HI_DPI_SURPORT ? (int) (image.getWidth() / SYSTEM_SCALE) : image.getWidth(); + } + + @Override + public int getIconHeight() { + return HI_DPI_SURPORT ? (int) (image.getHeight() / SYSTEM_SCALE) : image.getHeight(); + } + + /** + * 读取高清图标 + * @param url + * @return + */ + public static Icon readSVGIcon(String url) { + return readSVGIconWithCache(url, true); + } + + public static Icon readSVGIconWithCache(String url, boolean cacheRead) { + Icon icon = null; + if (cacheRead) { + icon = iconCache.get(url); + } + if (icon == null) { + if (!url.startsWith(ICON_PREFIX)) { + url = ICON_PREFIX + url; + } + BufferedImage image = (BufferedImage) SVGLoader.load(url); + icon = image == null ? IOUtils.readIcon(url) : new SVGIcon(image); + //只缓存svg图标 + if (image != null){ + iconCache.put(url, icon); + } + } + return icon; + } + + /** + * 读取指定尺寸的图标 + * @param url 资源路径 + * @param width 宽度 + * @param height 高度 + * @return + */ + public static Icon readSVGIcon(String url, float width, float height) { + if (!url.startsWith(ICON_PREFIX)) { + url = ICON_PREFIX + url; + } + BufferedImage image = (BufferedImage) SVGLoader.load(url, width, height); + return image == null ? IOUtils.readIcon(url) : new SVGIcon(image); + } +} From bfa6ddb3426c12c67a98a218ff82abd8d027a387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 11 Jan 2022 10:52:12 +0800 Subject: [PATCH 009/113] =?UTF-8?q?CHART-22247=20=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE=E8=BE=B9=E6=A1=86/=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=97=B6=E9=97=B4=E6=A0=87=E8=AF=86=E7=BA=BF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartGanttTimeLinePane.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java index f6fb41edbc..0af3a24b13 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java @@ -12,6 +12,8 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -21,6 +23,8 @@ public class VanChartGanttTimeLinePane extends JPanel { private ColorSelectBoxWithOutTransparent colorSelect; private UINumberDragPaneWithPercent opacity; + private JPanel centerPane; + public VanChartGanttTimeLinePane() { this.setLayout(new BorderLayout()); this.add(createSwitchButtonPane(), BorderLayout.NORTH); @@ -32,6 +36,12 @@ public class VanChartGanttTimeLinePane extends JPanel { double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED}; String[] array = new String[]{Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Not_Show"), Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Show")}; switchButton = new UIButtonGroup<>(array); + switchButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + setCenterPaneVisibility(); + } + }); UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT); return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { new Component[]{null, null}, @@ -46,11 +56,15 @@ public class VanChartGanttTimeLinePane extends JPanel { colorSelect = new ColorSelectBoxWithOutTransparent(100); opacity = new UINumberDragPaneWithPercent(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + centerPane = TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { new Component[]{null, null}, new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect}, new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity} }, rowSize, columnSize); + + centerPane.setVisible(false); + + return centerPane; } public void populateBean(Plot plot) { @@ -59,6 +73,8 @@ public class VanChartGanttTimeLinePane extends JPanel { setShowTimeLine(ganttPlot.isShowTimeLine()); setTimeLineColor(ganttPlot.getTimeLineColor()); setTimeLineOpacity(ganttPlot.getTimeLineOpacity()); + + centerPane.setVisible(ganttPlot.isShowTimeLine()); } } @@ -71,6 +87,10 @@ public class VanChartGanttTimeLinePane extends JPanel { } } + private void setCenterPaneVisibility() { + centerPane.setVisible(switchButton.getSelectedIndex() == 1); + } + public boolean isShowTimeLine() { return switchButton.getSelectedIndex() == 1; } From 697919f46aa1f94ca906d30ca4c9436572f61ac0 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 21 Dec 2021 14:59:09 +0800 Subject: [PATCH 010/113] =?UTF-8?q?REPORT-62688=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E9=9D=A2=E5=90=91=E9=A3=8E=E6=A0=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 设计器在线商城页面网页化 2. URL启动设计器安装主题文件 【改动思路】 同上 --- build.gradle | 4 + .../fr/design/mainframe/DesignerFrame.java | 7 + .../share/mini/MiniShopDisposingChecker.java | 37 +++ .../share/mini/MiniShopNativeTask.java | 11 + .../share/mini/MiniShopNativeTaskManager.java | 42 +++ .../FineStartupNotificationFactory.java | 33 ++ .../FineStartupNotificationProvider.java | 14 + .../Install4jStartupNotificationProvider.java | 35 +++ .../design/mainframe/FormParaWidgetPane.java | 11 +- .../config/ComponentReuseConfigManager.java | 4 + .../share/ui/online/OnlineWidgetRepoPane.java | 165 ++++++++-- .../share/ui/online/OnlineWidgetTabPane.java | 65 +++- .../installation/AsyncInstallation.java | 38 +++ .../installation/ComponentInstallation.java | 147 +++++++++ .../ComponentsPackageInstallation.java | 179 +++++++++++ .../ui/online/installation/Installation.java | 10 + .../TemplateThemeInstallation.java | 202 ++++++++++++ .../online/mini/MiniComponentShopDialog.java | 124 ++++++++ .../ui/online/mini/MiniComponentShopPane.java | 68 +++++ .../mini/bridge/ComposedNativeBridges.java | 26 ++ .../online/mini/bridge/NativeAuthBridge.java | 34 +++ .../mini/bridge/NativeBrowserBridge.java | 25 ++ .../mini/bridge/NativeProductBridge.java | 287 ++++++++++++++++++ .../online/mini/bridge/NativeTaskBridge.java | 89 ++++++ .../mainframe/share/util/OnlineShopUtils.java | 4 + .../java/com/fr/design/deeplink/DeepLink.java | 15 + .../fr/design/deeplink/DeepLinkManager.java | 133 ++++++++ .../TemplateThemeInstallationDeepLink.java | 53 ++++ .../main/java/com/fr/start/MainDesigner.java | 2 + 29 files changed, 1824 insertions(+), 40 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopDisposingChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTask.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTaskManager.java create mode 100644 designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/AsyncInstallation.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/Installation.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java create mode 100644 designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java create mode 100644 designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java create mode 100644 designer-realize/src/main/java/com/fr/design/deeplink/TemplateThemeInstallationDeepLink.java diff --git a/build.gradle b/build.gradle index a3892da963..ee08bdeeac 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,9 @@ allprojects { repositories { mavenLocal() + maven { + url 'https://maven.ej-technologies.com/repository' + } } idea { @@ -57,6 +60,7 @@ allprojects { } dependencies { + implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23' implementation 'com.fr.third:jxbrowser-win64:6.23' diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index be841f79a3..2534de5266 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -28,6 +28,8 @@ import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; +import com.fr.design.mainframe.share.mini.MiniShopNativeTaskManager; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; @@ -157,6 +159,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void windowClosing(WindowEvent e) { + // 检查mini商城是否存在未结束的后台任务 + if (!MiniShopDisposingChecker.check()) { + return; + } + // 关闭前check if (!TemplateSavingChecker.check()) { return; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopDisposingChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopDisposingChecker.java new file mode 100644 index 0000000000..dd76befe66 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopDisposingChecker.java @@ -0,0 +1,37 @@ +package com.fr.design.mainframe.share.mini; + +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; + +import javax.swing.JOptionPane; +import java.awt.Component; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/8 + */ +public class MiniShopDisposingChecker { + + public static boolean check() { + return check(DesignerContext.getDesignerFrame()); + } + + public static boolean check(Component optionParentComponent) { + if (MiniShopNativeTaskManager.getInstance().hasExecutingTasks()) { + int result = FineJOptionPane.showConfirmDialog( + optionParentComponent, + Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Close_Tip"), + "", + FineJOptionPane.YES_NO_OPTION + ); + if (result == JOptionPane.YES_OPTION) { + MiniShopNativeTaskManager.getInstance().cancelAllExecutingTasks(); + return true; + } + return false; + } + return true; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTask.java b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTask.java new file mode 100644 index 0000000000..9144f2fa0d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTask.java @@ -0,0 +1,11 @@ +package com.fr.design.mainframe.share.mini; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/8 + */ +public interface MiniShopNativeTask { + void execute(); + void cancel(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTaskManager.java b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTaskManager.java new file mode 100644 index 0000000000..514ff84c82 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/mini/MiniShopNativeTaskManager.java @@ -0,0 +1,42 @@ +package com.fr.design.mainframe.share.mini; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/8 + */ +public class MiniShopNativeTaskManager { + private MiniShopNativeTaskManager() { + } + private static class HOLDER { + private static final MiniShopNativeTaskManager singleton = new MiniShopNativeTaskManager(); + } + public static MiniShopNativeTaskManager getInstance() { + return MiniShopNativeTaskManager.HOLDER.singleton; + } + + + private static final Set executingTasks = new HashSet<>(); + + public void addStartedTask(MiniShopNativeTask task) { + executingTasks.add(task); + } + + public void removeCompletedTask(MiniShopNativeTask task) { + executingTasks.remove(task); + } + + public boolean hasExecutingTasks() { + return !executingTasks.isEmpty(); + } + + public void cancelAllExecutingTasks() { + for (MiniShopNativeTask executingTask: executingTasks) { + executingTask.cancel(); + } + executingTasks.clear(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationFactory.java b/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationFactory.java new file mode 100644 index 0000000000..b303d491ff --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationFactory.java @@ -0,0 +1,33 @@ +package com.fr.design.startup; + +import org.jetbrains.annotations.NotNull; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/11 + */ +public class FineStartupNotificationFactory { + private static final FineStartupNotificationProvider DEFAULT = Install4jStartupNotificationProvider.getInstance(); + private static FineStartupNotificationProvider provider; + + public FineStartupNotificationFactory() { + } + + public static FineStartupNotificationProvider getNotification() { + return provider; + } + + public static void setLogger(@NotNull FineStartupNotificationProvider provider) { + FineStartupNotificationFactory.provider = provider; + } + + public static void reset() { + provider = DEFAULT; + } + + + static { + provider = DEFAULT; + } +} diff --git a/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationProvider.java new file mode 100644 index 0000000000..b90390a703 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/startup/FineStartupNotificationProvider.java @@ -0,0 +1,14 @@ +package com.fr.design.startup; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/11 + */ +public interface FineStartupNotificationProvider { + void registerStartupListener(Listener listener); + + interface Listener { + void startupPerformed(String parameters); + } +} diff --git a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java new file mode 100644 index 0000000000..dbc7be2b72 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java @@ -0,0 +1,35 @@ +package com.fr.design.startup; + +import com.install4j.api.launcher.StartupNotification; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/11 + */ +public class Install4jStartupNotificationProvider implements FineStartupNotificationProvider { + + private Install4jStartupNotificationProvider() { + } + private static final Install4jStartupNotificationProvider INSTANCE = new Install4jStartupNotificationProvider(); + public static Install4jStartupNotificationProvider getInstance() { + return INSTANCE; + } + + @Override + public void registerStartupListener(Listener listener) { + boolean supported = false; + try { + supported = Class.forName("com.install4j.api.launcher.StartupNotification") != null; + } catch (Throwable ignored) {} + + if (supported) { + StartupNotification.registerStartupListener(new StartupNotification.Listener() { + @Override + public void startupPerformed(String parameters) { + listener.startupPerformed(parameters); + } + }); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 7a084c2f0f..85a0743841 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -18,6 +18,9 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.module.DesignModuleFactory; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.LayoutUtils; @@ -262,7 +265,13 @@ public class FormParaWidgetPane extends JPanel { jPanel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { - FormWidgetDetailPane.getInstance().enterWidgetLib(); + if (OnlineShopUtils.testConnection()) { + MiniComponentShopDialog.getInstance().show(); + } else { + OnlineWidgetRepoPane.getInstance().switch2InternetErrorPane(); + FormWidgetDetailPane.getInstance().switch2Local(); + FormWidgetDetailPane.getInstance().enterWidgetLib(); + } } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java index 78bc8af672..798bc359ac 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java @@ -22,6 +22,7 @@ public class ComponentReuseConfigManager { private static final String PROPERTIES_FILE_NAME = "reuse.properties"; private static final String MINI_SHOP_URL = "MINI_SHOP_URL"; + private static final String WEB_MINI_SHOP_URL = "WEB_MINI_SHOP_URL"; private static final String COMPONENT_UPLOAD_URL = "COMPONENT_UPLOAD_URL"; private static final String MARKET_LOGIN_URL = "MARKET_LOGIN_URL"; private static final String UPLOAD_REU_SUPPORT = "UPLOAD_REU_SUPPORT"; @@ -61,6 +62,9 @@ public class ComponentReuseConfigManager { return p; } + public String getWebMiniShopUrl() { + return loadAttribute(WEB_MINI_SHOP_URL, DesignerCloudURLManager.getInstance().acquireUrlByKind("component.miniShop")); + } public String getMiniShopUrl() { return loadAttribute(MINI_SHOP_URL, DesignerCloudURLManager.getInstance().acquireUrlByKind("af.reuseInfo")); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java index b9e430fe46..b4d3bcc68d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java @@ -1,29 +1,44 @@ package com.fr.design.mainframe.share.ui.online; import com.fr.base.BaseUtils; +import com.fr.base.Style; +import com.fr.config.constant.Constant; import com.fr.design.dialog.BasicPane; +import com.fr.design.form.util.FontTransformUtil; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.share.ui.base.LoadingPane; import com.fr.design.mainframe.share.ui.base.MouseClickListener; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.mainframe.theme.edit.ui.LabelUtils; import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.general.FRFont; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.BoxLayout; import javax.swing.JPanel; +import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; +import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.List; import java.util.concurrent.ExecutionException; @@ -35,13 +50,8 @@ public class OnlineWidgetRepoPane extends BasicPane { private static final String MARKET_URL = "https://market.fanruan.com/reuse"; private static List[] sharableWidgets; private OnlineWidgetTabPane componentTabPane; - private JPanel centerPane; private boolean isShowPackagePanel = false; - private CardLayout cardLayout; - private Status currentStatus; - - - enum Status {LOADING, DISCONNECTED, NORMAL} + private LoadableContentPane loadableContentPane; public static boolean loadWidgets() { if (sharableWidgets != null){ @@ -82,16 +92,15 @@ public class OnlineWidgetRepoPane extends BasicPane { } private void initPane() { - cardLayout = new CardLayout(); - this.setLayout(cardLayout); - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.setLayout(new BorderLayout()); + + this.loadableContentPane = new LoadableContentPane(createInternetErrorPane()); + this.loadableContentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(new LoadingPane(), Status.LOADING.name()); - this.add(this.centerPane, Status.NORMAL.name()); - this.add(createInternetErrorPane(), Status.DISCONNECTED.name()); + DisabledContentPane disabledContentPane = new DisabledContentPane(this.loadableContentPane); + this.add(disabledContentPane, BorderLayout.CENTER); - switchPane(Status.LOADING); + this.loadableContentPane.showLoading(); setContent(); } @@ -105,18 +114,15 @@ public class OnlineWidgetRepoPane extends BasicPane { } private void addCenterPane() { - this.centerPane.removeAll(); - this.centerPane.add(this.componentTabPane, BorderLayout.CENTER); - this.switchPane(Status.NORMAL); + JPanel contentPane = this.loadableContentPane.getContentPane(); + contentPane.removeAll(); + contentPane.setLayout(new BorderLayout()); + contentPane.add(this.componentTabPane, BorderLayout.CENTER); + this.loadableContentPane.showContent(); } public void switch2InternetErrorPane() { - switchPane(Status.DISCONNECTED); - } - - private void switchPane(Status status) { - this.currentStatus = status; - cardLayout.show(this, status.name()); + this.loadableContentPane.showError(); } private void synchronizedLoadingContent() { @@ -147,16 +153,18 @@ public class OnlineWidgetRepoPane extends BasicPane { if (componentTabPane != null) { componentTabPane.removeTabChangeListener(tabChangeListener); } - this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets[0].toArray(new OnlineShareWidget[sharableWidgets[0].size()]), - sharableWidgets[1].toArray(new OnlineShareWidget[sharableWidgets[1].size()])); + this.componentTabPane = new OnlineWidgetTabPane( + sharableWidgets[0].toArray(new OnlineShareWidget[0]), + sharableWidgets[1].toArray(new OnlineShareWidget[0]) + ); this.componentTabPane.addTabChangeListener(tabChangeListener); } else { - switchPane(Status.DISCONNECTED); + this.loadableContentPane.showError(); } return loadWidgetsSuccess; } - private OnlineWidgetTabPane.TabChangeListener tabChangeListener = new OnlineWidgetTabPane.TabChangeListener() { + private final OnlineWidgetTabPane.TabChangeListener tabChangeListener = new OnlineWidgetTabPane.TabChangeListener() { @Override public void tabChange(int selectedIndex) { setShowPackagePanel(selectedIndex != 0); @@ -173,7 +181,7 @@ public class OnlineWidgetRepoPane extends BasicPane { private JPanel createInternetErrorPane() { JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); - UILabel imagePanel = new UILabel(BaseUtils.readIcon("/com/fr/base/images/share/internet_error.png")); + UILabel imagePanel = new UILabel(IOUtils.readIcon("/com/fr/base/images/share/internet_error.png")); imagePanel.setPreferredSize(new Dimension(240, 96)); imagePanel.setHorizontalAlignment(SwingConstants.CENTER); panel.add(imagePanel); @@ -240,4 +248,105 @@ public class OnlineWidgetRepoPane extends BasicPane { this.componentTabPane.completeEmbedFilter(); } } + + private static class LoadableContentPane extends JPanel { + private enum Status { + LOADING, + DISCONNECTED, + NORMAL + } + private final CardLayout cardLayout; + private final JPanel contentPane; + + public LoadableContentPane(JPanel errorPane) { + cardLayout = new CardLayout(); + this.setLayout(cardLayout); + + this.add(new LoadingPane(), Status.LOADING.name()); + contentPane = new JPanel(); + this.add(contentPane, Status.NORMAL.name()); + this.add(errorPane, Status.DISCONNECTED.name()); + } + + private void switchPane(Status status) { + cardLayout.show(this, status.name()); + } + + public void showLoading() { + switchPane(Status.LOADING); + } + + public void showError() { + switchPane(Status.DISCONNECTED); + } + + public void showContent() { + switchPane(Status.NORMAL); + } + + public JPanel getContentPane() { + return contentPane; + } + } + + private static class DisabledContentPane extends JPanel { + private final CardLayout cardLayout; + + public DisabledContentPane(JPanel contentPane) { + cardLayout = new CardLayout(); + this.setLayout(cardLayout); + + this.add(new MaskPane(), "Disabled"); + this.add(contentPane, "Enabled"); + + MiniComponentShopDialog.getInstance().addWindowAdapter(new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + super.windowOpened(e); + setEnabled(false); + } + + @Override + public void windowClosed(WindowEvent e) { + super.windowClosed(e); + setEnabled(true); + } + }); + + setEnabled(true); + } + + @Override + public void setEnabled(boolean enabled) { + String constrains = enabled ? "Enabled" : "Disabled"; + cardLayout.show(this, constrains); + } + } + + private static class MaskPane extends JPanel { + private static final int PADDING = 30; + private final String text; + private final Style style; + public MaskPane() { + setLayout(new BorderLayout()); + + text = Toolkit.i18nText("Fine-Design_Share_Online_Repo_Pane_Forbidden_Tip"); + style = Style.getInstance(FRFont.getInstance().applyForeground(new Color(0x8F8F92))) + .deriveHorizontalAlignment(SwingConstants.CENTER) + .deriveVerticalAlignment(SwingConstants.CENTER) + .deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + + Graphics2D g2d = (Graphics2D) g; + g.translate(PADDING, 0); + BaseUtils.drawStringStyleInRotation(g2d, this.getWidth() - PADDING * 2, this.getHeight(), text, style, FontTransformUtil.getDesignerFontResolution()); + g.translate(-PADDING, 0); + + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index 52ea26bc26..c7a25be00c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -1,18 +1,29 @@ package com.fr.design.mainframe.share.ui.online; import com.fr.design.gui.ibutton.UITabGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.FormWidgetDetailPane; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.sort.OnlineWidgetSortType; -import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ui.online.embed.OnlineEmbedFilterShowPane; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.fr.design.mainframe.share.ui.online.widgetpackage.OnlineWidgetPackagesShowPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.form.share.bean.OnlineShareWidget; import javax.swing.BorderFactory; +import javax.swing.JButton; import javax.swing.JPanel; +import javax.swing.plaf.basic.BasicButtonUI; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.EventListener; import java.util.List; @@ -24,11 +35,14 @@ public class OnlineWidgetTabPane extends JPanel { private static final String COMPONENT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share"); private static final String COMPONENT_PACKAGE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Package"); private static final String COMPONENT_EMBED = "COMPONENT_EMBED"; + private static final int COMPONENT_PACKAGE_TAB_INDEX = 0; + private static final int COMPONENT_TAB_INDEX = 1; + private UITabGroup headGroup; private CardLayout cardLayout; private JPanel centerPane; private boolean packagePaneCreated = false; - private List tabChangeListeners; + private final List tabChangeListeners; private OnlineEmbedFilterShowPane embedFilterShowPane; public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) { @@ -44,12 +58,12 @@ public class OnlineWidgetTabPane extends JPanel { this.centerPane.add(new OnlineWidgetShowPane(sharableWidgets), COMPONENT); this.centerPane.add( embedFilterShowPane = new OnlineEmbedFilterShowPane(new OnlineWidgetShowPane(sharableWidgets, OnlineWidgetSortType.SALES)), COMPONENT_EMBED); //延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载 - this.headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { + this.headGroup = new UITabGroup(new String[]{COMPONENT_PACKAGE, COMPONENT}) { public void tabChanged(int newSelectedIndex) { for (TabChangeListener changeListener : tabChangeListeners) { changeListener.tabChange(newSelectedIndex); } - if (newSelectedIndex == 0) { + if (newSelectedIndex == COMPONENT_TAB_INDEX) { cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); } else { ComponentShareUtil.completeEmbedFilter(); @@ -64,15 +78,44 @@ public class OnlineWidgetTabPane extends JPanel { } }; - this.headGroup.setSelectedIndex(0); + this.headGroup.setSelectedIndex(COMPONENT_PACKAGE_TAB_INDEX); this.centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); - jPanel.add(headGroup, BorderLayout.CENTER); - this.add(jPanel, BorderLayout.NORTH); + JPanel fixedContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + fixedContentPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + fixedContentPane.add(headGroup, BorderLayout.NORTH); + + fixedContentPane.add(createMiniShopEntryPane(), BorderLayout.CENTER); + this.add(fixedContentPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } + private JPanel createMiniShopEntryPane() { + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + JButton button = new JButton(Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Entry_Text")); + button.setPreferredSize(new Dimension(button.getWidth(), 20)); + button.setUI(new BasicButtonUI()); + button.setOpaque(true); + button.setBackground(Color.WHITE); + button.setForeground(new Color(0x419BF9)); + button.setBorder(BorderFactory.createLineBorder(new Color(0x419BF9), 1, true)); + + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (OnlineShopUtils.testConnection()) { + MiniComponentShopDialog.getInstance().show(); + FormWidgetDetailPane.getInstance().switch2Local(); + FormWidgetDetailPane.getInstance().enterWidgetLib(); + } else { + OnlineWidgetRepoPane.getInstance().switch2InternetErrorPane(); + } + } + }); + container.add(button, BorderLayout.NORTH); + return container; + } + public void completeEmbedFilter(){ if (embedFilterShowPane!= null){ embedFilterShowPane.completeEmbedFilter(); @@ -85,8 +128,8 @@ public class OnlineWidgetTabPane extends JPanel { } } public void refreshPane() { - this.headGroup.setSelectedIndex(0); - this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); + this.headGroup.setSelectedIndex(COMPONENT_PACKAGE_TAB_INDEX); + this.cardLayout.show(centerPane, COMPONENT_PACKAGE); } public void refreshShowPaneUI(){ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/AsyncInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/AsyncInstallation.java new file mode 100644 index 0000000000..42602b8651 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/AsyncInstallation.java @@ -0,0 +1,38 @@ +package com.fr.design.mainframe.share.ui.online.installation; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/5 + */ +public abstract class AsyncInstallation implements Installation { + private AsyncActionListener actionListener; + + public void setActionListener(AsyncActionListener actionListener) { + this.actionListener = actionListener; + } + + protected void notifyProgress(double value) { + if (this.actionListener != null) { + this.actionListener.onProgress(value); + } + } + protected void notifySuccess() { + if (this.actionListener != null) { + this.actionListener.onSuccess(); + } + } + protected void notifyFailed() { + if (this.actionListener != null) { + this.actionListener.onFailed(); + } + } + + public abstract void cancel(); + + public interface AsyncActionListener { + void onProgress(double value); + void onSuccess(); + void onFailed(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java new file mode 100644 index 0000000000..e6403e902d --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java @@ -0,0 +1,147 @@ +package com.fr.design.mainframe.share.ui.online.installation; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.extra.Process; +import com.fr.design.login.DesignerLoginHelper; +import com.fr.design.login.DesignerLoginSource; +import com.fr.design.mainframe.share.collect.ComponentCollector; +import com.fr.design.mainframe.share.util.DownloadUtils; +import com.fr.design.mainframe.share.util.ShareComponentUtils; +import com.fr.form.share.Group; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.group.DefaultShareGroup; +import com.fr.form.share.group.DefaultShareGroupManager; +import com.fr.form.share.utils.ShareUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import javax.swing.SwingWorker; +import java.io.File; +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/5 + */ +public class ComponentInstallation extends AsyncInstallation { + private final OnlineShareWidget widget; + private SwingWorker worker; + + public ComponentInstallation(OnlineShareWidget widget) { + this.widget = widget; + } + + @Override + public void install() { + if (!checkLoginStatus()) { + notifyFailed(); + return; + } + notifyProgress(0.0D); + worker = createWorker(); + worker.execute(); + } + + private SwingWorker createWorker() { + return new SwingWorker() { + + @Override + protected Boolean doInBackground() { + + String tempFilePath = fetchRemoteReuFile2TempDir(); + if (StringUtils.isEmpty(tempFilePath)) { + return false; + } + if (isCancelled()) { + return false; + } + ShareComponentUtils.checkReadMe(); + if (isCancelled()) { + return false; + } + installTempReuFile(tempFilePath); + StableUtils.deleteFile(new File(tempFilePath)); + return true; + } + + @Override + protected void done() { + boolean result = false; + try { + result = get(); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + notifyProgress(0.0D); + if (result) { + notifySuccess(); + } else { + notifyFailed(); + } + } + }; + } + + private boolean checkLoginStatus() { + String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); + if (StringUtils.isEmpty(userName)) { + DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL); + return false; + } + return true; + } + + private String createLocalReuFilename() { + String filename = widget.getFileLoca(); + if (StringUtils.isEmpty(filename) || !filename.endsWith(".reu")) { + filename = widget.getName() + "." + widget.getUuid() + ".reu"; + } + return filename; + } + + private String fetchRemoteReuFile2TempDir() { + try { + String filename = createLocalReuFilename(); + return DownloadUtils.download(widget.getId(), filename, new Process() { + @Override + public void process(Double value) { + notifyProgress(value); + } + }); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } + + private void installTempReuFile(String tempFilePath) { + File file = new File(tempFilePath); + try { + Group targetGroup = getTargetGroup(); + if (file.exists() && targetGroup.installUniqueIdModule(file)) { + ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); + ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); + } + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + private Group getTargetGroup() { + return DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME); + } + + @Override + public void cancel() { + if (worker != null) { + worker.cancel(false); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java new file mode 100644 index 0000000000..56200a0c28 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java @@ -0,0 +1,179 @@ +package com.fr.design.mainframe.share.ui.online.installation; + +import com.fr.design.extra.Process; +import com.fr.design.mainframe.share.ui.base.ImitationProgress; +import com.fr.design.mainframe.share.util.DownloadUtils; +import com.fr.design.mainframe.share.util.InstallUtils; +import com.fr.design.mainframe.share.util.ShareComponentUtils; +import com.fr.form.share.Group; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import org.jetbrains.annotations.Nullable; + +import javax.swing.SwingWorker; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/5 + */ +public class ComponentsPackageInstallation extends AsyncInstallation { + private final OnlineShareWidget packageWidget; + private final int childrenCount; + private ImitationThread imitationThread; + private DownLoadSwingWorker worker; + + public ComponentsPackageInstallation(OnlineShareWidget packageWidget, int childrenCount) { + this.packageWidget = packageWidget; + this.childrenCount = childrenCount; + } + + @Override + public void install() { + + final Process downloadProcess = new Process() { + @Override + public void process(Double value) { + notifyProgress(0.8 * value); + } + }; + final Process installProcess = new Process() { + + @Override + public void process(Double value) { + notifyProgress(0.8 + 0.2 * value); + } + }; + + downloadProcess.process(0.0D); + + //假进度线程 + final ImitationProgress imitationProgress = new ImitationProgress(downloadProcess, childrenCount); + imitationThread = new ImitationThread(imitationProgress); + imitationThread.setName("Component-ImitationProcessThread"); + + //下载线程 + worker = new DownLoadSwingWorker(installProcess, packageWidget); + + imitationThread.start(); + worker.execute(); + } + + @Override + public void cancel() { + if (imitationThread != null) { + imitationThread.interrupt(); + } + if (worker != null) { + worker.cancel(false); + } + } + + /** + * 假进度线程 + */ + private static class ImitationThread extends Thread { + + private final ImitationProgress imitationProgress; + + public ImitationThread(ImitationProgress progress) { + imitationProgress = progress; + } + + @Override + public void run() { + imitationProgress.start(); + } + + public void complete() { + imitationProgress.completed(); + this.interrupt(); + } + + public void stopThread() { + imitationProgress.stop(); + this.interrupt(); + } + } + + private class DownLoadSwingWorker extends SwingWorker { + final Process installProcess; + final OnlineShareWidget onlineShareWidget; + + public DownLoadSwingWorker(Process installProcess, OnlineShareWidget onlineShareWidget) { + this.installProcess = installProcess; + this.onlineShareWidget = onlineShareWidget; + } + + @Override + @Nullable + protected Group doInBackground() { + final String filePath; + List failureList = new ArrayList<>(); + try { + filePath = DownloadUtils.downloadPackage(onlineShareWidget.getId(), onlineShareWidget.getName(), DownLoadSwingWorker.this::isCancelled); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + imitationThread.stopThread(); + return null; + } + if (this.isCancelled()) { + imitationThread.stopThread(); + StableUtils.deleteFile(new File(filePath)); + return null; + } + + //等待假进度线程结束 + imitationThread.complete(); + try { + imitationThread.join(); + } catch (InterruptedException ignore) { + } + + //再判断一次 + if (this.isCancelled()) { + StableUtils.deleteFile(new File(filePath)); + return null; + } + ShareComponentUtils.checkReadMe(); + //安装 + File file = new File(filePath); + installProcess.process(0.0D); + InstallUtils.InstallResult result = null; + try { + if (file.exists()) { + result = InstallUtils.installReusFile(file, System.currentTimeMillis(), failureList, installProcess); + } + } finally { + //删掉下载组件的目录 + StableUtils.deleteFile(file); + } + return result == null ? null : result.group; + } + + @Override + protected void done() { + Group group = null; + try { + group = get(); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + notifyProgress(0.0D); + if (group != null) { + notifySuccess(); + } else { + notifyFailed(); + } + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/Installation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/Installation.java new file mode 100644 index 0000000000..3fc80a8bfd --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/Installation.java @@ -0,0 +1,10 @@ +package com.fr.design.mainframe.share.ui.online.installation; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/5 + */ +public interface Installation { + void install(); +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java new file mode 100644 index 0000000000..f61af23d62 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java @@ -0,0 +1,202 @@ +package com.fr.design.mainframe.share.ui.online.installation; + +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.FormThemeConfig; +import com.fr.base.theme.TemplateTheme; +import com.fr.base.theme.TemplateThemeConfig; +import com.fr.design.DesignerEnvManager; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.i18n.Toolkit; +import com.fr.design.login.DesignerLoginHelper; +import com.fr.design.login.DesignerLoginSource; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; +import com.fr.design.mainframe.share.util.DownloadUtils; +import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import com.fr.transaction.CallBackAdaptor; +import com.fr.workspace.WorkContext; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import java.awt.Window; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.concurrent.ExecutionException; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/5 + */ +public class TemplateThemeInstallation extends AsyncInstallation { + private final String themePath; + private SwingWorker worker; + + public TemplateThemeInstallation(String themePath) { + this.themePath = themePath; + } + + @Override + public void install() { + fetchTheme(); + } + + private void fetchTheme() { + if (!checkAuthority()) { + onThemeFetched(null); + return; + } + + worker = new SwingWorker() { + + @Override + protected FormTheme doInBackground() { + return DownloadUtils.downloadThemeFile(themePath); + } + + @Override + protected void done() { + FormTheme theme = null; + try { + theme = get(); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + onThemeFetched(theme); + } + }; + worker.execute(); + } + + private boolean checkAuthority() { + if (!WorkContext.getCurrent().isRoot()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Message"), + Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Title"), + JOptionPane.WARNING_MESSAGE); + return false; + } + + String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); + if (StringUtils.isEmpty(userName)) { + DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL); + return false; + } + + return true; + } + + public void onThemeFetched(FormTheme theme) { + if (theme == null) { + notifyFailed(); + return; + } + saveTheme(theme); + } + + private FormTheme ensureThemeHasUniqueName(FormTheme theme, String expectedName) { + if (!FormThemeConfig.getInstance().contains(expectedName)) { + theme.setName(expectedName); + return theme; + } else { + String newName = (String) FineJOptionPane.showInputDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Share_Rename_Suitable_Theme_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Rename"), + FineJOptionPane.QUESTION_MESSAGE, null, null, + expectedName); + + return StringUtils.isEmpty(newName) ? null : ensureThemeHasUniqueName(theme, newName); + } + } + + private void saveTheme(FormTheme theme) { + final FormTheme uniqueNamedTheme = ensureThemeHasUniqueName(theme, theme.getName()); + if (uniqueNamedTheme != null) { + FormThemeConfig.getInstance().addTheme(theme, true, new CallBackAdaptor() { + @Override + public void afterCommit() { + super.afterCommit(); + onThemeSaved(uniqueNamedTheme); + } + + @Override + public void afterRollback() { + super.afterRollback(); + onThemeSaved(null); + } + }); + } else { + onThemeSaved(null); + } + } + + public void onThemeSaved(FormTheme theme) { + if (theme == null) { + notifyFailed(); + return; + } + + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (currentTemplate.getUsingTemplateThemeConfig() instanceof FormThemeConfig) { + TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(); + dialog.addWindowListener(new UsingDialogAdapter(theme, currentTemplate)); + dialog.setVisible(true); + } else { + FineJOptionPane.showConfirmDialog( + MiniComponentShopDialog.getInstance().getContentPane(), + Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_Success_Tip"), + "", + FineJOptionPane.YES_NO_OPTION + ); + } + notifySuccess(); + } + + public void applyTheme(JTemplate template, final String name, Window dialog) { + TemplateThemeConfig config = template.getUsingTemplateThemeConfig(); + TemplateTheme theme = config.cachedFetch(name); + template.setTemplateTheme(theme); + dialog.repaint(); + } + + @Override + public void cancel() { + if (worker != null) { + worker.cancel(true); + } + } + + private class UsingDialogAdapter extends WindowAdapter { + private final FormTheme theme; + private final JTemplate currentFormTemplate; + + public UsingDialogAdapter(FormTheme theme, JTemplate currentFormTemplate) { + this.theme = theme; + this.currentFormTemplate = currentFormTemplate; + } + + @Override + public void windowOpened(WindowEvent e) { + super.windowOpened(e); + Window window = e.getWindow(); + int returnVal = FineJOptionPane.showConfirmDialog( + window, + Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), + FineJOptionPane.OK_CANCEL_OPTION); + if (returnVal == JOptionPane.YES_OPTION) { + applyTheme(currentFormTemplate, theme.getName(), window); + } + window.removeWindowListener(this); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java new file mode 100644 index 0000000000..29fbafbaf3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -0,0 +1,124 @@ +package com.fr.design.mainframe.share.ui.online.mini; + +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.UIDialog; +import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; +import com.fr.general.IOUtils; + +import javax.swing.JFrame; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/4 + */ +public class MiniComponentShopDialog { + private static class HOLDER { + private static final MiniComponentShopDialog singleton = new MiniComponentShopDialog(); + } + public static MiniComponentShopDialog getInstance() { + return MiniComponentShopDialog.HOLDER.singleton; + } + + private final Set windowListeners = new HashSet<>(); + private JFrame frame; + + private JFrame createFrame() { + final JFrame frame = new JFrame(); + final MiniComponentShopPane shopPane = new MiniComponentShopPane(); + + frame.setSize(1200, 800); + frame.add(shopPane); + frame.setResizable(false); + frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + frame.addWindowListener(new WindowListener() { + @Override + public void windowOpened(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowOpened(e); + } + } + + @Override + public void windowClosing(WindowEvent e) { + for (WindowListener listener : windowListeners) { + listener.windowClosing(e); + } + if (MiniShopDisposingChecker.check(frame.getContentPane())) { + e.getWindow().dispose(); + } + } + + @Override + public void windowClosed(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowClosed(e); + } + getInstance().frame = null; + shopPane.dispose(); + } + + @Override + public void windowIconified(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowIconified(e); + } + } + + @Override + public void windowDeiconified(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowDeiconified(e); + } + } + + @Override + public void windowActivated(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowActivated(e); + } + } + + @Override + public void windowDeactivated(WindowEvent e) { + for (WindowListener listener: windowListeners) { + listener.windowDeactivated(e); + } + } + }); + return frame; + } + + public void show() { + if (frame == null) { + frame = createFrame(); + } + frame.setVisible(true); + } + + public Container getContentPane() { + if (frame != null) { + return frame.getContentPane(); + } + return null; + } + + public Window getWindow() { + return frame; + } + + public void addWindowAdapter(WindowListener windowListener) { + windowListeners.add(windowListener); + if (frame != null) { + frame.removeWindowListener(windowListener); + frame.addWindowListener(windowListener); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java new file mode 100644 index 0000000000..1fc0e24d63 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.share.ui.online.mini; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.share.ui.online.mini.bridge.ComposedNativeBridges; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.ui.ModernUIPane; +import com.fr.design.upm.event.CertificateEvent; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; +import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; + +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class MiniComponentShopPane extends JPanel { + private final ModernUIPane modernUIPane; + private final Listener loginListener; + private final Listener logoutListener; + + public MiniComponentShopPane() { + setLayout(new BorderLayout()); + DesignerEnvManager.getEnvManager().setOpenDebug(true); + modernUIPane = new ModernUIPane.Builder<>() + .withURL(OnlineShopUtils.getWebMiniShopPath()) + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + super.onScriptContextCreated(event); + JSObject window = event.getBrowser().executeJavaScriptAndReturnValue("window").asObject(); + window.asObject().setProperty("ShopHelper", new ComposedNativeBridges(window, JOptionPane.getFrameForComponent(MiniComponentShopPane.this))); + } + }) + .build(); + + add(modernUIPane, BorderLayout.CENTER); + + loginListener = new Listener() { + @Override + public void on(Event event, String param) { + modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); + } + }; + logoutListener = new Listener() { + @Override + public void on(Event event, String param) { + modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); + } + }; + + EventDispatcher.listen(CertificateEvent.LOGIN, loginListener); + EventDispatcher.listen(CertificateEvent.LOGOUT, logoutListener); + } + + public void dispose() { + modernUIPane.disposeBrowser(); + EventDispatcher.stopListen(loginListener); + EventDispatcher.stopListen(logoutListener); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java new file mode 100644 index 0000000000..ea729a1452 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java @@ -0,0 +1,26 @@ +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.chromium.JSObject; + +import java.awt.Window; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class ComposedNativeBridges { + @JSAccessible + public final NativeBrowserBridge Browser; + @JSAccessible + public final NativeAuthBridge Auth; + @JSAccessible + public final NativeProductBridge Product; + + public ComposedNativeBridges(JSObject window, Window nativeWindow) { + this.Browser = new NativeBrowserBridge(nativeWindow); + this.Auth = new NativeAuthBridge(); + this.Product = new NativeProductBridge(window); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java new file mode 100644 index 0000000000..a78a3b231c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java @@ -0,0 +1,34 @@ +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.login.DesignerLoginHelper; +import com.fr.design.login.DesignerLoginSource; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; +import com.teamdev.jxbrowser.chromium.JSAccessible; + +import java.awt.Window; +import java.util.HashMap; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class NativeAuthBridge { + @JSAccessible + @JSBridge + public String getLoginUsername() { + return DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); + } + + @JSAccessible + @JSBridge + public void goLogin() { + Window parentWindow = MiniComponentShopDialog.getInstance().getWindow(); + if (parentWindow != null) { + parentWindow.toFront(); + DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL, new HashMap<>(), parentWindow); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java new file mode 100644 index 0000000000..e062658749 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java @@ -0,0 +1,25 @@ +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.fr.design.bridge.exec.JSBridge; +import com.teamdev.jxbrowser.chromium.JSAccessible; + +import java.awt.Window; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class NativeBrowserBridge { + private final Window nativeWindow; + + public NativeBrowserBridge(Window nativeWindow) { + this.nativeWindow = nativeWindow; + } + + @JSAccessible + @JSBridge + public void dispose() { + this.nativeWindow.dispose(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java new file mode 100644 index 0000000000..52379b7f88 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java @@ -0,0 +1,287 @@ + +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.FormWidgetDetailPane; +import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; +import com.fr.design.mainframe.share.ui.online.installation.AsyncInstallation; +import com.fr.design.mainframe.share.ui.online.installation.ComponentInstallation; +import com.fr.design.mainframe.share.ui.online.installation.ComponentsPackageInstallation; +import com.fr.design.mainframe.share.ui.online.installation.TemplateThemeInstallation; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; +import com.fr.form.share.Group; +import com.fr.form.share.SharableWidgetProvider; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.group.DefaultShareGroupManager; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; +import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.chromium.JSObject; + +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class NativeProductBridge { + private final JSObject window; + + public NativeProductBridge(JSObject window) { + this.window = window; + } + + @JSAccessible + @JSBridge + public String getDownloadedProductIds() { + Set uuidList = new HashSet<>(); + for (Group group : DefaultShareGroupManager.getInstance().getAllGroup()) { + SharableWidgetProvider[] widgetProviderList = group.getAllBindInfoList(); + for (SharableWidgetProvider widget: widgetProviderList) { + if (StringUtils.isNotEmpty(widget.getId())) { + uuidList.add(widget.getId()); + } + } + } + JSONArray array = JSONArray.create(uuidList); + return array.toString(); + } + + @JSAccessible + @JSBridge + public Object createProductDownloadTask(String json) { + return new ComponentInstallationTask(window, json); + } + + @JSAccessible + @JSBridge + public Object createProductsPackageDownloadTask(String json) { + return new ComponentsPackageInstallationTask(window, json); + } + + @JSAccessible + @JSBridge + public Object createTemplateThemeDownloadTask(String themePath) { + return new TemplateThemeInstallationTask(window, themePath); + } + + public static class ComponentInstallationTask extends NativeTaskBridge { + private final OnlineShareWidget widget; + private final ComponentInstallation action; + + public ComponentInstallationTask(JSObject window, String widgetJson) { + super(window); + + JSONObject object = new JSONObject(widgetJson); + widget = OnlineShareWidget.parseFromJSONObject(object); + action = new ComponentInstallation(widget); + action.setActionListener(new AsyncInstallation.AsyncActionListener() { + @Override + public void onProgress(double value) { + fireProgressEvent(Double.toString(value)); + } + + @Override + public void onSuccess() { + fireSuccessEvent(null); + if (!DesignerContext.getDesignerFrame().isActive()) { + LocalWidgetRepoPane.getInstance().refreshPane(); + FormWidgetDetailPane.getInstance().switch2Local(); + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); + } + } + + @Override + public void onFailed() { + fireFailureEvent(null); + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void execute() { + super.execute(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + boolean allowedDownload = true; + if (!widget.isCompatibleWithCurrentEnv()) { + int result = FineJOptionPane.showConfirmDialog( + MiniComponentShopDialog.getInstance().getContentPane(), + Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Incompatible_Component_Tip"), + "", + FineJOptionPane.YES_NO_OPTION + ); + allowedDownload = result == JOptionPane.YES_OPTION; + } + if (allowedDownload) { + fireStartEvent(null); + action.install(); + } else { + fireFailureEvent(null); + } + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void cancel() { + super.cancel(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + action.cancel(); + } + }); + } + } + + public static class ComponentsPackageInstallationTask extends NativeTaskBridge { + + private final ComponentsPackageInstallation action; + private final OnlineShareWidget widget; + private final int childrenCount; + + public ComponentsPackageInstallationTask(JSObject window, String widgetJson) { + super(window); + JSONObject object = new JSONObject(widgetJson); + widget = OnlineShareWidget.parseFromJSONObject(object); + childrenCount = object.optInt("pkgsize", 0); + action = new ComponentsPackageInstallation(widget, childrenCount); + action.setActionListener(new AsyncInstallation.AsyncActionListener() { + @Override + public void onProgress(double value) { + fireProgressEvent(Double.toString(value)); + } + + @Override + public void onSuccess() { + fireSuccessEvent(null); + if (!DesignerContext.getDesignerFrame().isActive()) { + LocalWidgetRepoPane.getInstance().refreshPane(); + FormWidgetDetailPane.getInstance().switch2Local(); + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); + } + } + + @Override + public void onFailed() { + fireFailureEvent(null); + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void execute() { + super.execute(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + boolean allowedDownload; + if (!widget.isCompatibleWithCurrentEnv()) { + int result = FineJOptionPane.showConfirmDialog( + MiniComponentShopDialog.getInstance().getContentPane(), + Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Incompatible_Components_Package_Tip", childrenCount), + "", + FineJOptionPane.YES_NO_OPTION + ); + allowedDownload = result == JOptionPane.YES_OPTION; + } else { + int result = FineJOptionPane.showConfirmDialog( + MiniComponentShopDialog.getInstance().getContentPane(), + Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Components_Package_Tip", childrenCount), + "", + FineJOptionPane.YES_NO_OPTION + ); + allowedDownload = result == JOptionPane.YES_OPTION; + } + if (allowedDownload) { + fireStartEvent(null); + action.install(); + } else { + fireFailureEvent(null); + } + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void cancel() { + super.cancel(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + action.cancel(); + } + }); + } + } + + public static class TemplateThemeInstallationTask extends NativeTaskBridge { + private final TemplateThemeInstallation action; + public TemplateThemeInstallationTask(JSObject window, String themePath) { + super(window); + action = new TemplateThemeInstallation(themePath); + action.setActionListener(new AsyncInstallation.AsyncActionListener() { + @Override + public void onProgress(double value) { + fireProgressEvent(Double.toString(value)); + } + + @Override + public void onSuccess() { + fireSuccessEvent(null); + } + + @Override + public void onFailed() { + fireFailureEvent(null); + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void execute() { + super.execute(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + fireStartEvent(null); + action.install(); + } + }); + } + + @JSAccessible + @JSBridge + @Override + public void cancel() { + super.cancel(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + action.cancel(); + } + }); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java new file mode 100644 index 0000000000..c29fbc786a --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java @@ -0,0 +1,89 @@ +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.mainframe.share.mini.MiniShopNativeTask; +import com.fr.design.mainframe.share.mini.MiniShopNativeTaskManager; +import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/12/20 + */ +public class NativeTaskBridge implements MiniShopNativeTask { + + private final JSObject window; + + protected JSFunction startCb; + protected JSFunction progressCb; + protected JSFunction successCb; + protected JSFunction failureCb; + + public NativeTaskBridge(JSObject window) { + this.window = window; + } + + @JSBridge + @JSAccessible + public void setStartCallback(JSFunction cb) { + this.startCb = cb; + } + + @JSBridge + @JSAccessible + public void setProgressCallback(JSFunction cb) { + this.progressCb = cb; + } + + @JSBridge + @JSAccessible + public void setSuccessCallback(JSFunction cb) { + this.successCb = cb; + } + + @JSBridge + @JSAccessible + public void setFailureCallback(JSFunction cb) { + this.failureCb = cb; + } + + @JSBridge + @JSAccessible + @Override + public void execute() { + } + + @JSBridge + @JSAccessible + @Override + public void cancel() { + MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); + } + + + protected void fireStartEvent(String event) { + MiniShopNativeTaskManager.getInstance().addStartedTask(this); + if (this.startCb != null) { + this.startCb.invoke(window, event); + } + } + protected void fireProgressEvent(String event) { + if (this.progressCb != null) { + this.progressCb.invoke(window, event); + } + } + protected void fireSuccessEvent(String event) { + MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); + if (this.successCb != null) { + this.successCb.invoke(window, event); + } + } + protected void fireFailureEvent(String event) { + MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); + if (this.failureCb != null) { + this.failureCb.invoke(window, event); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java index 7341d7cbb6..d0fbd83d5f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java @@ -42,6 +42,10 @@ public class OnlineShopUtils { } + public static String getWebMiniShopPath() { + return ComponentReuseConfigManager.getInstance().getWebMiniShopUrl(); + } + public static String getReuInfoPath() { return ComponentReuseConfigManager.getInstance().getMiniShopUrl(); } diff --git a/designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java b/designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java new file mode 100644 index 0000000000..5b40c88450 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java @@ -0,0 +1,15 @@ +package com.fr.design.deeplink; + +import java.util.Map; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/6 + */ +public abstract class DeepLink { + + public abstract boolean accept(String url, String host, String path, Map params); + + public abstract void run(String url, String host, String path, Map params); +} 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 new file mode 100644 index 0000000000..b50bc2cbcd --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java @@ -0,0 +1,133 @@ +package com.fr.design.deeplink; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.startup.FineStartupNotificationFactory; +import com.fr.design.startup.FineStartupNotificationProvider; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.http.NameValuePair; +import com.fr.web.URLUtils; + +import javax.swing.SwingUtilities; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/6 + */ +public class DeepLinkManager { + + private DeepLinkManager(){} + private static final DeepLinkManager instance = new DeepLinkManager(); + public static DeepLinkManager getInstance(){ + return instance; + } + + private String pendingURL; + + private final List deepLinkList = new ArrayList<>(); + + private boolean isDesignerStartUpCompleted = false; + + private void register(DeepLink deepLink) { + if (deepLink != null) { + deepLinkList.add(deepLink); + } + } + + public void prepare() { + register(new TemplateThemeInstallationDeepLink()); + + FineStartupNotificationFactory.getNotification() + .registerStartupListener(new FineStartupNotificationProvider.Listener() { + @Override + public void startupPerformed(String parameters) { + if (canAcceptNewURL()) { + acceptNewURL(parameters); + if (canConsumePendingURL()) { + consumePendingURL(); + } + } + } + }); + + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null param) { + isDesignerStartUpCompleted = true; + if (canConsumePendingURL()) { + consumePendingURL(); + } + } + }); + } + + private boolean canAcceptNewURL() { + return StringUtils.isEmpty(this.pendingURL); + } + + private void acceptNewURL(String url) { + this.pendingURL = url; + } + + private boolean canConsumePendingURL() { + return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartUpCompleted; + } + + private void consumePendingURL() { + String host = null; + String path = null; + Map params = new HashMap<>(); + + URL url = null; + try { + url = new URL(null, this.pendingURL, new URLStreamHandler() { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return null; + } + }); + } catch (MalformedURLException ignored) {} + + if (url != null) { + host = url.getHost(); + path = url.getPath(); + + List pairs = URLUtils.parse(url.getQuery()); + for (NameValuePair pair: pairs) { + params.put(pair.getName(), pair.getValue()); + } + } + + FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL); + performDeepLinks(this.pendingURL, host, path, params); + + this.pendingURL = null; + } + + private void performDeepLinks(String url, String host, String path, Map params) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + for (DeepLink deepLink: deepLinkList) { + if (deepLink.accept(url, host, path, params)) { + deepLink.run(url, host, path, params); + } + } + } + }); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/deeplink/TemplateThemeInstallationDeepLink.java b/designer-realize/src/main/java/com/fr/design/deeplink/TemplateThemeInstallationDeepLink.java new file mode 100644 index 0000000000..9c9d146695 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/deeplink/TemplateThemeInstallationDeepLink.java @@ -0,0 +1,53 @@ +package com.fr.design.deeplink; + +import com.fr.design.mainframe.share.ui.online.installation.Installation; +import com.fr.design.mainframe.share.ui.online.installation.TemplateThemeInstallation; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.util.UriUtils; + +import java.io.UnsupportedEncodingException; +import java.util.Map; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/10 + */ +public class TemplateThemeInstallationDeepLink extends DeepLink { + public TemplateThemeInstallationDeepLink() { + } + private static class Holder { + public static TemplateThemeInstallationDeepLink INSTANCE = new TemplateThemeInstallationDeepLink(); + } + public static TemplateThemeInstallationDeepLink getInstance() { + return TemplateThemeInstallationDeepLink.Holder.INSTANCE; + } + + public static final String HOST = "template_theme"; + public static final String PATH = "/add"; + public static final String FILE_KEY = "file"; + + @Override + public boolean accept(String url, String host, String path, Map params) { + return host != null && StringUtils.equals(HOST, host) + && path != null && StringUtils.equals(PATH, path) + && params != null && params.containsKey(FILE_KEY) + ; + } + + @Override + public void run(String url, String host, String path, Map params) { + String remoteFileAddress = (String) params.get(FILE_KEY); + try { + remoteFileAddress = UriUtils.decode(remoteFileAddress, EncodeConstants.ENCODING_UTF_8); + FineLoggerFactory.getLogger().info("TemplateThemeInstallationDeepLink: " + remoteFileAddress); + + Installation installation = new TemplateThemeInstallation(remoteFileAddress); + installation.install(); + } catch (UnsupportedEncodingException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index f953df4668..3e461af0ab 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -11,6 +11,7 @@ import com.fr.design.actions.server.TemplateThemeManagerAction; import com.fr.design.actions.server.WidgetManagerAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; +import com.fr.design.deeplink.DeepLinkManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; @@ -106,6 +107,7 @@ public class MainDesigner extends BaseDesigner { */ public static void main(String[] args) { + DeepLinkManager.getInstance().prepare(); StopWatch watch = new StopWatch(); watch.start(); DesignerLifecycleMonitorContext.getMonitor().beforeStart(); From c1e2016c6e97460ac13c893bfd48644dbadfeb96 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Tue, 11 Jan 2022 16:25:58 +0800 Subject: [PATCH 011/113] =?UTF-8?q?REPORT-64012=20=20ssh=E4=B8=8Essl=20?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/AdvancePane.java | 14 +- .../connect/DatabaseConnectionPane.java | 44 ++- .../data/datapane/connect/JDBCDefPane.java | 13 +- .../design/data/datapane/connect/SshPane.java | 275 ++++++++++++++++++ .../design/data/datapane/connect/SslPane.java | 170 +++++++++++ .../editor/NotNegativeIntegerEditor.java | 28 ++ .../java/com/fr/file/FILEChooserPane.java | 89 +++++- 7 files changed, 609 insertions(+), 24 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java create mode 100644 designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java index 2041230957..683437b184 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java @@ -15,9 +15,9 @@ import com.fr.stable.StringUtils; import javax.swing.JPanel; import javax.swing.SwingConstants; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; @@ -34,13 +34,12 @@ public class AdvancePane extends BasicPane { public AdvancePane() { - + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); DBCP_VALIDATION_QUERY.addFocusListener(new JTextFieldHintListener(DBCP_VALIDATION_QUERY)); - ; double p = TableLayout.PREFERRED; - DBCP_VALIDATION_QUERY.setColumns(15); + DBCP_VALIDATION_QUERY.setColumns(20); double[] rowSizeDbcp = {p, p, p, p}; - double[] columnDbcp = {p, p}; + double[] columnDbcp = {200, p}; Component[][] comps = { {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, @@ -49,9 +48,8 @@ public class AdvancePane extends BasicPane { }; JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSizeDbcp, columnDbcp, 11, 11); - this.add(contextPane); - this.setPreferredSize(new Dimension(630, 120)); - this.setLayout(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); + jPanel.add(contextPane, BorderLayout.CENTER); + this.add(jPanel); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 91e8006d10..4d5556ef95 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -7,6 +7,7 @@ import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.operator.DataOperatorProvider; +import com.fr.data.security.ssl.impl.NormalSsl; import com.fr.data.solution.ExceptionSolutionSelector; import com.fr.data.solution.entity.DriverPage; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; @@ -61,7 +62,7 @@ import java.util.concurrent.ExecutionException; * Database Connection pane. */ public abstract class DatabaseConnectionPane extends BasicBeanPane { - private static int MAX_MAIN_PANEL_HEIGHT = 430; + private static int MAX_MAIN_PANEL_HEIGHT = 410; private static int MAX_MAIN_PANEL_WIDTH = 675; private UILabel message; @@ -312,6 +313,15 @@ public abstract class DatabaseConnectionPane jdbcMap = new HashMap(); + private JPanel linkPanel; static { jdbcMap.put(OTHER_DB, new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:"), @@ -477,11 +479,16 @@ public class JDBCDefPane extends JPanel { } ActionListener driverListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { + linkPanel.setVisible(DriverClasses.MYSQL.toString().equalsIgnoreCase((String) dbtypeComboBox.getSelectedItem()) + && driverComboBox.getSelectedItem() != null + && ComparatorUtils.equals(DriverClasses.MYSQL.getDriverClass(), driverComboBox.getSelectedItem().toString().trim())); + odbcTipsLink.setVisible(driverComboBox.getSelectedItem() != null + && ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem().toString().trim())); // 选择的如果是ODBC就显示提示 if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { return; } - odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示 Iterator> jdbc = jdbcMap.entrySet().iterator(); while (jdbc.hasNext()) { Entry entry = jdbc.next(); @@ -494,7 +501,6 @@ public class JDBCDefPane extends JPanel { } } } - }; ActionListener dbtypeButtonActionListener = new ActionListener() { @@ -738,4 +744,7 @@ public class JDBCDefPane extends JPanel { } + public void addLinkPane(JPanel panel) { + linkPanel = panel; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java new file mode 100644 index 0000000000..6baec5bbbf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -0,0 +1,275 @@ +package com.fr.design.data.datapane.connect; + +import com.fr.data.impl.JDBCDatabaseConnection; +import com.fr.data.security.ssh.BaseSsh; +import com.fr.data.security.ssh.Ssh; +import com.fr.data.security.ssh.SshException; +import com.fr.data.security.ssh.SshType; +import com.fr.data.security.ssh.impl.KeyVerifySsh; +import com.fr.data.security.ssh.impl.NormalSsh; +import com.fr.data.security.ssl.SslUtils; +import com.fr.design.border.UITitledBorder; +import com.fr.design.dialog.BasicPane; +import com.fr.design.editor.editor.NotNegativeIntegerEditor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; +import com.fr.design.gui.itextfield.UITextField; +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.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.third.guava.collect.HashBiMap; + +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +import static com.fr.design.i18n.Toolkit.i18nText; + +/** + * @author xiqiu + * @date 2021/12/23 + * @description + */ +public class SshPane extends BasicPane { + private static HashBiMap typeMap; + + static { + typeMap = HashBiMap.create(); + typeMap.put(Toolkit.i18nText("Fine-Design_Basic_Password"), SshType.NORMAL); + typeMap.put(Toolkit.i18nText("Fine-Design_Basic_Ssh_Public_Key"), SshType.KEY); + } + + private UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using")); + private NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(); + private UITextField ip = new UITextField(); + private UIComboBox type = new UIComboBox(); + private UITextField user = new UITextField(); + private JPasswordField password = new UIPasswordFieldWithFixedLength(20); + private JPasswordField secret = new UIPasswordFieldWithFixedLength(20); + private KeyFileUITextField keyPath = new KeyFileUITextField(); + private JPanel contextPane; + private Component[][] passwordComps; + private Component[][] keyComps; + private double p = TableLayout.PREFERRED; + private double f = TableLayout.FILL; + private JPanel jPanel; + private UIButton fileChooserButton = new UIButton("..."); + private double[] columnSize = new double[]{208, p}; + + public SshPane() { + this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))); + this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + typeMap.keySet().forEach(key -> type.addItem(key)); + type.setSelectedItem(typeMap.inverse().get(SshType.KEY)); + jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + keyPath.setColumns(18); + fileChooserButton.setPreferredSize(new Dimension(20, 20)); + type.setEditable(false); + type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key")); + JPanel filePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + filePanel.add(keyPath); + filePanel.add(fileChooserButton); + Component[] compIp = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":", SwingConstants.RIGHT), ip}; + Component[] compPort = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":", SwingConstants.RIGHT), port}; + Component[] compUserName = {new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":", SwingConstants.RIGHT), user}; + Component[] compMethod = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Verify_Method") + ":", SwingConstants.RIGHT), type}; + Component[] compPassword = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":", SwingConstants.RIGHT), password}; + Component[] compKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key") + ":", SwingConstants.RIGHT), filePanel}; + Component[] comSecret = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret") + ":", SwingConstants.RIGHT), secret}; + + passwordComps = new Component[][]{ + compIp, + compPort, + compUserName, + compMethod, + compPassword + }; + keyComps = new Component[][]{ + compIp, + compPort, + compUserName, + compMethod, + compKey, + comSecret + }; + usingSsh.setSelected(true); + contextPane = TableLayoutHelper.createGapTableLayoutPane(keyComps, new double[]{p, p, p, p, p, p}, columnSize, 11, 11); + jPanel.add(usingSsh, BorderLayout.NORTH); + jPanel.add(contextPane, BorderLayout.CENTER); + this.add(jPanel); + + usingSsh.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + changePane(); + } + }); + + type.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + changePaneForType(); + } + }); + fileChooserButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(SslUtils.KEY_FILE_EXTENSION)); + int type = fileChooser.showOpenDialog(SshPane.this); + if (type == FILEChooserPane.OK_OPTION) { + final FILE file = fileChooser.getSelectedFILE(); + if (file == null) { + keyPath.setText(StringUtils.EMPTY); + } else { + keyPath.setText(file.getPath()); + } + } + fileChooser.removeAllFilter(); + } + }); + } + + + private void changePane() { + contextPane.setVisible(usingSsh.isSelected()); + } + + private void changePaneForType() { + contextPane.removeAll(); + switch (typeMap.get(type.getSelectedItem())) { + case NORMAL: + TableLayoutHelper.addComponent2ResultPane(passwordComps, new double[]{p, p, p, p, p}, columnSize, contextPane); + break; + case KEY: + TableLayoutHelper.addComponent2ResultPane(keyComps, new double[]{p, p, p, p, p, p}, columnSize, contextPane); + break; + default: + throw new SshException("un support ssh type"); + } + jPanel.revalidate(); + jPanel.repaint(); + } + + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"); + } + + + public void populate(JDBCDatabaseConnection jdbcDatabase) { + if (jdbcDatabase.getSsh() == null) { + jdbcDatabase.setSsh(new NormalSsh()); + } + Ssh ssh = jdbcDatabase.getSsh(); + switch (ssh.getSshType()) { + case KEY: + type.setSelectedItem(typeMap.inverse().get(ssh.getSshType())); + KeyVerifySsh keyVerifySsh = (KeyVerifySsh) ssh; + keyPath.setText(keyVerifySsh.getPrivateKeyPath()); + secret.setText(keyVerifySsh.getSecret()); + password.setText(StringUtils.EMPTY); + setCommonConfig(keyVerifySsh); + break; + case NORMAL: + type.setSelectedItem(typeMap.inverse().get(ssh.getSshType())); + NormalSsh normalSsh = (NormalSsh) ssh; + password.setText(normalSsh.getSecret()); + keyPath.setText(StringUtils.EMPTY); + secret.setText(StringUtils.EMPTY); + setCommonConfig(normalSsh); + break; + default: + throw new SshException("un support ssh type"); + } + usingSsh.setSelected(ssh.isUsingSsh()); + changePane(); + } + + private void setCommonConfig(BaseSsh baseSsh) { + ip.setText(baseSsh.getIp()); + port.setValue(baseSsh.getPort()); + user.setText(baseSsh.getUser()); + } + + public void update(JDBCDatabaseConnection jdbcDatabase) { + Ssh ssh; + switch (typeMap.get(type.getSelectedItem())) { + case NORMAL: + NormalSsh normalSsh = new NormalSsh(); + normalSsh.setSecret(new String(password.getPassword()).trim()); + getCommonConfig(normalSsh); + ssh = normalSsh; + break; + case KEY: + KeyVerifySsh keyVerifySsh = new KeyVerifySsh(); + keyVerifySsh.setPrivateKeyPath(keyPath.getText().trim()); + keyVerifySsh.setSecret(new String(secret.getPassword()).trim()); + getCommonConfig(keyVerifySsh); + ssh = keyVerifySsh; + break; + default: + throw new SshException("un support ssh type"); + } + jdbcDatabase.setSsh(ssh); + } + + private void getCommonConfig(BaseSsh baseSsh) { + baseSsh.setUsingSsh(usingSsh.isSelected()); + baseSsh.setIp(ip.getText().trim()); + baseSsh.setPort(port.getValue()); + baseSsh.setUser(user.getText().trim()); + } + + public static class KeyFileUITextField extends UITextField { + private static final String PREFIX = ProjectConstants.RESOURCES_NAME + "/"; + private static final String UPPER = ".."; + + public KeyFileUITextField() { + super(); + this.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String text = KeyFileUITextField.this.getText(); + if (text != null && text.contains(UPPER)) { + KeyFileUITextField.this.setText(text.replace(UPPER, ".")); + } + } + }); + } + + + @Override + public String getText() { + // 获取的时候,不为空,给他加上前缀就好了,否则还是空 + if (!StringUtils.isEmpty(super.getText())) { + return PREFIX + super.getText(); + } + return StringUtils.EMPTY; + } + + @Override + public void setText(String text) { + // 设置的时候,不为空,说明文件指定了(文件需要是resource下),替换掉前缀 + if (!StringUtils.isEmpty(text)) { + super.setText(text.replace(PREFIX, "")); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java new file mode 100644 index 0000000000..1749e2efb0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -0,0 +1,170 @@ +package com.fr.design.data.datapane.connect; + +import com.fr.data.impl.JDBCDatabaseConnection; +import com.fr.data.security.ssl.Ssl; +import com.fr.data.security.ssl.SslException; +import com.fr.data.security.ssl.SslType; +import com.fr.data.security.ssl.SslUtils; +import com.fr.data.security.ssl.impl.NormalSsl; +import com.fr.design.border.UITitledBorder; +import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +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.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import static com.fr.design.i18n.Toolkit.i18nText; + +/** + * @author xiqiu + * @date 2022/1/4 + * @description + */ +public class SslPane extends BasicPane { + UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using")); + private KeyFileUITextField keyPathCa = new KeyFileUITextField(); + private UIButton fileChooserButtonCa = new UIButton("..."); + private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(); + private UIButton fileChooserButtonClientCert = new UIButton("..."); + private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(); + private UIButton fileChooserButtonClientKey = new UIButton("..."); + private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); + private UITextField cipher = new UITextField(); + private JPanel jPanel; + private Component[][] usingComps; + private double p = TableLayout.PREFERRED; + private double f = TableLayout.FILL; + private JPanel contextPane; + private double[] columnSize = new double[]{208, p}; + + public SslPane() { + this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))); + this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + Dimension dimension = new Dimension(20, 20); + int columns = 18; + keyPathCa.setColumns(columns); + fileChooserButtonCa.setPreferredSize(dimension); + keyPathClientCert.setColumns(columns); + fileChooserButtonClientCert.setPreferredSize(dimension); + fileChooserButtonClientKey.setPreferredSize(dimension); + keyPathClientKey.setColumns(columns); + JPanel filePanelCa = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + filePanelCa.add(keyPathCa); + filePanelCa.add(fileChooserButtonCa); + Component[] compCa = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca") + ":", SwingConstants.RIGHT), filePanelCa}; + Component[] compVerifyCa = {null, verifyCa}; + JPanel filePanelClientCert = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + filePanelClientCert.add(keyPathClientCert); + filePanelClientCert.add(fileChooserButtonClientCert); + Component[] compClientCert = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert") + ":", SwingConstants.RIGHT), filePanelClientCert}; + JPanel filePanelClientKey = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + filePanelClientKey.add(keyPathClientKey); + filePanelClientKey.add(fileChooserButtonClientKey); + Component[] compClientKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key") + ":", SwingConstants.RIGHT), filePanelClientKey}; + Component[] comCipher = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Cipher") + ":", SwingConstants.RIGHT), cipher}; + usingComps = new Component[][]{ + compCa, + compVerifyCa, + compClientCert, + compClientKey, + comCipher + }; + usingSsl.setSelected(true); + contextPane = TableLayoutHelper.createGapTableLayoutPane(usingComps, new double[]{p, p, p, p, p, p}, columnSize, 11, 11); + jPanel.add(usingSsl, BorderLayout.NORTH); + jPanel.add(contextPane, BorderLayout.CENTER); + this.add(jPanel); + usingSsl.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + changePane(); + } + }); + fileChooserButtonCa.addActionListener(new TextFieldActionListener(keyPathCa)); + fileChooserButtonClientCert.addActionListener(new TextFieldActionListener(keyPathClientCert)); + fileChooserButtonClientKey.addActionListener(new TextFieldActionListener(keyPathClientKey)); + } + + private void changePane() { + contextPane.setVisible(usingSsl.isSelected()); + } + + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"); + } + + public void populate(JDBCDatabaseConnection jdbcDatabase) { + Ssl ssl = jdbcDatabase.getSsl(); + if (ssl == null) { + ssl = new NormalSsl(); + jdbcDatabase.setSsl(ssl); + } + if (ssl.getSslType() == SslType.NORMAL) { + NormalSsl normalSsl = (NormalSsl) ssl; + keyPathCa.setText(normalSsl.getCaCertificate()); + keyPathClientCert.setText(normalSsl.getClientCertificate()); + keyPathClientKey.setText(normalSsl.getClientPrivateKey()); + verifyCa.setSelected(normalSsl.isVerifyCa()); + cipher.setText(normalSsl.getCipher()); + } else { + throw new SslException("un support ssl type"); + } + usingSsl.setSelected(ssl.isUsingSsl()); + changePane(); + } + + public void update(JDBCDatabaseConnection jdbcDatabase) { + NormalSsl normalSsl = new NormalSsl(); + normalSsl.setCipher(cipher.getText().trim()); + normalSsl.setVerifyCa(verifyCa.isSelected()); + normalSsl.setCaCertificate(keyPathCa.getText().trim()); + normalSsl.setClientCertificate(keyPathClientCert.getText().trim()); + normalSsl.setClientPrivateKey(keyPathClientKey.getText().trim()); + normalSsl.setUsingSsl(usingSsl.isSelected()); + jdbcDatabase.setSsl(normalSsl); + } + + private class TextFieldActionListener implements ActionListener { + private UITextField textField; + + public TextFieldActionListener(UITextField textField) { + this.textField = textField; + } + + @Override + public void actionPerformed(ActionEvent e) { + FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(SslUtils.KEY_FILE_EXTENSION)); + int type = fileChooser.showOpenDialog(SslPane.this); + if (type == FILEChooserPane.OK_OPTION) { + final FILE file = fileChooser.getSelectedFILE(); + if (file == null) { + textField.setText(StringUtils.EMPTY); + } else { + textField.setText(file.getPath()); + } + } + fileChooser.removeAllFilter(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java new file mode 100644 index 0000000000..7d24a22778 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java @@ -0,0 +1,28 @@ +package com.fr.design.editor.editor; + +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +/** + * @author xiqiu + * @date 2022/1/10 + * @description 一个简单的非负整数框 + */ +public class NotNegativeIntegerEditor extends IntegerEditor { + private static final String NEG = "-"; + + public NotNegativeIntegerEditor() { + super(); + this.numberField.addKeyListener(new KeyAdapter() { + + @Override + public void keyReleased(KeyEvent evt) { + char keyChar = evt.getKeyChar(); + if (NEG.equals(keyChar + "")) { + numberField.setText(numberField.getTextValue().replace(NEG, "")); + } + } + }); + } +} + diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 426fd18e26..2eeb27a5d0 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -47,9 +47,9 @@ import com.fr.stable.StringUtils; import com.fr.stable.os.windows.WindowsDetector; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; - import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; + import javax.swing.AbstractAction; import javax.swing.AbstractListModel; import javax.swing.ActionMap; @@ -202,6 +202,13 @@ public class FILEChooserPane extends BasicPane { return INSTANCE; } + public static FILEChooserPane getInstanceWithDesignatePath(String path, FILEFilter filter) { + INSTANCE.setDesignateModel(path); + INSTANCE.removeAllFilter(); + INSTANCE.addChooseFILEFilter(filter, 0); + return INSTANCE; + } + public static FILEChooserPane getMultiEnvInstance(boolean showLoc, boolean showWebReport) { INSTANCE.showEnv = true; INSTANCE.showLoc = showLoc; @@ -499,7 +506,7 @@ public class FILEChooserPane extends BasicPane { } private String calProperFileName(String fileName, ChooseFileFilter fileFilter) { - if(fileFilter == null){ + if (fileFilter == null) { return fileName; } String filterExtension = fileFilter.getExtensionString(); @@ -516,10 +523,10 @@ public class FILEChooserPane extends BasicPane { return fileNameWithOutExtension + filterExtension; } - private boolean isMapping(String fromExtension, String toExtension){ - if(FileExtension.CPTX.matchExtension(fromExtension)){ + private boolean isMapping(String fromExtension, String toExtension) { + if (FileExtension.CPTX.matchExtension(fromExtension)) { return FileExtension.CPT.matchExtension(toExtension); - }else if(FileExtension.CPT.matchExtension(fromExtension)){ + } else if (FileExtension.CPT.matchExtension(fromExtension)) { return FileExtension.CPTX.matchExtension(toExtension); } return false; @@ -678,7 +685,7 @@ public class FILEChooserPane extends BasicPane { * 移除文件后缀的方法 * 解决cptx文件的另存为操作默认会出现双后缀的bug(xxx.cptx.cpt) **/ - private String removeSuffix(String text){ + private String removeSuffix(String text) { return FileExtension.CPTX.matchExtension(text) ? text.substring(0, text.length() - FileExtension.CPTX.getSuffix().length()) : text; } @@ -783,7 +790,7 @@ public class FILEChooserPane extends BasicPane { ChooseFileFilter supportedTypes = new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")); Set providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG); for (ReportSupportedFileProvider provider : providers) { - for (FileExtension fileExtension : provider.getFileExtensions()){ + for (FileExtension fileExtension : provider.getFileExtensions()) { supportedTypes.addExtension(fileExtension.getExtension()); } } @@ -915,7 +922,7 @@ public class FILEChooserPane extends BasicPane { if (access(selectedFile) && access(currentDirectory)) { if (selectedFile.exists()) { int selVal = FineJOptionPane.showConfirmDialog(dialog, Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Cover_The_Current_File") + " ?", - Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (selVal == JOptionPane.YES_OPTION) { option = JOPTIONPANE_OK_OPTION; saveDictionary(); @@ -1031,6 +1038,14 @@ public class FILEChooserPane extends BasicPane { setPlaceListModel(new PlaceListModel()); } + private void setDesignateModel(String path) { + if (placesList == null) { + return; + } + setPlaceListModel(new DesignateRemotePlaceListModel(path)); + } + + private void setMultiPlaceListModel() { if (placesList == null) { return; @@ -1125,6 +1140,7 @@ public class FILEChooserPane extends BasicPane { private abstract class AbstractPlaceListModel extends AbstractListModel { + private static final long serialVersionUID = 8473695327688235386L; protected List filesOfSystem = new ArrayList(); protected void processSystemFile() { @@ -1157,7 +1173,8 @@ public class FILEChooserPane extends BasicPane { protected void setCD(final FILE lastDirectory) { for (int i = 0; i < this.getSize(); i++) { FILE file = this.getElementAt(i); - if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix())) { + //前缀相同不代表能用啊,比如说 repolets 和 resource ,都是 env下的,但就不该去显示resource下的文件呀 + if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix()) && lastDirectory.getPath() != null && lastDirectory.getPath().startsWith(file.getPath())) { setCurrentDirectory(lastDirectory); return; } @@ -1166,7 +1183,60 @@ public class FILEChooserPane extends BasicPane { } } + /** + * 一个简单的指定远程目录的 placelistmodel + */ + private class DesignateRemotePlaceListModel extends AbstractPlaceListModel { + private static final long serialVersionUID = -6340666958714469249L; + + private FileNodeFILE envFILE; + + public DesignateRemotePlaceListModel(String path) { + envFILE = new DesignateFileNodeFILE(new FileNode(path, true)) { + @Override + public String getName() { + return Toolkit.i18nText("Fine-Design_Basic_Utils_Report_Env_Directory_Designate"); + } + }; + } + + @Override + public FILE getElementAt(int index) { + if (index < 1) { + return envFILE; + } + throw new IndexOutOfBoundsException(); + } + + @Override + public int getSize() { + return 1; + } + + @Override + protected void setCD(FILE lastDirectory) { + setCurrentDirectory(envFILE); + } + + /** + * 简单的重写了标签的FileNodeFILE + */ + private class DesignateFileNodeFILE extends FileNodeFILE { + + public DesignateFileNodeFILE(FileNode node) { + super(node); + } + + @Override + public Icon getIcon() { + return BaseUtils.readIcon("/com/fr/base/images/oem/logo.png"); + } + } + } + + private class PlaceListModel extends AbstractPlaceListModel { + private static final long serialVersionUID = 6138969918807381364L; private FileNodeFILE envFILE; private FileNodeFILE webReportFILE; @@ -1217,6 +1287,7 @@ public class FILEChooserPane extends BasicPane { private class MultiLocalEnvPlaceListModel extends AbstractPlaceListModel { + private static final long serialVersionUID = 6300018896958532154L; private List envFiles = new ArrayList(); private FileNodeFILE webReportFILE; From 13d419d2a7b00844af7908b9218474f27eba4e9f Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 12 Jan 2022 09:50:29 +0800 Subject: [PATCH 012/113] =?UTF-8?q?REPORT-65249=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E7=AE=A1=E7=90=86-=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF-=E7=BC=96=E8=BE=91=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=97=B6=E4=BF=9D=E5=AD=98=E6=8C=89=E9=92=AE=E7=9A=84=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 保存主题后自动关闭主题详情编辑对话框 【改动思路】 同上 --- .../fr/design/mainframe/theme/TemplateThemeProfilePane.java | 3 ++- .../mainframe/theme/dialog/TemplateThemeProfileDialog.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index 9e88dfba1a..92acb5c71e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java @@ -206,7 +206,7 @@ public abstract class TemplateThemeProfilePane extends }); } - public UIButton createSaveButton() { + public UIButton createSaveButton(final TemplateThemeProfileDialog profileDialog) { saveButton = new UIButton(); saveButton.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save")); saveButton.setEnabled(false); @@ -224,6 +224,7 @@ public abstract class TemplateThemeProfilePane extends @Override public void run() { DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully")); + profileDialog.exit(); } }); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java index a76597f8e8..0a26a6691e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java @@ -90,7 +90,7 @@ public class TemplateThemeProfileDialog extends Templat })); } - uiButtonList.add(profilePane.createSaveButton()); + uiButtonList.add(profilePane.createSaveButton(TemplateThemeProfileDialog.this)); uiButtonList.add(profilePane.createSaveAsButton(TemplateThemeProfileDialog.this)); uiButtonList.add(createCancelButton()); From 1db66af9b8dec45fb655760c8d597154d3ad95ad Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 12 Jan 2022 10:37:13 +0800 Subject: [PATCH 013/113] =?UTF-8?q?REPORT-65681=20&=20REPORT-65644=20&=20R?= =?UTF-8?q?EPORT-65635=20=E5=9B=BE=E6=A0=87=E4=BB=A5=E5=8F=8A=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=9D=A2=E6=9D=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/javascript/JSContentPane.java | 12 +- .../JSContentWithDescriptionPane.java | 128 +++++++++++++----- .../fr/design/images/edit/advancedEditor.svg | 10 ++ .../fr/design/javascript/jsapi/category.json | 1 - .../javascript/jsapi/images/connectFailed.svg | 8 ++ .../com/fr/design/javascript/jsapi/jsapi.json | 2 +- 6 files changed, 122 insertions(+), 39 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg create mode 100644 designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index 10bee69d27..65bec03a84 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java @@ -1,5 +1,6 @@ package com.fr.design.javascript; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.KeyWords; @@ -16,6 +17,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; +import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.beautify.JavaScriptFormatHelper; import com.fr.design.javascript.jsapi.JSImplPopulateAction; import com.fr.design.javascript.jsapi.JSImplUpdateAction; @@ -92,7 +94,7 @@ public class JSContentPane extends BasicPane { private void addNewPaneLabel(){ - UILabel advancedEditorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Advanced_Editor"), SwingConstants.LEFT); + UILabel advancedEditorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Advanced_Editor"), IconUtils.readIcon("com/fr/design/images/edit/advancedEditor.svg"), SwingConstants.LEFT); advancedEditorLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); advancedEditorLabel.addMouseListener(new MouseAdapter() { @@ -104,7 +106,7 @@ public class JSContentPane extends BasicPane { jsImplUpdateAction.update(javaScript); newJavaScriptImplPane.populate(javaScript); if(advancedEditorDialog == null || !advancedEditorDialog.isVisible()) { - advancedEditorDialog = newJavaScriptImplPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + advancedEditorDialog = newJavaScriptImplPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { if (javaScript != null) { @@ -117,7 +119,7 @@ public class JSContentPane extends BasicPane { public void doCancel() { super.doCancel(); } - }); + },new Dimension(900,800)); advancedEditorDialog.setModal(modal); advancedEditorDialog.setResizable(true); advancedEditorDialog.pack(); @@ -126,7 +128,7 @@ public class JSContentPane extends BasicPane { advancedEditorDialog.requestFocus(); } }); - labelPane.add(advancedEditorLabel,BorderLayout.CENTER); + labelPane.add(advancedEditorLabel,BorderLayout.EAST); } protected UIScrollPane createContentTextAreaPanel(){ @@ -181,7 +183,7 @@ public class JSContentPane extends BasicPane { } }); - labelPane.add(label,BorderLayout.EAST); + labelPane.add(label,BorderLayout.CENTER); JPanel jsParaPane = new JPanel(new BorderLayout(4, 4)); jsParaPane.setPreferredSize(new Dimension(300, 80)); UIScrollPane scrollPane = new UIScrollPane(funNameLabel); diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index b1516fe366..ffbfa8425e 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -1,5 +1,6 @@ package com.fr.design.javascript; +import com.fr.base.svg.IconUtils; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent; @@ -12,7 +13,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; -import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itextfield.PlaceholderTextField; import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.jsapi.JSAPITreeHelper; import com.fr.design.javascript.jsapi.JSAPIUserObject; @@ -26,8 +27,10 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Cursor; import java.awt.Desktop; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -69,7 +72,7 @@ import javax.swing.tree.TreePath; public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener { //搜索关键词输入框 - private UITextField keyWordTextField = new UITextField(16); + private PlaceholderTextField keyWordTextField = new PlaceholderTextField(16); //搜索出的提示列表 private JList tipsList; private DefaultListModel tipsListModel = new DefaultListModel(); @@ -109,6 +112,11 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private String currentValue; + private static CardLayout card; + + private static final String RELOAD_CARD = "reloadCard"; + private static final String DOC_LIST_CARD = "docListCard"; + public JSContentWithDescriptionPane(String[] args) { this.setLayout(new BorderLayout()); //=============================== @@ -156,6 +164,14 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi this.add(functionNameAndDescriptionPanel, BorderLayout.SOUTH); } + public void populate(String js) { + contentTextArea.setText(js); + ifHasBeenWriten = 1; + currentPosition = contentTextArea.getCaretPosition(); + beginPosition = getBeginPosition(); + insertPosition = beginPosition; + } + private void initContextAreaListener() { contentTextArea.addKeyListener(new KeyAdapter() { @Override @@ -186,6 +202,27 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi uninstallAutoCompletion(); } }); + contentTextArea.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + insertPosition = contentTextArea.getCaretPosition(); + if (ifHasBeenWriten == 0) { + contentTextArea.setText(StringUtils.EMPTY); + ifHasBeenWriten = 1; + contentTextArea.setForeground(Color.black); + insertPosition = 0; + } + } + + @Override + public void mouseReleased(MouseEvent e) { + currentPosition = contentTextArea.getCaretPosition(); + if (currentPosition == insertPosition) { + beginPosition = getBeginPosition(); + insertPosition = beginPosition; + } + } + }); } @Override @@ -281,9 +318,9 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi String value = ((JSAPIUserObject) userObject).getValue(); if (StringUtils.equals(value, directCategory)) { moduleTree.setSelectionPath(new TreePath(treeModel.getPathToRoot(node))); + moduleTree.scrollPathToVisible(moduleTree.getSelectionPath()); return true; } - return false; } for (int i = 0; i < node.getChildCount(); i++) { if (setModuleTreeSelection(node.getChildAt(i), directCategory, treeModel)) { @@ -340,39 +377,60 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi } private void initHelpDocumentPane(JPanel descriptionAndDocumentPanel) { - UIScrollPane helpDOCScrollPane; + card = new CardLayout(); + JPanel mainPane = new JPanel(card); + initHelpDocumentList(); + UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList); + helpDOCScrollPane.setPreferredSize(new Dimension(200, 200)); + helpDOCScrollPane.setBorder(null); + mainPane.add(helpDOCScrollPane, DOC_LIST_CARD); + + UILabel imageLabel = new UILabel(); + imageLabel.setIcon(IconUtils.readIcon("com/fr/design/javascript/jsapi/images/connectFailed.svg")); + imageLabel.setPreferredSize(new Dimension(180, 65)); + JPanel imagePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + imagePane.setBorder(BorderFactory.createEmptyBorder(0, 42, 0, 0)); + imagePane.add(imageLabel); + imagePane.setBackground(Color.WHITE); + + UILabel failedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0); + failedLabel.setPreferredSize(new Dimension(180, 20)); + UILabel reloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0); + reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); + reloadLabel.setPreferredSize(new Dimension(180, 20)); + reloadLabel.setForeground(Color.blue); + JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0); + + labelPane.setBorder(BorderFactory.createEmptyBorder(35, 45, 0, 0)); + labelPane.setBackground(Color.WHITE); + labelPane.add(imagePane); + labelPane.add(failedLabel); + labelPane.add(reloadLabel); + JPanel containerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + containerPanel.add(labelPane, BorderLayout.CENTER); + reloadLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (isNetworkOk()) { + doHelpDocumentSearch(); + card.show(mainPane, DOC_LIST_CARD); + } + } + }); + mainPane.add(containerPanel, RELOAD_CARD); if (isNetworkOk()) { - helpDOCList = new JList(new DefaultListModel()); - initHelpDOCListRender(); - initHelpDOCListListener(); - helpDOCScrollPane = new UIScrollPane(helpDOCList); doHelpDocumentSearch(); + card.show(mainPane, DOC_LIST_CARD); } else { - UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0); - label1.setPreferredSize(new Dimension(180, 20)); - UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0); - label2.setPreferredSize(new Dimension(180, 20)); - label2.setForeground(Color.blue); - JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0); - labelPane.setBackground(Color.WHITE); - labelPane.add(label1); - labelPane.add(label2); - JPanel containerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - containerPanel.add(labelPane, BorderLayout.CENTER); - helpDOCScrollPane = new UIScrollPane(containerPanel); - label2.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - descriptionAndDocumentPanel.removeAll(); - initHelpDocumentPane(descriptionAndDocumentPanel); - - } - }); + card.show(mainPane, RELOAD_CARD); } - helpDOCScrollPane.setPreferredSize(new Dimension(200, 200)); - helpDOCScrollPane.setBorder(null); - descriptionAndDocumentPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Relevant_Cases"), helpDOCScrollPane), BorderLayout.EAST); + descriptionAndDocumentPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Relevant_Cases"), mainPane), BorderLayout.EAST); + } + private void initHelpDocumentList() { + helpDOCList = new JList(new DefaultListModel()); + initHelpDOCListRender(); + initHelpDOCListListener(); } private void initHelpDOCListListener() { @@ -558,7 +616,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi } private void initInterfaceNameModule() { - moduleTree.setSelectionPath(moduleTree.getPathForRow(0)); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) moduleTree.getModel(); + TreeNode root = (TreeNode) defaultTreeModel.getRoot(); + while (root.getChildCount() > 0){ + root = root.getChildAt(0); + } + moduleTree.setSelectionPath(new TreePath(defaultTreeModel.getPathToRoot(root))); } private void setDescription(String interfaceName) { @@ -652,6 +715,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi tipsPane.setBorder(BorderFactory.createEmptyBorder(30, 2, 0, 0)); JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); searchPane.setLayout(new BorderLayout(4, 4)); + keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface")); searchPane.add(keyWordTextField, BorderLayout.CENTER); //搜索按钮 diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg b/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg new file mode 100644 index 0000000000..6ddc105cb9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/advancedEditor.svg @@ -0,0 +1,10 @@ + + + 高级编辑 + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json index ad17929765..ece3628ab5 100644 --- a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json +++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/category.json @@ -41,7 +41,6 @@ }, "Fine-Design_JSAPI_Form": { "Fine-Design_JSAPI_Form_Component_Get": {}, - "Fine-Design_JSAPI_Form_Component_Universal": {}, "Fine-Design_JSAPI_Form_Component_Tab": {} } } \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg new file mode 100644 index 0000000000..6b0dfbc665 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/images/connectFailed.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json index e268f70e18..dcad373927 100644 --- a/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json +++ b/designer-base/src/main/resources/com/fr/design/javascript/jsapi/jsapi.json @@ -29,5 +29,5 @@ "importExcel_Append", "importExcel_Cover", "stash", "clear"], "Fine-Design_JSAPI_Cpt_View_Preview_Report_Location":["centerReport"], "Fine-Design_JSAPI_Form_Component_Get":["getAllWidgets"], - "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "showCardByIndex", "getShowIndex", "setTitleVisible"] + "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "getShowIndex", "setTitleVisible"] } \ No newline at end of file From 04cda3cc93696fc5b26f150539a212cc766d07e0 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Wed, 12 Jan 2022 15:19:31 +0800 Subject: [PATCH 014/113] =?UTF-8?q?REPORT-64012=20=20=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=92=8C=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/SshPane.java | 34 ++++++++++++++----- .../design/data/datapane/connect/SslPane.java | 5 ++- .../java/com/fr/file/FILEChooserPane.java | 5 ++- .../com/fr/file/filter/ChooseFileFilter.java | 11 +++++- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 6baec5bbbf..dc62ec59e0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -7,7 +7,6 @@ import com.fr.data.security.ssh.SshException; import com.fr.data.security.ssh.SshType; import com.fr.data.security.ssh.impl.KeyVerifySsh; import com.fr.data.security.ssh.impl.NormalSsh; -import com.fr.data.security.ssl.SslUtils; import com.fr.design.border.UITitledBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.NotNegativeIntegerEditor; @@ -38,6 +37,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static com.fr.design.i18n.Toolkit.i18nText; @@ -130,8 +131,8 @@ public class SshPane extends BasicPane { fileChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(SslUtils.KEY_FILE_EXTENSION)); - int type = fileChooser.showOpenDialog(SshPane.this); + FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(true)); + int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY); if (type == FILEChooserPane.OK_OPTION) { final FILE file = fileChooser.getSelectedFILE(); if (file == null) { @@ -238,6 +239,8 @@ public class SshPane extends BasicPane { } public static class KeyFileUITextField extends UITextField { + private static final Pattern ERROR_START = Pattern.compile("^([/\\\\.]+).*"); + private static final Pattern MUTI_DOT = Pattern.compile("\\.+"); private static final String PREFIX = ProjectConstants.RESOURCES_NAME + "/"; private static final String UPPER = ".."; @@ -246,14 +249,29 @@ public class SshPane extends BasicPane { this.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { - String text = KeyFileUITextField.this.getText(); - if (text != null && text.contains(UPPER)) { - KeyFileUITextField.this.setText(text.replace(UPPER, ".")); + String text = KeyFileUITextField.this.getTextOrigin(); + if (text != null) { + if (text.contains(UPPER)) { + text = MUTI_DOT.matcher(text).replaceAll("."); + KeyFileUITextField.this.setTextOrigin(text); + } + Matcher matcher = ERROR_START.matcher(text); + if (matcher.matches()) { + text = text.substring(matcher.group(1).length()); + KeyFileUITextField.this.setTextOrigin(text); + } } } }); } + public String getTextOrigin() { + return super.getText(); + } + + public void setTextOrigin(String text) { + super.setText(text); + } @Override public String getText() { @@ -267,8 +285,8 @@ public class SshPane extends BasicPane { @Override public void setText(String text) { // 设置的时候,不为空,说明文件指定了(文件需要是resource下),替换掉前缀 - if (!StringUtils.isEmpty(text)) { - super.setText(text.replace(PREFIX, "")); + if (!StringUtils.isEmpty(text) && text.startsWith(PREFIX)) { + super.setText(text.replaceFirst(PREFIX, "")); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index 1749e2efb0..e50d95edcf 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -4,7 +4,6 @@ import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.security.ssl.Ssl; import com.fr.data.security.ssl.SslException; import com.fr.data.security.ssl.SslType; -import com.fr.data.security.ssl.SslUtils; import com.fr.data.security.ssl.impl.NormalSsl; import com.fr.design.border.UITitledBorder; import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; @@ -154,8 +153,8 @@ public class SslPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { - FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(SslUtils.KEY_FILE_EXTENSION)); - int type = fileChooser.showOpenDialog(SslPane.this); + FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(true)); + int type = fileChooser.showOpenDialog(SslPane.this, StringUtils.EMPTY); if (type == FILEChooserPane.OK_OPTION) { final FILE file = fileChooser.getSelectedFILE(); if (file == null) { diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 2eeb27a5d0..30f55d7ef0 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -203,6 +203,9 @@ public class FILEChooserPane extends BasicPane { } public static FILEChooserPane getInstanceWithDesignatePath(String path, FILEFilter filter) { + INSTANCE.showLoc = false; + INSTANCE.showEnv = false; + INSTANCE.showWebReport = false; INSTANCE.setDesignateModel(path); INSTANCE.removeAllFilter(); INSTANCE.addChooseFILEFilter(filter, 0); @@ -891,7 +894,7 @@ public class FILEChooserPane extends BasicPane { saveDictionary(); dialogExit(); } else { - FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Basic_App_Template_Report_Not_Exist")); + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Basic_App_File_Not_Exist")); return; } } diff --git a/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java b/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java index 147e1946d4..0f6057d0ab 100644 --- a/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java +++ b/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java @@ -31,6 +31,15 @@ public class ChooseFileFilter extends FileFilter implements FILEFilter, java.io. this(extension, null); } + public ChooseFileFilter(boolean noRestrict) { + if (noRestrict) { + this.filters = null; + this.fullDescription = FileExtension.ALL.getExtension(); + } else { + this.filters = new ArrayList<>(); + } + } + public ChooseFileFilter(String extension, String description) { this(); if (extension != null) { @@ -314,4 +323,4 @@ public class ChooseFileFilter extends FileFilter implements FILEFilter, java.io. return (o instanceof ChooseFileFilter) && ComparatorUtils.equals(((ChooseFileFilter) o).getDescription(), getDescription()); } -} \ No newline at end of file +} From 9820584c14ff08f1b166f77b103a655f901cc67f Mon Sep 17 00:00:00 2001 From: xiqiu Date: Wed, 12 Jan 2022 15:26:34 +0800 Subject: [PATCH 015/113] =?UTF-8?q?REPORT-64012=20=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/data/datapane/connect/SshPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index dc62ec59e0..16374bd5c4 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -250,7 +250,7 @@ public class SshPane extends BasicPane { @Override public void keyReleased(KeyEvent e) { String text = KeyFileUITextField.this.getTextOrigin(); - if (text != null) { + if (!StringUtils.isEmpty(text)) { if (text.contains(UPPER)) { text = MUTI_DOT.matcher(text).replaceAll("."); KeyFileUITextField.this.setTextOrigin(text); From 7b9663bcb761f55af191ed37a970a4c561a5f816 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 13 Jan 2022 14:50:19 +0800 Subject: [PATCH 016/113] =?UTF-8?q?REPORT-64406=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=82=B9=E5=87=BB=E6=A8=A1=E6=9D=BF=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=AF=E5=8A=A8=E8=AE=BE=E8=AE=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Mac端在设计器未启动状态下,直接点击模板文件,触发设计器启动, 但启动成功后,设计器里并没有打开对应的模板。查看install4j的 文档后发现还需要使用install4j运行时jar中的API注册监听函数, 才能拿到文件路径。 点击文件启动应用的API与点击网页链接启动应用的API,恰好是一个, 所以就可以在之前迭代的URL启动设计器功能基础上修复这个BUG。 【改动思路】 实现一个用于mac端文件打开的DeepLink --- .../fr/design/deeplink/DeepLinkManager.java | 22 +++++++++++++- .../design/deeplink/FileOpen4MacDeepLink.java | 29 +++++++++++++++++++ .../main/java/com/fr/start/MainDesigner.java | 1 + 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java 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 b50bc2cbcd..a1de69db4f 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 @@ -9,16 +9,19 @@ import com.fr.event.Listener; import com.fr.event.Null; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.stable.os.OperatingSystem; import com.fr.third.org.apache.http.NameValuePair; import com.fr.web.URLUtils; import javax.swing.SwingUtilities; +import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -49,6 +52,7 @@ public class DeepLinkManager { } public void prepare() { + register(new FileOpen4MacDeepLink()); register(new TemplateThemeInstallationDeepLink()); FineStartupNotificationFactory.getNotification() @@ -115,7 +119,7 @@ public class DeepLinkManager { FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL); performDeepLinks(this.pendingURL, host, path, params); - this.pendingURL = null; + markPendingURLConsumed(); } private void performDeepLinks(String url, String host, String path, Map params) { @@ -130,4 +134,20 @@ 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); + argList.add(filePath); + markPendingURLConsumed(); + return argList.toArray(new String[]{}); + } else { + return args; + } + } + + private void markPendingURLConsumed() { + this.pendingURL = null; + } } diff --git a/designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java b/designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java new file mode 100644 index 0000000000..5709aabd6f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java @@ -0,0 +1,29 @@ +package com.fr.design.deeplink; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.file.FileFILE; +import com.fr.stable.StringUtils; +import com.fr.stable.os.OperatingSystem; + +import java.io.File; +import java.util.Map; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/13 + */ +public class FileOpen4MacDeepLink extends DeepLink { + @Override + public boolean accept(String url, String host, String path, Map params) { + return OperatingSystem.isMacos() && StringUtils.isEmpty(host) && StringUtils.isEmpty(path) && params.isEmpty(); + } + + @Override + public void run(String url, String host, String path, Map params) { + File file = new File(url); + if (file.exists()) { + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file)); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 3e461af0ab..4b66c362c2 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -122,6 +122,7 @@ public class MainDesigner extends BaseDesigner { }); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 + args = DeepLinkManager.getInstance().createNewArgs(args); designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); try { designerRoot.start(); From 859500f8a67e3779db7f7f103bd54a8af9fe8f52 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Thu, 13 Jan 2022 15:19:12 +0800 Subject: [PATCH 017/113] =?UTF-8?q?REPORT-64012=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/JDBCDefPane.java | 6 +++++- .../com/fr/design/data/datapane/connect/SshPane.java | 5 ++++- .../com/fr/design/data/datapane/connect/SslPane.java | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index d735eb0b68..e8c7c17b8e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -6,6 +6,7 @@ import com.fr.data.driver.config.DriverLoaderConfig; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.solution.entity.DriverClasses; import com.fr.design.border.UITitledBorder; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxUI; @@ -29,6 +30,7 @@ import com.fr.third.guava.collect.HashBiMap; import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; +import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JPasswordField; @@ -195,7 +197,9 @@ public class JDBCDefPane extends JPanel { userNameTextField = new UITextField(15); userNameTextField.setName(USER_NAME); passwordTextField = new UIPasswordFieldWithFixedLength(15); - dbtypeButton = new UIButton("."); + dbtypeButton = new UIButton(); + dbtypeButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); + dbtypeButton.setPreferredSize(new Dimension(20, 20)); dbtypeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL")); dbtypeButton.addActionListener(dbtypeButtonActionListener); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 16374bd5c4..5e31220852 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -8,6 +8,7 @@ import com.fr.data.security.ssh.SshType; import com.fr.data.security.ssh.impl.KeyVerifySsh; import com.fr.data.security.ssh.impl.NormalSsh; import com.fr.design.border.UITitledBorder; +import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.NotNegativeIntegerEditor; import com.fr.design.gui.ibutton.UIButton; @@ -27,6 +28,7 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.guava.collect.HashBiMap; +import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.SwingConstants; @@ -70,10 +72,11 @@ public class SshPane extends BasicPane { private double p = TableLayout.PREFERRED; private double f = TableLayout.FILL; private JPanel jPanel; - private UIButton fileChooserButton = new UIButton("..."); + private UIButton fileChooserButton = new UIButton(); private double[] columnSize = new double[]{208, p}; public SshPane() { + fileChooserButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); typeMap.keySet().forEach(key -> type.addItem(key)); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index e50d95edcf..801c441443 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -6,6 +6,7 @@ import com.fr.data.security.ssl.SslException; import com.fr.data.security.ssl.SslType; import com.fr.data.security.ssl.impl.NormalSsl; import com.fr.design.border.UITitledBorder; +import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; @@ -22,6 +23,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; @@ -40,11 +42,11 @@ import static com.fr.design.i18n.Toolkit.i18nText; public class SslPane extends BasicPane { UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using")); private KeyFileUITextField keyPathCa = new KeyFileUITextField(); - private UIButton fileChooserButtonCa = new UIButton("..."); + private UIButton fileChooserButtonCa = new UIButton(); private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(); - private UIButton fileChooserButtonClientCert = new UIButton("..."); + private UIButton fileChooserButtonClientCert = new UIButton(); private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(); - private UIButton fileChooserButtonClientKey = new UIButton("..."); + private UIButton fileChooserButtonClientKey = new UIButton(); private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); private UITextField cipher = new UITextField(); private JPanel jPanel; @@ -55,6 +57,9 @@ public class SslPane extends BasicPane { private double[] columnSize = new double[]{208, p}; public SslPane() { + fileChooserButtonCa.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); + fileChooserButtonClientCert.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); + fileChooserButtonClientKey.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); From ee86cda3b1df0d4cee33e6df5ede665dc79c72af Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 13 Jan 2022 16:54:34 +0800 Subject: [PATCH 018/113] =?UTF-8?q?REPORT-65644=20=E6=9C=AA=E8=81=94?= =?UTF-8?q?=E7=BD=91=E6=97=B6=EF=BC=8C=E6=89=93=E5=BC=80=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E5=86=8D=E8=81=94=E7=BD=91=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/javascript/JSContentWithDescriptionPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index ffbfa8425e..469598a3f6 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -108,7 +108,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com"; - private static final String DOCUMENT_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_search"); + private static final String DOCUMENT_SEARCH_URL = "https://help.fanruan.com/finereport/api-helpdoc-title-"; private String currentValue; @@ -352,7 +352,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private void doHelpDocumentSearch() { Object value = interfaceNameList.getSelectedValue(); if (value != null) { - String url = DOCUMENT_SEARCH_URL + value.toString(); + String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); try { String result = HttpToolbox.get(url); JSONObject jsonObject = new JSONObject(result); From 49a778c2e8054260fd149d380f640fa58c70e23e Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 14 Jan 2022 09:21:55 +0800 Subject: [PATCH 019/113] =?UTF-8?q?REPORT-65857=20=20=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=92=8Cbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/SshPane.java | 17 ++++++++++++----- .../design/data/datapane/connect/SslPane.java | 12 ++++-------- .../editor/editor/NotNegativeIntegerEditor.java | 5 +++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 5e31220852..747dd34535 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -59,13 +59,13 @@ public class SshPane extends BasicPane { } private UICheckBox usingSsh = new UICheckBox(i18nText("Fine-Design_Basic_Ssh_Using")); - private NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(); - private UITextField ip = new UITextField(); + private NotNegativeIntegerEditor port = new NotNegativeIntegerEditor(20); + private UITextField ip = new UITextField(20); private UIComboBox type = new UIComboBox(); - private UITextField user = new UITextField(); + private UITextField user = new UITextField(20); private JPasswordField password = new UIPasswordFieldWithFixedLength(20); private JPasswordField secret = new UIPasswordFieldWithFixedLength(20); - private KeyFileUITextField keyPath = new KeyFileUITextField(); + private KeyFileUITextField keyPath = new KeyFileUITextField(18); private JPanel contextPane; private Component[][] passwordComps; private Component[][] keyComps; @@ -82,7 +82,6 @@ public class SshPane extends BasicPane { typeMap.keySet().forEach(key -> type.addItem(key)); type.setSelectedItem(typeMap.inverse().get(SshType.KEY)); jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - keyPath.setColumns(18); fileChooserButton.setPreferredSize(new Dimension(20, 20)); type.setEditable(false); type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key")); @@ -247,6 +246,12 @@ public class SshPane extends BasicPane { private static final String PREFIX = ProjectConstants.RESOURCES_NAME + "/"; private static final String UPPER = ".."; + public KeyFileUITextField(int columns) { + this(); + this.setColumns(columns); + } + + public KeyFileUITextField() { super(); this.addKeyListener(new KeyAdapter() { @@ -290,6 +295,8 @@ public class SshPane extends BasicPane { // 设置的时候,不为空,说明文件指定了(文件需要是resource下),替换掉前缀 if (!StringUtils.isEmpty(text) && text.startsWith(PREFIX)) { super.setText(text.replaceFirst(PREFIX, "")); + } else { + super.setText(text); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index 801c441443..ca7933bc28 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -41,14 +41,14 @@ import static com.fr.design.i18n.Toolkit.i18nText; */ public class SslPane extends BasicPane { UICheckBox usingSsl = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Using")); - private KeyFileUITextField keyPathCa = new KeyFileUITextField(); + private KeyFileUITextField keyPathCa = new KeyFileUITextField(18); private UIButton fileChooserButtonCa = new UIButton(); - private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(); + private KeyFileUITextField keyPathClientCert = new KeyFileUITextField(18); private UIButton fileChooserButtonClientCert = new UIButton(); - private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(); + private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18); private UIButton fileChooserButtonClientKey = new UIButton(); private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); - private UITextField cipher = new UITextField(); + private UITextField cipher = new UITextField(20); private JPanel jPanel; private Component[][] usingComps; private double p = TableLayout.PREFERRED; @@ -64,13 +64,9 @@ public class SslPane extends BasicPane { this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); Dimension dimension = new Dimension(20, 20); - int columns = 18; - keyPathCa.setColumns(columns); fileChooserButtonCa.setPreferredSize(dimension); - keyPathClientCert.setColumns(columns); fileChooserButtonClientCert.setPreferredSize(dimension); fileChooserButtonClientKey.setPreferredSize(dimension); - keyPathClientKey.setColumns(columns); JPanel filePanelCa = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); filePanelCa.add(keyPathCa); filePanelCa.add(fileChooserButtonCa); diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java index 7d24a22778..98c59c1736 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/NotNegativeIntegerEditor.java @@ -11,6 +11,11 @@ import java.awt.event.KeyEvent; public class NotNegativeIntegerEditor extends IntegerEditor { private static final String NEG = "-"; + public NotNegativeIntegerEditor(int columns) { + this(); + this.setColumns(columns); + } + public NotNegativeIntegerEditor() { super(); this.numberField.addKeyListener(new KeyAdapter() { From 2e5e14797dca0f3c3f2a7856bd8d82acb25081d8 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 14 Jan 2022 10:07:19 +0800 Subject: [PATCH 020/113] =?UTF-8?q?REPORT-65857=20=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/AdvancePane.java | 2 +- .../fr/design/data/datapane/connect/SshPane.java | 6 ++---- .../fr/design/data/datapane/connect/SslPane.java | 14 ++++---------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java index 683437b184..7784aa5712 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/AdvancePane.java @@ -39,7 +39,7 @@ public class AdvancePane extends BasicPane { double p = TableLayout.PREFERRED; DBCP_VALIDATION_QUERY.setColumns(20); double[] rowSizeDbcp = {p, p, p, p}; - double[] columnDbcp = {200, p}; + double[] columnDbcp = {190, p}; Component[][] comps = { {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 747dd34535..9a870d07d2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -73,7 +73,7 @@ public class SshPane extends BasicPane { private double f = TableLayout.FILL; private JPanel jPanel; private UIButton fileChooserButton = new UIButton(); - private double[] columnSize = new double[]{208, p}; + private double[] columnSize = new double[]{195, p}; public SshPane() { fileChooserButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); @@ -85,9 +85,7 @@ public class SshPane extends BasicPane { fileChooserButton.setPreferredSize(new Dimension(20, 20)); type.setEditable(false); type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key")); - JPanel filePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - filePanel.add(keyPath); - filePanel.add(fileChooserButton); + JPanel filePanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPath, fileChooserButton}}, new double[]{p}, new double[]{f, 20}, 0); Component[] compIp = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":", SwingConstants.RIGHT), ip}; Component[] compPort = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":", SwingConstants.RIGHT), port}; Component[] compUserName = {new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":", SwingConstants.RIGHT), user}; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index ca7933bc28..e15c44102d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -54,7 +54,7 @@ public class SslPane extends BasicPane { private double p = TableLayout.PREFERRED; private double f = TableLayout.FILL; private JPanel contextPane; - private double[] columnSize = new double[]{208, p}; + private double[] columnSize = new double[]{195, p}; public SslPane() { fileChooserButtonCa.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); @@ -67,18 +67,12 @@ public class SslPane extends BasicPane { fileChooserButtonCa.setPreferredSize(dimension); fileChooserButtonClientCert.setPreferredSize(dimension); fileChooserButtonClientKey.setPreferredSize(dimension); - JPanel filePanelCa = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - filePanelCa.add(keyPathCa); - filePanelCa.add(fileChooserButtonCa); + JPanel filePanelCa = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathCa, fileChooserButtonCa}}, new double[]{p}, new double[]{f, 20}, 0); Component[] compCa = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca") + ":", SwingConstants.RIGHT), filePanelCa}; Component[] compVerifyCa = {null, verifyCa}; - JPanel filePanelClientCert = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - filePanelClientCert.add(keyPathClientCert); - filePanelClientCert.add(fileChooserButtonClientCert); + JPanel filePanelClientCert = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathClientCert, fileChooserButtonClientCert}}, new double[]{p}, new double[]{f, 20}, 0); Component[] compClientCert = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert") + ":", SwingConstants.RIGHT), filePanelClientCert}; - JPanel filePanelClientKey = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - filePanelClientKey.add(keyPathClientKey); - filePanelClientKey.add(fileChooserButtonClientKey); + JPanel filePanelClientKey = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathClientKey, fileChooserButtonClientKey}}, new double[]{p}, new double[]{f, 20}, 0); Component[] compClientKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key") + ":", SwingConstants.RIGHT), filePanelClientKey}; Component[] comCipher = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Cipher") + ":", SwingConstants.RIGHT), cipher}; usingComps = new Component[][]{ From ab02d7df3c33acc6fcdf10e5911cbe741a4e54b2 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 14 Jan 2022 10:14:54 +0800 Subject: [PATCH 021/113] =?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 f7ee5493b14b35af3a9a39466f3d372cc7bdadf8 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 14 Jan 2022 10:18:41 +0800 Subject: [PATCH 022/113] =?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 ea2237b7c252cddc3786d949828c2cfb7b407a14 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 14 Jan 2022 14:56:31 +0800 Subject: [PATCH 023/113] =?UTF-8?q?REPORT-64012=20=E5=8E=BB=E6=8E=89cipher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/SslPane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index e15c44102d..2d9c26e235 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -48,7 +48,7 @@ public class SslPane extends BasicPane { private KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18); private UIButton fileChooserButtonClientKey = new UIButton(); private UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); - private UITextField cipher = new UITextField(20); +// private UITextField cipher = new UITextField(20); private JPanel jPanel; private Component[][] usingComps; private double p = TableLayout.PREFERRED; @@ -74,16 +74,16 @@ public class SslPane extends BasicPane { Component[] compClientCert = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert") + ":", SwingConstants.RIGHT), filePanelClientCert}; JPanel filePanelClientKey = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{{keyPathClientKey, fileChooserButtonClientKey}}, new double[]{p}, new double[]{f, 20}, 0); Component[] compClientKey = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key") + ":", SwingConstants.RIGHT), filePanelClientKey}; - Component[] comCipher = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Cipher") + ":", SwingConstants.RIGHT), cipher}; +// Component[] comCipher = {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Cipher") + ":", SwingConstants.RIGHT), cipher}; usingComps = new Component[][]{ compCa, compVerifyCa, compClientCert, compClientKey, - comCipher +// comCipher }; usingSsl.setSelected(true); - contextPane = TableLayoutHelper.createGapTableLayoutPane(usingComps, new double[]{p, p, p, p, p, p}, columnSize, 11, 11); + contextPane = TableLayoutHelper.createGapTableLayoutPane(usingComps, new double[]{p, p, p, p}, columnSize, 11, 11); jPanel.add(usingSsl, BorderLayout.NORTH); jPanel.add(contextPane, BorderLayout.CENTER); this.add(jPanel); @@ -120,7 +120,7 @@ public class SslPane extends BasicPane { keyPathClientCert.setText(normalSsl.getClientCertificate()); keyPathClientKey.setText(normalSsl.getClientPrivateKey()); verifyCa.setSelected(normalSsl.isVerifyCa()); - cipher.setText(normalSsl.getCipher()); +// cipher.setText(normalSsl.getCipher()); } else { throw new SslException("un support ssl type"); } @@ -130,7 +130,7 @@ public class SslPane extends BasicPane { public void update(JDBCDatabaseConnection jdbcDatabase) { NormalSsl normalSsl = new NormalSsl(); - normalSsl.setCipher(cipher.getText().trim()); +// normalSsl.setCipher(cipher.getText().trim()); normalSsl.setVerifyCa(verifyCa.isSelected()); normalSsl.setCaCertificate(keyPathCa.getText().trim()); normalSsl.setClientCertificate(keyPathClientCert.getText().trim()); From c65515aace725cfe9277e88c2a4d8522d7221d7d Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 14 Jan 2022 15:42:09 +0800 Subject: [PATCH 024/113] =?UTF-8?q?REPORT-65513=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8D=95=E5=85=83=E6=A0=BC=E7=BB=84=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E2=80=9C=E5=8D=95=E5=85=83=E6=A0=BC=E4=B8=AA?= =?UTF-8?q?=E6=95=B0=E5=BF=85=E9=A1=BB=E7=9B=B8=E5=90=8C=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/write/submit/SmartInsertDBManipulationPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 3818f1ac80..193fd4de9a 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -291,6 +291,10 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { @Override public void checkValid() throws Exception { KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); + checkModelValid(model); + } + + private void checkModelValid(KeyColumnTableModel model) throws Exception { int cnt = model.getRowCount(); int groupLength = -1; for (int i = 0; i < cnt; i++) { @@ -374,7 +378,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { */ @Override public void checkValid() throws Exception { - SmartInsertDBManipulationPane.this.checkValid(); + KeyColumnTableModel model = (KeyColumnTableModel) table.getModel(); + SmartInsertDBManipulationPane.this.checkModelValid(model); } private SelectionListener listener = new SelectionListener() { From 822a1b2a6f8903c662ed3df3a7275af3674b9181 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 17 Jan 2022 09:50:13 +0800 Subject: [PATCH 025/113] =?UTF-8?q?REPORT-65722=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=82=B9=E5=87=BB=E9=80=89=E6=8B=A9=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=97=B6=E6=97=A0=E5=8F=8D?= =?UTF-8?q?=E5=BA=94=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=87=BA=E7=8E=B0=E5=8E=9F?= =?UTF-8?q?=E7=94=9F=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=20=E5=90=8C=E6=AD=A5=E5=88=B011.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ifilechooser/JavaFxNativeFileChooser.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java index 4d36883240..fb6a7e88be 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java @@ -197,7 +197,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { private File currentDirectory; public Builder fileSelectionMode(FileSelectionMode fileSelectionMode) { - this.fileSelectionMode = fileSelectionMode; + if (fileSelectionMode != null) { + this.fileSelectionMode = fileSelectionMode; + } return this; } @@ -209,13 +211,17 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { } public Builder filters(FileChooser.ExtensionFilter[] filters) { - this.filters = filters; + if (filters != null) { + this.filters = filters; + } return this; } public Builder filters(ExtensionFilter[] filters) { - for (ExtensionFilter filter : filters) { - this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); + if (filters != null) { + for (ExtensionFilter filter : filters) { + this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); + } } return this; } From 6a8791b91740769eb71bcee95c8b39e54b260dc6 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Mon, 17 Jan 2022 14:25:54 +0800 Subject: [PATCH 026/113] =?UTF-8?q?REPORT-64011=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=A7=E6=96=87=E6=9C=AC=E7=9A=84=E6=98=BE=E7=A4=BA=E4=BE=BF?= =?UTF-8?q?=E5=88=A9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellOtherSetPane.java | 176 ++++++++++++++++-- 1 file changed, 164 insertions(+), 12 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 0ea7713ca9..8bd6dcac11 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 @@ -12,7 +12,10 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; +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.layout.VerticalFlowLayout; @@ -30,8 +33,7 @@ import com.fr.report.cell.cellattr.CellPageAttr; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.design.i18n.Toolkit; -import java.awt.Color; + import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JPanel; @@ -40,6 +42,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; @@ -57,6 +60,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private static final int HEAD_HEIGTH = 24; private static final int COMBO_WIDTH = 154; private static final int BUTTON_GROUP_WIDTH = 140; + private static final double f = TableLayout.FILL; + private static final double p = TableLayout.PREFERRED; // normal private UIButtonGroup autoshrik; @@ -66,8 +71,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIComboBox showContent; + //内容提示 + private UIButtonGroup tooltipButtonGroup; + private CardLayout tooltipLayout; + private JPanel tooltipPane; private UITextField tooltipTextField; + //文本超出时隐藏 + private UICheckBox textOverflowCheckBox; + private UIComboBox showPartComboBox; + private CardLayout showPartLayout; + private JPanel showPartPane; + private UISpinner showCharNums; + private UIComboBox textOverflowTypeComboBox; + private UITextField fileNameTextField; // 分页 @@ -213,17 +230,16 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private JPanel seniorUpPane() { JPanel pane = new JPanel(new BorderLayout()); // TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。 + pane.add(createTextOverflowPane(), BorderLayout.SOUTH); pane.add(createShowContentPane(), BorderLayout.CENTER); pane.add(createSeniorCheckPane(), BorderLayout.NORTH); return pane; } private JPanel createShowContentPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p, p, p}; double[] colSize = {f, COMBO_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; JPanel fileNamePane = createNormal(); fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); @@ -232,21 +248,98 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UIComponentUtils.setLineWrap(showContentLabel); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); - JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); - toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); + tooltipLayout = new CardLayout(); + tooltipPane = new JPanel(tooltipLayout); + tooltipPane.add(new JPanel(), "none"); + tooltipPane.add(tooltipTextField, "content"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); + tooltipButtonGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (tooltipButtonGroup.getSelectedIndex() == 0) { + tooltipPane.setPreferredSize(new Dimension(154, 20)); + tooltipLayout.show(tooltipPane, "content"); + } else { + tooltipLayout.show(tooltipPane, "none"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + } + } + }); Component[][] components = new Component[][]{ new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 - new Component[]{toolTipLabel, toolTipTextFieldWrapper} + new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" + new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行 }; JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0)); + showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); return showContentPane; } + private JPanel createTextOverflowPane() { + showPartLayout = new CardLayout(); + showPartPane = new JPanel(showPartLayout); + showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10); + JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0)); + showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST); + showPartNumPane.add(showCharNums, BorderLayout.CENTER); + showPartPane.add(new JPanel(), "none"); + showPartPane.add(showPartNumPane, "content"); + showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")}); + showPartComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + 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)); + } + } + }); + + textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); + UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":"); + UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":"); + Component[][] textOverflowComponents = new Component[][]{ + new Component[]{showPartLabel, showPartComboBox, showPartPane}, + new Component[]{hideTypeLabel, textOverflowTypeComboBox, null} + }; + JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p}); + textOverflowComPane.setVisible(false); + textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); + textOverflowCheckBox.addItemListener(new ItemListener() { + @Override + 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) { + showPartLayout.show(showPartPane, "content"); + } else { + showPartLayout.show(showPartPane, "none"); + showPartPane.setPreferredSize(new Dimension(0, 0)); + } + } else { + textOverflowComPane.setVisible(false); + } + } + }); + JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + dynamicPaneWrapper.add(textOverflowComPane); + JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH); + textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER); + textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + return textOverflowPane; + } + private JPanel createSeniorCheckPane() { previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); @@ -370,6 +463,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); + tooltipButtonGroup.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group")); + textOverflowCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); + showPartComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart")); + showCharNums.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")); + textOverflowTypeComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); } @@ -428,7 +526,38 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else { showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); } - tooltipTextField.setText(cellGUIAttr.getTooltipText()); + if (cellGUIAttr.isCustomTooltip()) { + tooltipButtonGroup.setSelectedIndex(0); + tooltipTextField.setText(cellGUIAttr.getTooltipText()); + } else { + tooltipButtonGroup.setSelectedIndex(1); + } + if (tooltipButtonGroup.getSelectedIndex() == 0) { + tooltipPane.setPreferredSize(new Dimension(100, 20)); + tooltipLayout.show(tooltipPane, "content"); + } else { + tooltipLayout.show(tooltipPane, "none"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + } + tooltipPane.setVisible(true); + if (cellGUIAttr.isHideTextWhenOverflow()) { + textOverflowCheckBox.setSelected(true); + if (cellGUIAttr.isShowCharNum()) { + showPartLayout.show(showPartPane, "content"); + showCharNums.setValue(cellGUIAttr.getShowCharNums()); + } else { + showPartLayout.show(showPartPane, "none"); + showPartPane.setPreferredSize(new Dimension(0, 0)); + } + showPartPane.setVisible(true); + if (cellGUIAttr.isTextOverflowEllipsis()) { + textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis")); + } else { + textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")); + } + } else { + textOverflowCheckBox.setSelected(false); + } CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 if (cellPageAttr == null) { cellPageAttr = new CellPageAttr(); @@ -520,7 +649,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setFileName(fileNameTextField.getText()); } } - + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"))) { + cellGUIAttr.setCustomTooltip(tooltipButtonGroup.getSelectedIndex() == 0); + if (tooltipButtonGroup.getSelectedIndex() == 0) { + if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { + cellGUIAttr.setTooltipText(fieldName); + } else { + cellGUIAttr.setTooltipText(tooltipTextField.getText()); + } + } else if (tooltipButtonGroup.getSelectedIndex() == 1) { + cellGUIAttr.setTooltipText("=$$$"); + } + } if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) { if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { cellGUIAttr.setTooltipText(fieldName); @@ -528,6 +668,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setTooltipText(tooltipTextField.getText()); } } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"))) { + cellGUIAttr.setHideTextWhenOverflow(textOverflowCheckBox.isSelected()); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"))) { + cellGUIAttr.setShowCharNum(showPartComboBox.getSelectedIndex() == 0); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"))) { + cellGUIAttr.setShowCharNums((int) showCharNums.getValue()); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"))) { + cellGUIAttr.setTextOverflowEllipsis(textOverflowTypeComboBox.getSelectedIndex() == 0); + } // 如果与默认的CellGUIAttr相同,就不用保存这个属性了 if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) { cellElement.setCellGUIAttr(cellNullGUIAttr); From 6d9b77c809257e58c164cfd9899d717a143f4af7 Mon Sep 17 00:00:00 2001 From: wtianye <10320502+wtianye@user.noreply.gitee.com> Date: Mon, 17 Jan 2022 17:37:30 +0800 Subject: [PATCH 027/113] =?UTF-8?q?REPORT-65910=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=A4=B4=E7=9A=84=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E4=BB=A5=E5=90=8E=EF=BC=8C=E4=BB=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E5=A4=B4=E5=8C=BA=E5=9F=9F=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/sort/header/HeaderAreaPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4f4617053b..95da80c8ca 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 @@ -205,7 +205,7 @@ public class HeaderAreaPane extends JPanel { void build() { ElementCasePane elementCase = SortColumnRowPane.getCurrentElementCase(); - if (elementCase != null && this.elementCase != elementCase) { + if (elementCase != null) { this.elementCase = elementCase; notSelectables = new ArrayList<>(); buildNotSelectables(elementCase.getEditingElementCase()); From d166a5891a0cffe93fb7d1dc718bbc260d05d09f Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 17 Jan 2022 17:52:37 +0800 Subject: [PATCH 028/113] =?UTF-8?q?REPORT-64443=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E6=8A=A5=E9=94=99=E8=B7=B3=E8=BD=AC=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 16 ++- .../form/FormECDesignerProvider.java | 12 +- .../loghandler/DesignerLogHandler.java | 132 +++++++++++++++++- .../com/fr/design/selection/Selectedable.java | 28 ++-- .../fr/design/designer/creator/XCreator.java | 11 ++ .../main/java/com/fr/design/fit/NewJForm.java | 33 ++++- .../java/com/fr/design/mainframe/JForm.java | 52 ++++++- .../com/fr/design/mainframe/JWorkBook.java | 23 +-- .../mainframe/ReportComponentComposite.java | 23 ++- .../design/mainframe/WorkSheetDesigner.java | 27 ++++ .../form/FormElementCaseDesigner.java | 28 ++++ .../main/java/com/fr/poly/PolyDesigner.java | 35 ++++- .../java/com/fr/poly/creator/ECBlockPane.java | 29 ++++ 13 files changed, 403 insertions(+), 46 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index f1a40ccdc7..f37b817e99 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.base.TRL; import com.fr.base.extension.FileExtension; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; @@ -105,9 +106,9 @@ import javax.swing.JOptionPane; import javax.swing.SwingConstants; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; -import java.io.ByteArrayOutputStream; import java.awt.Dimension; import java.awt.FontMetrics; +import java.io.ByteArrayOutputStream; import java.util.Set; import java.util.concurrent.Callable; @@ -1000,7 +1001,7 @@ public abstract class JTemplate> return true; } - public boolean isNewCreateTpl(){ + public boolean isNewCreateTpl() { return isNewCreateTpl; } @@ -1543,7 +1544,7 @@ public abstract class JTemplate> /** * 设置新引擎后,有不支持的功能时,设计器中模板的标题需要加上“兼容模式”或者“不支持分页引擎”来提示用户 - * */ + */ private String compatibilityTip() { if (!CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath())) { return StringUtils.EMPTY; @@ -1888,6 +1889,15 @@ public abstract class JTemplate> templateThemeButton.setToolTipText(name); } + /** + * 定位 + * + * @param trl + */ + public void navigate(TRL trl) { + + } + public void generateForBiddenTemplate() { } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java index 88a4623071..2dc68704ec 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java @@ -1,10 +1,6 @@ package com.fr.design.mainframe.form; -import java.awt.Dimension; -import java.awt.image.BufferedImage; - -import javax.swing.JComponent; - +import com.fr.base.TRL; import com.fr.design.designer.TargetComponent; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuDef; @@ -12,6 +8,10 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.form.FormElementCaseProvider; +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + public interface FormECDesignerProvider { String XML_TAG = "FormElementCaseDesigner"; @@ -92,4 +92,6 @@ public interface FormECDesignerProvider { void refreshPropertyPane(); void removeSelection(); + + default void navigate(TRL trl) {} } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 1cb8e5d1aa..f7ffe1aaee 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -1,31 +1,43 @@ package com.fr.design.mainframe.loghandler; import com.fr.base.BaseUtils; +import com.fr.base.TRL; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.ui.util.UIUtil; +import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.log.Log4jConfig; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; - +import com.fr.stable.project.ProjectConstants; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.LogEvent; +import org.jetbrains.annotations.Nullable; + import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComponent; +import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextPane; import javax.swing.KeyStroke; +import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultEditorKit; import javax.swing.text.Document; +import javax.swing.text.Element; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLDocument; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -36,8 +48,14 @@ import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.io.File; +import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -61,6 +79,8 @@ public class DesignerLogHandler { private static final String ACTION_MAP_KEY = "clear"; + private static final Pattern pattern = Pattern.compile("\\([^(]*.(?>cpt|frm|cptx)[^)]*\\)"); + public static DesignerLogHandler getInstance() { return HOLDER.singleton; @@ -215,13 +235,61 @@ public class DesignerLogHandler { popup.show(jTextArea, event.getX(), event.getY()); checkEnabled(); } + if (event.getButton() == MouseEvent.BUTTON1) { + String url = findTplLinkFromMouseEvent(event); + if (StringUtils.isNotEmpty(url)) { + navigate(url); + } + } } }); } + /** + * 将模板定位链接导航到指定的位置 + * + * @param href 模板定位链接 + */ + private void navigate(String href) { + if (!href.startsWith(TRL.PREFIX)) { + return; + } + TRL trl = new TRL(href); + DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + File.separator + trl.getTemplatePath())); + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (currentEditingTemplate != null) { + currentEditingTemplate.navigate(trl); + } + } + + /** + * 鼠标事件中定位到模板链接 + * + * @param event 鼠标事件 + * @return 模板链接 + */ + private String findTplLinkFromMouseEvent(MouseEvent event) { + JEditorPane editor = (JEditorPane) event.getSource(); + int pos = editor.getUI().viewToModel(editor, event.getPoint()); + if (pos >= 0 && editor.getDocument() instanceof HTMLDocument) { + HTMLDocument hdoc = (HTMLDocument) editor.getDocument(); + Element elem = hdoc.getCharacterElement(pos); + Object a = elem.getAttributes().getAttribute(HTML.Tag.A); + if (a instanceof AttributeSet) { + AttributeSet set = (AttributeSet) a; + String url = (String) set.getAttribute(HTML.Attribute.HREF); + if (StringUtils.isNotEmpty(url)) { + return url; + } + } + } + return StringUtils.EMPTY; + } + private JTextPane initLogJTextArea() { final JTextPane resultPane = new JTextPane(); + resultPane.setContentType("text/html"); InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction); @@ -294,6 +362,12 @@ public class DesignerLogHandler { SimpleAttributeSet attrSet = new SimpleAttributeSet(); if (style == DesignerLogger.ERROR_INT) { + String[] tplLink = tryFindTplLink(str); + if (tplLink != null + && tplLink.length > 0 + && dealWithTplLink(str, tplLink)) { + return; + } StyleConstants.setForeground(attrSet, Color.RED); StyleConstants.setBold(attrSet, true); } else if (style == DesignerLogger.WARN_INT) { @@ -314,6 +388,62 @@ public class DesignerLogHandler { } } + /** + * 处理模板链接 + * + * @param s 含有模板链接 + * @param tplLink 模板链接 + * @return 是否处理成功 + */ + private boolean dealWithTplLink(String s, String[] tplLink) { + String afterBr = s.replaceAll("\\n", "
"); + String[] lineSeg = pattern.split(afterBr); + StringBuilder sb = new StringBuilder(""); + for(int i=0;i< tplLink.length;i++){ + sb.append("") + .append(lineSeg[i]) + .append("") + .append(tplLink[i]) + .append(""); + } + if (lineSeg.length > tplLink.length) { + sb.append("").append(lineSeg[lineSeg.length-1]).append(""); + } + sb.append(""); + + try { + Document doc = jTextArea.getStyledDocument(); + HTMLDocument htmlDocument = (HTMLDocument) doc; + htmlDocument.insertAfterEnd(htmlDocument.getCharacterElement(doc.getLength()), sb.toString()); + } catch (BadLocationException | IOException ignored) { + // 这里出问题不记录日志否则会导致死循环 + return false; + } + return true; + } + + /** + * 尝试找到模板链接 + * + * @param s 可能含有模板链接的字符串 + * @return 模板链接 + */ + @Nullable + private String[] tryFindTplLink(String s) { + Document doc = jTextArea.getStyledDocument(); + if (!(doc instanceof HTMLDocument)) { + return null; + } + Matcher matcher = pattern.matcher(s); + List list = new ArrayList<>(); + while (matcher.find()) { + list.add(matcher.group(0)); + } + return list.toArray(new String[0]); + } + private String appendLocaleMark(String str, int style) { if (style == DesignerLogger.ERROR_INT) { diff --git a/designer-base/src/main/java/com/fr/design/selection/Selectedable.java b/designer-base/src/main/java/com/fr/design/selection/Selectedable.java index 5e78482e82..8900054431 100644 --- a/designer-base/src/main/java/com/fr/design/selection/Selectedable.java +++ b/designer-base/src/main/java/com/fr/design/selection/Selectedable.java @@ -1,25 +1,29 @@ package com.fr.design.selection; +import com.fr.base.TRL; + /** - * * @author zhou * @since 2012-7-26上午10:20:32 */ public interface Selectedable { - public S getSelection(); + S getSelection(); + + void setSelection(S selectElement); - public void setSelection(S selectElement); + /** + * Adds a ChangeListener to the listener list. + */ + void addSelectionChangeListener(SelectionListener selectionListener); - /** - * Adds a ChangeListener to the listener list. - */ - public void addSelectionChangeListener(SelectionListener selectionListener); + /** + * removes a ChangeListener from the listener list. + */ + void removeSelectionChangeListener(SelectionListener selectionListener); - /** - * removes a ChangeListener from the listener list. - */ - public void removeSelectionChangeListener(SelectionListener selectionListener); + // august:这儿就不要加fireSelectionChangeListener方法了。因为这个方法一般要定义成私有的,不然外部随即的调用! + default void navigate(TRL trl) { - // august:这儿就不要加fireSelectionChangeListener方法了。因为这个方法一般要定义成私有的,不然外部随即的调用! + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 14fc9ea248..792e97045e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -54,6 +54,7 @@ import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.StringJoiner; /** * @author richer @@ -943,4 +944,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return false; } + + @Override + public String toString() { + return new StringJoiner(", ", XCreator.class.getSimpleName() + "[", "]") + .add("data=" + data) + .add("shareId='" + shareId + "'") + .add("isHelpBtnOnFocus=" + isHelpBtnOnFocus) + .add("selected=" + selected) + .toString(); + } } diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index 0a12a74257..60bd8d5427 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -2,25 +2,27 @@ package com.fr.design.fit; import com.fr.base.DynamicUnitList; import com.fr.base.Parameter; +import com.fr.base.TRL; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XComponent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWTitleLayout; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.mainframe.DesignerUIModeConfig; -import com.fr.design.preview.DeveloperPreview; -import com.fr.design.preview.FormAdaptivePreview; import com.fr.design.fit.toolbar.SwitchAction; import com.fr.design.fun.PreviewProvider; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.preview.DeveloperPreview; +import com.fr.design.preview.FormAdaptivePreview; import com.fr.design.preview.FormPreview; import com.fr.design.preview.MobilePreview; import com.fr.design.utils.ComponentUtils; @@ -29,6 +31,7 @@ import com.fr.form.FormElementCaseProvider; import com.fr.form.fit.NewFormMarkAttr; import com.fr.form.main.Form; import com.fr.form.ui.ElementCaseEditor; +import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.JComponent; @@ -215,6 +218,7 @@ public class NewJForm extends JForm { return new PreviewProvider[]{new FormPreview(), new MobilePreview()}; } + @Override public UIButton[] createExtraButtons() { UIButton[] extraButtons = super.createExtraButtons(); return addAdaptiveSwitchButton(extraButtons); @@ -228,4 +232,25 @@ public class NewJForm extends JForm { public boolean isNewJFrom() { return jFormType == null || jFormType.isNewType(); } + + @Override + public void navigate(TRL trl) { + String blockName = trl.unescapeNext(); + JForm.traversalXCreator(formDesign.getRootComponent(), xCreator -> { + if (!ComparatorUtils.equals(xCreator.toData().getWidgetName(), blockName)) { + return; + } + if (xCreator instanceof XElementCase) { + getFormDesign().getSelectionModel().selectACreator(xCreator); + xCreator.startEditing(); + if (getElementCaseDesign() != null) { + getElementCaseDesign().navigate(trl); + } + } else { + tabChanged(FORM_TAB); + getFormDesign().getSelectionModel().reset(); + getFormDesign().getSelectionModel().selectACreator(xCreator); + } + }, XCreator.class); + } } 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..449aa51906 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 @@ -96,6 +96,7 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.web.controller.ViewRequestConstants; +import org.jetbrains.annotations.Nullable; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -125,7 +126,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm { } protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) { - if (CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath())){ + if (CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath())) { exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), new CSVExportAction(this), new TextExportAction(this)); - }else { + } else { exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), new CSVExportAction(this), new TextExportAction(this), new EmbeddedExportExportAction(this)); } @@ -758,15 +758,14 @@ public class JWorkBook extends JTemplate { new ReportWatermarkAction(this), new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Current_Sheet")), }, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu()); - if (enableNewEngine){ + if (enableNewEngine) { return ArraysUtil.insert(commonShortCut, new CalculateAttrAction(this), 5); - }else { + } else { return commonShortCut; } } - /** * 模板的工具 * @@ -1243,6 +1242,7 @@ public class JWorkBook extends JTemplate { return ViewRequestConstants.REPORT_VIEW_PATH; } + @Override protected void addChooseFILEFilter(FILEChooserPane fileChooser) { String appName = ProductConstants.APP_NAME; fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); @@ -1304,7 +1304,7 @@ public class JWorkBook extends JTemplate { @Override public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) { - ReportTheme oldTheme = getTarget().getTemplateTheme(); + ReportTheme oldTheme = getTarget().getTemplateTheme(); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); getTarget().setTemplateTheme(newTheme, compatible); @@ -1318,4 +1318,9 @@ public class JWorkBook extends JTemplate { super.setTemplateTheme(newTheme, compatible); } + + @Override + public void navigate(TRL trl) { + reportComposite.selectCell(trl); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 5fe5618293..d0f6a114d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.ScreenResolution; -import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.base.TRL; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.EditingState; import com.fr.design.event.RemoveListener; @@ -13,14 +13,13 @@ import com.fr.grid.Grid; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; import com.fr.report.report.TemplateReport; +import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.event.MouseWheelEvent; -import java.awt.event.MouseWheelListener; import java.util.ArrayList; /** @@ -80,6 +79,22 @@ public class ReportComponentComposite extends JComponent implements RemoveListen } }; + /** + * 选中格子 + * + * @param trl 模板资源路径 + */ + public void selectCell(TRL trl) { + String sheetIndexStr = trl.next(); + if(StringUtils.isEmpty(sheetIndexStr)) { + return; + } + int sheetIndex = Integer.parseInt(sheetIndexStr); + if (sheetIndex >= 0) { + sheetNameTab.setSelectedIndex(sheetIndex); + centerCardPane.editingComponet.navigate(trl); + } + } protected void doBeforeChange(int oldIndex) { if (oldIndex >= 0) { @@ -131,7 +146,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen } } - private void updateJSlider(){ + private void updateJSlider() { centerCardPane.editingComponet.updateJSliderValue(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java index da75480136..0529cf82a3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.ScreenResolution; +import com.fr.base.TRL; import com.fr.design.DesignState; import com.fr.design.actions.report.ReportColumnsAction; import com.fr.design.actions.report.ReportEngineAttrAction; @@ -19,11 +20,14 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.selection.SelectionListener; import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; +import com.fr.stable.ColumnRow; +import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; @@ -196,4 +200,27 @@ public class WorkSheetDesigner extends ReportComponent 10000) { + setSelection(new FloatSelection(TRL.unescape(cellName))); + return; + } + CellSelection cellSelection = new CellSelection(columnRow.getColumn(), columnRow.getRow(), columnRow.getColumnSpan(), columnRow.getRowSpan()); + // 滚动到位 + JScrollBar verticalBar = getVerticalScrollBar(), + horizontalBar = getHorizontalScrollBar(); + int m = columnRow.getColumn(), n = columnRow.getRow(); + verticalBar.setMaximum(n); + verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20); + horizontalBar.setMaximum(m); + horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12); + // 选中 + setSelection(cellSelection); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 9d89a7cd33..481ab540bf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -3,6 +3,7 @@ */ package com.fr.design.mainframe.form; +import com.fr.base.TRL; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.AllowAuthorityEditAction; @@ -32,13 +33,16 @@ import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; import com.fr.grid.Grid; import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; import com.fr.report.cell.CellElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.ColumnRow; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; @@ -389,4 +393,28 @@ public class FormElementCaseDesigner public FormElementCaseProvider getEditingElementCase() { return this.getEditingElementCasePane().getTarget(); } + + @Override + public void navigate(TRL trl) { + String cellName = trl.next(); + if (StringUtils.isEmpty(cellName)) { + return; + } + ColumnRow columnRow = ColumnRow.valueOf(cellName); + if (!ColumnRow.validate(columnRow) || columnRow.getColumn() > 10000) { + setSelection((S)new FloatSelection(TRL.unescape(cellName))); + return; + } + CellSelection cellSelection = new CellSelection(columnRow.getColumn(), columnRow.getRow(), columnRow.getColumnSpan(), columnRow.getRowSpan()); + // 滚动到位 + JScrollBar verticalBar = getVerticalScrollBar(), + horizontalBar = getHorizontalScrollBar(); + int m = columnRow.getColumn(), n = columnRow.getRow(); + verticalBar.setMaximum(n); + verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20); + horizontalBar.setMaximum(m); + horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12); + // 选中 + setSelection((S)cellSelection); + } } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index 437cb8ea12..494b7e4c60 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -5,6 +5,7 @@ package com.fr.poly; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.base.TRL; import com.fr.base.vcs.DesignerMode; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.DesignState; @@ -65,6 +66,7 @@ import com.fr.stable.unit.FU; import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UnitRectangle; +import org.jetbrains.annotations.Nullable; import javax.swing.AbstractAction; import javax.swing.ActionMap; @@ -124,7 +126,7 @@ public class PolyDesigner extends ReportComponent 0 && elementCasePane != null) { + elementCasePane.navigate(trl); + } + + } + + @Nullable + private BlockCreator getBlock(String blockName) { + for (int i = 0; i < addedData.getAddedCount(); i++) { + BlockCreator creator = addedData.getAddedAt(i); + if (ComparatorUtils.equals(blockName, creator.getValue().getBlockName())) { + return creator; + } + } + return null; + } } diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java index 9a584836be..33bcda20a6 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java @@ -3,6 +3,7 @@ */ package com.fr.poly.creator; +import com.fr.base.TRL; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; @@ -32,11 +33,16 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; import com.fr.page.ReportSettingsProvider; import com.fr.poly.PolyDesigner; import com.fr.report.poly.PolyECBlock; import com.fr.stable.ArrayUtils; +import com.fr.stable.ColumnRow; +import com.fr.stable.StringUtils; +import javax.swing.JScrollBar; import java.awt.Dimension; /** @@ -171,4 +177,27 @@ public class ECBlockPane extends PolyElementCasePane { return designer.getTemplateReport().getReportSettings(); } + @Override + public void navigate(TRL trl) { + String cellName = trl.next(); + if (StringUtils.isEmpty(cellName)) { + return; + } + ColumnRow columnRow = ColumnRow.valueOf(cellName); + if (!ColumnRow.validate(columnRow) || columnRow.getColumn() > 10000) { + setSelection(new FloatSelection(TRL.unescape(cellName))); + return; + } + CellSelection cellSelection = new CellSelection(columnRow.getColumn(), columnRow.getRow(), columnRow.getColumnSpan(), columnRow.getRowSpan()); + // 滚动到位 + JScrollBar verticalBar = getVerticalScrollBar(), + horizontalBar = getHorizontalScrollBar(); + int m = columnRow.getColumn(), n = columnRow.getRow(); + verticalBar.setMaximum(n); + verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20); + horizontalBar.setMaximum(m); + horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12); + // 选中 + setSelection(cellSelection); + } } From dc28f2fac245696c8017c4cb1509b5e459779382 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 18 Jan 2022 12:16:45 +0800 Subject: [PATCH 029/113] =?UTF-8?q?REPORT-65975=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E6=8E=A7=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E8=A1=A8=E5=90=8D=E5=90=8E=E4=BC=9A?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=BD=93=E5=89=8D=E9=80=89=E6=8B=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icombobox/TableSearchTreeComboBox.java | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 6b41986939..27cdc17283 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -16,12 +16,13 @@ import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import javax.swing.JTree; import javax.swing.SwingWorker; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.event.MouseEvent; import java.util.Enumeration; /** @@ -40,7 +41,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); this.parent = parent; - setUI(new TableSearchTreeComboBoxUI()); + initPopupListener(); } protected UIComboBoxEditor createEditor() { @@ -158,12 +159,6 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { - public boolean accept(TableProcedure procedure) { - return true; - } - }; - /** * 表名模糊搜索实现 */ @@ -184,15 +179,31 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - /** - * 重写FRTreeComboBoxUI,实现点击下拉时触发模糊搜索 - */ - private class TableSearchTreeComboBoxUI extends FRTreeComboBoxUI { - - @Override - public void mouseClicked(MouseEvent e) { - searchExecute(); + private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { + public boolean accept(TableProcedure procedure) { + return true; } + }; + + protected void initPopupListener() { + // 点击下拉时触发模糊搜索 + this.addPopupMenuListener(new PopupMenuListener() { + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + searchExecute(); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); } /** From f4a3c9095851b948f3b5574db365f60beeb3d0d2 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 18 Jan 2022 12:19:30 +0800 Subject: [PATCH 030/113] =?UTF-8?q?REPORT-65975=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E6=8E=A7=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E8=A1=A8=E5=90=8D=E5=90=8E=E4=BC=9A?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=BD=93=E5=89=8D=E9=80=89=E6=8B=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/TableSearchTreeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 27cdc17283..7198eeef09 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -185,7 +185,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } }; - protected void initPopupListener() { + private void initPopupListener() { // 点击下拉时触发模糊搜索 this.addPopupMenuListener(new PopupMenuListener() { From ea454eccfe8a65f86cbbecc689093efc236c9bcd Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 18 Jan 2022 14:43:07 +0800 Subject: [PATCH 031/113] =?UTF-8?q?REPORT-64445=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/fit/FormFitAttrModelType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index a77566442d..658eece8e0 100644 --- 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 @@ -73,7 +73,7 @@ public enum FormFitAttrModelType { 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)}; + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), 2)}; } @Override @@ -81,7 +81,7 @@ public enum FormFitAttrModelType { 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)}; + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), 2)}; } From 46f00406e9a866479003af3de985249164b9a4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 18 Jan 2022 16:33:55 +0800 Subject: [PATCH 032/113] =?UTF-8?q?CHART-22531=20=E5=A4=9A=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E8=BD=B4=E5=88=86=E5=B1=82=E8=AE=BE=E7=BD=AE=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F=E2=80=94=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...goryPlotMoreCateReportDataContentPane.java | 35 ++- ...egoryPlotMoreCateTableDataContentPane.java | 44 ++-- ...VanChartMoreCateReportDataContentPane.java | 7 +- .../VanChartMoreCateTableDataContentPane.java | 7 +- .../designer/style/axis/VanChartAxisPane.java | 6 + .../axis/VanChartAxisStyleSettingPane.java | 158 ++++++++++++ .../style/axis/VanChartBaseAxisPane.java | 242 +++++++++++++++++- ...VanChartCategoryStylePaneWithCheckBox.java | 102 ++++++++ 8 files changed, 563 insertions(+), 38 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index d4e1f64e77..cbaf8b0c1b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -7,6 +7,7 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.formula.TinyFormulaPane; @@ -19,14 +20,14 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.LinkedHashMap; +import java.util.Map; /** @@ -40,10 +41,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor private JPanel boxPane; private UIButton addButton; - private ArrayList formualList = new ArrayList(); + private Map formualList = new LinkedHashMap<>(); private UIObserverListener uiobListener = null; - public List getFormualList() { + public Map getFormualList() { return formualList; } @@ -99,12 +100,17 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } private TinyFormulaPane addNewCatePane() { + String uuid = UUIDUtil.generate(); + return addNewCatePane(uuid); + } + + private TinyFormulaPane addNewCatePane(String uuid) { final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); pane.setPreferredSize(new Dimension(100, 16)); pane.registerChangeListener(uiobListener); - formualList.add(pane); + formualList.put(uuid, pane); final JPanel newButtonPane = new JPanel(); newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); @@ -119,7 +125,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor @Override public void actionPerformed(ActionEvent e) { boxPane.remove(newButtonPane); - formualList.remove(pane); + formualList.remove(uuid); checkComponent(); relayoutPane(); } @@ -171,11 +177,11 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - int size = reportDefinition.getMoreCateSize(); - if (reportDefinition.getCategoryName() != null && size > 0) { - for(int i = 0; i < size; i++) { - TinyFormulaPane pane = addNewCatePane(); - pane.populateBean(Utils.objectToString(reportDefinition.getMoreCateWithIndex(i))); + Map moreCateLabels = reportDefinition.getMoreCateLabels(); + if (reportDefinition.getCategoryName() != null && !moreCateLabels.isEmpty()) { + for (Map.Entry entry : moreCateLabels.entrySet()) { + TinyFormulaPane pane = addNewCatePane(entry.getKey()); + pane.populateBean(Utils.objectToString(entry.getValue())); } } } @@ -198,9 +204,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { - for (int i = 0, size = formualList.size(); i < size; i++) { - TinyFormulaPane pane = formualList.get(i); - reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); + for (Map.Entry entry : formualList.entrySet()) { + String uuid = entry.getKey(); + TinyFormulaPane pane = entry.getValue(); + reportDefinition.addMoreCate(uuid, canBeFormula(pane.updateBean())); } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 3bf0225ef2..29f18002c7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -6,6 +6,7 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; +import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -15,15 +16,20 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +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 java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** * 多分类轴 的数据集定义界面. @@ -39,12 +45,12 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private JPanel boxPane; - private ArrayList boxList = new ArrayList(); + private Map boxList = new LinkedHashMap<>(); private UIButton addButton; private UIObserverListener uiobListener = null; - public List getBoxList() { + public Map getBoxList() { return boxList; } @@ -108,6 +114,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } private UIComboBox addNewCombox() { + String uuid = UUIDUtil.generate(); + return addNewCombox(uuid); + } + + private UIComboBox addNewCombox(String uuid) { final JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); @@ -134,7 +145,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); buttonPane.add(delButton); boxPane.add(buttonPane); - boxList.add(combox); + boxList.put(uuid, combox); checkComponent(); @@ -142,7 +153,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); - boxList.remove(combox); + boxList.remove(uuid); checkComponent(); relayoutPane(); } @@ -216,10 +227,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); if (top instanceof NormalTableDataDefinition) { NormalTableDataDefinition normal = (NormalTableDataDefinition) top; - int size = normal.getMoreCateSize(); - for (int i = 0; i < size; i++) { - UIComboBox box = addNewCombox(); - box.setSelectedItem(normal.getMoreCateWithIndex(i)); + Map moreCateLabels = normal.getMoreCateLabels(); + for(Map.Entry entry : moreCateLabels.entrySet()) { + UIComboBox box = addNewCombox(entry.getKey()); + box.setSelectedItem(entry.getValue()); } } @@ -245,10 +256,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { - for (int i = 0, size = boxList.size(); i < size; i++) { - UIComboBox box = boxList.get(i); - if (box.getSelectedItem() != null) { - normal.addMoreCate(box.getSelectedItem().toString()); + for (Map.Entry entry : boxList.entrySet()) { + String uuid = entry.getKey(); + UIComboBox comboBox = entry.getValue(); + if (comboBox != null && comboBox.getSelectedItem() != null) { + normal.addMoreCate(uuid, comboBox.getSelectedItem().toString()); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateReportDataContentPane.java index 2ffb094e07..08419faed6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateReportDataContentPane.java @@ -3,11 +3,14 @@ package com.fr.van.chart.designer.data; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.design.formula.TinyFormulaPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotMoreCateReportDataContentPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import java.util.Map; + /** * Created by mengao on 2017/7/3. */ @@ -41,8 +44,8 @@ public class VanChartMoreCateReportDataContentPane extends CategoryPlotMoreCateR private void checkBoxList(boolean isSupportMulticategory) { if (getFormualList().size() != 0) { - for (int i = 0; i < getFormualList().size(); i++) { - getFormualList().get(i).setEnabled(isSupportMulticategory); + for (Map.Entry entry : getFormualList().entrySet()) { + entry.getValue().setEnabled(isSupportMulticategory); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java index dcf160aec1..ce6e7a16c6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java @@ -3,11 +3,14 @@ package com.fr.van.chart.designer.data; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotMoreCateTableDataContentPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import java.util.Map; + /** * Created by mengao on 2017/7/3. */ @@ -43,8 +46,8 @@ public class VanChartMoreCateTableDataContentPane extends CategoryPlotMoreCateTa private void checkBoxList(boolean isSupportMulticategory) { if (getBoxList().size() != 0) { - for (int i = 0; i < getBoxList().size(); i++) { - getBoxList().get(i).setEnabled(isSupportMulticategory); + for (Map.Entry entry : getBoxList().entrySet()) { + entry.getValue().setEnabled(isSupportMulticategory); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java index e8379e78b4..11841813d9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java @@ -1,5 +1,6 @@ package com.fr.van.chart.designer.style.axis; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; @@ -41,6 +42,7 @@ public class VanChartAxisPane extends BasicBeanPane { protected VanChartAxisPlot editingPlot; protected VanChartStylePane parent; + private Chart chart; public VanChartAxisPane(VanChartAxisPlot plot, VanChartStylePane parent){ this.editingPlot = plot; @@ -188,6 +190,7 @@ public class VanChartAxisPane extends BasicBeanPane { if(chart == null){ return; } + this.chart = chart; Plot plot = chart.getPlot(); populateBean(plot); @@ -208,10 +211,12 @@ public class VanChartAxisPane extends BasicBeanPane { } for(VanChartAxis axis : editingPlot.getXAxisList()){ + axis.setChart(chart); VanChartXYAxisPaneInterface axisPane = xAxisPaneMap.get(axis.getAxisName()); axisPane.populate(axis); } for(VanChartAxis axis : editingPlot.getYAxisList()){ + axis.setChart(chart); VanChartXYAxisPaneInterface axisPane = yAxisPaneMap.get(axis.getAxisName()); axisPane.populate(axis); } @@ -237,6 +242,7 @@ public class VanChartAxisPane extends BasicBeanPane { if(chart == null){ return; } + this.chart = chart; Plot plot = chart.getPlot(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java new file mode 100644 index 0000000000..94a9e4a0cd --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java @@ -0,0 +1,158 @@ +package com.fr.van.chart.designer.style.axis; + +import com.fr.base.BaseFormula; +import com.fr.chart.base.TextAttr; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; +import com.fr.design.mainframe.chart.mode.ChartEditContext; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.VanChartAxisCategoryStyle; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class VanChartAxisStyleSettingPane extends BasicBeanPane { + private static final double ROTATION_MAX = 90.0; + + private AxisLabelDisplayComboBox labelDisplayComboBox; + private ChartTextAttrPane labelTextAttrPane; + private UINumberDragPane labelTextRotation; + private UIButtonGroup labelGapStyle; + private UITextField labelGapValue; + private JPanel labelGapPane; + private JPanel labelGapValuePane; + private JPanel contentPane; + + public VanChartAxisStyleSettingPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] column = {f, s}; + double[] row = {p, p, p}; + + labelDisplayComboBox = new AxisLabelDisplayComboBox(); + JPanel labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + labelTextAttrPane = getChartTextAttrPane(); + labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + labelGapStyle = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + labelGapValue = new UITextField(); + labelGapPane = createLabelGapPane(row, column); + + this.setLayout(new BorderLayout()); + contentPane = new JPanel(new BorderLayout()); + contentPane.add(labelDisplayPane, BorderLayout.NORTH); + contentPane.add(labelTextAttrPane, BorderLayout.CENTER); + contentPane.add(labelGapPane, BorderLayout.SOUTH); + this.add(contentPane, BorderLayout.NORTH); + initListner(); + } + + @Override + public Dimension getPreferredSize() { + Dimension defaultSize = super.getPreferredSize(); + return new Dimension(defaultSize.width, contentPane.getPreferredSize().height); + } + + private void initListner() { + labelDisplayComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + labelGapPane.setVisible(labelDisplayComboBox.getSelectedIndex() == 0); + } + }); + + labelGapStyle.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); + } + }); + } + + @Override + public void populateBean(VanChartAxisCategoryStyle style) { + labelDisplayComboBox.populateBean(style.getLabelDisplay()); + labelTextAttrPane.populate(style.getTextAttr()); + labelTextRotation.populateBean((double) style.getTextAttr().getRotation()); + labelGapStyle.setSelectedIndex(style.isAutoLabelGap() ? 0 : 1); + labelGapValue.setText(style.getLabelIntervalNumber().getContent()); + + labelGapPane.setVisible(labelDisplayComboBox.getSelectedIndex() == 0); + labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); + } + + @Override + public VanChartAxisCategoryStyle updateBean() { + VanChartAxisCategoryStyle style = new VanChartAxisCategoryStyle(); + style.setLabelDisplay(labelDisplayComboBox.updateBean()); + TextAttr textAttr = style.getTextAttr(); + labelTextAttrPane.update(textAttr); + textAttr.setRotation(labelTextRotation.updateBean().intValue()); + style.setTextAttr(textAttr); + style.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); + if (style.isAutoLabelGap()) { + style.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("0")); + } else { + style.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); + } + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + private JPanel createLabelGapPane(double[] row, double[] col) { + Component[][] gapComponents = new Component[][]{ + new Component[]{null, null}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_TextRotation")), + UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) + }, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle} + }; + + JPanel gapDetailPane = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); + labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText(""), labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(gapDetailPane, BorderLayout.CENTER); + panel.add(labelGapValuePane, BorderLayout.SOUTH); + + return panel; + } + + protected ChartTextAttrPane getChartTextAttrPane() { + return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() { + protected double getEdithAreaWidth() { + return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + } + } : new ChartTextAttrPane() { + @Override + protected JPanel getContentPane(JPanel buttonPane) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize); + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index aff9d64c30..407adf92b3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -3,8 +3,12 @@ package com.fr.van.chart.designer.style.axis; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.base.TextAttr; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Title; +import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UINumberDragPane; @@ -25,6 +29,7 @@ import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.VanChartAxisCategoryStyle; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.base.OverlapHandleType; import com.fr.plugin.chart.base.VanChartConstants; @@ -37,6 +42,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox; +import com.fr.van.chart.designer.style.axis.component.VanChartCategoryStylePaneWithCheckBox; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -49,14 +55,20 @@ import java.awt.CardLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * 坐标轴的基础配置项。分类,时间,值等公共的部分。 */ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { - private static final long serialVersionUID = -5717246802333308973L; private static final double ROTATION_MAX = 90.0; + private static final String WHOLE_DISPLAY = "wholeDisplay"; // 整体显示 + private static final String LAYER_DISPLAY = "layerDisplay"; // 分层显示 + protected UIButtonGroup showTitle; protected TinyFormulaPane titleContent; protected UIButtonGroup titleAlignPane; @@ -66,6 +78,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel titlePane; protected UIButtonGroup showLabel; + protected UIButtonGroup showLogic; protected ChartTextAttrPane labelTextAttrPane; protected UINumberDragPane labelTextRotation; @@ -80,10 +93,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //protected UISpinner labelGapValue; protected JPanel labelPanel; + private JPanel labelStylePane; + private JPanel showLogicPane; private JPanel labelGapPane; private JPanel labelGapStylePane; private JPanel labelGapValuePane; private JPanel labelDisplayPane; + private JPanel categoryStylePane; + private List categoryStyles = new ArrayList<>(); protected LineComboBox axisLineStyle; @@ -107,6 +124,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel centerPane; private VanChartHtmlLabelPane htmlLabelPane; + private VanChartStylePane parent; + public VanChartBaseAxisPane() { this(true); } @@ -117,6 +136,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } public void setParentPane(VanChartStylePane parent) { + this.parent = parent; htmlLabelPane.setParent(parent); } @@ -220,16 +240,19 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { addComponentsListener(); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel); + JPanel showLogicPane = createShowLogicPane(); JPanel labelPane = new JPanel(new BorderLayout()); labelPane.add(showLabelPane, BorderLayout.NORTH); - labelPane.add(labelPanel, BorderLayout.CENTER); + labelPane.add(showLogicPane, BorderLayout.CENTER); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, labelPane); } private void initLabelComponents() { showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); + showLogic = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Whole_Display"), Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Layer_Display")}); + initButtonGroupListener(); labelDisplayComboBox = new AxisLabelDisplayComboBox(); labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); @@ -241,6 +264,51 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelGapValue = new UITextField(); } + private void initButtonGroupListener() { + showLogic.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + showLabelStyleCard(); + } + }); + } + + private void showLabelStyleCard() { + CardLayout layout = (CardLayout) labelStylePane.getLayout(); + if (showLogic.getSelectedIndex() == 0) { + layout.show(labelStylePane, WHOLE_DISPLAY); + } else { + layout.show(labelStylePane, LAYER_DISPLAY); + } + labelStylePane.revalidate(); + } + + /** + * 创建显示逻辑以及其下面面板 + * + * @return + */ + private JPanel createShowLogicPane() { + showLogicPane = new JPanel(new BorderLayout()); + labelStylePane = new JPanel(new CardLayout()); + labelStylePane.add(labelPanel, WHOLE_DISPLAY); + labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); + showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); + showLogicPane.add(labelStylePane, BorderLayout.CENTER); + return showLogicPane; + } + + /** + * 创建多分类轴标签设置面板 + * + * @return + */ + private JPanel createCategoryStylePane() { + categoryStylePane = new JPanel(new BorderLayout()); + categoryStylePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + return categoryStylePane; + } + private JPanel createLabelGapPane(double[] row, double[] col) { Component[][] gapComponents = new Component[][]{ new Component[]{null, null}, @@ -570,8 +638,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkLabelPane() { if (showLabel != null) { boolean enabled = showLabel.getSelectedIndex() == 0; - if (labelPanel != null) { - labelPanel.setVisible(enabled); + if (showLogicPane != null) { + showLogicPane.setVisible(enabled); } if (enabled) { //轴标签缩略间隔显示 恢复用注释。下面1行删除。 @@ -698,6 +766,24 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if (showLabel != null) { showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); } + + populateShowLogicPane(axis); + } + + private void populateShowLogicPane(VanChartAxis axis) { + if (showLogic != null) { + showLogic.setSelectedIndex(axis.getLabelDisplayMode()); + } + populateWholeDisplayPane(axis); + populateLayerDisplayPane(axis); + showLabelStyleCard(); + labelStylePane.revalidate(); + } + + /** + * populate整体显示那个card面板 + */ + private void populateWholeDisplayPane(VanChartAxis axis) { TextAttr labelTextAttr = axis.getTextAttr(); if (labelTextAttrPane != null) { labelTextAttrPane.populate(labelTextAttr); @@ -723,6 +809,124 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } + /** + * populate分层显示那个card面板 + * + * @param axis + */ + private void populateLayerDisplayPane(VanChartAxis axis) { + Chart chart = axis.getChart(); + if (chart == null) { + return; + } + categoryStylePane.removeAll(); + categoryStyles.clear(); + populateDefaultCateLabelStyle(axis); + populateMoreCateLabelStyle(axis); + + categoryStylePane.revalidate(); + } + + /** + * 默认一定会有一个分类标签,就populate这个 + */ + private void populateDefaultCateLabelStyle(VanChartAxis axis) { + populateCategoryStyles(axis, VanChartAxis.DEFAULT_CATEGORY_UUID, 0); + } + + /** + * populate其余的分类标签 + * + * @param axis + */ + private void populateMoreCateLabelStyle(VanChartAxis axis) { + Chart chart = axis.getChart(); + Map moreCateLabels = new LinkedHashMap<>(); + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition == null) { + return; + } + if (definition instanceof NormalTableDataDefinition) { + NormalTableDataDefinition tableDataDefinition = (NormalTableDataDefinition) definition; + moreCateLabels.putAll(tableDataDefinition.getMoreCateLabels()); + } else if (definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDataDefinition = (NormalReportDataDefinition) definition; + for (Map.Entry entry : reportDataDefinition.getMoreCateLabels().entrySet()) { + String uuid = entry.getKey(); + String cateLabel = Utils.objectToString(entry.getValue()); + moreCateLabels.put(uuid, cateLabel); + } + } + + int i = 1; + List uuids = new ArrayList<>(); + for (Map.Entry entry : moreCateLabels.entrySet()) { + String uuid = entry.getKey(); + uuids.add(uuid); + populateCategoryStyles(axis, uuid, i); + i++; + } + axis.retainUsefulCategoryStyles(uuids); + } + + private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) { + VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); + VanChartAxisCategoryStyle style = populateAxisCategoryStyles(axis, uuid, index); + pane.populate(style, uuid); + categoryStyles.add(pane); + categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); + + } + + private VanChartAxisCategoryStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { + VanChartAxisCategoryStyle style; + if (axis.getCategoryStyle(uuid) != null) { + style = axis.getCategoryStyle(uuid); + } else { + style = axis.getCategoryStyleByIndex(index); + if (style == null) { + style = new VanChartAxisCategoryStyle(); + } + axis.addCategoryStyle(uuid, style); + } + return style; + } + + private JPanel createCateLableStylePanel() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = getCateLableStylePaneRow(); + double[] column = {f, p}; + + JPanel content = TableLayoutHelper.createTableLayoutPane(getCateLabelStyleComponents(), row, column); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")), content} + }; + + return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); + } + + private Component[][] getCateLabelStyleComponents() { + Component[][] components = new Component[categoryStyles.size()][]; + for (int i = 0; i < categoryStyles.size(); i++) { + components[i] = new Component[2]; + components[i][0] = categoryStyles.get(i); + components[i][1] = null; + } + return components; + } + + private double[] getCateLableStylePaneRow() { + double[] row = new double[categoryStyles.size()]; + for (int i = 0; i < categoryStyles.size(); i++) { + row[i] = TableLayout.PREFERRED; + } + return row; + } + //轴线样式 private void populateLineStyle(VanChartAxis axis) { if (axisLineStyle != null) { @@ -837,6 +1041,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if (showLabel != null) { axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); } + updateShowLogicPane(axis); + } + + private void updateShowLogicPane(VanChartAxis axis) { + if (showLogic != null) { + axis.setLabelDisplayMode(showLogic.getSelectedIndex()); + } + + updateWholeDisplayPane(axis); + updateLayerDisplayPane(axis); + } + + /** + * update整体显示那个card面板 + */ + private void updateWholeDisplayPane(VanChartAxis axis) { TextAttr labelTextAttr = axis.getTextAttr(); if (labelTextAttrPane != null) { labelTextAttrPane.update(labelTextAttr); @@ -866,6 +1086,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } + /** + * update分层显示那个card面板 + * + * @param axis + */ + private void updateLayerDisplayPane(VanChartAxis axis) { + for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { + Map styleMap = categoryStyle.update(); + for (Map.Entry entry : styleMap.entrySet()) { + axis.addCategoryStyle(entry.getKey(), entry.getValue()); + } + } + } + //轴线样式 private void updateLineStyle(VanChartAxis axis) { if (axisLineStyle != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java new file mode 100644 index 0000000000..71b2b2948c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java @@ -0,0 +1,102 @@ +package com.fr.van.chart.designer.style.axis.component; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.VanChartAxisCategoryStyle; +import com.fr.stable.Constants; +import com.fr.van.chart.designer.style.axis.VanChartAxisStyleSettingPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.LinkedHashMap; +import java.util.Map; + +public class VanChartCategoryStylePaneWithCheckBox extends JPanel { + private UICheckBox checkBox; // 复选框 + private UIButton settingButton; // 设置按钮 + private VanChartAxisStyleSettingPane settingPane; // 设置弹窗面板 + + private JPanel showOnPane; + private AbstractAttrNoScrollPane parent; + + private String axisId; + private VanChartAxisCategoryStyle axis; + + public VanChartCategoryStylePaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane, String checkBoxName) { + this.parent = parent; + this.showOnPane = showOnPane; + + this.setLayout(new BorderLayout()); + checkBox = new UICheckBox(checkBoxName); + checkBox.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + checkBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + /* 为什么需要这句话呢?因为这个checkBox是动态加上去的,没有走最上层父组件ChartStylePane的initAllListener方法, + * 所以不会触发update监听,下面的bubble弹窗则是不属于ChartStylePane的单独悬浮组件,也只能这样触发update监听 + */ + if(parent != null){ + parent.attributeChanged(); + } + } + }); + settingButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Setting")); + + this.add(checkBox, BorderLayout.CENTER); + this.add(settingButton, BorderLayout.EAST); + + initListener(); + } + + private void initListener() { + if(settingButton != null) { + settingButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + if (settingPane == null) { + settingPane = new VanChartAxisStyleSettingPane(); + } + + Point comPoint = settingButton.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); + Dimension size = settingPane.getPreferredSize(); + UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { + + @Override + public void updateContentPane() { + axis = settingPane.updateBean(); + if(parent != null){//条件属性没有parent + parent.attributeChanged(); + } + } + }; + pane.show(showOnPane, axis); + super.mouseReleased(e); + } + }); + } + } + + public void populate(VanChartAxisCategoryStyle style, String uuid) { + this.axis = style; + this.axisId = uuid; + checkBox.setSelected(axis.isAvailable()); + } + + public Map update() { + axis.setAvailable(checkBox.isSelected()); + Map map = new LinkedHashMap<>(); + map.put(axisId, axis); + return map; + } +} From 9752d1b92be43f54768cb5c2a731679b36d72ebb Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 19 Jan 2022 10:07:03 +0800 Subject: [PATCH 033/113] =?UTF-8?q?REPORT-65975=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E6=8E=A7=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E8=A1=A8=E5=90=8D=E5=90=8E=E4=BC=9A?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=BD=93=E5=89=8D=E9=80=89=E6=8B=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icombobox/TableSearchTreeComboBox.java | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 6b41986939..7198eeef09 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -16,12 +16,13 @@ import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import javax.swing.JTree; import javax.swing.SwingWorker; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.event.MouseEvent; import java.util.Enumeration; /** @@ -40,7 +41,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); this.parent = parent; - setUI(new TableSearchTreeComboBoxUI()); + initPopupListener(); } protected UIComboBoxEditor createEditor() { @@ -158,12 +159,6 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { - public boolean accept(TableProcedure procedure) { - return true; - } - }; - /** * 表名模糊搜索实现 */ @@ -184,15 +179,31 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - /** - * 重写FRTreeComboBoxUI,实现点击下拉时触发模糊搜索 - */ - private class TableSearchTreeComboBoxUI extends FRTreeComboBoxUI { - - @Override - public void mouseClicked(MouseEvent e) { - searchExecute(); + private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { + public boolean accept(TableProcedure procedure) { + return true; } + }; + + private void initPopupListener() { + // 点击下拉时触发模糊搜索 + this.addPopupMenuListener(new PopupMenuListener() { + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + searchExecute(); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); } /** From 4452ccf7ed421a09ab7b7386fcc56a00ffa212e9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 12 Jan 2022 15:42:32 +0800 Subject: [PATCH 034/113] =?UTF-8?q?REPORT-62688=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E9=9D=A2=E5=90=91=E9=A3=8E=E6=A0=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 优化JxBrowser接口 1. 减少监听器注册接口的数目 2. 增减全局下载任务的监听接口,以实现列表项/详情页/历史版本等不同页面下载任务状态的同步 3. JS可在Java对象上添加自定义属性,从而在JS环境中跟踪指定下载任务的状态. 4. mini商城中主题下载后弹出的一系列交互窗口的父窗口应当 是mini商城窗口 【改动思路】 同上 --- .../dialog/TemplateThemeGridPagesDialog.java | 9 +- .../dialog/TemplateThemeUsingDialog.java | 7 + .../installation/ComponentInstallation.java | 3 +- .../ComponentsPackageInstallation.java | 3 +- .../TemplateThemeInstallation.java | 22 +- .../online/mini/MiniComponentShopDialog.java | 2 + .../mini/bridge/NativeProductBridge.java | 205 ++++++++++++++++-- .../online/mini/bridge/NativeTaskBridge.java | 54 ++--- .../mini/bridge/SafeJSFunctionInvoker.java | 29 +++ 9 files changed, 266 insertions(+), 68 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java index da0649d804..bf65b9be28 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; import com.fr.design.mainframe.theme.TemplateThemeGridPane; import javax.swing.JPanel; +import java.awt.Window; /** * @author Starryi @@ -19,13 +20,17 @@ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements protected TemplateThemeGridPagesPane overallPane; - public TemplateThemeGridPagesDialog() { - super(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); + public TemplateThemeGridPagesDialog(Window parentWindow) { + super(parentWindow, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); setupContentPane(); setupActionButtons(); } + public TemplateThemeGridPagesDialog() { + this(DesignerContext.getDesignerFrame()); + } + @Override protected JPanel createContentPane() { overallPane = new TemplateThemeGridPagesPane(this); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java index 420a7ed439..9818e60b5c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java @@ -1,11 +1,18 @@ package com.fr.design.mainframe.theme.dialog; +import java.awt.Window; + /** * @author Starryi * @version 1.0 * Created by Starryi on 2021/8/13 */ public class TemplateThemeUsingDialog extends TemplateThemeGridPagesDialog { + public TemplateThemeUsingDialog(Window parentWindow) { + super(parentWindow); + overallPane.showThemeUsingPane(); + } + public TemplateThemeUsingDialog() { super(); overallPane.showThemeUsingPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java index e6403e902d..172bb7d9f3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentInstallation.java @@ -19,6 +19,7 @@ import com.fr.stable.StringUtils; import javax.swing.SwingWorker; import java.io.File; import java.io.IOException; +import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; /** @@ -75,7 +76,7 @@ public class ComponentInstallation extends AsyncInstallation { } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); Thread.currentThread().interrupt(); - } catch (ExecutionException e) { + } catch (ExecutionException | CancellationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java index 56200a0c28..39107a5a11 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/ComponentsPackageInstallation.java @@ -15,6 +15,7 @@ import javax.swing.SwingWorker; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; /** @@ -164,7 +165,7 @@ public class ComponentsPackageInstallation extends AsyncInstallation { } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); Thread.currentThread().interrupt(); - } catch (ExecutionException e) { + } catch (ExecutionException | CancellationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java index f61af23d62..4de568db7f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/installation/TemplateThemeInstallation.java @@ -25,6 +25,8 @@ import javax.swing.SwingWorker; import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.util.HashMap; +import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; /** @@ -33,13 +35,19 @@ import java.util.concurrent.ExecutionException; * Created by Starryi on 2022/1/5 */ public class TemplateThemeInstallation extends AsyncInstallation { + private final Window parentWindow; private final String themePath; private SwingWorker worker; - public TemplateThemeInstallation(String themePath) { + public TemplateThemeInstallation(Window parentWindow, String themePath) { + this.parentWindow = parentWindow; this.themePath = themePath; } + public TemplateThemeInstallation(String themePath) { + this(DesignerContext.getDesignerFrame(), themePath); + } + @Override public void install() { fetchTheme(); @@ -66,7 +74,7 @@ public class TemplateThemeInstallation extends AsyncInstallation { } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); Thread.currentThread().interrupt(); - } catch (ExecutionException e) { + } catch (ExecutionException | CancellationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -78,7 +86,7 @@ public class TemplateThemeInstallation extends AsyncInstallation { private boolean checkAuthority() { if (!WorkContext.getCurrent().isRoot()) { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(parentWindow, Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Message"), Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Title"), JOptionPane.WARNING_MESSAGE); @@ -87,7 +95,7 @@ public class TemplateThemeInstallation extends AsyncInstallation { String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); if (StringUtils.isEmpty(userName)) { - DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL); + DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL, new HashMap<>(), parentWindow); return false; } @@ -108,7 +116,7 @@ public class TemplateThemeInstallation extends AsyncInstallation { return theme; } else { String newName = (String) FineJOptionPane.showInputDialog( - DesignerContext.getDesignerFrame(), + parentWindow, Toolkit.i18nText("Fine-Design_Share_Rename_Suitable_Theme_Tip"), Toolkit.i18nText("Fine-Design_Basic_Rename"), FineJOptionPane.QUESTION_MESSAGE, null, null, @@ -147,12 +155,12 @@ public class TemplateThemeInstallation extends AsyncInstallation { JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (currentTemplate.getUsingTemplateThemeConfig() instanceof FormThemeConfig) { - TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(); + TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(parentWindow); dialog.addWindowListener(new UsingDialogAdapter(theme, currentTemplate)); dialog.setVisible(true); } else { FineJOptionPane.showConfirmDialog( - MiniComponentShopDialog.getInstance().getContentPane(), + MiniComponentShopDialog.getInstance().getWindow(), Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_Success_Tip"), "", FineJOptionPane.YES_NO_OPTION diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index 29fbafbaf3..939a7112e1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.ui.online.mini; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import javax.swing.JFrame; @@ -93,6 +94,7 @@ public class MiniComponentShopDialog { } } }); + GUICoreUtils.centerWindow(frame); return frame; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java index 52379b7f88..a579681747 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java @@ -17,15 +17,18 @@ import com.fr.form.share.Group; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.group.DefaultShareGroupManager; -import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.stable.StringUtils; import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; +import java.awt.Window; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; /** @@ -35,6 +38,13 @@ import java.util.Set; */ public class NativeProductBridge { private final JSObject window; + private static final Map executingComponentInstallationTasks = new HashMap<>(); + private static final Map executingComponentsPackageInstallationTasks = new HashMap<>(); + private static final Map executingTemplateThemeInstallationTasks = new HashMap<>(); + + private final Map> componentDownloadTaskStartListeners = new HashMap<>(); + private final Map> componentsPackageDownloadTaskStartListeners = new HashMap<>(); + private final Map> themeDownloadTaskStartListeners = new HashMap<>(); public NativeProductBridge(JSObject window) { this.window = window; @@ -42,30 +52,116 @@ public class NativeProductBridge { @JSAccessible @JSBridge - public String getDownloadedProductIds() { - Set uuidList = new HashSet<>(); + public boolean isProductDownloaded(String uuid) { for (Group group : DefaultShareGroupManager.getInstance().getAllGroup()) { SharableWidgetProvider[] widgetProviderList = group.getAllBindInfoList(); for (SharableWidgetProvider widget: widgetProviderList) { - if (StringUtils.isNotEmpty(widget.getId())) { - uuidList.add(widget.getId()); + if (StringUtils.equals(uuid, widget.getId())) { + return true; } } } - JSONArray array = JSONArray.create(uuidList); - return array.toString(); + return false; + } + + @JSAccessible + @JSBridge + public void addProductDownloadTaskStartListener(String json, JSFunction function) { + JSONObject object = new JSONObject(json); + OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); + String uuid = widget.getUuid(); + boolean isPackage = widget.isWidgetPackage(); + + Map> downloadTaskGetters = + isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; + Set startListeners = downloadTaskGetters.get(widget.getUuid()); + if (startListeners == null) { + startListeners = new HashSet<>(); + } + startListeners.add(function); + downloadTaskGetters.put(widget.getUuid(), startListeners); + + + } + + @JSAccessible + @JSBridge + public void removeProductDownloadTaskStartListener(String json, JSFunction function) { + JSONObject object = new JSONObject(json); + OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); + String uuid = widget.getUuid(); + boolean isPackage = widget.isWidgetPackage(); + + Map> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; + + Set startListeners = downloadTaskGetters.get(uuid); + if (startListeners == null) { + startListeners = new HashSet<>(); + } + startListeners.remove(function); + downloadTaskGetters.put(uuid, startListeners); + } + + @JSAccessible + @JSBridge + public Object getExecutingProductDownloadTask(String json) { + JSONObject object = new JSONObject(json); + OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); + String uuid = widget.getUuid(); + boolean isPackage = widget.isWidgetPackage(); + + Map executingDownloadTask = + isPackage ? executingComponentsPackageInstallationTasks : executingComponentInstallationTasks; + NativeTaskBridge task = executingDownloadTask.get(uuid); + if (task != null) { + task.checkJSEnvChange(this.window); + } + return task; } @JSAccessible @JSBridge public Object createProductDownloadTask(String json) { - return new ComponentInstallationTask(window, json); + JSONObject object = new JSONObject(json); + OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); + int childrenCount = object.optInt("pkgsize", 0); + if (childrenCount > 0) { + return new ComponentsPackageInstallationTask(window, widget, childrenCount); + } else { + return new ComponentInstallationTask(window, widget); + } + } + + @JSAccessible + @JSBridge + public void addThemeDownloadTaskStartListener(String themePath, JSFunction function) { + Set startListeners = themeDownloadTaskStartListeners.get(themePath); + if (startListeners == null) { + startListeners = new HashSet<>(); + } + startListeners.add(function); + themeDownloadTaskStartListeners.put(themePath, startListeners); } @JSAccessible @JSBridge - public Object createProductsPackageDownloadTask(String json) { - return new ComponentsPackageInstallationTask(window, json); + public void removeThemeDownloadTaskStartListener(String themePath, JSFunction function) { + Set startListeners = themeDownloadTaskStartListeners.get(themePath); + if (startListeners == null) { + startListeners = new HashSet<>(); + } + startListeners.remove(function); + themeDownloadTaskStartListeners.put(themePath, startListeners); + } + + @JSAccessible + @JSBridge + public Object getExecutingThemeDownloadTask(String themePath) { + NativeTaskBridge task = executingTemplateThemeInstallationTasks.get(themePath); + if (task != null) { + task.checkJSEnvChange(this.window); + } + return task; } @JSAccessible @@ -74,15 +170,13 @@ public class NativeProductBridge { return new TemplateThemeInstallationTask(window, themePath); } - public static class ComponentInstallationTask extends NativeTaskBridge { + public class ComponentInstallationTask extends NativeTaskBridge { private final OnlineShareWidget widget; private final ComponentInstallation action; - public ComponentInstallationTask(JSObject window, String widgetJson) { + public ComponentInstallationTask(JSObject window, OnlineShareWidget widget) { super(window); - - JSONObject object = new JSONObject(widgetJson); - widget = OnlineShareWidget.parseFromJSONObject(object); + this.widget = widget; action = new ComponentInstallation(widget); action.setActionListener(new AsyncInstallation.AsyncActionListener() { @Override @@ -93,8 +187,8 @@ public class NativeProductBridge { @Override public void onSuccess() { fireSuccessEvent(null); + LocalWidgetRepoPane.getInstance().refreshPane(); if (!DesignerContext.getDesignerFrame().isActive()) { - LocalWidgetRepoPane.getInstance().refreshPane(); FormWidgetDetailPane.getInstance().switch2Local(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); } @@ -147,19 +241,38 @@ public class NativeProductBridge { } }); } + + @Override + protected void fireStartEvent(String event) { + executingComponentInstallationTasks.put(widget.getUuid(), this); + Set startListeners = componentDownloadTaskStartListeners.get(widget.getUuid()); + SafeJSFunctionInvoker.invoke(startListeners, window); + super.fireStartEvent(event); + } + + @Override + protected void fireFailureEvent(String event) { + executingComponentInstallationTasks.remove(widget.getUuid()); + super.fireFailureEvent(event); + } + + @Override + protected void fireSuccessEvent(String event) { + executingComponentInstallationTasks.remove(widget.getUuid()); + super.fireSuccessEvent(event); + } } - public static class ComponentsPackageInstallationTask extends NativeTaskBridge { + public class ComponentsPackageInstallationTask extends NativeTaskBridge { private final ComponentsPackageInstallation action; private final OnlineShareWidget widget; private final int childrenCount; - public ComponentsPackageInstallationTask(JSObject window, String widgetJson) { + public ComponentsPackageInstallationTask(JSObject window, OnlineShareWidget widget, int childrenCount) { super(window); - JSONObject object = new JSONObject(widgetJson); - widget = OnlineShareWidget.parseFromJSONObject(object); - childrenCount = object.optInt("pkgsize", 0); + this.widget = widget; + this.childrenCount = childrenCount; action = new ComponentsPackageInstallation(widget, childrenCount); action.setActionListener(new AsyncInstallation.AsyncActionListener() { @Override @@ -170,8 +283,8 @@ public class NativeProductBridge { @Override public void onSuccess() { fireSuccessEvent(null); + LocalWidgetRepoPane.getInstance().refreshPane(); if (!DesignerContext.getDesignerFrame().isActive()) { - LocalWidgetRepoPane.getInstance().refreshPane(); FormWidgetDetailPane.getInstance().switch2Local(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); } @@ -232,13 +345,37 @@ public class NativeProductBridge { } }); } + + @Override + protected void fireStartEvent(String event) { + executingComponentsPackageInstallationTasks.put(widget.getUuid(), this); + super.fireStartEvent(event); + + Set startListeners = componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); + SafeJSFunctionInvoker.invoke(startListeners, window); + } + + @Override + protected void fireFailureEvent(String event) { + executingComponentsPackageInstallationTasks.remove(widget.getUuid()); + super.fireFailureEvent(event); + } + + @Override + protected void fireSuccessEvent(String event) { + executingComponentsPackageInstallationTasks.remove(widget.getUuid()); + super.fireSuccessEvent(event); + } } - public static class TemplateThemeInstallationTask extends NativeTaskBridge { + public class TemplateThemeInstallationTask extends NativeTaskBridge { + private final String themePath; private final TemplateThemeInstallation action; public TemplateThemeInstallationTask(JSObject window, String themePath) { super(window); - action = new TemplateThemeInstallation(themePath); + this.themePath = themePath; + Window miniShopWindow = MiniComponentShopDialog.getInstance().getWindow(); + action = new TemplateThemeInstallation(miniShopWindow, themePath); action.setActionListener(new AsyncInstallation.AsyncActionListener() { @Override public void onProgress(double value) { @@ -283,5 +420,25 @@ public class NativeProductBridge { } }); } + + @Override + protected void fireStartEvent(String event) { + executingTemplateThemeInstallationTasks.put(themePath, this); + Set startListeners = themeDownloadTaskStartListeners.get(themePath); + SafeJSFunctionInvoker.invoke(startListeners, window); + super.fireStartEvent(event); + } + + @Override + protected void fireFailureEvent(String event) { + executingTemplateThemeInstallationTasks.remove(themePath); + super.fireFailureEvent(event); + } + + @Override + protected void fireSuccessEvent(String event) { + executingTemplateThemeInstallationTasks.remove(themePath); + super.fireSuccessEvent(event); + } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java index c29fbc786a..eb343c623c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java @@ -7,6 +7,11 @@ import com.teamdev.jxbrowser.chromium.JSAccessible; import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + /** * @author Starryi * @version 1.0 @@ -14,39 +19,30 @@ import com.teamdev.jxbrowser.chromium.JSObject; */ public class NativeTaskBridge implements MiniShopNativeTask { - private final JSObject window; - - protected JSFunction startCb; - protected JSFunction progressCb; - protected JSFunction successCb; - protected JSFunction failureCb; + private JSObject window; + protected final Set statusCbs = new HashSet<>(); public NativeTaskBridge(JSObject window) { this.window = window; } - @JSBridge - @JSAccessible - public void setStartCallback(JSFunction cb) { - this.startCb = cb; - } - - @JSBridge - @JSAccessible - public void setProgressCallback(JSFunction cb) { - this.progressCb = cb; + public void checkJSEnvChange(JSObject window) { + if (this.window != window) { + this.window = window; + this.statusCbs.clear(); + } } @JSBridge @JSAccessible - public void setSuccessCallback(JSFunction cb) { - this.successCb = cb; + public void addStatusCallback(JSFunction cb) { + this.statusCbs.add(cb); } @JSBridge @JSAccessible - public void setFailureCallback(JSFunction cb) { - this.failureCb = cb; + public void removeStatusCallback(JSFunction cb) { + this.statusCbs.remove(cb); } @JSBridge @@ -60,30 +56,22 @@ public class NativeTaskBridge implements MiniShopNativeTask { @Override public void cancel() { MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); + fireFailureEvent(null); } - protected void fireStartEvent(String event) { MiniShopNativeTaskManager.getInstance().addStartedTask(this); - if (this.startCb != null) { - this.startCb.invoke(window, event); - } + SafeJSFunctionInvoker.invoke(statusCbs, window, "START", event); } protected void fireProgressEvent(String event) { - if (this.progressCb != null) { - this.progressCb.invoke(window, event); - } + SafeJSFunctionInvoker.invoke(statusCbs, window, "PROGRESS", event); } protected void fireSuccessEvent(String event) { MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); - if (this.successCb != null) { - this.successCb.invoke(window, event); - } + SafeJSFunctionInvoker.invoke(statusCbs, window, "SUCCESS", event); } protected void fireFailureEvent(String event) { MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); - if (this.failureCb != null) { - this.failureCb.invoke(window, event); - } + SafeJSFunctionInvoker.invoke(statusCbs, window, "FAILURE", event); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java new file mode 100644 index 0000000000..238376f9ed --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java @@ -0,0 +1,29 @@ +package com.fr.design.mainframe.share.ui.online.mini.bridge; + +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; + +import java.util.Collection; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/17 + */ +public class SafeJSFunctionInvoker { + + public static void invoke(Collection functions, JSObject instance, Object... args) { + if (functions != null) { + for (JSFunction function: functions) { + if (function != null && !function.getContext().isDisposed()) { + function.invoke(instance, args); + } + } + } + } + public static void invoke(JSFunction function, JSObject instance, Object... args) { + if (function != null && !function.getContext().isDisposed()) { + function.invoke(instance, args); + } + } +} From b38f99515f5e80fbbcba36d17b620309647c8632 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Jan 2022 11:46:00 +0800 Subject: [PATCH 035/113] =?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 83d78aaa9136f8101c3cb92f268070e4e36197f9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 19 Jan 2022 15:37:23 +0800 Subject: [PATCH 036/113] =?UTF-8?q?REPORT-65989=20frm=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=86=8510.0=E6=A8=A1=E6=9D=BF=E5=9C=A811.0=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E6=89=93=E5=BC=80=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=BC=A0=E6=A0=87=E6=BB=9A=E8=BD=AE=E6=BB=91?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 表格中处理触摸板滚动和缩放虽然用的都是MouseWheelListener接口,但是是分开注册。 其中处理纵向滚动的是逻辑是在GridMouseAdapter中实现,而处理缩放的逻辑则是在 FormReportComponentComposite.java(表单报表块)和 ReportComponentComposite.java(报表) 中实现。 所以删除GridMouseAdapter中处理鼠标纵向滚动的的代码后,表单报表块就无法处理鼠标纵向滚动了。 目前排查了下,发现还有FormReportComponentComposite(表单报表块)以及PreviewPane(组件快捷配置) 还未实现触摸板双向滚动,所以一起处理下,将原来添加缩放的逻辑替换为双向滚动 + 缩放. 【改动思路】 同上 --- .../form/FormReportComponentComposite.java | 19 ++--- ...rtComponentCompositeMouseWheelHandler.java | 79 +++++++++++++++++++ .../design/share/ui/effect/PreviewPane.java | 25 +----- .../effect/PreviewPaneMouseWheelHandler.java | 69 ++++++++++++++++ 4 files changed, 156 insertions(+), 36 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java create mode 100644 designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java index 67235ee7b2..05c3b13ec0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -12,6 +12,8 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JFormSliderPane; +import com.fr.design.mainframe.ReportComponent; +import com.fr.design.mainframe.ReportComponentCompositeMouseWheelHandler; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; @@ -53,23 +55,11 @@ public class FormReportComponentComposite extends JComponent implements TargetMo sheetNameTab = new FormTabPane(ecContainer, jform); this.add(createSouthControlPane(), BorderLayout.SOUTH); jSliderContainer.addValueChangeListener(showValSpinnerChangeListener); - this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); + this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(new FormReportComponentCompositeMouseWheelHandler(this)); elementCaseDesigner.addTargetModifiedListener(this); this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION); } - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - if (InputEventBaseOnOS.isControlDown(e)) { - int dir = e.getWheelRotation(); - int old_resolution = jSliderContainer.getShowValue(); - jSliderContainer.setShowValue(old_resolution - (dir * DIR)); - } - } - }; - - ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -195,5 +185,8 @@ public class FormReportComponentComposite extends JComponent implements TargetMo jForm.fireTargetModified(); } + public JFormSliderPane getSliderContainer() { + return this.jSliderContainer; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java new file mode 100644 index 0000000000..7e8da60dc5 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java @@ -0,0 +1,79 @@ +package com.fr.design.mainframe.form; + +import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.design.mainframe.DesignerScaleMouseWheelHandler; +import com.fr.design.mainframe.DesignerTranslateMouseWheelHandler; +import com.fr.design.mainframe.JFormSliderPane; +import com.fr.design.mainframe.ReportComponentComposite; + +import javax.swing.JScrollBar; +import javax.swing.JViewport; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/9/24 + */ +public class FormReportComponentCompositeMouseWheelHandler implements MouseWheelListener { + private final DesignerTranslateMouseWheelHandler translateMouseWheelHandler; + private final DesignerScaleMouseWheelHandler scaleMouseWheelHandler; + + public FormReportComponentCompositeMouseWheelHandler(FormReportComponentComposite componentComposite) { + translateMouseWheelHandler = new DesignerTranslateMouseWheelHandler(new ScrollPaneAdapter(componentComposite)); + scaleMouseWheelHandler = new DesignerScaleMouseWheelHandler(new ScalePaneAdapter(componentComposite), ReportComponentComposite.DIR); + } + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + if (InputEventBaseOnOS.isControlDown(e)) { + scaleMouseWheelHandler.mouseWheelMoved(e); + } else { + translateMouseWheelHandler.mouseWheelMoved(e); + } + } + + private static class ScrollPaneAdapter implements DesignerTranslateMouseWheelHandler.ScrollPane { + private final FormReportComponentComposite componentComposite; + private JViewport viewport; + + public ScrollPaneAdapter(FormReportComponentComposite componentComposite) { + this.componentComposite = componentComposite; + this.viewport = new JViewport(); + } + + @Override + public boolean isWheelScrollingEnabled() { + return true; + } + + @Override + public JScrollBar getVerticalScrollBar() { + return componentComposite.elementCaseDesigner.getVerticalScrollBar(); + } + + @Override + public JScrollBar getHorizontalScrollBar() { + return componentComposite.elementCaseDesigner.getHorizontalScrollBar(); + } + + @Override + public JViewport getViewport() { + return viewport; + } + } + + private static class ScalePaneAdapter implements DesignerScaleMouseWheelHandler.ScalePane { + private final FormReportComponentComposite componentComposite; + + public ScalePaneAdapter(FormReportComponentComposite componentComposite) { + this.componentComposite = componentComposite; + } + + @Override + public JFormSliderPane getSlidePane() { + return componentComposite.getSliderContainer(); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java index 68cd025e30..a9a7a85124 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java @@ -70,7 +70,6 @@ public class PreviewPane extends JPanel implements CallbackEvent{ private static final int MAX = 400; private static final int HUND = 100; private static final int MIN = 10; - private static final int DIR = 10; private static final double MIN_TIME = 0.4; private Widget widget; @@ -194,27 +193,7 @@ public class PreviewPane extends JPanel implements CallbackEvent{ grid.removeMouseMotionListener(grid.getGridMouseAdapter()); grid.removeMouseListener(grid.getGridMouseAdapter()); - grid.addMouseWheelListener(new MouseWheelListener() { - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - if (!InputEventBaseOnOS.isControlDown(e)) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane.isVerticalScrollBarVisible()) { - JScrollBar scrollBar = reportPane.getVerticalScrollBar(); - int maxValue = scrollBar.getModel().getMaximum(); - int newValue = reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation(); - int extendValue = GridUtils.getExtentValue(newValue, elementCase.getRowHeightList_DEC(), grid.getHeight(), getResolution()); - if (extendValue <= maxValue) { - reportPane.getVerticalScrollBar().setValue(newValue); - } - } - } else { - int dir = e.getWheelRotation(); - addScale( - dir * DIR); - grid.setCursor(SCALE_CURSOR); - } - } - }); + grid.addMouseWheelListener(new PreviewPaneMouseWheelHandler(this)); grid.addMouseMotionListener(new MouseMotionAdapter() { @Override @@ -320,7 +299,7 @@ public class PreviewPane extends JPanel implements CallbackEvent{ elementCasePane.repaint(); } - private void addScale(int step) { + public void addScale(int step) { scaleValue += step; scaleValue = fixedScale(scaleValue); plusButton.setEnabled(scaleValue < MAX); diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java b/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java new file mode 100644 index 0000000000..56e73955d1 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java @@ -0,0 +1,69 @@ +package com.fr.design.share.ui.effect; + +import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.design.mainframe.DesignerTranslateMouseWheelHandler; + +import javax.swing.JScrollBar; +import javax.swing.JViewport; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; + +import static com.fr.design.share.ui.effect.PreviewPane.SCALE_CURSOR; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/9/24 + */ +public class PreviewPaneMouseWheelHandler implements MouseWheelListener { + private static final int DIR = 10; + + private final DesignerTranslateMouseWheelHandler translateMouseWheelHandler; + private final PreviewPane previewPane; + + public PreviewPaneMouseWheelHandler(PreviewPane previewPane) { + this.translateMouseWheelHandler = new DesignerTranslateMouseWheelHandler(new PreviewPaneScrollPaneAdapter(previewPane)); + this.previewPane = previewPane; + } + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + if (InputEventBaseOnOS.isControlDown(e)) { + int dir = e.getWheelRotation(); + previewPane.addScale( - dir * DIR); + previewPane.getElementCasePane().getGrid().setCursor(SCALE_CURSOR); + } else { + translateMouseWheelHandler.mouseWheelMoved(e); + } + } + + private static class PreviewPaneScrollPaneAdapter implements DesignerTranslateMouseWheelHandler.ScrollPane { + private final PreviewPane previewPane; + private final JViewport viewport; + + public PreviewPaneScrollPaneAdapter(PreviewPane previewPane) { + this.previewPane = previewPane; + this.viewport = new JViewport(); + } + + @Override + public boolean isWheelScrollingEnabled() { + return true; + } + + @Override + public JScrollBar getVerticalScrollBar() { + return previewPane.getElementCasePane().getVerticalScrollBar(); + } + + @Override + public JScrollBar getHorizontalScrollBar() { + return previewPane.getElementCasePane().getHorizontalScrollBar(); + } + + @Override + public JViewport getViewport() { + return this.viewport; + } + } +} From f2810dff76fc321ce69f1fa6c5be283399b95e24 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Jan 2022 18:05:57 +0800 Subject: [PATCH 037/113] =?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 038/113] =?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 8c5a2ec35a0ba6da388b607aca27d64249cb90d4 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 11:52:24 +0800 Subject: [PATCH 039/113] =?UTF-8?q?CHART-22531=20=E5=A4=9A=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E8=BD=B4=E5=88=86=E5=B1=82=E8=AE=BE=E7=BD=AE=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F=E2=80=94=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/VanChartAxisPaneHelper.java | 30 ++ .../axis/VanChartAxisStyleSettingPane.java | 74 ++-- .../style/axis/VanChartBaseAxisPane.java | 343 ++++-------------- .../style/axis/VanChartTimeAxisPane.java | 5 - .../style/axis/VanChartValueAxisPane.java | 5 - ...VanChartCategoryStylePaneWithCheckBox.java | 19 +- .../gauge/VanChartGaugeDetailAxisPane.java | 13 +- 7 files changed, 153 insertions(+), 336 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java new file mode 100644 index 0000000000..770043af9c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java @@ -0,0 +1,30 @@ +package com.fr.van.chart.designer.style.axis; + +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; +import com.fr.design.mainframe.chart.mode.ChartEditContext; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; + +public class VanChartAxisPaneHelper { + public static ChartTextAttrPane createAxisTextAttrPane() { + return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() { + protected double getEdithAreaWidth() { + return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + } + } : new ChartTextAttrPane() { + @Override + protected JPanel getContentPane(JPanel buttonPane) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize); + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java index 94a9e4a0cd..5deb498319 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java @@ -10,11 +10,9 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; -import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; -import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; -import com.fr.plugin.chart.VanChartAxisCategoryStyle; +import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox; @@ -25,10 +23,11 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class VanChartAxisStyleSettingPane extends BasicBeanPane { +public class VanChartAxisStyleSettingPane extends BasicBeanPane { private static final double ROTATION_MAX = 90.0; private AxisLabelDisplayComboBox labelDisplayComboBox; + private JPanel labelDisplayPane; private ChartTextAttrPane labelTextAttrPane; private UINumberDragPane labelTextRotation; private UIButtonGroup labelGapStyle; @@ -37,7 +36,10 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); labelGapValue = new UITextField(); labelGapPane = createLabelGapPane(row, column); @@ -61,6 +66,10 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane { protected UIButtonGroup showLabel; protected UIButtonGroup showLogic; - protected ChartTextAttrPane labelTextAttrPane; - protected UINumberDragPane labelTextRotation; - - private AxisLabelDisplayComboBox labelDisplayComboBox; - - //轴标签缩略间隔显示 恢复用注释。下面6行删除。 - protected UITextField labelGapValue; private UIButtonGroup overlapHandleTypeGroup; - protected UIButtonGroup labelGapStyle; //轴标签缩略间隔显示 恢复用注释。取消注释。 //protected UISpinner labelGapValue; - protected JPanel labelPanel; - private JPanel labelStylePane; + protected JPanel labelContentPane; + private VanChartAxisStyleSettingPane labelPane; private JPanel showLogicPane; - private JPanel labelGapPane; - private JPanel labelGapStylePane; - private JPanel labelGapValuePane; - private JPanel labelDisplayPane; + private JPanel labelStylePane; private JPanel categoryStylePane; + private VanChartAxisStyleSettingPane wholeDisplayLabelPanel; private List categoryStyles = new ArrayList<>(); protected LineComboBox axisLineStyle; @@ -234,17 +219,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel createLabelPane(double[] row, double[] col) { initLabelComponents(); - labelGapPane = createLabelGapPane(row, col); - labelPanel = createLabelDetailPanel(); + labelPane = new VanChartAxisStyleSettingPane(showLabelDisplay(), getChartTextAttrPane()); + wholeDisplayLabelPanel = new VanChartAxisStyleSettingPane(showLabelDisplay(), getChartTextAttrPane()); + wholeDisplayLabelPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); addComponentsListener(); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel); - JPanel showLogicPane = createShowLogicPane(); + JPanel labelContentPane = createLabelContentPane(); JPanel labelPane = new JPanel(new BorderLayout()); labelPane.add(showLabelPane, BorderLayout.NORTH); - labelPane.add(showLogicPane, BorderLayout.CENTER); + labelPane.add(labelContentPane, BorderLayout.CENTER); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, labelPane); } @@ -253,15 +239,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLogic = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Whole_Display"), Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Layer_Display")}); initButtonGroupListener(); - - labelDisplayComboBox = new AxisLabelDisplayComboBox(); - labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - labelDisplayPane.setVisible(showLabelDisplay()); - - labelTextAttrPane = getChartTextAttrPane(); - labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); - labelGapStyle = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - labelGapValue = new UITextField(); } private void initButtonGroupListener() { @@ -288,14 +265,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { * * @return */ - private JPanel createShowLogicPane() { + private JPanel createLabelContentPane() { + labelContentPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout()); labelStylePane = new JPanel(new CardLayout()); - labelStylePane.add(labelPanel, WHOLE_DISPLAY); + labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); showLogicPane.add(labelStylePane, BorderLayout.CENTER); - return showLogicPane; + showLogicPane.setVisible(false); + labelContentPane.add(labelPane, BorderLayout.NORTH); + labelContentPane.add(showLogicPane, BorderLayout.CENTER); + return labelContentPane; } /** @@ -309,37 +290,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { return categoryStylePane; } - private JPanel createLabelGapPane(double[] row, double[] col) { - Component[][] gapComponents = new Component[][]{ - new Component[]{null, null}, - new Component[]{ - FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_TextRotation")), - UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) - }, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle} - }; - - JPanel gapDetailPane = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); - labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText(""), labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - - JPanel panel = new JPanel(new BorderLayout()); - panel.add(gapDetailPane, BorderLayout.CENTER); - panel.add(labelGapValuePane, BorderLayout.SOUTH); - - return panel; - } - - private JPanel createLabelDetailPanel() { - JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); - - panel.add(labelDisplayPane, BorderLayout.NORTH); - panel.add(labelTextAttrPane, BorderLayout.CENTER); - panel.add(labelGapPane, BorderLayout.SOUTH); - - return panel; - } - private void addComponentsListener() { // 显示/隐藏 showLabel.addActionListener(new ActionListener() { @@ -348,123 +298,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { checkLabelPane(); } }); - - // 间隔/缩略/换行 - labelDisplayComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkLabelGapPane(); - } - }); - - // 自动/固定 - labelGapStyle.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkLabelGapValuePane(); - } - }); - } - -// protected JPanel createLabelPane(double[] row, double[] col){ -// double p = TableLayout.PREFERRED; -// showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); -// labelTextAttrPane = getChartTextAttrPane(); -// -// JPanel rotationPane = createLabelRotationPane(col); -// JPanel overlapPane = createLabelOverlapPane(); -// -// -// Component[][] components = new Component[][]{ -// new Component[]{labelTextAttrPane, null}, -// new Component[]{rotationPane, null}, -// new Component[]{overlapPane, null}, -// }; -// -// JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); -// labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); -// labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); -// showLabel.addActionListener(new ActionListener() { -// @Override -// public void actionPerformed(ActionEvent e) { -// checkLabelPane(); -// } -// }); -// JPanel jPanel = new JPanel(new BorderLayout()); -// jPanel.add(showLabelPane, BorderLayout.NORTH); -// jPanel.add(labelPanel, BorderLayout.CENTER); -// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); -// } - - private JPanel createLabelRotationPane(double[] col) { - labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); - - Component[][] gapComponents = new Component[][]{ - new Component[]{ - FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_TextRotation")), - UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) - } - }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col); - } - - private JPanel createLabelOverlapPane() { - - labelGapStyle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - - //轴标签缩略间隔显示 恢复用注释。取消注释。 - //labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1); - labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - - JPanel panel = new JPanel(new BorderLayout(0, 0)); - addOverlapGroupButton(panel); - panel.add(labelGapStylePane, BorderLayout.CENTER); - panel.add(labelGapValuePane, BorderLayout.SOUTH); - - labelGapStyle.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkLabelGapValuePane(); - } - }); - - return panel; - } - - protected void addOverlapGroupButton(JPanel panel) { - overlapHandleTypeGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")}, - new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL}); - JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - - panel.add(north, BorderLayout.NORTH); - - overlapHandleTypeGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkLabelGapAndStylePane(); - } - }); - } protected ChartTextAttrPane getChartTextAttrPane() { - return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() { - protected double getEdithAreaWidth() { - return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; - } - } : new ChartTextAttrPane() { - @Override - protected JPanel getContentPane(JPanel buttonPane) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; - double[] columnSize = {f, e}; - double[] rowSize = {p, p, p}; - - return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize); - } - }; + return VanChartAxisPaneHelper.createAxisTextAttrPane(); } protected JPanel createLineStylePane(double[] row, double[] col) { @@ -605,7 +442,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkAllUse() { checkCardPane(); checkLabelPane(); - checkLabelGapPane(); checkTitlePane(); //区域显示策略 恢复用注释。删除下面一行。 checkMaxProPortionUse(); @@ -638,14 +474,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkLabelPane() { if (showLabel != null) { boolean enabled = showLabel.getSelectedIndex() == 0; - if (showLogicPane != null) { - showLogicPane.setVisible(enabled); - } - if (enabled) { - //轴标签缩略间隔显示 恢复用注释。下面1行删除。 - checkLabelGapValuePane(); - //轴标签缩略间隔显示 恢复用注释。取消注释。 - //checkLabelGapAndStylePane(); + if (labelContentPane != null) { + labelContentPane.setVisible(enabled); } } } @@ -656,39 +486,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } - private void checkLabelGapAndStylePane() { - if (overlapHandleTypeGroup != null && labelGapStylePane != null) { - boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; - - labelGapStylePane.setVisible(visible); - } - checkLabelGapValuePane(); - } - - protected void checkLabelGapPane() { - if (labelGapPane != null) { - boolean visible = true; - - if (showLabelDisplay() && labelDisplayPane != null && labelDisplayComboBox != null) { - visible = labelDisplayComboBox.getSelectedIndex() == 0; - } - - labelGapPane.setVisible(visible); - } - } - - protected void checkLabelGapValuePane() { - if (labelGapValuePane != null && labelGapStyle != null) { - boolean visible = labelGapStyle.getSelectedIndex() == 1; - //轴标签缩略间隔显示 恢复用注释。取消注释。 -// if (overlapHandleTypeGroup != null) { -// visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; -// } - labelGapValuePane.setVisible(visible); - } - } - - /** * 是否是指定类型 * @@ -767,7 +564,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); } + labelPane.populateBean(getAxisLabelStyle(axis)); populateShowLogicPane(axis); + switchLabelPane(axis); + labelContentPane.validate(); + } + + /** + * 切换显示是单分类样式设置面板还是多分类样式设置面板 + */ + private void switchLabelPane(VanChartAxis axis) { + labelPane.setVisible(!axis.isMultiCategory()); + showLogicPane.setVisible(axis.isMultiCategory()); } private void populateShowLogicPane(VanChartAxis axis) { @@ -784,29 +592,16 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { * populate整体显示那个card面板 */ private void populateWholeDisplayPane(VanChartAxis axis) { - TextAttr labelTextAttr = axis.getTextAttr(); - if (labelTextAttrPane != null) { - labelTextAttrPane.populate(labelTextAttr); - } - if (labelTextRotation != null) { - labelTextRotation.populateBean((double) labelTextAttr.getRotation()); - } - //轴标签缩略间隔显示 恢复用注释。取消注释。 -// if (overlapHandleTypeGroup != null) { -// overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); -// } - if (labelDisplayComboBox != null) { - labelDisplayComboBox.populateBean(axis.getLabelDisplay()); - } - if (labelGapStyle != null) { - labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); - } - if (labelGapValue != null) { - //轴标签缩略间隔显示 恢复用注释。下面1行删除。 - labelGapValue.setText(axis.getLabelNumber().getContent()); - //轴标签缩略间隔显示 恢复用注释。取消注释。 - //labelGapValue.setValue(axis.getIntervalNumber()); - } + wholeDisplayLabelPanel.populateBean(getAxisLabelStyle(axis)); + } + + private VanChartAxisLabelStyle getAxisLabelStyle(VanChartAxis axis) { + VanChartAxisLabelStyle style = new VanChartAxisLabelStyle(); + style.setLabelDisplay(axis.getLabelDisplay()); + style.setTextAttr(axis.getTextAttr()); + style.setAutoLabelGap(axis.isAutoLabelGap()); + style.setLabelIntervalNumber(axis.getLabelNumber()); + return style; } /** @@ -871,21 +666,21 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) { VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); - VanChartAxisCategoryStyle style = populateAxisCategoryStyles(axis, uuid, index); + VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, uuid, index); pane.populate(style, uuid); categoryStyles.add(pane); categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); } - private VanChartAxisCategoryStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { - VanChartAxisCategoryStyle style; + private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { + VanChartAxisLabelStyle style; if (axis.getCategoryStyle(uuid) != null) { style = axis.getCategoryStyle(uuid); } else { style = axis.getCategoryStyleByIndex(index); if (style == null) { - style = new VanChartAxisCategoryStyle(); + style = new VanChartAxisLabelStyle(); } axis.addCategoryStyle(uuid, style); } @@ -1041,7 +836,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if (showLabel != null) { axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); } - updateShowLogicPane(axis); + if (!axis.isMultiCategory()) { + axis.setLabelDisplayMode(VanChartAxis.WHOLE_DISPLAY); + updateLabelPaneStyle(axis, labelPane); + } else { + updateShowLogicPane(axis); + } + switchLabelPane(axis); } private void updateShowLogicPane(VanChartAxis axis) { @@ -1057,33 +858,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { * update整体显示那个card面板 */ private void updateWholeDisplayPane(VanChartAxis axis) { - TextAttr labelTextAttr = axis.getTextAttr(); - if (labelTextAttrPane != null) { - labelTextAttrPane.update(labelTextAttr); - } - if (labelTextRotation != null) { - labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); - } - //轴标签缩略间隔显示 恢复用注释。取消注释。 -// if (overlapHandleTypeGroup != null) { -// axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); -// } - if (labelDisplayComboBox != null) { - axis.setLabelDisplay(labelDisplayComboBox.updateBean()); - } - if (labelGapStyle != null) { - axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); - } - if (labelGapValue != null) { - //轴标签缩略间隔显示 恢复用注释。下面5行删除。 - if (axis.isAutoLabelGap()) { - axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); - } else { - axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); - } - //轴标签缩略间隔显示 恢复用注释。取消注释。 - //axis.setIntervalNumber((int) labelGapValue.getValue()); - } + updateLabelPaneStyle(axis, wholeDisplayLabelPanel); + } + + private void updateLabelPaneStyle(VanChartAxis axis, VanChartAxisStyleSettingPane pane) { + VanChartAxisLabelStyle style = pane.updateBean(); + axis.setLabelDisplay(style.getLabelDisplay()); + axis.setTextAttr(style.getTextAttr()); + axis.setAutoLabelGap(style.isAutoLabelGap()); + axis.setLabelIntervalNumber(style.getLabelIntervalNumber()); } /** @@ -1093,8 +876,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { */ private void updateLayerDisplayPane(VanChartAxis axis) { for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { - Map styleMap = categoryStyle.update(); - for (Map.Entry entry : styleMap.entrySet()) { + Map styleMap = categoryStyle.update(); + for (Map.Entry entry : styleMap.entrySet()) { axis.addCategoryStyle(entry.getKey(), entry.getValue()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index 1a0b78982f..500667963b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -85,11 +85,6 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { return false; } - @Override - protected void addOverlapGroupButton(JPanel panel) { - //do nothing - } - private JPanel createValueDefinition(){ timeMinMaxValuePane = new TimeMinMaxValuePane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java index 7633d0c1e4..032642c93a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java @@ -66,11 +66,6 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { return false; } - @Override - protected void addOverlapGroupButton(JPanel panel) { - //do nothing - } - protected JPanel createMinMaxValuePane(double[] row, double[] col){ JPanel panel = createCommenValuePane(row,col); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java index 71b2b2948c..52877216ac 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java @@ -5,8 +5,9 @@ import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; -import com.fr.plugin.chart.VanChartAxisCategoryStyle; +import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; import com.fr.stable.Constants; +import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import com.fr.van.chart.designer.style.axis.VanChartAxisStyleSettingPane; import javax.swing.BorderFactory; @@ -30,7 +31,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { private AbstractAttrNoScrollPane parent; private String axisId; - private VanChartAxisCategoryStyle axis; + private VanChartAxisLabelStyle axis; public VanChartCategoryStylePaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane, String checkBoxName) { this.parent = parent; @@ -64,13 +65,13 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { @Override public void mouseReleased(MouseEvent e) { if (settingPane == null) { - settingPane = new VanChartAxisStyleSettingPane(); + settingPane = new VanChartAxisStyleSettingPane(VanChartAxisPaneHelper.createAxisTextAttrPane()); } Point comPoint = settingButton.getLocationOnScreen(); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Dimension size = settingPane.getPreferredSize(); - UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { + UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { @Override public void updateContentPane() { @@ -87,15 +88,15 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { } } - public void populate(VanChartAxisCategoryStyle style, String uuid) { + public void populate(VanChartAxisLabelStyle style, String uuid) { this.axis = style; this.axisId = uuid; - checkBox.setSelected(axis.isAvailable()); + checkBox.setSelected(axis.isShowLabel()); } - public Map update() { - axis.setAvailable(checkBox.isSelected()); - Map map = new LinkedHashMap<>(); + public Map update() { + axis.setShowLabel(checkBox.isSelected()); + Map map = new LinkedHashMap<>(); map.put(axisId, axis); return map; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index 91de3ed359..aa2c2a3fd3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -1,5 +1,6 @@ package com.fr.van.chart.designer.style.axis.gauge; +import com.fr.chart.base.TextAttr; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -35,6 +36,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { private static final long serialVersionUID = -9213466625457882224L; + private ChartTextAttrPane labelTextAttrPane; private ColorSelectBox mainTickColor; private ColorSelectBox secTickColor; @@ -83,12 +85,12 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { protected JPanel createLabelPane(double[] row, double[] col) { showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); - labelPanel = new JPanel(new BorderLayout()); - labelPanel.add(labelTextAttrPane); - labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); + labelContentPane = new JPanel(new BorderLayout()); + labelContentPane.add(labelTextAttrPane); + labelContentPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); JPanel panel = new JPanel(new BorderLayout(0, 6)); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); - panel.add(labelPanel, BorderLayout.CENTER); + panel.add(labelContentPane, BorderLayout.CENTER); showLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -183,6 +185,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { public void populateBean(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + labelTextAttrPane.populate(axis.getTextAttr()); if (mainTickColor != null) { mainTickColor.setSelectObject(gaugeAxis.getMainTickColor()); } @@ -194,6 +197,8 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { public void updateBean(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + TextAttr textAttr = axis.getTextAttr(); + labelTextAttrPane.update(textAttr); if (mainTickColor != null) { gaugeAxis.setMainTickColor(mainTickColor.getSelectObject()); } 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 040/113] =?UTF-8?q?CHART-22545=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=AF=AD=E8=A8=80=E8=8B=B1=E8=AF=AD-=E7=94=98?= =?UTF-8?q?=E7=89=B9=E5=9B=BE-=E6=A0=87=E7=AD=BE=E6=A0=BC=E5=BC=8F-?= =?UTF-8?q?=E6=8E=A7=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 041/113] =?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 042/113] =?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 043/113] =?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 044/113] =?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 94991b96abbd953c5ce45159ee07ebd731362797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 21 Jan 2022 16:38:06 +0800 Subject: [PATCH 045/113] =?UTF-8?q?REPORT-66011=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=98=BE=E7=A4=BA=E7=9A=84=E6=96=87=E5=AD=97=E9=94=99?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 0ede5114ff..75f6faf6b3 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -42,7 +42,6 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.stable.StringUtils; -import com.fr.third.jodd.util.ArraysUtil; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -861,7 +860,7 @@ public class CellDSColumnEditor extends CellQuickEditor { //显示set和tip setCardPane.setPreferredSize(new Dimension(156, 20)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 40)); + tipCardPane.setPreferredSize(new Dimension(224, 50)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); } else { //未定义 From f9dab88662cc7f43c97cea00fb26f6a4eea4e88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 21 Jan 2022 16:40:17 +0800 Subject: [PATCH 046/113] =?UTF-8?q?REPORT-66011=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=98=BE=E7=A4=BA=E7=9A=84=E6=96=87=E5=AD=97=E9=94=99?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 75f6faf6b3..66d32a351e 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -984,7 +984,7 @@ public class CellDSColumnEditor extends CellQuickEditor { //显示set和tip setCardPane.setPreferredSize(new Dimension(156, 20)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 40)); + tipCardPane.setPreferredSize(new Dimension(224, 50)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); break; case EVEN: From 5731b1b68faefc939f8ff4defa5ba0fdff7a5bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 21 Jan 2022 18:22:44 +0800 Subject: [PATCH 047/113] =?UTF-8?q?REPORT-65920=20=E3=80=9011.0=E3=80=91ma?= =?UTF-8?q?c=E7=94=B5=E8=84=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=EF=BC=8Ctab-=E7=A7=BB=E5=8A=A8=E7=AB=AF-=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=A8=A1=E6=9D=BF=EF=BC=8C=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E5=81=B6=E5=8F=91=E6=80=A7=E7=9A=84=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=B8=8B=E9=9D=A2=E4=B8=80=E4=B8=AA=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/style/AbstractPopBox.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java index 4df9b75144..167cc163e1 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java @@ -134,6 +134,7 @@ public abstract class AbstractPopBox extends JPanel { Window parentWindow = SwingUtilities.windowForComponent(this); if (parentWindow != null) { this.selectPopupWindow = new SelectControlWindow(parentWindow); + this.selectPopupWindow.setAlwaysOnTop(true); } selectPopupWindow.addMouseListener(new MouseAdapter() { From 96c70b73d4dad98a72f55811e20c18d5832571fb Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 24 Jan 2022 11:10:07 +0800 Subject: [PATCH 048/113] =?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.=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=BB=8E=E5=85=A8=E5=B1=80=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteBodyLayoutDefinePane.java | 3 ++- .../ui/designer/layout/FRFitLayoutDefinePane.java | 12 +++++++++--- 2 files changed, 11 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..2632a359f7 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,7 @@ 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..c0083821dd 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,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Mon, 24 Jan 2022 11:17:45 +0800 Subject: [PATCH 049/113] =?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.=E4=BB=8E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E8=AF=BB=E5=8F=96=E6=B0=B4=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java | 1 + .../design/widget/ui/designer/layout/FRFitLayoutDefinePane.java | 1 + 2 files changed, 2 insertions(+) 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 2632a359f7..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 @@ -164,6 +164,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); boundPane.populate(); + //从全局读取水印 watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile())); } 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 c0083821dd..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 @@ -206,6 +206,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Mon, 24 Jan 2022 11:21:23 +0800 Subject: [PATCH 050/113] =?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 051/113] =?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 052/113] =?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 053/113] =?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 054/113] =?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 +} From 58f1eb1748316a76ba4d36bbdb45a8f41252b0d2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 25 Jan 2022 15:17:58 +0800 Subject: [PATCH 055/113] =?UTF-8?q?REPORT-62688=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E9=9D=A2=E5=90=91=E9=A3=8E=E6=A0=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 关闭窗口调试功能 【改动思路】 同上 --- .../mainframe/share/ui/online/mini/MiniComponentShopPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java index 1fc0e24d63..843638d192 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.share.ui.online.mini; -import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.share.ui.online.mini.bridge.ComposedNativeBridges; import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.ui.ModernUIPane; @@ -28,7 +27,6 @@ public class MiniComponentShopPane extends JPanel { public MiniComponentShopPane() { setLayout(new BorderLayout()); - DesignerEnvManager.getEnvManager().setOpenDebug(true); modernUIPane = new ModernUIPane.Builder<>() .withURL(OnlineShopUtils.getWebMiniShopPath()) .prepare(new ScriptContextAdapter() { From 9105c2d33ff54cb147c0b0055389f86e6ac1bf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 25 Jan 2022 17:49:06 +0800 Subject: [PATCH 056/113] =?UTF-8?q?CHART-22531=20=E5=A4=9A=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E8=BD=B4=E5=88=86=E5=B1=82=E8=AE=BE=E7=BD=AE=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F=E2=80=94=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...goryPlotMoreCateReportDataContentPane.java | 33 ++++----- ...egoryPlotMoreCateTableDataContentPane.java | 34 ++++----- .../custom/style/VanChartCustomAxisPane.java | 2 +- .../style/VanChartCustomAxisTabPane.java | 10 ++- ...VanChartMoreCateReportDataContentPane.java | 7 +- .../VanChartMoreCateTableDataContentPane.java | 7 +- .../designer/style/axis/VanChartAxisPane.java | 4 ++ .../style/axis/VanChartBaseAxisPane.java | 70 +++++-------------- ...VanChartCategoryStylePaneWithCheckBox.java | 12 +--- 9 files changed, 65 insertions(+), 114 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index cbaf8b0c1b..93d189c697 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -26,7 +26,8 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.List; import java.util.Map; @@ -41,10 +42,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor private JPanel boxPane; private UIButton addButton; - private Map formualList = new LinkedHashMap<>(); + private List formualList = new ArrayList(); private UIObserverListener uiobListener = null; - public Map getFormualList() { + public List getFormualList() { return formualList; } @@ -100,17 +101,12 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } private TinyFormulaPane addNewCatePane() { - String uuid = UUIDUtil.generate(); - return addNewCatePane(uuid); - } - - private TinyFormulaPane addNewCatePane(String uuid) { final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); pane.setPreferredSize(new Dimension(100, 16)); pane.registerChangeListener(uiobListener); - formualList.put(uuid, pane); + formualList.add(pane); final JPanel newButtonPane = new JPanel(); newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); @@ -125,7 +121,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor @Override public void actionPerformed(ActionEvent e) { boxPane.remove(newButtonPane); - formualList.remove(uuid); + formualList.remove(pane); checkComponent(); relayoutPane(); } @@ -177,11 +173,11 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - Map moreCateLabels = reportDefinition.getMoreCateLabels(); - if (reportDefinition.getCategoryName() != null && !moreCateLabels.isEmpty()) { - for (Map.Entry entry : moreCateLabels.entrySet()) { - TinyFormulaPane pane = addNewCatePane(entry.getKey()); - pane.populateBean(Utils.objectToString(entry.getValue())); + int size = reportDefinition.getMoreCateSize(); + if (reportDefinition.getCategoryName() != null && size > 0) { + for(int i = 0; i < size; i++) { + TinyFormulaPane pane = addNewCatePane(); + pane.populateBean(Utils.objectToString(reportDefinition.getMoreCateWithIndex(i))); } } } @@ -204,10 +200,9 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { - for (Map.Entry entry : formualList.entrySet()) { - String uuid = entry.getKey(); - TinyFormulaPane pane = entry.getValue(); - reportDefinition.addMoreCate(uuid, canBeFormula(pane.updateBean())); + for (int i = 0, size = formualList.size(); i < size; i++) { + TinyFormulaPane pane = formualList.get(i); + reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 29f18002c7..572c28edde 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -6,7 +6,6 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; -import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -27,9 +26,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.LinkedHashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * 多分类轴 的数据集定义界面. @@ -45,12 +43,12 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private JPanel boxPane; - private Map boxList = new LinkedHashMap<>(); + private List boxList = new ArrayList(); private UIButton addButton; private UIObserverListener uiobListener = null; - public Map getBoxList() { + public List getBoxList() { return boxList; } @@ -114,11 +112,6 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } private UIComboBox addNewCombox() { - String uuid = UUIDUtil.generate(); - return addNewCombox(uuid); - } - - private UIComboBox addNewCombox(String uuid) { final JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); @@ -145,7 +138,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); buttonPane.add(delButton); boxPane.add(buttonPane); - boxList.put(uuid, combox); + boxList.add(combox); checkComponent(); @@ -153,7 +146,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); - boxList.remove(uuid); + boxList.remove(combox); checkComponent(); relayoutPane(); } @@ -227,10 +220,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); if (top instanceof NormalTableDataDefinition) { NormalTableDataDefinition normal = (NormalTableDataDefinition) top; - Map moreCateLabels = normal.getMoreCateLabels(); - for(Map.Entry entry : moreCateLabels.entrySet()) { - UIComboBox box = addNewCombox(entry.getKey()); - box.setSelectedItem(entry.getValue()); + int size = normal.getMoreCateSize(); + for (int i = 0; i < size; i++) { + UIComboBox box = addNewCombox(); + box.setSelectedItem(normal.getMoreCateWithIndex(i)); } } @@ -256,11 +249,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { - for (Map.Entry entry : boxList.entrySet()) { - String uuid = entry.getKey(); - UIComboBox comboBox = entry.getValue(); - if (comboBox != null && comboBox.getSelectedItem() != null) { - normal.addMoreCate(uuid, comboBox.getSelectedItem().toString()); + for (int i = 0, size = boxList.size(); i < size; i++) { + UIComboBox box = boxList.get(i); + if (box.getSelectedItem() != null) { + normal.addMoreCate(box.getSelectedItem().toString()); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisPane.java index 35b6d63e70..75a3c0f2ca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisPane.java @@ -54,7 +54,7 @@ public class VanChartCustomAxisPane extends BasicScrollPane { } if(axisPane != null) { - axisPane.populateBean((VanChartCustomPlot) chart.getPlot()); + axisPane.populateBean((VanChart) chart); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisTabPane.java index 93ac30c52e..5f9927c6b1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomAxisTabPane.java @@ -87,11 +87,16 @@ public class VanChartCustomAxisTabPane extends VanChartCustomPlotTabPane customPlotList = plot.getCustomPlotList(); ArrayList plotOrder = plot.getDiffAxisOrder(); @@ -100,12 +105,13 @@ public class VanChartCustomAxisTabPane extends VanChartCustomPlotTabPane entry : getFormualList().entrySet()) { - entry.getValue().setEnabled(isSupportMulticategory); + for (int i = 0; i < getFormualList().size(); i++) { + getFormualList().get(i).setEnabled(isSupportMulticategory); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java index ce6e7a16c6..dcf160aec1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/data/VanChartMoreCateTableDataContentPane.java @@ -3,14 +3,11 @@ package com.fr.van.chart.designer.data; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotMoreCateTableDataContentPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; -import java.util.Map; - /** * Created by mengao on 2017/7/3. */ @@ -46,8 +43,8 @@ public class VanChartMoreCateTableDataContentPane extends CategoryPlotMoreCateTa private void checkBoxList(boolean isSupportMulticategory) { if (getBoxList().size() != 0) { - for (Map.Entry entry : getBoxList().entrySet()) { - entry.getValue().setEnabled(isSupportMulticategory); + for (int i = 0; i < getBoxList().size(); i++) { + getBoxList().get(i).setEnabled(isSupportMulticategory); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java index 11841813d9..ef532d12ba 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java @@ -287,4 +287,8 @@ public class VanChartAxisPane extends BasicBeanPane { public VanChart updateBean() { return null; } + + public void setChart(Chart chart) { + this.chart = chart; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 5da2e664e5..1023ecde8c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -7,8 +7,6 @@ import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Title; -import com.fr.chart.chartdata.NormalReportDataDefinition; -import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UINumberDragPane; @@ -51,9 +49,7 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; /** * 坐标轴的基础配置项。分类,时间,值等公共的部分。 @@ -616,73 +612,44 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } categoryStylePane.removeAll(); categoryStyles.clear(); - populateDefaultCateLabelStyle(axis); - populateMoreCateLabelStyle(axis); + populateCateLabelStyle(axis); categoryStylePane.revalidate(); } - /** - * 默认一定会有一个分类标签,就populate这个 - */ - private void populateDefaultCateLabelStyle(VanChartAxis axis) { - populateCategoryStyles(axis, VanChartAxis.DEFAULT_CATEGORY_UUID, 0); - } /** - * populate其余的分类标签 + * populate分类标签 * * @param axis */ - private void populateMoreCateLabelStyle(VanChartAxis axis) { + private void populateCateLabelStyle(VanChartAxis axis) { Chart chart = axis.getChart(); - Map moreCateLabels = new LinkedHashMap<>(); + int size; TopDefinitionProvider definition = chart.getFilterDefinition(); - if (definition == null) { - return; - } - if (definition instanceof NormalTableDataDefinition) { - NormalTableDataDefinition tableDataDefinition = (NormalTableDataDefinition) definition; - moreCateLabels.putAll(tableDataDefinition.getMoreCateLabels()); - } else if (definition instanceof NormalReportDataDefinition) { - NormalReportDataDefinition reportDataDefinition = (NormalReportDataDefinition) definition; - for (Map.Entry entry : reportDataDefinition.getMoreCateLabels().entrySet()) { - String uuid = entry.getKey(); - String cateLabel = Utils.objectToString(entry.getValue()); - moreCateLabels.put(uuid, cateLabel); - } - } + size = definition == null ? 1 : definition.getMoreCateSize() + 1; - int i = 1; - List uuids = new ArrayList<>(); - for (Map.Entry entry : moreCateLabels.entrySet()) { - String uuid = entry.getKey(); - uuids.add(uuid); - populateCategoryStyles(axis, uuid, i); - i++; + for (int i = 0; i < size; i++) { + populateCategoryStyles(axis, i); } - axis.retainUsefulCategoryStyles(uuids); } - private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) { + private void populateCategoryStyles(VanChartAxis axis, int index) { VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); - VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, uuid, index); - pane.populate(style, uuid); + VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, index); + pane.populate(style); categoryStyles.add(pane); categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); } - private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { + private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, int index) { VanChartAxisLabelStyle style; - if (axis.getCategoryStyle(uuid) != null) { - style = axis.getCategoryStyle(uuid); + if (axis.getCategoryStylesSize() > index && axis.getCategoryStyle(index) != null) { + style = axis.getCategoryStyle(index); } else { - style = axis.getCategoryStyleByIndex(index); - if (style == null) { - style = new VanChartAxisLabelStyle(); - } - axis.addCategoryStyle(uuid, style); + style = new VanChartAxisLabelStyle(); + axis.addCategoryStyle(style); } return style; } @@ -875,12 +842,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { * @param axis */ private void updateLayerDisplayPane(VanChartAxis axis) { + List styles = new ArrayList<>(); for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { - Map styleMap = categoryStyle.update(); - for (Map.Entry entry : styleMap.entrySet()) { - axis.addCategoryStyle(entry.getKey(), entry.getValue()); - } + styles.add(categoryStyle.update()); } + axis.setCategoryStyles(styles); } //轴线样式 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java index 52877216ac..49394c0522 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java @@ -19,8 +19,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.LinkedHashMap; -import java.util.Map; public class VanChartCategoryStylePaneWithCheckBox extends JPanel { private UICheckBox checkBox; // 复选框 @@ -30,7 +28,6 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { private JPanel showOnPane; private AbstractAttrNoScrollPane parent; - private String axisId; private VanChartAxisLabelStyle axis; public VanChartCategoryStylePaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane, String checkBoxName) { @@ -88,16 +85,13 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { } } - public void populate(VanChartAxisLabelStyle style, String uuid) { + public void populate(VanChartAxisLabelStyle style) { this.axis = style; - this.axisId = uuid; checkBox.setSelected(axis.isShowLabel()); } - public Map update() { + public VanChartAxisLabelStyle update() { axis.setShowLabel(checkBox.isSelected()); - Map map = new LinkedHashMap<>(); - map.put(axisId, axis); - return map; + return axis; } } From 1e6c649e499fffc8c277b2731d4bd18e818b0a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 25 Jan 2022 21:26:15 +0800 Subject: [PATCH 057/113] =?UTF-8?q?REPORT-66011=20=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/style/AbstractPopBox.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java index 167cc163e1..9cff473c11 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java @@ -10,8 +10,6 @@ import javax.swing.JWindow; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.util.ArrayList; -import java.util.List; import java.awt.AWTEvent; import java.awt.Dimension; import java.awt.Point; @@ -21,6 +19,8 @@ import java.awt.Window; import java.awt.event.AWTEventListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; /** * @author kunsnat E-mail:kunsnat@gmail.com @@ -134,7 +134,6 @@ public abstract class AbstractPopBox extends JPanel { Window parentWindow = SwingUtilities.windowForComponent(this); if (parentWindow != null) { this.selectPopupWindow = new SelectControlWindow(parentWindow); - this.selectPopupWindow.setAlwaysOnTop(true); } selectPopupWindow.addMouseListener(new MouseAdapter() { From faa8dc4f8b34baf4877c27053ec940dab570b6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 26 Jan 2022 10:16:31 +0800 Subject: [PATCH 058/113] =?UTF-8?q?REPORT-63660=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=B8=8D=E5=90=88=E7=90=86=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/LoadingUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java b/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java index d464dec796..a5a6803d3f 100644 --- a/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java @@ -21,7 +21,7 @@ public class LoadingUtils { public static JPanel createLoadingPane() { JPanel jPanel = new JPanel(); UILabel loadingLabel = new UILabel(LOADING_ICON); - UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading")); + UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Loading")); tipLabel.setForeground(TIP_COLOR); jPanel.setLayout(new LayoutManager() { @Override From 9908c5f109a330d22b4d2f20e4940a80b9251bfd Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 26 Jan 2022 18:12:23 +0800 Subject: [PATCH 059/113] =?UTF-8?q?REPORT-66222=E3=80=90=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BC=98=E5=8C=96=E3=80=91=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=B8=AD=E5=AD=98=E5=9C=A8=E8=8B=B1=E6=96=87?= =?UTF-8?q?(),=E6=97=A5=E5=BF=97=E4=B8=AD=E7=9A=84=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loghandler/DesignerLogHandler.java | 127 +++++++++++++----- .../loghandler/DesignerLogHandlerTest.java | 50 +++++++ 2 files changed, 141 insertions(+), 36 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/mainframe/loghandler/DesignerLogHandlerTest.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index f7ffe1aaee..88e064fe00 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.loghandler; +import com.finebi.cbb.base.tuple.Pair; import com.fr.base.BaseUtils; import com.fr.base.TRL; import com.fr.design.file.HistoryTemplateListCache; @@ -17,6 +18,8 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.LogEvent; +import com.fr.third.guava.base.Splitter; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.AbstractAction; @@ -51,10 +54,11 @@ import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Date; +import java.util.Deque; import java.util.List; -import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -362,10 +366,7 @@ public class DesignerLogHandler { SimpleAttributeSet attrSet = new SimpleAttributeSet(); if (style == DesignerLogger.ERROR_INT) { - String[] tplLink = tryFindTplLink(str); - if (tplLink != null - && tplLink.length > 0 - && dealWithTplLink(str, tplLink)) { + if (renderLink(str)) { return; } StyleConstants.setForeground(attrSet, Color.RED); @@ -388,6 +389,23 @@ public class DesignerLogHandler { } } + /** + * 渲染模板链接 + * + * @param str 可能包含模板链接字符串 + * @return 是否处理成功 + */ + private boolean renderLink(String str) { + Document doc = jTextArea.getStyledDocument(); + if (doc instanceof HTMLDocument) { + String[] tplLink = findTplLink(str); + return tplLink != null + && tplLink.length > 0 + && link2Html(str, tplLink); + } + return false; + } + /** * 处理模板链接 * @@ -395,55 +413,62 @@ public class DesignerLogHandler { * @param tplLink 模板链接 * @return 是否处理成功 */ - private boolean dealWithTplLink(String s, String[] tplLink) { - String afterBr = s.replaceAll("\\n", "
"); - String[] lineSeg = pattern.split(afterBr); + private boolean link2Html(String s, String[] tplLink) { + List lineSeg = splitLineSeg(s, tplLink); + String html = buildHtml(lineSeg, tplLink); + try { + Document doc = jTextArea.getStyledDocument(); + HTMLDocument htmlDocument = (HTMLDocument) doc; + htmlDocument.insertAfterEnd(htmlDocument.getCharacterElement(doc.getLength()), html); + } catch (BadLocationException | IOException ignored) { + // 这里出问题不记录日志否则会导致死循环 + return false; + } + return true; + } + + @NotNull + private String buildHtml(List lineSeg, String[] tplLink) { StringBuilder sb = new StringBuilder(""); - for(int i=0;i< tplLink.length;i++){ + for (int i = 0; i < tplLink.length; i++) { sb.append("") - .append(lineSeg[i]) + .append(lineSeg.get(i)) .append("") .append(tplLink[i]) .append(""); } - if (lineSeg.length > tplLink.length) { - sb.append("").append(lineSeg[lineSeg.length-1]).append(""); + if (lineSeg.size() > tplLink.length) { + sb.append("").append(lineSeg.get(lineSeg.size() - 1)).append(""); } sb.append(""); - - try { - Document doc = jTextArea.getStyledDocument(); - HTMLDocument htmlDocument = (HTMLDocument) doc; - htmlDocument.insertAfterEnd(htmlDocument.getCharacterElement(doc.getLength()), sb.toString()); - } catch (BadLocationException | IOException ignored) { - // 这里出问题不记录日志否则会导致死循环 - return false; - } - return true; + return sb.toString(); } /** - * 尝试找到模板链接 - * - * @param s 可能含有模板链接的字符串 - * @return 模板链接 + * 将非公式部分切割为数组 */ - @Nullable - private String[] tryFindTplLink(String s) { - Document doc = jTextArea.getStyledDocument(); - if (!(doc instanceof HTMLDocument)) { - return null; + @NotNull + private List splitLineSeg(String s, String[] tplLink) { + String seg = s.replaceAll("\\n", "
"); + List lineSeg = new ArrayList<>(2); + List lineSegTmp = new ArrayList<>(); + String tmp = seg; + for (String link : tplLink) { + lineSegTmp = Splitter.on(link).omitEmptyStrings().splitToList(tmp); + lineSeg.add(lineSegTmp.get(0)); + if (lineSegTmp.size() > 1) { + tmp = lineSegTmp.get(1); + } } - Matcher matcher = pattern.matcher(s); - List list = new ArrayList<>(); - while (matcher.find()) { - list.add(matcher.group(0)); + if (lineSegTmp.size() > 1) { + lineSeg.add(lineSegTmp.get(1)); } - return list.toArray(new String[0]); + return lineSeg; } + private String appendLocaleMark(String str, int style) { if (style == DesignerLogger.ERROR_INT) { @@ -505,4 +530,34 @@ public class DesignerLogHandler { }; } + + /** + * 尝试找到模板链接 + * + * @param s 可能含有模板链接的字符串 + * @return 模板链接 + */ + @Nullable + public static String[] findTplLink(String s) { + List list = new ArrayList<>(); + // 栈配对 + Deque> stack = new ArrayDeque<>(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c == '(') { + stack.push(new Pair<>(c, i)); + } else if (c == ')') { + Pair left = stack.peek(); + if (left != null && left.getFirst() == '(') { + Pair pop = stack.pop(); + String link = s.substring(pop.getSecond(), i + 1); + if (link.contains(ProjectConstants.CPT_SUFFIX) + || link.contains(ProjectConstants.FRM_SUFFIX)) { + list.add(link); + } + } + } + } + return list.toArray(new String[0]); + } } diff --git a/designer-base/src/test/java/com/fr/design/mainframe/loghandler/DesignerLogHandlerTest.java b/designer-base/src/test/java/com/fr/design/mainframe/loghandler/DesignerLogHandlerTest.java new file mode 100644 index 0000000000..c7dd1de70a --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/mainframe/loghandler/DesignerLogHandlerTest.java @@ -0,0 +1,50 @@ +package com.fr.design.mainframe.loghandler; + +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * @author vito + * @version 10.0 + * Created by vito on 2022/1/25 + */ +public class DesignerLogHandlerTest { + + @Test + public void findTplLink() { + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)", "(公式定位测试/单sheet2(2).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式计算错误:(公式定位测试/单sheet2(1).cpt:0:A1),出错公式(公式定位测试/单sheet2(2).cpt:0:A1),的飞机啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).frm:0:A1)", "(公式定位测试/单sheet2(2).frm:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式计算错误:(公式定位测试/单sheet2(1).frm:0:A1),出错公式(公式定位测试/单sheet2(2).frm:0:A1),的飞机啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式(计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式)计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机)啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机(啊") + ); + Assert.assertArrayEquals( + new String[]{"(公式定位测试/单sheet2(1).cpt:0:A1)"}, + DesignerLogHandler.findTplLink("错误代码:11300310 公式(0fdasf)计算错误:(公式定位测试/单sheet2(1).cpt:0:A1)的飞机啊") + ); + } +} \ No newline at end of file From 3b885412c2a8b35690a7839e96fc235c2ec093ee Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 9 Feb 2022 15:31:00 +0800 Subject: [PATCH 060/113] =?UTF-8?q?REPORT-66342=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=BB=84=E4=BB=B6=E9=A1=B5=E9=9D=A2=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E6=98=BE=E7=A4=BA=E5=8A=A0=E8=BD=BD=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B2=A1=E6=9C=89=E6=8A=A5=E9=94=99=EF=BC=9B?= =?UTF-8?q?=E5=B8=86=E8=BD=AF=E5=B8=82=E5=9C=BAweb=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Comparator中比较double时使用了允许误差的比较方法,产生异常 【改动思路】 使用Double.compare方法比较double值 --- .../design/mainframe/share/sort/OnlineWidgetSortType.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java b/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java index ef5ecbbf8a..dfa0e70739 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java @@ -27,7 +27,11 @@ public enum OnlineWidgetSortType implements SortType { public int compare(OnlineShareWidget o1, OnlineShareWidget o2) { double t1 = getSortValue(o1, parameterMap); double t2 = getSortValue(o2, parameterMap); - return ComparatorUtils.compareCommonType(t2, t1); + // Comparator中比较double/float相等时,不允许误差. 否则会违背 "若x = y , y = z, 则x = z"的约定。 + // 因为允许误差的情况下,x和y间的误差在允许范围内,被判定相等,y和z间的误差在允许范围内,被判定相等, + // 但x和z间的误差可能超出允许范围,从而不相等,因此会违背上述约定。 + // 产生IllegalArgumentException: Comparison method violates its general contract! + return Double.compare(t2, t1); } }); } From 219339fb59e8f29337ed7721343442236d8d4243 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 9 Feb 2022 15:59:22 +0800 Subject: [PATCH 061/113] =?UTF-8?q?REPORT-66373=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=EF=BC=8C?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E9=9C=80=E8=A6=81=E4=B8=80=E4=B8=AA=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 和交互产品讨论后,补充一下窗口名称 【改动思路】 同上 --- .../share/ui/online/mini/MiniComponentShopDialog.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index 939a7112e1..0c21a4d414 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -1,14 +1,11 @@ package com.fr.design.mainframe.share.ui.online.mini; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.UIDialog; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; import javax.swing.JFrame; import java.awt.Container; -import java.awt.Dimension; import java.awt.Window; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; @@ -36,6 +33,7 @@ public class MiniComponentShopDialog { final MiniComponentShopPane shopPane = new MiniComponentShopPane(); frame.setSize(1200, 800); + frame.setTitle(Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Window_Title")); frame.add(shopPane); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); From e69e76edcae88ce27109fd91e269fa5b5698067e Mon Sep 17 00:00:00 2001 From: Lanlan Date: Wed, 9 Feb 2022 16:00:28 +0800 Subject: [PATCH 062/113] =?UTF-8?q?KERNEL-9974=20=E3=80=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=97=B4=E9=80=9A=E4=BF=A1=E3=80=91RPC=E7=A7=BB?= =?UTF-8?q?=E9=99=A4-=E6=8F=92=E4=BB=B6=E5=95=86=E5=9F=8E=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/extra/WebViewDlgHelper.java | 23 ++++++++------ .../java/com/fr/design/upm/UpmFinder.java | 31 +++++++++++++------ .../fr/start/module/DesignerActivator.java | 4 +++ 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java index f35fbdf116..f671f220bf 100644 --- a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java +++ b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java @@ -1,6 +1,6 @@ package com.fr.design.extra; -import com.fr.base.FRContext; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.PluginResourceLoader; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; @@ -15,12 +15,12 @@ import com.fr.general.IOUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.PluginStoreConfig; import com.fr.plugin.PluginStoreConstants; import com.fr.stable.CommonUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import javax.swing.SwingWorker; @@ -44,15 +44,15 @@ public class WebViewDlgHelper { private static final String LATEST = "latest"; private static final String SHOP_SCRIPTS = "shop_scripts"; private static final int VERSION_8 = 8; - private static String installHome = FRContext.getCommonOperator().getWebRootPath(); + private static String installHome = PluginStoreConstants.getLocalInstallHome(); private static final String MAIN_JS_PATH = "/scripts/plugin.html"; - private static final String ENV_VERSION = "ENV_VERSION"; static { GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override public void envChanged() { - installHome = FRContext.getCommonOperator().getWebRootPath(); + installHome = PluginStoreConstants.getLocalInstallHome(); + PluginResourceLoader.INSTANCE.checkOldShopFile(); } }); } @@ -74,8 +74,11 @@ public class WebViewDlgHelper { } return; } - String jar_version = PluginStoreConstants.getProps(ENV_VERSION, StringUtils.EMPTY); - if (ComparatorUtils.equals(jar_version, ProductConstants.VERSION)) { + // 检测更新前先刷新一下版本号 + PluginStoreConstants.refreshProps(); + + String jarVersion = PluginStoreConfig.getInstance().getEnvVersion(); + if (ComparatorUtils.equals(jarVersion, ProductConstants.VERSION)) { updateShopScripts(SHOP_SCRIPTS); showPluginDlg(); } else { @@ -133,7 +136,7 @@ public class WebViewDlgHelper { * * @param filePath 待删除文件路径 */ - private static void deleteExtraFile(String filePath){ + private static void deleteExtraFile(String filePath) { CommonIOUtils.deleteFile(new File(filePath)); } @@ -259,7 +262,7 @@ public class WebViewDlgHelper { try { if (get()) { File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)); - if(scriptZip.exists()){ + if (scriptZip.exists()) { IOUtils.unzip(scriptZip, installHome); CommonUtils.deleteFile(scriptZip); } @@ -283,7 +286,7 @@ public class WebViewDlgHelper { protected Void doInBackground() throws Exception { String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update"); if (url != null) { - String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getProps("VERSION")); + String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConfig.getInstance().getVersion()); JSONObject resultJSONObject = new JSONObject(text); String isLatest = resultJSONObject.optString("result"); if (!ComparatorUtils.equals(isLatest, LATEST)) { diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index f3284c11e5..576c5a9b96 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -1,6 +1,6 @@ package com.fr.design.upm; -import com.fr.base.FRContext; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; @@ -12,8 +12,11 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; +import com.fr.general.CommonIOUtils; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.PluginStoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; @@ -33,7 +36,7 @@ public class UpmFinder { private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; - public static String installHome = FRContext.getCommonOperator().getWebRootPath(); + public static String installHome = PluginStoreConstants.getLocalInstallHome(); private static UIDialog dialog = null; @@ -41,7 +44,8 @@ public class UpmFinder { EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { @Override public void on(Event event, Workspace param) { - installHome = FRContext.getCommonOperator().getWebRootPath(); + installHome = PluginStoreConstants.getLocalInstallHome(); + UpmResourceLoader.INSTANCE.checkOldShopFile(); } }); } @@ -75,24 +79,24 @@ public class UpmFinder { } private static void showUpmPane() { - if (!checkUPMResourcesExist()){ + if (!checkUPMResourcesExist()) { // upm下载 int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); - if (val == JOptionPane.OK_OPTION){ + if (val == JOptionPane.OK_OPTION) { try { UpmResourceLoader.INSTANCE.download(); - UpmResourceLoader.INSTANCE.install(); + installUpmResource(); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); } } - } - else { + } else { UpmShowPane upmPane = new UpmShowPane(); if (dialog == null) { dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); @@ -102,6 +106,15 @@ public class UpmFinder { } } + private static void installUpmResource() { + String installHome = PluginStoreConstants.getLocalInstallHome(); + File scriptZip = new File(BaseResourceLoader.SCRIPT_DOWNLOAD_PATH); + if (scriptZip.exists()) { + IOUtils.unzip(scriptZip, installHome); + CommonIOUtils.deleteFile(scriptZip); + } + } + private static void showUpdatePane() { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); if (!GeneralContext.getLocale().equals(Locale.JAPANESE) && !GeneralContext.getLocale().equals(Locale.JAPAN) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index eea3360bae..be583c7d56 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -12,6 +12,8 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.config.MarketConfig; import com.fr.config.ServerPreferenceConfig; import com.fr.decision.update.backup.RecoverManager; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.PluginResourceLoader; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.NewFormAction; @@ -180,6 +182,8 @@ public class DesignerActivator extends Activator implements Prepare { AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); pushUpdateTask.run(); + PluginResourceLoader.INSTANCE.checkOldShopFile(); + UpmResourceLoader.INSTANCE.checkOldShopFile(); } @Override From 49a7825ed2d0de30a15a3b14c89f807c935e57fe Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 9 Feb 2022 17:09:13 +0800 Subject: [PATCH 063/113] =?UTF-8?q?REPORT-66378=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=EF=BC=8C?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E4=B8=8B=E5=A5=97=E7=94=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=85=A5=E5=8F=A3=E6=98=AF=E5=90=A6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 国际化下屏蔽mini商城窗口,屏蔽条件与在线组件库保持一直 【改动思路】 同上 --- .../com/fr/design/mainframe/share/ComponentShareUtil.java | 4 ++++ .../main/java/com/fr/design/mainframe/FormParaWidgetPane.java | 3 ++- .../design/mainframe/share/ui/online/OnlineWidgetTabPane.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java index cec7fbc8fc..2445826128 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java @@ -34,6 +34,10 @@ public class ComponentShareUtil { return localeMark.getValue(); } + public static boolean isShowMiniShopWindow() { + return isShowOnlineWidgetRepoPane(); + } + /** * 判断是否可触达 * diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 85a0743841..2f78a98f09 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -18,6 +18,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.fr.design.mainframe.share.util.OnlineShopUtils; @@ -265,7 +266,7 @@ public class FormParaWidgetPane extends JPanel { jPanel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { - if (OnlineShopUtils.testConnection()) { + if (OnlineShopUtils.testConnection() && ComponentShareUtil.isShowMiniShopWindow()) { MiniComponentShopDialog.getInstance().show(); } else { OnlineWidgetRepoPane.getInstance().switch2InternetErrorPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index c7a25be00c..1ab2cec121 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -103,7 +103,7 @@ public class OnlineWidgetTabPane extends JPanel { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (OnlineShopUtils.testConnection()) { + if (OnlineShopUtils.testConnection() && ComponentShareUtil.isShowMiniShopWindow()) { MiniComponentShopDialog.getInstance().show(); FormWidgetDetailPane.getInstance().switch2Local(); FormWidgetDetailPane.getInstance().enterWidgetLib(); From 12b78e7e4b4ba708c8000e2180b0fa9ad75f4613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 9 Feb 2022 18:51:52 +0800 Subject: [PATCH 064/113] =?UTF-8?q?CHART-22754&CHART-22755&CHART-22757&CHA?= =?UTF-8?q?RT-22769&CHART-22768=20=E8=8B=A5=E5=B9=B2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index bbc923f4d8..b6e18f83a5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -184,7 +184,7 @@ public class ChangeConfigPane extends BasicBeanPane { BorderLayout.CENTER ); - UIExpandablePane expandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Button_Content"), 20, buttonContentPane) { + UIExpandablePane expandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), 20, buttonContentPane) { protected void setcontentPanelontentPanelBorder() { } @@ -212,6 +212,7 @@ public class ChangeConfigPane extends BasicBeanPane { populateSwitchTitlePane(i, collection); } + showSwitchTitleCard(collection.getChartName(select)); chartTypesPane.revalidate(); switchTitlePane.revalidate(); selectedChart = select; @@ -228,7 +229,7 @@ public class ChangeConfigPane extends BasicBeanPane { result = Utils.objectToString(switchTitle); } } else { - result = collection.getChartName(chartIndex); + result = Toolkit.i18nText("Fine-Design_Chart_Chart") + (chartIndex + 1); } TinyFormulaPane title = new TinyFormulaPane(); @@ -357,8 +358,7 @@ public class ChangeConfigPane extends BasicBeanPane { @Override public void mouseClicked(MouseEvent e) { resetChangeChartButtons(); - CardLayout cardLayout = (CardLayout) switchTitlePane.getLayout(); - cardLayout.show(switchTitlePane, collection.getChartName(buttonIndex)); + showSwitchTitleCard(collection.getChartName(buttonIndex)); ChangeChartButton.this.setSelected(true); selectedChart = buttonIndex; } @@ -375,4 +375,9 @@ public class ChangeConfigPane extends BasicBeanPane { changeChartButton.setSelected(false); } } + + private void showSwitchTitleCard(String chartName) { + CardLayout cardLayout = (CardLayout) switchTitlePane.getLayout(); + cardLayout.show(switchTitlePane, chartName); + } } From f2da7fb7bc8e10e6a4042f0155266e2dbffe1d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 10 Feb 2022 17:11:44 +0800 Subject: [PATCH 065/113] =?UTF-8?q?CHART-22767=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=87=E9=A2=98=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?-=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=9B=BE=E8=A1=A8=E5=BE=88?= =?UTF-8?q?=E5=A4=9A=EF=BC=8C=E5=88=87=E6=8D=A2=E5=B1=9E=E6=80=A7=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E9=9C=80=E8=A6=81=E5=A2=9E=E5=8A=A0=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index b6e18f83a5..ebc3ab5b32 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -11,6 +11,7 @@ import com.fr.chart.base.AttrChangeType; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.AttrScrollPane; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -77,11 +78,26 @@ public class ChangeConfigPane extends BasicBeanPane { private int selectedChart; // 设置面板里面选取的图表,不是真正切换的图表 public ChangeConfigPane(){ + init(); + this.setLayout(new BorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 15)); + this.add(createScrollPane(), BorderLayout.CENTER); + } + + private JPanel createScrollPane() { + return new AttrScrollPane() { + @Override + protected JPanel createContentPane() { + return contentPane; + } + }; + } + + private void init() { initButtonGroup(); configPane = createConfigPane(); contentPane = createContentPane(); contentPane.setBorder(BorderFactory.createEmptyBorder(CONSTANT_TEN, CONSTANT_THIRTY, CONSTANT_TEN, CONSTANT_THIRTY)); - this.add(contentPane, BorderLayout.CENTER); } private JPanel createContentPane() { @@ -172,17 +188,18 @@ public class ChangeConfigPane extends BasicBeanPane { chartTypesPane = new JPanel(); chartTypesPane.setLayout(new BoxLayout(chartTypesPane, BoxLayout.Y_AXIS)); + chartTypesPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); switchTitlePane.setLayout(new CardLayout()); - buttonContentPane.add(chartTypesPane, BorderLayout.NORTH); - buttonContentPane.add( - TableLayout4VanChartHelper.createGapTableLayoutPane( - Toolkit.i18nText("Fine-Design_Chart_Switch_Title_Label"), - switchTitlePane, - EDIT_AREA_WIDTH - ), - BorderLayout.CENTER + JPanel titleEditPane = TableLayout4VanChartHelper.createGapTableLayoutPane( + Toolkit.i18nText("Fine-Design_Chart_Switch_Title_Label"), + switchTitlePane, + EDIT_AREA_WIDTH ); + titleEditPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + + buttonContentPane.add(chartTypesPane, BorderLayout.NORTH); + buttonContentPane.add(titleEditPane, BorderLayout.CENTER); UIExpandablePane expandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), 20, buttonContentPane) { protected void setcontentPanelontentPanelBorder() { From db1430c9600367e5de26ae4378eafca73fe0d280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 10 Feb 2022 18:04:33 +0800 Subject: [PATCH 066/113] =?UTF-8?q?CHART-22876=20=E8=BD=B4=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F=E5=88=86=E5=B1=82=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89-=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=B2=A1=E6=B3=95=E9=80=89=E4=B8=AD=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../axis/component/VanChartCategoryStylePaneWithCheckBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java index 49394c0522..acc87572ff 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java @@ -68,7 +68,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { Point comPoint = settingButton.getLocationOnScreen(); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Dimension size = settingPane.getPreferredSize(); - UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { + UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 230) { @Override public void updateContentPane() { From 9f17196a5bf49d66e6cdc51a3502e8d3535ad4db Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 10 Feb 2022 11:22:34 +0800 Subject: [PATCH 067/113] =?UTF-8?q?REPORT-66263=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E=E4=B8=8A=E4=BF=9D=E5=AD=98=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E8=B0=83=E7=94=A8=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E4=B8=BB=E9=A2=98=E6=B2=A1=E6=9C=89=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Windows平台上,启动设计器的URL参数是通过main函数传递进来的,因此需要单独处理 【改动思路】 同上 --- .../java/com/fr/design/deeplink/DeepLink.java | 0 .../com/fr/design/deeplink/DeepLinkCore.java | 184 ++++++++++++++++++ .../java/com/fr/design/utils/DesignUtils.java | 14 ++ .../fr/design/deeplink/DeepLinkManager.java | 144 +------------- .../main/java/com/fr/start/MainDesigner.java | 3 +- 5 files changed, 205 insertions(+), 140 deletions(-) rename {designer-realize => designer-base}/src/main/java/com/fr/design/deeplink/DeepLink.java (100%) create mode 100644 designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java diff --git a/designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java b/designer-base/src/main/java/com/fr/design/deeplink/DeepLink.java similarity index 100% rename from designer-realize/src/main/java/com/fr/design/deeplink/DeepLink.java rename to designer-base/src/main/java/com/fr/design/deeplink/DeepLink.java diff --git a/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java b/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java new file mode 100644 index 0000000000..55a45709bf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java @@ -0,0 +1,184 @@ +package com.fr.design.deeplink; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.startup.FineStartupNotificationFactory; +import com.fr.design.startup.FineStartupNotificationProvider; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import com.fr.stable.os.OperatingSystem; +import com.fr.third.org.apache.http.NameValuePair; +import com.fr.web.URLUtils; + +import javax.swing.SwingUtilities; +import java.awt.Color; +import java.awt.Frame; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/1/6 + */ +public class DeepLinkCore { + + protected DeepLinkCore(){} + private static final DeepLinkCore instance = new DeepLinkCore(); + public static DeepLinkCore getInstance(){ + return instance; + } + + private String pendingURL; + + private final List deepLinkList = new ArrayList<>(); + + private boolean isDesignerStartupCompleted = false; + + public void register(DeepLink deepLink) { + if (deepLink != null) { + deepLinkList.add(deepLink); + } + } + + public void start(String[] args) { + if (OperatingSystem.isWindows()) { + if (args.length > 0) { + receiveDeeplink(args[0]); + } + } + + if (OperatingSystem.isWindows() && args.length > 0) { + receiveDeeplink(args[0]); + } + + FineStartupNotificationFactory.getNotification() + .registerStartupListener(new FineStartupNotificationProvider.Listener() { + @Override + public void startupPerformed(String parameters) { + receiveDeeplink(parameters); + } + }); + + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null param) { + EventDispatcher.stopListen(this); + isDesignerStartupCompleted = true; + if (canConsumePendingURL()) { + consumePendingURL(); + } + } + }); + } + + public void receiveDeeplink(String url) { + if (canAcceptNewURL()) { + acceptNewURL(url); + if (canConsumePendingURL()) { + consumePendingURL(); + } + } + } + + public void receiveDeeplink2(String url) { + if (canAcceptNewURL()) { + acceptNewURL(url); + if (canConsumePendingURL()) { + consumePendingURL(); + } else { + Frame frame = new Frame("can not ConsumePendingURL"); + frame.setSize(400, 400); + frame.setBackground(Color.BLACK); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent windowEvent){ + frame.dispose(); + } + }); + frame.setVisible(true); + } + } else { + Frame frame = new Frame("can not AcceptNewURL"); + frame.setSize(400, 400); + frame.setBackground(Color.BLACK); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent windowEvent){ + frame.dispose(); + } + }); + frame.setVisible(true); + } + } + + private boolean canAcceptNewURL() { + return StringUtils.isEmpty(this.pendingURL); + } + + private void acceptNewURL(String url) { + this.pendingURL = url; + } + + private boolean canConsumePendingURL() { + return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartupCompleted; + } + + private void consumePendingURL() { + String host = null; + String path = null; + Map params = new HashMap<>(); + + URL url = null; + try { + url = new URL(null, this.pendingURL, new URLStreamHandler() { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return null; + } + }); + } catch (MalformedURLException ignored) {} + + if (url != null) { + host = url.getHost(); + path = url.getPath(); + + List pairs = URLUtils.parse(url.getQuery()); + for (NameValuePair pair: pairs) { + params.put(pair.getName(), pair.getValue()); + } + } + + FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL); + performDeepLinks(this.pendingURL, host, path, params); + + markPendingURLConsumed(); + } + + private void performDeepLinks(String url, String host, String path, Map params) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + for (DeepLink deepLink: deepLinkList) { + if (deepLink.accept(url, host, path, params)) { + deepLink.run(url, host, path, params); + } + } + } + }); + } + + private void markPendingURLConsumed() { + this.pendingURL = null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index f066d648a2..f9fb484a6a 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -5,6 +5,7 @@ import com.fr.base.ServerConfig; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.deeplink.DeepLinkCore; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; @@ -26,10 +27,15 @@ import com.fr.start.ServerStarter; import com.fr.value.NotNullLazyValue; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; + import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.awt.Color; import java.awt.Desktop; import java.awt.Font; +import java.awt.Frame; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -213,6 +219,14 @@ public class DesignUtils { DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); } }); + } else { + String url = line; + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + DeepLinkCore.getInstance().receiveDeeplink2(url); + } + }); } } } 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 9cef24dcc8..14723e84d3 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 @@ -1,153 +1,21 @@ package com.fr.design.deeplink; -import com.fr.design.constants.DesignerLaunchStatus; -import com.fr.design.startup.FineStartupNotificationFactory; -import com.fr.design.startup.FineStartupNotificationProvider; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; -import com.fr.event.Null; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import com.fr.stable.os.OperatingSystem; -import com.fr.third.org.apache.http.NameValuePair; -import com.fr.web.URLUtils; - -import javax.swing.SwingUtilities; -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * @author Starryi * @version 1.0 - * Created by Starryi on 2022/1/6 + * Created by Starryi on 2022/2/10 */ public class DeepLinkManager { - - private DeepLinkManager(){} + protected DeepLinkManager(){} private static final DeepLinkManager instance = new DeepLinkManager(); public static DeepLinkManager getInstance(){ return instance; } - private String pendingURL; - - private final List deepLinkList = new ArrayList<>(); - - private boolean isDesignerStartUpCompleted = false; - - private void register(DeepLink deepLink) { - if (deepLink != null) { - deepLinkList.add(deepLink); - } - } - - public void prepare() { - register(new FileOpen4MacDeepLink()); - register(new TemplateThemeInstallationDeepLink()); - - FineStartupNotificationFactory.getNotification() - .registerStartupListener(new FineStartupNotificationProvider.Listener() { - @Override - public void startupPerformed(String parameters) { - if (canAcceptNewURL()) { - acceptNewURL(parameters); - if (canConsumePendingURL()) { - consumePendingURL(); - } - } - } - }); - - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { - @Override - public void on(Event event, Null param) { - isDesignerStartUpCompleted = true; - if (canConsumePendingURL()) { - consumePendingURL(); - } - } - }); - } - - private boolean canAcceptNewURL() { - return StringUtils.isEmpty(this.pendingURL); - } - - private void acceptNewURL(String url) { - this.pendingURL = url; - } - - private boolean canConsumePendingURL() { - return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartUpCompleted; - } - - private void consumePendingURL() { - String host = null; - String path = null; - Map params = new HashMap<>(); - - URL url = null; - try { - url = new URL(null, this.pendingURL, new URLStreamHandler() { - @Override - protected URLConnection openConnection(URL u) throws IOException { - return null; - } - }); - } catch (MalformedURLException ignored) {} - - if (url != null) { - host = url.getHost(); - path = url.getPath(); - - List pairs = URLUtils.parse(url.getQuery()); - for (NameValuePair pair: pairs) { - params.put(pair.getName(), pair.getValue()); - } - } - - FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL); - performDeepLinks(this.pendingURL, host, path, params); - - markPendingURLConsumed(); - } - - private void performDeepLinks(String url, String host, String path, Map params) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - for (DeepLink deepLink: deepLinkList) { - if (deepLink.accept(url, host, path, params)) { - deepLink.run(url, host, path, params); - } - } - } - }); - } - - public String[] createNewArgs(String[] args) { - String filePath = this.pendingURL; - if (OperatingSystem.isMacos() && StringUtils.isNotEmpty(filePath) && new File(filePath).exists()) { - List argList = new ArrayList<>(Arrays.asList(args)); - argList.add(filePath); - markPendingURLConsumed(); - return argList.toArray(new String[]{}); - } else { - return args; - } - } + public void start(String[] args) { + DeepLinkCore.getInstance().register(new FileOpen4MacDeepLink()); + DeepLinkCore.getInstance().register(new TemplateThemeInstallationDeepLink()); - private void markPendingURLConsumed() { - this.pendingURL = null; + DeepLinkCore.getInstance().start(args); } } diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 4b66c362c2..e29a4e804a 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -107,7 +107,7 @@ public class MainDesigner extends BaseDesigner { */ public static void main(String[] args) { - DeepLinkManager.getInstance().prepare(); + DeepLinkManager.getInstance().start(args); StopWatch watch = new StopWatch(); watch.start(); DesignerLifecycleMonitorContext.getMonitor().beforeStart(); @@ -122,7 +122,6 @@ public class MainDesigner extends BaseDesigner { }); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 - args = DeepLinkManager.getInstance().createNewArgs(args); designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); try { designerRoot.start(); From 8e10bef6cfb55bd50737d6ef57b5c280555a7da7 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 11 Feb 2022 10:32:35 +0800 Subject: [PATCH 068/113] =?UTF-8?q?REPORT-64245=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E6=8F=8F=E8=BF=B0=E5=86=8D?= =?UTF-8?q?=E4=BC=98=E5=8C=96=201.=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E6=8B=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formula/exception/function/MismatchedTokenFunction.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java index dd830ed572..fb4eea22b7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java @@ -90,6 +90,8 @@ public class MismatchedTokenFunction implements Function"; + } else if (tokenType == 33 || tokenType == 26 || tokenType == 31) { + return Toolkit.i18nText("Fine-Design_Basic_Formula_Right_Closing_Symbol"); } else { String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); return tokenType >= 0 && tokenType < tokenNames.length ? TranslateTokenUtils.translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; From 93d206b987e3acb6f950a6650fe400a743e5bf1d Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 11 Feb 2022 14:36:10 +0800 Subject: [PATCH 069/113] =?UTF-8?q?REPORT-66521=20=E5=AE=8C=E5=85=A8?= =?UTF-8?q?=E7=A7=BB=E9=99=A4log4j1.x=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/socketio/DesignerSocketIO.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index e5f44d4e44..d8f7265f7d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -22,7 +22,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; -import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.logging.log4j.core.LogEvent; import com.fr.third.org.apache.http.client.config.RequestConfig; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; @@ -33,6 +32,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.server.socket.CustomLogEvent; import com.fr.workspace.server.socket.LogEventConverter; import io.socket.client.IO; import io.socket.client.Socket; @@ -151,14 +151,14 @@ public class DesignerSocketIO { if (ArrayUtils.isNotEmpty(objects)) { try { Object obj = SerializerHelper.deserialize((byte[]) objects[0]); - // 兼容下老版本服务器 + // 完全去除log4j1.x LogEvent event; - if (obj instanceof LoggingEvent) { - event = LogEventConverter.convert((LoggingEvent) obj); + if (obj instanceof CustomLogEvent) { + event = LogEventConverter.convert((CustomLogEvent) obj); + DesignerLogger.log(event); } else { - event = (LogEvent) obj; + FineLoggerFactory.getLogger().warn("Unable to display server push logs, because server and designer versions are inconsistent!"); } - DesignerLogger.log(event); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From ba0686bee021da43d3a249d2de82d9d26ea0aa1d Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 11 Feb 2022 18:07:34 +0800 Subject: [PATCH 070/113] =?UTF-8?q?REPORT-66324=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=EF=BC=8C?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A1=86=E9=83=A8=E5=88=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=20&=20REPORT-66361=20=E3=80=90?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E?= =?UTF-8?q?=EF=BC=8C=E9=AB=98dpi=E4=B8=8B=E6=98=BE=E7=A4=BA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 高分辨率下窗口尺寸过小,内容显示不全。 窗口内容会根据分辨率自动调整,但是窗口尺寸不会。 【改动思路】 窗口尺寸使用FU/UNIT表示 --- .../share/ui/online/mini/MiniComponentShopDialog.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index 0c21a4d414..81bc642b47 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -1,8 +1,12 @@ package com.fr.design.mainframe.share.ui.online.mini; +import com.fr.base.ScreenResolution; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.Constants; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.UNIT; import javax.swing.JFrame; import java.awt.Container; @@ -32,7 +36,10 @@ public class MiniComponentShopDialog { final JFrame frame = new JFrame(); final MiniComponentShopPane shopPane = new MiniComponentShopPane(); - frame.setSize(1200, 800); + final UNIT width = FU.getInstance(900 * Constants.FU_PER_OLD_PIX); + final UNIT height = FU.getInstance(600 * Constants.FU_PER_OLD_PIX); + int resolution = ScreenResolution.getScreenResolution(); + frame.setSize(width.toPixI(resolution), height.toPixI(resolution)); frame.setTitle(Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Window_Title")); frame.add(shopPane); frame.setResizable(false); From 62912360e21e8b48c7898b7f3885e22941bd5726 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 11 Feb 2022 18:53:41 +0800 Subject: [PATCH 071/113] =?UTF-8?q?REPORT-66304=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E4=B8=8B=E8=BD=BD=E5=AD=98=E5=9C=A8=E9=AB=98=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=BB=84=E4=BB=B6=E7=9A=84=E7=BB=84=E4=BB=B6=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E7=A4=BA=E5=92=8C=E6=95=88=E6=9E=9C=E8=B7=9F?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 使用组件包的designerVersion来判断兼容性不可靠,需要依次检查其中的每个组件的 兼容性 【改动思路】 同上 --- .../mini/bridge/NativeProductBridge.java | 19 ++++++++++++++----- .../mainframe/share/util/OnlineShopUtils.java | 7 ++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java index a579681747..e9daf3e0e5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.share.ui.online.installation.ComponentInstallatio import com.fr.design.mainframe.share.ui.online.installation.ComponentsPackageInstallation; import com.fr.design.mainframe.share.ui.online.installation.TemplateThemeInstallation; import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.form.share.Group; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.bean.OnlineShareWidget; @@ -306,23 +307,31 @@ public class NativeProductBridge { @Override public void run() { boolean allowedDownload; - if (!widget.isCompatibleWithCurrentEnv()) { - int result = FineJOptionPane.showConfirmDialog( + OnlineShareWidget[] childrenWidgets = OnlineShopUtils.getPackageWidgets(widget, false); + boolean isCompatibleWithCurrentEnv = true; + for (OnlineShareWidget children: childrenWidgets) { + if (!children.isCompatibleWithCurrentEnv()) { + isCompatibleWithCurrentEnv = false; + break; + } + } + int result; + if (!isCompatibleWithCurrentEnv) { + result = FineJOptionPane.showConfirmDialog( MiniComponentShopDialog.getInstance().getContentPane(), Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Incompatible_Components_Package_Tip", childrenCount), "", FineJOptionPane.YES_NO_OPTION ); - allowedDownload = result == JOptionPane.YES_OPTION; } else { - int result = FineJOptionPane.showConfirmDialog( + result = FineJOptionPane.showConfirmDialog( MiniComponentShopDialog.getInstance().getContentPane(), Toolkit.i18nText("Fine-Design_Share_Online_Mini_Shop_Download_Components_Package_Tip", childrenCount), "", FineJOptionPane.YES_NO_OPTION ); - allowedDownload = result == JOptionPane.YES_OPTION; } + allowedDownload = result == JOptionPane.YES_OPTION; if (allowedDownload) { fireStartEvent(null); action.install(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java index d0fbd83d5f..fef0caed2c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java @@ -256,7 +256,12 @@ public class OnlineShopUtils { } public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) { - String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ ProductConstants.RELEASE_VERSION; + return getPackageWidgets(widgetPackage, true); + } + + public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage, boolean requireCompatible) { + String targetDesignerVersion = requireCompatible ? ProductConstants.RELEASE_VERSION : "0"; + String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ targetDesignerVersion; OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl); for (OnlineShareWidget widget : widgets) { widget.setParentPackage(widgetPackage); From 0248a72bd3b406c26941de303b31623156a0ae42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 11 Feb 2022 21:35:50 +0800 Subject: [PATCH 072/113] =?UTF-8?q?CHART-22767&CHART-22876&CHART-22873&CHA?= =?UTF-8?q?RT-22861&CHART-22863&CHART-22797&CHART-22768=20=E8=8B=A5?= =?UTF-8?q?=E5=B9=B2bug=E4=B8=80=E8=B5=B7=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 3 ++- ...goryPlotMoreCateReportDataContentPane.java | 6 ++--- ...egoryPlotMoreCateTableDataContentPane.java | 3 ++- .../style/axis/VanChartAxisPaneHelper.java | 26 +++++++++++++++++++ .../style/axis/VanChartBaseAxisPane.java | 16 +++++++++++- 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index ebc3ab5b32..043aa3df12 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -246,7 +246,8 @@ public class ChangeConfigPane extends BasicBeanPane { result = Utils.objectToString(switchTitle); } } else { - result = Toolkit.i18nText("Fine-Design_Chart_Chart") + (chartIndex + 1); + result = collection.getChartName(chartIndex); + chart.setSwitchTitle(result); } TinyFormulaPane title = new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 93d189c697..057492b0f2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -7,7 +7,6 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; -import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.formula.TinyFormulaPane; @@ -16,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -28,7 +28,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** @@ -192,11 +191,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor Plot plot = collection.getSelectedChart().getPlot(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - reportDefinition.clearMoreCate(); updateMoreCate(reportDefinition, plot); - } + VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); } protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 572c28edde..10ce5fcec5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -246,6 +247,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD normal.clearMoreCate(); updateMoreCate(normal, plot); } + VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { @@ -256,5 +258,4 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } } } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java index 770043af9c..9c327b2b2a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java @@ -1,9 +1,15 @@ package com.fr.van.chart.designer.style.axis; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; +import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -27,4 +33,24 @@ public class VanChartAxisPaneHelper { } }; } + + /** + * 在update数据集分类的时候,需要联动update一下样式-坐标轴里面的分层样式设置,来自CHART-22873 + * + * @param collection + */ + public static void updateAxisCategoryStyles(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + int size = definition == null ? 1 : definition.getMoreCateSize() + 1; + + Plot plot = collection.getSelectedChart().getPlot(); + if (plot instanceof VanChartAxisPlot) { + for(VanChartAxis axis : ((VanChartAxisPlot) plot).getXAxisList()){ + axis.clearCategoryStyles(); + for (int i = 0; i < size; i++) { + axis.addCategoryStyle(new VanChartAxisLabelStyle()); + } + } + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 1023ecde8c..a6f6671007 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -46,6 +46,7 @@ import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -264,7 +265,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { private JPanel createLabelContentPane() { labelContentPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout()); - labelStylePane = new JPanel(new CardLayout()); + labelStylePane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + switch (showLogic.getSelectedIndex()) { + case 0: + return wholeDisplayLabelPanel.getPreferredSize(); + case 1: + return categoryStylePane.getPreferredSize(); + case -1: + default: + return super.getPreferredSize(); + } + } + }; labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); From d3edad6a172af1559c0df09f138ed3b0c5142152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 14 Feb 2022 10:01:21 +0800 Subject: [PATCH 073/113] =?UTF-8?q?CHART-22873=20=E5=B0=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=88=86=E7=B1=BB=E6=A0=B7=E5=BC=8F=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=94=BE=E5=88=B0ChartCollection=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...goryPlotMoreCateReportDataContentPane.java | 3 +-- ...egoryPlotMoreCateTableDataContentPane.java | 3 +-- .../style/axis/VanChartAxisPaneHelper.java | 26 ------------------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 057492b0f2..b0d6e20638 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -15,7 +15,6 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -194,7 +193,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor reportDefinition.clearMoreCate(); updateMoreCate(reportDefinition, plot); } - VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); + collection.updateAxisCategoryStyles(); } protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 10ce5fcec5..87c47b18b7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -14,7 +14,6 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -247,7 +246,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD normal.clearMoreCate(); updateMoreCate(normal, plot); } - VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); + collection.updateAxisCategoryStyles(); } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java index 9c327b2b2a..770043af9c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java @@ -1,15 +1,9 @@ package com.fr.van.chart.designer.style.axis; -import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.Plot; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; -import com.fr.plugin.chart.attr.axis.VanChartAxis; -import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; -import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -33,24 +27,4 @@ public class VanChartAxisPaneHelper { } }; } - - /** - * 在update数据集分类的时候,需要联动update一下样式-坐标轴里面的分层样式设置,来自CHART-22873 - * - * @param collection - */ - public static void updateAxisCategoryStyles(ChartCollection collection) { - TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); - int size = definition == null ? 1 : definition.getMoreCateSize() + 1; - - Plot plot = collection.getSelectedChart().getPlot(); - if (plot instanceof VanChartAxisPlot) { - for(VanChartAxis axis : ((VanChartAxisPlot) plot).getXAxisList()){ - axis.clearCategoryStyles(); - for (int i = 0; i < size; i++) { - axis.addCategoryStyle(new VanChartAxisLabelStyle()); - } - } - } - } } From 3764a4ce48569bdf2f8a1319e45b7cd2aec13f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 14 Feb 2022 10:19:05 +0800 Subject: [PATCH 074/113] =?UTF-8?q?CHART-22797=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=B0=86ChangeCon?= =?UTF-8?q?figPane=E9=87=8C=E9=9D=A2=E5=85=B3=E4=BA=8ESwitchTitle=E4=B8=BA?= =?UTF-8?q?null=E7=9A=84=E5=86=97=E4=BD=99=E5=88=A4=E6=96=AD=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/chart/gui/ChangeConfigPane.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 043aa3df12..f053b09d61 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -23,6 +23,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -238,18 +239,14 @@ public class ChangeConfigPane extends BasicBeanPane { private void populateSwitchTitlePane(int chartIndex, ChartCollection collection) { Chart chart = collection.getChart(chartIndex, Chart.class); Object switchTitle = chart.getSwitchTitle(); - String result; + String result = StringUtils.EMPTY; if (switchTitle != null) { if (switchTitle instanceof BaseFormula) { result = ((BaseFormula) switchTitle).getContent(); } else { result = Utils.objectToString(switchTitle); } - } else { - result = collection.getChartName(chartIndex); - chart.setSwitchTitle(result); } - TinyFormulaPane title = new TinyFormulaPane(); title.populateBean(result); switchTitles.add(title); From 8d9fe39e252f7d96a712a2871be08155aec2c22c Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Mon, 14 Feb 2022 14:16:02 +0800 Subject: [PATCH 075/113] =?UTF-8?q?KERNEL-9267=20=E6=8B=86=E5=88=86third.j?= =?UTF-8?q?ar=E4=B8=BAthird.jar=20+=20cbb.jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index ee08bdeeac..8e2e8b627b 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,7 @@ plugins { // 模块参数 ext { frVersion = "" + cbbVersion = "" outputPath = "build" ignoreTestFailureSetting = true languageLevelSetting = 1.8 @@ -60,6 +61,8 @@ allprojects { } dependencies { + implementation 'com.fr.essential:fine-essential:' + cbbVersion + implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23' From 2a4f61fbc61b8633ec6db1a4b5035c7326e90fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 14 Feb 2022 14:29:45 +0800 Subject: [PATCH 076/113] =?UTF-8?q?CHART-22876&CHART-22873&CHART-22861&CHA?= =?UTF-8?q?RT-22863&CHART-22797&CHART-22768=20=E8=8B=A5=E5=B9=B2bug?= =?UTF-8?q?=E4=B8=80=E8=B5=B7=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 6 ++---- ...ategoryPlotMoreCateReportDataContentPane.java | 4 +--- ...CategoryPlotMoreCateTableDataContentPane.java | 1 + .../style/axis/VanChartBaseAxisPane.java | 16 +++++++++++++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index ebc3ab5b32..f053b09d61 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -23,6 +23,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -238,17 +239,14 @@ public class ChangeConfigPane extends BasicBeanPane { private void populateSwitchTitlePane(int chartIndex, ChartCollection collection) { Chart chart = collection.getChart(chartIndex, Chart.class); Object switchTitle = chart.getSwitchTitle(); - String result; + String result = StringUtils.EMPTY; if (switchTitle != null) { if (switchTitle instanceof BaseFormula) { result = ((BaseFormula) switchTitle).getContent(); } else { result = Utils.objectToString(switchTitle); } - } else { - result = Toolkit.i18nText("Fine-Design_Chart_Chart") + (chartIndex + 1); } - TinyFormulaPane title = new TinyFormulaPane(); title.populateBean(result); switchTitles.add(title); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 93d189c697..54c3bd33d4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -7,7 +7,6 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; -import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.formula.TinyFormulaPane; @@ -28,7 +27,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** @@ -195,7 +193,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor reportDefinition.clearMoreCate(); updateMoreCate(reportDefinition, plot); - + collection.updateAxisCategoryStyles(); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 572c28edde..4c809e64f3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -246,6 +246,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD normal.clearMoreCate(); updateMoreCate(normal, plot); } + collection.updateAxisCategoryStyles(); } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 1023ecde8c..a6f6671007 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -46,6 +46,7 @@ import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -264,7 +265,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { private JPanel createLabelContentPane() { labelContentPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout()); - labelStylePane = new JPanel(new CardLayout()); + labelStylePane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + switch (showLogic.getSelectedIndex()) { + case 0: + return wholeDisplayLabelPanel.getPreferredSize(); + case 1: + return categoryStylePane.getPreferredSize(); + case -1: + default: + return super.getPreferredSize(); + } + } + }; labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); From c1ca4cfdb514e474dff2ec5c34da922d8e58d59e Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 14 Feb 2022 14:39:27 +0800 Subject: [PATCH 077/113] =?UTF-8?q?REPORT-66306=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8C=85=E4=B8=8B=E8=BD=BD=E9=9D=A2=E6=9D=BF=E6=97=A0=E9=81=AE?= =?UTF-8?q?=E7=BD=A9=E9=98=B4=E5=BD=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 swing中两个组件上下层叠时,重绘底层组件,会将其内容会知道上方,遮挡上层组件, 因此也需要手动重新绘制上层组件。 【改动思路】 主动调用下阴影层的重绘方法 --- .../ui/online/OnlineDownloadPackagePane.java | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java index 59a09c466c..987cffaceb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java @@ -72,22 +72,6 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { return false; } - protected JPanel createWidgetPane() { - return new JPanel() { - @Override - public void paint(Graphics g) { - super.paint(g); - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f); - g2d.setComposite(composite); - g2d.setColor(Color.DARK_GRAY); - g2d.fillRect(0, 0, getWidth(), getHeight()); - g2d.setComposite(oldComposite); - } - }; - } - protected JPanel createContentPane(JPanel widgetPane) { JPanel panel = new JPanel() { @Override @@ -114,7 +98,20 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { parentPane.resetWidgetDetailPane(packageId, getSharableWidgetProviders()); } } - }); + }) { + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f); + g2d.setComposite(composite); + g2d.setColor(Color.DARK_GRAY); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(oldComposite); + + super.paint(g); + } + }; panel.add(downloadProgressPane); panel.add(widgetPane, BorderLayout.CENTER); return panel; @@ -125,10 +122,16 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { final com.fr.design.extra.Process downloadProcess = aDouble -> { OnlineDownloadPackagePane.this.process = 0.8 * aDouble; downloadProgressPane.updateProgress(process); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } }; final com.fr.design.extra.Process installProcess = aDouble -> { OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble; downloadProgressPane.updateProgress(process); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } }; downloadProcess.process(0.0D); @@ -220,6 +223,9 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { File file = new File(filePath); installProcess.process(0.0D); downloadProgressPane.changeState(); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } InstallUtils.InstallResult result = null; try { if (file.exists()) { From 3dfe341cbbd81cef5abed61625f5f5fa72efbe26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 14 Feb 2022 18:16:22 +0800 Subject: [PATCH 078/113] =?UTF-8?q?REPORT-65772=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98-=E6=89=93=E5=BC=80=E4=B8=80?= =?UTF-8?q?=E5=BC=A0cpt=EF=BC=8C=E8=BF=9B=E5=85=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=BC=96=E8=BE=91=E5=90=8E=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E6=89=93=E5=BC=80=E4=B8=80=E5=BC=A0frm=E6=97=B6=EF=BC=8Cfrm?= =?UTF-8?q?=E4=B9=9F=E6=9C=89=E6=A8=A1=E6=9D=BF=E6=9D=83=E9=99=90=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A1=86=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormDesigner.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index ef1177ece9..a703512aba 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1520,7 +1520,10 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private DesignerBaseOperate getLayoutBaseOperate(){ FormSelection selection = this.getSelectionModel().getSelection(); XCreator creator = selection.getSelectedCreator(); - XLayoutContainer container = (XLayoutContainer) creator.getParent(); + XLayoutContainer container = null; + if (creator != null) { + container = (XLayoutContainer) creator.getParent(); + } if (container == null) { return new DefaultDesignerBaseOperate(); } From 7040a69a398b4f14d2b2abaa9871c74649c78d61 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 15 Feb 2022 10:26:22 +0800 Subject: [PATCH 079/113] =?UTF-8?q?REPORT-66465=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=EF=BC=8C?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=89=93=E5=BC=80=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 windows平台上使用7.15版本的JxBrowser 【改动思路】 同上 --- .../ui/online/mini/MiniComponentShopPane.java | 23 ++++- .../mini/bridge/ComposedNativeBridges.java | 19 ++-- .../online/mini/bridge/NativeAuthBridge.java | 3 + .../mini/bridge/NativeBrowserBridge.java | 13 +-- .../mini/bridge/NativeProductBridge.java | 86 ++++++++++++------- .../online/mini/bridge/NativeTaskBridge.java | 21 ++--- .../mini/bridge/SafeJSFunctionInvoker.java | 29 +++++-- 7 files changed, 126 insertions(+), 68 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java index 843638d192..9b980f14b2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java @@ -3,15 +3,18 @@ package com.fr.design.mainframe.share.ui.online.mini; import com.fr.design.mainframe.share.ui.online.mini.bridge.ComposedNativeBridges; import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.ui.ModernUIPane; +import com.fr.design.ui.compatible.ModernUIPaneFactory; import com.fr.design.upm.event.CertificateEvent; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import com.teamdev.jxbrowser.js.JsObject; +import org.jetbrains.annotations.Nullable; -import javax.swing.JOptionPane; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -27,14 +30,26 @@ public class MiniComponentShopPane extends JPanel { public MiniComponentShopPane() { setLayout(new BorderLayout()); - modernUIPane = new ModernUIPane.Builder<>() + modernUIPane = ModernUIPaneFactory.modernUIPaneBuilder() .withURL(OnlineShopUtils.getWebMiniShopPath()) - .prepare(new ScriptContextAdapter() { + .prepareForV6(new ScriptContextAdapter() { @Override public void onScriptContextCreated(ScriptContextEvent event) { super.onScriptContextCreated(event); JSObject window = event.getBrowser().executeJavaScriptAndReturnValue("window").asObject(); - window.asObject().setProperty("ShopHelper", new ComposedNativeBridges(window, JOptionPane.getFrameForComponent(MiniComponentShopPane.this))); + window.setProperty("ShopHelper", new ComposedNativeBridges(window)); + } + }) + .prepareForV7(new InjectJsCallback() { + @Nullable + @Override + public Response on(Params params) { + // 7.x + JsObject window = params.frame().executeJavaScript("window"); + if (window != null) { + window.putProperty("ShopHelper", new ComposedNativeBridges(window)); + } + return InjectJsCallback.Response.proceed(); } }) .build(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java index ea729a1452..3a09774c53 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/ComposedNativeBridges.java @@ -1,9 +1,7 @@ package com.fr.design.mainframe.share.ui.online.mini.bridge; import com.teamdev.jxbrowser.chromium.JSAccessible; -import com.teamdev.jxbrowser.chromium.JSObject; - -import java.awt.Window; +import com.teamdev.jxbrowser.js.JsAccessible; /** * @author Starryi @@ -12,14 +10,19 @@ import java.awt.Window; */ public class ComposedNativeBridges { @JSAccessible - public final NativeBrowserBridge Browser; + @JsAccessible + public final Object Browser; + @JSAccessible - public final NativeAuthBridge Auth; + @JsAccessible + public final Object Auth; + @JSAccessible - public final NativeProductBridge Product; + @JsAccessible + public final Object Product; - public ComposedNativeBridges(JSObject window, Window nativeWindow) { - this.Browser = new NativeBrowserBridge(nativeWindow); + public ComposedNativeBridges(Object window) { + this.Browser = new NativeBrowserBridge(); this.Auth = new NativeAuthBridge(); this.Product = new NativeProductBridge(window); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java index a78a3b231c..42f3a6c655 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeAuthBridge.java @@ -6,6 +6,7 @@ import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.js.JsAccessible; import java.awt.Window; import java.util.HashMap; @@ -17,12 +18,14 @@ import java.util.HashMap; */ public class NativeAuthBridge { @JSAccessible + @JsAccessible @JSBridge public String getLoginUsername() { return DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); } @JSAccessible + @JsAccessible @JSBridge public void goLogin() { Window parentWindow = MiniComponentShopDialog.getInstance().getWindow(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java index e062658749..ee77a8b95a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeBrowserBridge.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.share.ui.online.mini.bridge; import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.mainframe.share.ui.online.mini.MiniComponentShopDialog; import com.teamdev.jxbrowser.chromium.JSAccessible; +import com.teamdev.jxbrowser.js.JsAccessible; import java.awt.Window; @@ -11,15 +13,14 @@ import java.awt.Window; * Created by Starryi on 2021/12/20 */ public class NativeBrowserBridge { - private final Window nativeWindow; - - public NativeBrowserBridge(Window nativeWindow) { - this.nativeWindow = nativeWindow; - } @JSAccessible + @JsAccessible @JSBridge public void dispose() { - this.nativeWindow.dispose(); + Window nativeWindow = MiniComponentShopDialog.getInstance().getWindow(); + if (nativeWindow != null) { + nativeWindow.dispose(); + } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java index e9daf3e0e5..0da415a5d8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java @@ -21,8 +21,7 @@ import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.json.JSONObject; import com.fr.stable.StringUtils; import com.teamdev.jxbrowser.chromium.JSAccessible; -import com.teamdev.jxbrowser.chromium.JSFunction; -import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.js.JsAccessible; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -38,20 +37,21 @@ import java.util.Set; * Created by Starryi on 2021/12/20 */ public class NativeProductBridge { - private final JSObject window; + private final Object window; private static final Map executingComponentInstallationTasks = new HashMap<>(); private static final Map executingComponentsPackageInstallationTasks = new HashMap<>(); private static final Map executingTemplateThemeInstallationTasks = new HashMap<>(); - private final Map> componentDownloadTaskStartListeners = new HashMap<>(); - private final Map> componentsPackageDownloadTaskStartListeners = new HashMap<>(); - private final Map> themeDownloadTaskStartListeners = new HashMap<>(); + private final Map> componentDownloadTaskStartListeners = new HashMap<>(); + private final Map> componentsPackageDownloadTaskStartListeners = new HashMap<>(); + private final Map> themeDownloadTaskStartListeners = new HashMap<>(); - public NativeProductBridge(JSObject window) { + public NativeProductBridge(Object window) { this.window = window; } @JSAccessible + @JsAccessible @JSBridge public boolean isProductDownloaded(String uuid) { for (Group group : DefaultShareGroupManager.getInstance().getAllGroup()) { @@ -66,16 +66,17 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge - public void addProductDownloadTaskStartListener(String json, JSFunction function) { + public void addProductDownloadTaskStartListener(String json, Object function) { JSONObject object = new JSONObject(json); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); String uuid = widget.getUuid(); boolean isPackage = widget.isWidgetPackage(); - Map> downloadTaskGetters = + Map> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; - Set startListeners = downloadTaskGetters.get(widget.getUuid()); + Set startListeners = downloadTaskGetters.get(widget.getUuid()); if (startListeners == null) { startListeners = new HashSet<>(); } @@ -86,16 +87,17 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge - public void removeProductDownloadTaskStartListener(String json, JSFunction function) { + public void removeProductDownloadTaskStartListener(String json, Object function) { JSONObject object = new JSONObject(json); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); String uuid = widget.getUuid(); boolean isPackage = widget.isWidgetPackage(); - Map> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; + Map> downloadTaskGetters = isPackage ? componentsPackageDownloadTaskStartListeners : componentDownloadTaskStartListeners; - Set startListeners = downloadTaskGetters.get(uuid); + Set startListeners = downloadTaskGetters.get(uuid); if (startListeners == null) { startListeners = new HashSet<>(); } @@ -104,6 +106,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge public Object getExecutingProductDownloadTask(String json) { JSONObject object = new JSONObject(json); @@ -121,22 +124,24 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge public Object createProductDownloadTask(String json) { JSONObject object = new JSONObject(json); OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); int childrenCount = object.optInt("pkgsize", 0); if (childrenCount > 0) { - return new ComponentsPackageInstallationTask(window, widget, childrenCount); + return new ComponentsPackageInstallationTask(this, window, widget, childrenCount); } else { - return new ComponentInstallationTask(window, widget); + return new ComponentInstallationTask(this, window, widget); } } @JSAccessible + @JsAccessible @JSBridge - public void addThemeDownloadTaskStartListener(String themePath, JSFunction function) { - Set startListeners = themeDownloadTaskStartListeners.get(themePath); + public void addThemeDownloadTaskStartListener(String themePath, Object function) { + Set startListeners = themeDownloadTaskStartListeners.get(themePath); if (startListeners == null) { startListeners = new HashSet<>(); } @@ -145,9 +150,10 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge - public void removeThemeDownloadTaskStartListener(String themePath, JSFunction function) { - Set startListeners = themeDownloadTaskStartListeners.get(themePath); + public void removeThemeDownloadTaskStartListener(String themePath, Object function) { + Set startListeners = themeDownloadTaskStartListeners.get(themePath); if (startListeners == null) { startListeners = new HashSet<>(); } @@ -156,9 +162,10 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge public Object getExecutingThemeDownloadTask(String themePath) { - NativeTaskBridge task = executingTemplateThemeInstallationTasks.get(themePath); + NativeTaskBridge task = (NativeTaskBridge) executingTemplateThemeInstallationTasks.get(themePath); if (task != null) { task.checkJSEnvChange(this.window); } @@ -166,17 +173,20 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge public Object createTemplateThemeDownloadTask(String themePath) { - return new TemplateThemeInstallationTask(window, themePath); + return new TemplateThemeInstallationTask(this, window, themePath); } - public class ComponentInstallationTask extends NativeTaskBridge { + public static class ComponentInstallationTask extends NativeTaskBridge { + private final NativeProductBridge env; private final OnlineShareWidget widget; private final ComponentInstallation action; - public ComponentInstallationTask(JSObject window, OnlineShareWidget widget) { + public ComponentInstallationTask(NativeProductBridge env, Object window, OnlineShareWidget widget) { super(window); + this.env = env; this.widget = widget; action = new ComponentInstallation(widget); action.setActionListener(new AsyncInstallation.AsyncActionListener() { @@ -203,6 +213,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void execute() { @@ -231,6 +242,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void cancel() { @@ -246,8 +258,8 @@ public class NativeProductBridge { @Override protected void fireStartEvent(String event) { executingComponentInstallationTasks.put(widget.getUuid(), this); - Set startListeners = componentDownloadTaskStartListeners.get(widget.getUuid()); - SafeJSFunctionInvoker.invoke(startListeners, window); + Set startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid()); + SafeJSFunctionInvoker.invoke(startListeners, env.window); super.fireStartEvent(event); } @@ -264,14 +276,16 @@ public class NativeProductBridge { } } - public class ComponentsPackageInstallationTask extends NativeTaskBridge { + public static class ComponentsPackageInstallationTask extends NativeTaskBridge { + private final NativeProductBridge env; private final ComponentsPackageInstallation action; private final OnlineShareWidget widget; private final int childrenCount; - public ComponentsPackageInstallationTask(JSObject window, OnlineShareWidget widget, int childrenCount) { + public ComponentsPackageInstallationTask(NativeProductBridge env, Object window, OnlineShareWidget widget, int childrenCount) { super(window); + this.env = env; this.widget = widget; this.childrenCount = childrenCount; action = new ComponentsPackageInstallation(widget, childrenCount); @@ -299,6 +313,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void execute() { @@ -343,6 +358,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void cancel() { @@ -360,8 +376,8 @@ public class NativeProductBridge { executingComponentsPackageInstallationTasks.put(widget.getUuid(), this); super.fireStartEvent(event); - Set startListeners = componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); - SafeJSFunctionInvoker.invoke(startListeners, window); + Set startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); + SafeJSFunctionInvoker.invoke(startListeners, env.window); } @Override @@ -377,11 +393,13 @@ public class NativeProductBridge { } } - public class TemplateThemeInstallationTask extends NativeTaskBridge { + public static class TemplateThemeInstallationTask extends NativeTaskBridge { + private final NativeProductBridge env; private final String themePath; private final TemplateThemeInstallation action; - public TemplateThemeInstallationTask(JSObject window, String themePath) { + public TemplateThemeInstallationTask(NativeProductBridge env, Object window, String themePath) { super(window); + this.env = env; this.themePath = themePath; Window miniShopWindow = MiniComponentShopDialog.getInstance().getWindow(); action = new TemplateThemeInstallation(miniShopWindow, themePath); @@ -404,6 +422,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void execute() { @@ -418,6 +437,7 @@ public class NativeProductBridge { } @JSAccessible + @JsAccessible @JSBridge @Override public void cancel() { @@ -433,8 +453,8 @@ public class NativeProductBridge { @Override protected void fireStartEvent(String event) { executingTemplateThemeInstallationTasks.put(themePath, this); - Set startListeners = themeDownloadTaskStartListeners.get(themePath); - SafeJSFunctionInvoker.invoke(startListeners, window); + Set startListeners = env.themeDownloadTaskStartListeners.get(themePath); + SafeJSFunctionInvoker.invoke(startListeners, env.window); super.fireStartEvent(event); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java index eb343c623c..06c26c0186 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java @@ -4,12 +4,9 @@ import com.fr.design.bridge.exec.JSBridge; import com.fr.design.mainframe.share.mini.MiniShopNativeTask; import com.fr.design.mainframe.share.mini.MiniShopNativeTaskManager; import com.teamdev.jxbrowser.chromium.JSAccessible; -import com.teamdev.jxbrowser.chromium.JSFunction; -import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.js.JsAccessible; -import java.util.HashMap; import java.util.HashSet; -import java.util.Map; import java.util.Set; /** @@ -19,14 +16,14 @@ import java.util.Set; */ public class NativeTaskBridge implements MiniShopNativeTask { - private JSObject window; - protected final Set statusCbs = new HashSet<>(); + private Object window; + protected final Set statusCbs = new HashSet<>(); - public NativeTaskBridge(JSObject window) { + public NativeTaskBridge(Object window) { this.window = window; } - public void checkJSEnvChange(JSObject window) { + public void checkJSEnvChange(Object window) { if (this.window != window) { this.window = window; this.statusCbs.clear(); @@ -35,24 +32,28 @@ public class NativeTaskBridge implements MiniShopNativeTask { @JSBridge @JSAccessible - public void addStatusCallback(JSFunction cb) { + @JsAccessible + public void addStatusCallback(Object cb) { this.statusCbs.add(cb); } @JSBridge @JSAccessible - public void removeStatusCallback(JSFunction cb) { + @JsAccessible + public void removeStatusCallback(Object cb) { this.statusCbs.remove(cb); } @JSBridge @JSAccessible + @JsAccessible @Override public void execute() { } @JSBridge @JSAccessible + @JsAccessible @Override public void cancel() { MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java index 238376f9ed..e5bf71da87 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/SafeJSFunctionInvoker.java @@ -2,6 +2,8 @@ package com.fr.design.mainframe.share.ui.online.mini.bridge; import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.js.JsFunction; +import com.teamdev.jxbrowser.js.JsObject; import java.util.Collection; @@ -12,18 +14,31 @@ import java.util.Collection; */ public class SafeJSFunctionInvoker { - public static void invoke(Collection functions, JSObject instance, Object... args) { + public static void invoke(Collection functions, Object instance, Object... args) { if (functions != null) { - for (JSFunction function: functions) { - if (function != null && !function.getContext().isDisposed()) { - function.invoke(instance, args); - } + for (Object function: functions) { + invoke(function, instance, args); } } } - public static void invoke(JSFunction function, JSObject instance, Object... args) { - if (function != null && !function.getContext().isDisposed()) { + + public static void invoke(Object function, Object instance, Object... args) { + if (function != null) { + if (function instanceof JSFunction && instance instanceof JSObject) { + invokeV6((JSFunction) function, (JSObject) instance, args); + } else if (function instanceof JsFunction && instance instanceof JsObject) { + invokeV7((JsFunction) function, (JsObject) instance, args); + } + } + } + + private static void invokeV6(JSFunction function, JSObject instance, Object... args) { + if (!function.getContext().isDisposed()) { function.invoke(instance, args); } } + + private static void invokeV7(JsFunction function, JsObject instance, Object... args) { + function.invoke(instance, args); + } } From 45ae58a91ae87178f81a682161fdc42a4321d42f Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Tue, 15 Feb 2022 11:28:07 +0800 Subject: [PATCH 080/113] =?UTF-8?q?REPORT-64011=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=A7=E6=96=87=E6=9C=AC=20-=20=E5=85=88=E5=9B=9E=E9=80=80?= =?UTF-8?q?=EF=BC=8C=E7=AD=89=E6=96=B0=E5=89=8D=E7=AB=AF=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=AE=8C=E4=BA=86=E5=86=8D=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellOtherSetPane.java | 171 +----------------- 1 file changed, 10 insertions(+), 161 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 99a0d9bf48..efab3fc66e 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 @@ -12,10 +12,8 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; 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.layout.VerticalFlowLayout; @@ -60,8 +58,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private static final int HEAD_HEIGTH = 24; private static final int COMBO_WIDTH = 154; private static final int BUTTON_GROUP_WIDTH = 140; - private static final double f = TableLayout.FILL; - private static final double p = TableLayout.PREFERRED; // normal private UIButtonGroup autoshrik; @@ -71,20 +67,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIComboBox showContent; - //内容提示 - private UIButtonGroup tooltipButtonGroup; - private CardLayout tooltipLayout; - private JPanel tooltipPane; private UITextField tooltipTextField; - //文本超出时隐藏 - private UICheckBox textOverflowCheckBox; - private UIComboBox showPartComboBox; - private CardLayout showPartLayout; - private JPanel showPartPane; - private UISpinner showCharNums; - private UIComboBox textOverflowTypeComboBox; - private UITextField fileNameTextField; // 分页 @@ -230,16 +214,17 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private JPanel seniorUpPane() { JPanel pane = new JPanel(new BorderLayout()); // TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。 - pane.add(createTextOverflowPane(), BorderLayout.SOUTH); pane.add(createShowContentPane(), BorderLayout.CENTER); pane.add(createSeniorCheckPane(), BorderLayout.NORTH); return pane; } private JPanel createShowContentPane() { - double[] rowSize = {p, p, p, p}; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; double[] colSize = {f, COMBO_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; JPanel fileNamePane = createNormal(); fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); @@ -248,96 +233,21 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UIComponentUtils.setLineWrap(showContentLabel); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); - tooltipLayout = new CardLayout(); - tooltipPane = new JPanel(tooltipLayout); - tooltipPane.add(new JPanel(), "none"); - tooltipPane.add(tooltipTextField, "content"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); - tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); - tooltipButtonGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.setPreferredSize(new Dimension(154, 20)); - tooltipLayout.show(tooltipPane, "content"); - } else { - tooltipLayout.show(tooltipPane, "none"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); - } - } - }); + JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); + toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); Component[][] components = new Component[][]{ new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 - new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" - new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行 + new Component[]{toolTipLabel, toolTipTextFieldWrapper} }; JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); + showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0)); return showContentPane; } - private JPanel createTextOverflowPane() { - showPartLayout = new CardLayout(); - showPartPane = new JPanel(showPartLayout); - showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10); - JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0)); - showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST); - showPartNumPane.add(showCharNums, BorderLayout.CENTER); - showPartPane.add(new JPanel(), "none"); - showPartPane.add(showPartNumPane, "content"); - showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")}); - showPartComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - 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)); - } - } - }); - - textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); - UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":"); - UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":"); - Component[][] textOverflowComponents = new Component[][]{ - new Component[]{showPartLabel, showPartComboBox, showPartPane}, - new Component[]{hideTypeLabel, textOverflowTypeComboBox, null} - }; - JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p}); - textOverflowComPane.setVisible(false); - textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); - textOverflowCheckBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED); - if (e.getStateChange() == ItemEvent.SELECTED) { - 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)); - } - noAutoRadioButton.setSelected(true); - } - } - }); - JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - dynamicPaneWrapper.add(textOverflowComPane); - JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH); - textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER); - textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - return textOverflowPane; - } - private JPanel createSeniorCheckPane() { previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); @@ -461,11 +371,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); - tooltipButtonGroup.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group")); - textOverflowCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); - showPartComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart")); - showCharNums.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")); - textOverflowTypeComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); } @@ -524,40 +429,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else { showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); } - if (cellGUIAttr.isCustomTooltip()) { - tooltipButtonGroup.setSelectedIndex(0); - tooltipTextField.setText(cellGUIAttr.getTooltipText()); - } else { - tooltipButtonGroup.setSelectedIndex(1); - } - if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.setPreferredSize(new Dimension(100, 20)); - tooltipLayout.show(tooltipPane, "content"); - } else { - tooltipLayout.show(tooltipPane, "none"); - tooltipPane.setPreferredSize(new Dimension(0, 0)); - } - tooltipPane.setVisible(true); - if (cellGUIAttr.isHideTextWhenOverflow()) { - textOverflowCheckBox.setSelected(true); - if (cellGUIAttr.isShowCharNum()) { - showPartComboBox.setSelectedIndex(0); - showCharNums.setValue(cellGUIAttr.getShowCharNums()); - } else { - showPartComboBox.setSelectedIndex(1); - } - showPartPane.setVisible(true); - if (cellGUIAttr.isTextOverflowEllipsis()) { - textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis")); - } else { - textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")); - } - } else { - showPartComboBox.setSelectedIndex(0); - showCharNums.setValue(cellGUIAttr.getShowCharNums()); - textOverflowTypeComboBox.setSelectedIndex(0); - textOverflowCheckBox.setSelected(false); - } + tooltipTextField.setText(cellGUIAttr.getTooltipText()); CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 if (cellPageAttr == null) { cellPageAttr = new CellPageAttr(); @@ -649,18 +521,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setFileName(fileNameTextField.getText()); } } - if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"))) { - cellGUIAttr.setCustomTooltip(tooltipButtonGroup.getSelectedIndex() == 0); - if (tooltipButtonGroup.getSelectedIndex() == 0) { - if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { - cellGUIAttr.setTooltipText(fieldName); - } else { - cellGUIAttr.setTooltipText(tooltipTextField.getText()); - } - } else if (tooltipButtonGroup.getSelectedIndex() == 1) { - cellGUIAttr.setTooltipText("=$$$"); - } - } + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) { if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { cellGUIAttr.setTooltipText(fieldName); @@ -668,18 +529,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setTooltipText(tooltipTextField.getText()); } } - if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"))) { - cellGUIAttr.setHideTextWhenOverflow(textOverflowCheckBox.isSelected()); - } - if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"))) { - cellGUIAttr.setShowCharNum(showPartComboBox.getSelectedIndex() == 0); - } - if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"))) { - cellGUIAttr.setShowCharNums((int) showCharNums.getValue()); - } - if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"))) { - cellGUIAttr.setTextOverflowEllipsis(textOverflowTypeComboBox.getSelectedIndex() == 0); - } // 如果与默认的CellGUIAttr相同,就不用保存这个属性了 if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) { cellElement.setCellGUIAttr(cellNullGUIAttr); From a01d78599f7744f4c801de968566bd73f57cb9a4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 15 Feb 2022 15:41:45 +0800 Subject: [PATCH 081/113] =?UTF-8?q?REPORT-66465=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=EF=BC=8C?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=89=93=E5=BC=80=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 调试模式下禁止HTTPS证书验证,使得商城测试服务器 可以正常访问 【改动思路】 同上 --- .../fr/design/ui/compatible/NewModernUIPane.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java index d755d4e05f..0b56fc0ad6 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java @@ -17,8 +17,11 @@ import com.teamdev.jxbrowser.engine.EngineOptions; import com.teamdev.jxbrowser.engine.RenderingMode; import com.teamdev.jxbrowser.event.Observer; import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.net.Network; import com.teamdev.jxbrowser.net.Scheme; +import com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback; import com.teamdev.jxbrowser.view.swing.BrowserView; +import org.jetbrains.annotations.Nullable; import java.awt.BorderLayout; @@ -108,6 +111,17 @@ public class NewModernUIPane extends ModernUIPane { } Engine engine = Engine.newInstance(builder.build()); + if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + // 调试模式下,禁止HTTPS证书验证,使得可以正常访问商城测试服务器等 + Network network = engine.network(); + network.set(VerifyCertificateCallback.class, new VerifyCertificateCallback() { + @Nullable + @Override + public Response on(Params params) { + return VerifyCertificateCallback.Response.valid(); + } + }); + } browser = engine.newBrowser(); // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 From 50754f75d2611da9e5265d3eaa819b3b073083ae Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 15 Feb 2022 17:08:04 +0800 Subject: [PATCH 082/113] =?UTF-8?q?REPORT-66807=20Mini=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=90=AF=E5=8A=A8=E6=9D=A5=E6=BA=90=E5=9F=8B?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 区分不同的启动来源,便于埋点分析 【改动思路】 同上 --- .../design/mainframe/share/ui/online/OnlineWidgetTabPane.java | 2 +- .../share/ui/online/mini/MiniComponentShopDialog.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index 1ab2cec121..cfa5d799f1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -104,7 +104,7 @@ public class OnlineWidgetTabPane extends JPanel { @Override public void actionPerformed(ActionEvent e) { if (OnlineShopUtils.testConnection() && ComponentShareUtil.isShowMiniShopWindow()) { - MiniComponentShopDialog.getInstance().show(); + MiniComponentShopDialog.getInstance().showFromOnlineRepoPane(); FormWidgetDetailPane.getInstance().switch2Local(); FormWidgetDetailPane.getInstance().enterWidgetLib(); } else { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index 81bc642b47..817adfa347 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -110,6 +110,10 @@ public class MiniComponentShopDialog { frame.setVisible(true); } + public void showFromOnlineRepoPane() { + show(); + } + public Container getContentPane() { if (frame != null) { return frame.getContentPane(); From 10528297b3994addaacd94ff1ea9cf1fd822c759 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 16 Feb 2022 14:58:45 +0800 Subject: [PATCH 083/113] =?UTF-8?q?REPORT-66808=20=20&&=20REPORT-66811=20?= =?UTF-8?q?=E3=80=90=E6=96=B0=E8=80=81=E8=87=AA=E9=80=82=E5=BA=94=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=9D=A2=E6=9D=BF=E4=BF=AE=E6=94=B9=E3=80=91=E8=80=81?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F-PC=E7=AB=AF=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=9A=84=E2=80=9C=E6=8A=A5=E8=A1=A8=E2=80=9D?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=BB=98=E8=AE=A4=E6=97=B6=EF=BC=8C=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=A2=84=E6=9C=9F=E6=98=AF=E6=9C=89=E4=B8=AA=E2=80=9C?= =?UTF-8?q?=E5=B7=B2=E9=80=89=E6=8B=A9=E9=BB=98=E8=AE=A4balabala=E2=80=9D?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E7=9A=84=EF=BC=8C=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=B9=88=E6=9C=89=EF=BC=9B=E3=80=90=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=E3=80=91=E8=80=81=E6=A8=A1=E5=BC=8F-?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=96=87=E6=A1=A3=E9=87=8C=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E2=80=9C=E6=8A=A5=E8=A1=A8=E7=BC=A9=E6=94=BE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E2=80=9D=E5=8F=AF=E9=80=89=E2=80=9C=E5=8F=8C=E5=90=91=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E2=80=9D=E2=80=9C=E4=B8=8D=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E2=80=9D=EF=BC=8C=E7=8E=B0=E5=9C=A8=E7=9A=84=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E6=98=AF=E2=80=9C=E5=9B=BA=E5=AE=9A=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E2=80=9D=E2=80=9C=E9=80=82=E5=BA=94=E5=8C=BA=E5=9F=9F=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/fit/FormFitAttrModelType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 658eece8e0..c43aa057d8 100644 --- 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 @@ -27,8 +27,8 @@ public enum FormFitAttrModelType { @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) + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WAbsoluteLayout.STATE_FIT), + new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), WAbsoluteLayout.STATE_FIXED) }; } From 01a40a1e7bbde69f71e6252e821fda3e54058f68 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 16 Feb 2022 14:59:14 +0800 Subject: [PATCH 084/113] =?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 --- .../layout/ElementEditorDefinePane.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java index 3eb947488e..8f1e1c994c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java @@ -7,22 +7,28 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.*; import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.attrpane.PcFitExpandablePane; +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.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.PaddingMargin; import com.fr.form.web.FormToolBarManager; import com.fr.general.ComparatorUtils; +import com.fr.report.fit.FitProvider; import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.util.ArrayList; import java.util.List; @@ -78,11 +84,23 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane Date: Wed, 16 Feb 2022 18:37:41 +0800 Subject: [PATCH 085/113] =?UTF-8?q?REPORT-66254=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E6=89=93=E5=BC=80=E5=95=86=E5=9F=8E=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=88=B0=E5=95=86=E5=9F=8E=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=EF=BC=8C=E6=9C=9F=E9=97=B4=E5=A4=A7=E6=A6=82?= =?UTF-8?q?=E6=9C=895=E7=A7=92=E7=A9=BA=E7=99=BD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BC=98=E5=8C=96=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 网络加载时间比较长,从而出现空白画面 2. 前端资源JS中存在相对地址的fetch请求,因而无法将JS缓存到本地使用 为了缓存空白问题,关闭商城窗口时重新加载数据,清除页面状态,同时不清除 窗口内存资源。从而再下次打开时,可以直接展示该窗口对象,提高展示效率。 【改动思路】 同上 --- .../share/ui/online/mini/MiniComponentShopDialog.java | 3 +-- .../share/ui/online/mini/MiniComponentShopPane.java | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index 817adfa347..ab17b0de30 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -67,8 +67,7 @@ public class MiniComponentShopDialog { for (WindowListener listener: windowListeners) { listener.windowClosed(e); } - getInstance().frame = null; - shopPane.dispose(); + shopPane.reload(); } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java index 9b980f14b2..f9d3849f78 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopPane.java @@ -59,13 +59,13 @@ public class MiniComponentShopPane extends JPanel { loginListener = new Listener() { @Override public void on(Event event, String param) { - modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); + reload(); } }; logoutListener = new Listener() { @Override public void on(Event event, String param) { - modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); + reload(); } }; @@ -78,4 +78,8 @@ public class MiniComponentShopPane extends JPanel { EventDispatcher.stopListen(loginListener); EventDispatcher.stopListen(logoutListener); } + + public void reload() { + modernUIPane.redirect(OnlineShopUtils.getWebMiniShopPath()); + } } From 776c38aa4e32a939675de8f5e5639a7ffd0ad810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 14:08:18 +0800 Subject: [PATCH 086/113] =?UTF-8?q?REPORT-66884=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E7=BB=84=E4=BB=B6=E6=97=B6=E5=80=99=E5=A4=87?= =?UTF-8?q?=E4=BB=BD=E7=BB=84=E4=BB=B6=E7=9A=84=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/DraggingModel.java | 10 ---------- .../mainframe/FormCreatorDropTarget.java | 6 +----- .../com/fr/design/mainframe/FormDesigner.java | 20 +++++++------------ .../guide/creator/GuideCreateUtils.java | 7 ++++--- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java index 6308ff70b5..95e003faf3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java @@ -14,7 +14,6 @@ public class DraggingModel { private MouseEvent currentDragEvent; private int creatorLeftTopX = -999; // 隐藏 private int creatorLeftTopY = -999; // 隐藏 - private boolean dragNewWidget; // 是否正在拖拽一个新的组件下来 public DraggingModel() { @@ -40,11 +39,6 @@ public class DraggingModel { return this; } - public DraggingModel dragNewWidget(boolean dragNewWidget) { - this.dragNewWidget = dragNewWidget; - return this; - } - public FormDesigner getDesigner() { return designer; } @@ -79,10 +73,6 @@ public class DraggingModel { return creatorLeftTopY; } - public boolean isDragNewWidget() { - return dragNewWidget; - } - public void moveTo(int x, int y) { XLayoutContainer container = designer.getDraggingHotspotLayout(); LayoutAdapter adapter = container.getLayoutAdapter(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index aa58d713e5..62e256379c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -264,11 +264,7 @@ public class FormCreatorDropTarget extends DropTarget { Point loc = dtde.getLocation(); int x = designer.getRelativeX(loc.x); int y = designer.getRelativeY(loc.y); - if (model.isDragNewWidget()) { - designer.addNewWidget(creator, x, y); - } else { - designer.changeWidgetPlace(creator, x, y); - } + designer.addWidgetToForm(creator, x, y); // 放到事件末尾执行 SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index a703512aba..0e28ef3b69 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1252,12 +1252,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection return; } + instantiateCreator(xCreator); draggingModel = new DraggingModel() .designer(this) .creator(xCreator) .startDragEvent(startDragEvent) - .currentDragEvent(currentDragEvent) - .dragNewWidget(true); + .currentDragEvent(currentDragEvent); this.setDropTarget(new FormCreatorDropTarget(this, xCreator)); repaint(); } @@ -1273,12 +1273,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection if (currentDragEvent == null || this.getDropTarget() != null) { return; } + backUpCreator(xCreator); draggingModel = new DraggingModel() .designer(this) .creator(xCreator) .startDragEvent(startDragEvent) - .currentDragEvent(currentDragEvent) - .dragNewWidget(false); + .currentDragEvent(currentDragEvent); XLayoutContainer container = this.getDraggingHotspotLayout(); LayoutAdapter adapter = container.getLayoutAdapter(); adapter.dragging(this.getDraggingModel()); @@ -1990,7 +1990,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection return spacingLineDrawer; } - private void instantiateCreator(XCreator creator) { + public void instantiateCreator(XCreator creator) { ModelUtil.renameWidgetName(this.getTarget(), creator); creator.addNotify(); @@ -1999,18 +1999,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); } - public void addNewWidget(XCreator creator, int x, int y) { - instantiateCreator(creator); - addWidgetToForm(creator, x, y); - } - - public void changeWidgetPlace(XCreator creator, int x, int y) { + public void backUpCreator(XCreator creator) { creator.backupCurrentSize(); creator.backupParent(); - addWidgetToForm(creator, x, y); } - private void addWidgetToForm(XCreator creator, int x, int y) { + public void addWidgetToForm(XCreator creator, int x, int y) { if(creator == null) { return; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java index bb21208740..bb651cce93 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java @@ -130,12 +130,13 @@ public class GuideCreateUtils { return; } FormDesigner designer = GuideCreateUtils.getFormDesigner(); - designer.getSelectionModel().selectACreator(xLayoutContainer); if (dragNewComponent) { - designer.addNewWidget(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); + designer.instantiateCreator(xCreator); } else { - designer.changeWidgetPlace(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); + designer.backUpCreator(xCreator); } + designer.getSelectionModel().selectACreator(xLayoutContainer); + designer.addWidgetToForm(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); designer.getSelectionModel().selectACreator(xCreator); } From ea6418f46c3fde3215be95fd700306f36d4ef6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 14:19:10 +0800 Subject: [PATCH 087/113] REPORT-66884 --- .../com/fr/design/mainframe/FormDesigner.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 0e28ef3b69..2b43265f9a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1991,17 +1991,21 @@ public class FormDesigner extends TargetComponent implements TreeSelection } public void instantiateCreator(XCreator creator) { - ModelUtil.renameWidgetName(this.getTarget(), creator); - creator.addNotify(); + if (creator != null) { + ModelUtil.renameWidgetName(this.getTarget(), creator); + creator.addNotify(); - ComponentAdapter adapter = new CompositeComponentAdapter(this, creator); - adapter.initialize(); - creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); + ComponentAdapter adapter = new CompositeComponentAdapter(this, creator); + adapter.initialize(); + creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); + } } public void backUpCreator(XCreator creator) { - creator.backupCurrentSize(); - creator.backupParent(); + if (creator != null) { + creator.backupCurrentSize(); + creator.backupParent(); + } } public void addWidgetToForm(XCreator creator, int x, int y) { From dcc0f0ad2a85c4dfee77c3b732435a10c4569023 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 17 Feb 2022 14:47:16 +0800 Subject: [PATCH 088/113] =?UTF-8?q?REPORT-66930=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E7=BD=91=E6=85=A2=E6=97=B6=E5=A4=9A=E6=AC=A1=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=B8=8B=E8=BD=BD=E5=87=BA=E7=8E=B0=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 存在任务重复创建和执行的问题 【改动思路】 同上 --- .../mini/bridge/NativeProductBridge.java | 73 ++++++++++++++----- .../online/mini/bridge/NativeTaskBridge.java | 6 ++ 2 files changed, 62 insertions(+), 17 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java index 0da415a5d8..e6a4f720cc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java @@ -37,10 +37,15 @@ import java.util.Set; * Created by Starryi on 2021/12/20 */ public class NativeProductBridge { + private static final Map createdComponentInstallationTasks = new HashMap<>(); + private static final Map createdComponentsPackageInstallationTasks = new HashMap<>(); + private static final Map createdTemplateThemeInstallationTasks = new HashMap<>(); + + private static final Map startedComponentInstallationTasks = new HashMap<>(); + private static final Map startedComponentsPackageInstallationTasks = new HashMap<>(); + private static final Map startedTemplateThemeInstallationTasks = new HashMap<>(); + private final Object window; - private static final Map executingComponentInstallationTasks = new HashMap<>(); - private static final Map executingComponentsPackageInstallationTasks = new HashMap<>(); - private static final Map executingTemplateThemeInstallationTasks = new HashMap<>(); private final Map> componentDownloadTaskStartListeners = new HashMap<>(); private final Map> componentsPackageDownloadTaskStartListeners = new HashMap<>(); @@ -115,7 +120,7 @@ public class NativeProductBridge { boolean isPackage = widget.isWidgetPackage(); Map executingDownloadTask = - isPackage ? executingComponentsPackageInstallationTasks : executingComponentInstallationTasks; + isPackage ? startedComponentsPackageInstallationTasks : startedComponentInstallationTasks; NativeTaskBridge task = executingDownloadTask.get(uuid); if (task != null) { task.checkJSEnvChange(this.window); @@ -131,9 +136,22 @@ public class NativeProductBridge { OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object); int childrenCount = object.optInt("pkgsize", 0); if (childrenCount > 0) { - return new ComponentsPackageInstallationTask(this, window, widget, childrenCount); + if (createdComponentsPackageInstallationTasks.containsKey(widget.getUuid())) { + return createdComponentsPackageInstallationTasks.get(widget.getUuid()); + } else { + ComponentsPackageInstallationTask task = new ComponentsPackageInstallationTask(this, window, widget, childrenCount); + createdComponentsPackageInstallationTasks.put(widget.getUuid(), task); + return task; + } + } else { - return new ComponentInstallationTask(this, window, widget); + if (createdComponentInstallationTasks.containsKey(widget.getUuid())) { + return createdComponentInstallationTasks.get(widget.getUuid()); + } else { + ComponentInstallationTask task = new ComponentInstallationTask(this, window, widget); + createdComponentInstallationTasks.put(widget.getUuid(), task); + return task; + } } } @@ -165,7 +183,7 @@ public class NativeProductBridge { @JsAccessible @JSBridge public Object getExecutingThemeDownloadTask(String themePath) { - NativeTaskBridge task = (NativeTaskBridge) executingTemplateThemeInstallationTasks.get(themePath); + NativeTaskBridge task = startedTemplateThemeInstallationTasks.get(themePath); if (task != null) { task.checkJSEnvChange(this.window); } @@ -176,7 +194,13 @@ public class NativeProductBridge { @JsAccessible @JSBridge public Object createTemplateThemeDownloadTask(String themePath) { - return new TemplateThemeInstallationTask(this, window, themePath); + if (createdTemplateThemeInstallationTasks.containsKey(themePath)) { + return createdTemplateThemeInstallationTasks.get(themePath); + } else { + TemplateThemeInstallationTask task = new TemplateThemeInstallationTask(this, window, themePath); + createdTemplateThemeInstallationTasks.put(themePath, task); + return task; + } } public static class ComponentInstallationTask extends NativeTaskBridge { @@ -217,6 +241,9 @@ public class NativeProductBridge { @JSBridge @Override public void execute() { + if (isExecuting) { + return; + } super.execute(); SwingUtilities.invokeLater(new Runnable() { @Override @@ -257,7 +284,7 @@ public class NativeProductBridge { @Override protected void fireStartEvent(String event) { - executingComponentInstallationTasks.put(widget.getUuid(), this); + startedComponentInstallationTasks.put(widget.getUuid(), this); Set startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid()); SafeJSFunctionInvoker.invoke(startListeners, env.window); super.fireStartEvent(event); @@ -265,13 +292,15 @@ public class NativeProductBridge { @Override protected void fireFailureEvent(String event) { - executingComponentInstallationTasks.remove(widget.getUuid()); + startedComponentInstallationTasks.remove(widget.getUuid()); + createdComponentInstallationTasks.remove(widget.getUuid()); super.fireFailureEvent(event); } @Override protected void fireSuccessEvent(String event) { - executingComponentInstallationTasks.remove(widget.getUuid()); + startedComponentInstallationTasks.remove(widget.getUuid()); + createdComponentInstallationTasks.remove(widget.getUuid()); super.fireSuccessEvent(event); } } @@ -317,6 +346,9 @@ public class NativeProductBridge { @JSBridge @Override public void execute() { + if (isExecuting) { + return; + } super.execute(); SwingUtilities.invokeLater(new Runnable() { @Override @@ -373,7 +405,7 @@ public class NativeProductBridge { @Override protected void fireStartEvent(String event) { - executingComponentsPackageInstallationTasks.put(widget.getUuid(), this); + startedComponentsPackageInstallationTasks.put(widget.getUuid(), this); super.fireStartEvent(event); Set startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid()); @@ -382,13 +414,15 @@ public class NativeProductBridge { @Override protected void fireFailureEvent(String event) { - executingComponentsPackageInstallationTasks.remove(widget.getUuid()); + startedComponentsPackageInstallationTasks.remove(widget.getUuid()); + createdComponentsPackageInstallationTasks.remove(widget.getUuid()); super.fireFailureEvent(event); } @Override protected void fireSuccessEvent(String event) { - executingComponentsPackageInstallationTasks.remove(widget.getUuid()); + startedComponentsPackageInstallationTasks.remove(widget.getUuid()); + createdComponentsPackageInstallationTasks.remove(widget.getUuid()); super.fireSuccessEvent(event); } } @@ -426,6 +460,9 @@ public class NativeProductBridge { @JSBridge @Override public void execute() { + if (isExecuting) { + return; + } super.execute(); SwingUtilities.invokeLater(new Runnable() { @Override @@ -452,7 +489,7 @@ public class NativeProductBridge { @Override protected void fireStartEvent(String event) { - executingTemplateThemeInstallationTasks.put(themePath, this); + startedTemplateThemeInstallationTasks.put(themePath, this); Set startListeners = env.themeDownloadTaskStartListeners.get(themePath); SafeJSFunctionInvoker.invoke(startListeners, env.window); super.fireStartEvent(event); @@ -460,13 +497,15 @@ public class NativeProductBridge { @Override protected void fireFailureEvent(String event) { - executingTemplateThemeInstallationTasks.remove(themePath); + startedTemplateThemeInstallationTasks.remove(themePath); + createdTemplateThemeInstallationTasks.remove(themePath); super.fireFailureEvent(event); } @Override protected void fireSuccessEvent(String event) { - executingTemplateThemeInstallationTasks.remove(themePath); + startedTemplateThemeInstallationTasks.remove(themePath); + createdTemplateThemeInstallationTasks.remove(themePath); super.fireSuccessEvent(event); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java index 06c26c0186..2929a35408 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java @@ -18,6 +18,7 @@ public class NativeTaskBridge implements MiniShopNativeTask { private Object window; protected final Set statusCbs = new HashSet<>(); + protected boolean isExecuting = false; public NativeTaskBridge(Object window) { this.window = window; @@ -49,6 +50,9 @@ public class NativeTaskBridge implements MiniShopNativeTask { @JsAccessible @Override public void execute() { + if (!isExecuting) { + isExecuting = true; + } } @JSBridge @@ -68,10 +72,12 @@ public class NativeTaskBridge implements MiniShopNativeTask { SafeJSFunctionInvoker.invoke(statusCbs, window, "PROGRESS", event); } protected void fireSuccessEvent(String event) { + isExecuting = false; MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); SafeJSFunctionInvoker.invoke(statusCbs, window, "SUCCESS", event); } protected void fireFailureEvent(String event) { + isExecuting = false; MiniShopNativeTaskManager.getInstance().removeCompletedTask(this); SafeJSFunctionInvoker.invoke(statusCbs, window, "FAILURE", event); } From 360daa5c1af55643ed8a4f2998b9f38b8d4b006e Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 17 Feb 2022 14:50:00 +0800 Subject: [PATCH 089/113] =?UTF-8?q?REPORT-66254=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=95=86=E5=9F=8E=E9=A3=8E=E6=A0=BC=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E6=89=93=E5=BC=80=E5=95=86=E5=9F=8E=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=88=B0=E5=95=86=E5=9F=8E=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=EF=BC=8C=E6=9C=9F=E9=97=B4=E5=A4=A7=E6=A6=82?= =?UTF-8?q?=E6=9C=895=E7=A7=92=E7=A9=BA=E7=99=BD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BC=98=E5=8C=96=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 补一下因为REPORT-66254优化改动,导致的在线组件库禁用提示面板显示不正常 的问题。优化后,再次打开Mini商城窗口不会重新创建Window,只会执行 setVisible,所以windowOpened回调方法没有执行。 【改动思路】 补充下windowOpened回调方法执行逻辑 同上 --- .../share/ui/online/mini/MiniComponentShopDialog.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java index ab17b0de30..be2d724667 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java @@ -106,6 +106,11 @@ public class MiniComponentShopDialog { if (frame == null) { frame = createFrame(); } + if (!frame.isVisible()) { + for (WindowListener listener: windowListeners) { + listener.windowOpened(null); + } + } frame.setVisible(true); } From 3d4902ed344f8e7c8f1b4158719004fd9f1b98d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 15:18:27 +0800 Subject: [PATCH 090/113] =?UTF-8?q?REPORT-66886=20=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E6=82=AC=E6=B5=AEn=E7=A7=92=E5=90=8E=E9=87=8A=E6=94=BE?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=B0=86=E7=BB=84=E4=BB=B6=E6=94=BE?= =?UTF-8?q?=E5=85=A5tab=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/events/AddingWidgetListenerTable.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java index 4825e88883..5d0889c358 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/AddingWidgetListenerTable.java @@ -28,23 +28,13 @@ public class AddingWidgetListenerTable { public void beforeAdded() { for (final AddingWidgetListener listener : listeners) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - listener.beforeAdded(); - } - }); + listener.beforeAdded(); } } public void afterAdded(boolean addResult) { for (final AddingWidgetListener listener : listeners) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - listener.afterAdded(addResult); - } - }); + listener.afterAdded(addResult); } } From 458cdf7a61439d11de5396283cf8368000ac4378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 17:07:14 +0800 Subject: [PATCH 091/113] REPORT-66827&REPORT-66947&REPORT-66946 --- .../main/java/com/fr/design/mainframe/EditingMouseListener.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index f48b60320d..0555cf1723 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -459,13 +459,11 @@ public class EditingMouseListener extends MouseInputAdapter { if (isSelectionDrag()) { stateModel.changeSelection(e); - return; } // 调整大小这边单独提出来,不跟后面拖组件混在一起,实在不好管理 if (stateModel.isDraggingSize()) { stateModel.dragging(e); - return; } designer.startDraggingFormWidget(lastXCreator, lastPressEvent, e); From fafc8e71ff4af176736cdbc932f61783afcd019c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 17:08:00 +0800 Subject: [PATCH 092/113] REPORT-66947 --- .../com/fr/design/mainframe/FormDesignerUI.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 1d641decef..8307e945f6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -116,8 +116,8 @@ public class FormDesignerUI extends ComponentUI { designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), designer.getArea().getVerticalValue() + designer.getParaHeight()); } - DraggingModel draggingModel = designer.getDraggingModel(); - if (draggingModel != null && draggingModel.getCreator() != null) { + + if (needPaintDraggingBean()) { // 当前正在添加的组件 paintDraggingBean(g); } @@ -217,6 +217,19 @@ public class FormDesignerUI extends ComponentUI { ComponentUtils.resetBuffer(dbcomponents); } + private boolean needPaintDraggingBean() { + DraggingModel draggingModel = designer.getDraggingModel(); + if (draggingModel == null || draggingModel.getCreator() == null) { + return false; + } + + XCreator creator = draggingModel.getCreator(); + int leftTopX = draggingModel.getCreatorLeftTopX(); + int leftTopY = draggingModel.getCreatorLeftTopY(); + + return leftTopX + creator.getWidth() > 0 && leftTopY + creator.getHeight() > 0; + } + private void paintAuthorityCreator(Graphics2D g2d, Rectangle creatorBounds) { back_or_selection_rect.setRect(creatorBounds.getX(), creatorBounds.getY(), From a8572a9e0c37099316dff36c069459918b5d316b Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 17 Feb 2022 18:09:15 +0800 Subject: [PATCH 093/113] =?UTF-8?q?REPORT-66306=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8C=85=E4=B8=8B=E8=BD=BD=E9=9D=A2=E6=9D=BF=E6=97=A0=E9=81=AE?= =?UTF-8?q?=E7=BD=A9=E9=98=B4=E5=BD=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 swing中两个组件上下层叠时,重绘底层组件,会将其内容会知道上方,遮挡上层组件, 因此也需要手动重新绘制上层组件。 【改动思路】 主动调用下阴影层的重绘方法 --- .../share/ui/block/OnlineWidgetBlock.java | 67 ++++++++++--------- .../ui/online/OnlineDownloadPackagePane.java | 8 +++ .../share/ui/online/OnlineWidgetTabPane.java | 11 ++- .../OnlineWidgetPackagesShowPane.java | 15 +++-- 4 files changed, 63 insertions(+), 38 deletions(-) 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 3eacc52261..61c913201b 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 @@ -337,41 +337,42 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { null, this ); - return; - } - //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 - if (!isRightClickPopupMenuVisible() && (isMouseEnter || downloading)) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - //画白色的编辑层 - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 20 / 100.0F)); - g2d.setColor(COVER_COLOR); - g2d.fillRect(x, y, w, h); - g2d.setComposite(oldComposite); - //画编辑按钮图标 - BufferedImage image = (process > 0 || downloading) ? WIDGET_DOWNLOADING_ICON : WIDGET_DOWNLOAD_ICON; - g2d.drawImage( - image, - (x + w / 2 - 12), - (y + h / 2 - 16), - image.getWidth(), - image.getHeight(), - null, - this - ); - Stroke oldStroke = g2d.getStroke(); - g2d.setStroke(XCreatorConstants.STROKE); - g2d.setColor(Color.decode("#419BF9")); - double arcAngle = downloading ? (36 + 360 * 0.9 * process) : 0.0; - g2d.drawArc(x + w / 2 - 12, y + h / 2 - 16, 24, 24, 90, -(int) arcAngle); - g2d.setColor(Color.WHITE); - g2d.setStroke(oldStroke); - } + } else { + //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 + if (!isRightClickPopupMenuVisible() && (isMouseEnter || downloading)) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + //画白色的编辑层 + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 20 / 100.0F)); + g2d.setColor(COVER_COLOR); + g2d.fillRect(x, y, w, h); + g2d.setComposite(oldComposite); + //画编辑按钮图标 + BufferedImage image = (process > 0 || downloading) ? WIDGET_DOWNLOADING_ICON : WIDGET_DOWNLOAD_ICON; + g2d.drawImage( + image, + (x + w / 2 - 12), + (y + h / 2 - 16), + image.getWidth(), + image.getHeight(), + null, + this + ); + Stroke oldStroke = g2d.getStroke(); + g2d.setStroke(XCreatorConstants.STROKE); + g2d.setColor(Color.decode("#419BF9")); + double arcAngle = downloading ? (36 + 360 * 0.9 * process) : 0.0; + g2d.drawArc(x + w / 2 - 12, y + h / 2 - 16, 24, 24, 90, -(int) arcAngle); + g2d.setColor(Color.WHITE); + g2d.setStroke(oldStroke); + } - boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); - if (isUnusable) { - paintUnusableMask((Graphics2D) g); + boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); + if (isUnusable) { + paintUnusableMask((Graphics2D) g); + } } + if (this.parentPane != null) { this.parentPane.refreshShowPaneUI(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java index 987cffaceb..1d4990c7d7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java @@ -256,4 +256,12 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { } } } + + @Override + public void refreshShowPaneUI() { + if (downloadProgressPane != null && downloadProgressPane.isShowing()) { + downloadProgressPane.invalidate(); + downloadProgressPane.repaint(); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index cfa5d799f1..ca0e8aa6a8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -16,6 +16,7 @@ import com.fr.form.share.bean.OnlineShareWidget; import javax.swing.BorderFactory; import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.plaf.basic.BasicButtonUI; import java.awt.BorderLayout; @@ -44,6 +45,7 @@ public class OnlineWidgetTabPane extends JPanel { private boolean packagePaneCreated = false; private final List tabChangeListeners; private OnlineEmbedFilterShowPane embedFilterShowPane; + private OnlineWidgetPackagesShowPane widgetPackagesShowPane; public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) { tabChangeListeners = new ArrayList<>(); @@ -70,7 +72,8 @@ public class OnlineWidgetTabPane extends JPanel { ComponentCollector.getInstance().collectCmpPktClick(); //延迟组件包面板的初始化,防止组件面板里组件和缩略图和组件包面板里组件的缩略图一起加载 if (!packagePaneCreated) { - centerPane.add(new OnlineWidgetPackagesShowPane(sharableWidgetPackages), COMPONENT_PACKAGE); + widgetPackagesShowPane = new OnlineWidgetPackagesShowPane(sharableWidgetPackages); + centerPane.add(widgetPackagesShowPane, COMPONENT_PACKAGE); packagePaneCreated = true; } cardLayout.show(centerPane, COMPONENT_PACKAGE); @@ -89,6 +92,8 @@ public class OnlineWidgetTabPane extends JPanel { this.add(centerPane, BorderLayout.CENTER); } + + private JPanel createMiniShopEntryPane() { JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); container.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); @@ -136,6 +141,10 @@ public class OnlineWidgetTabPane extends JPanel { if (embedFilterShowPane != null) { this.embedFilterShowPane.refreshUI(); } + + if (headGroup.getSelectedIndex() == COMPONENT_PACKAGE_TAB_INDEX && widgetPackagesShowPane != null) { + widgetPackagesShowPane.refreshShowPaneUI(); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java index 1697593627..d133cd0583 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java @@ -48,6 +48,7 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { private JPanel detailPane; private String currentPackageId; private OnlineWidgetSelectPane onlineWidgetSelectPane; + private OnlineDownloadPackagePane onlineDownloadPackagePane; private UILabel downloadLabel; private final Map cachePanelMap = new HashMap<>(); @@ -109,15 +110,15 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { private void downLoadPackage() { downloadLabel.setVisible(false); detailPane.removeAll(); - OnlineDownloadPackagePane widgetSelectPane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50); - detailPane.add(widgetSelectPane, BorderLayout.CENTER); + onlineDownloadPackagePane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50); + detailPane.add(onlineDownloadPackagePane, BorderLayout.CENTER); cardLayout.show(centerPane, WIDGET_DETAIL); - cachePanelMap.put(currentPackageId, widgetSelectPane); + cachePanelMap.put(currentPackageId, onlineDownloadPackagePane); for (OnlineShareWidget onlineShareWidget : getSharableWidgetProviders()) { if (StringUtils.equals(onlineShareWidget.getId(), currentPackageId)) { - widgetSelectPane.downloadWidget(onlineShareWidget); + onlineDownloadPackagePane.downloadWidget(onlineShareWidget); break; } } @@ -193,4 +194,10 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { protected FilterPane createFilterPane() { return FilterPane.createOnlinePackageFilterPane(); } + + public void refreshShowPaneUI() { + if (onlineDownloadPackagePane != null && onlineDownloadPackagePane.isShowing()) { + onlineDownloadPackagePane.refreshShowPaneUI(); + } + } } From 173e2ee7e75f3dbb540a48871abbfc48818aebb2 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 17 Feb 2022 18:23:28 +0800 Subject: [PATCH 094/113] =?UTF-8?q?REPORT-66274=E3=80=90=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BC=98=E5=8C=96=E3=80=91windows=E4=B8=8B?= =?UTF-8?q?=E4=BB=8E=E6=97=A5=E5=BF=97=E5=AE=9A=E4=BD=8D=E4=BC=9A=E5=86=8D?= =?UTF-8?q?=E6=89=93=E5=BC=80=E4=B8=80=E6=AC=A1=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/DesignerLogHandler.java | 3 +-- designer-base/src/main/java/com/fr/file/FILEFactory.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 88e064fe00..621956ce6a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -51,7 +51,6 @@ import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayDeque; @@ -259,7 +258,7 @@ public class DesignerLogHandler { return; } TRL trl = new TRL(href); - DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + File.separator + trl.getTemplatePath())); + DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + FILEFactory.SEPARATOR + trl.getTemplatePath())); JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (currentEditingTemplate != null) { currentEditingTemplate.navigate(trl); diff --git a/designer-base/src/main/java/com/fr/file/FILEFactory.java b/designer-base/src/main/java/com/fr/file/FILEFactory.java index 3d48bab341..d558483784 100644 --- a/designer-base/src/main/java/com/fr/file/FILEFactory.java +++ b/designer-base/src/main/java/com/fr/file/FILEFactory.java @@ -1,6 +1,5 @@ package com.fr.file; -import com.fr.base.FRContext; import com.fr.design.file.NodeAuthProcessor; import com.fr.file.filetree.FileNode; import com.fr.workspace.WorkContext; @@ -10,6 +9,7 @@ public class FILEFactory { public static final String FILE_PREFIX = "file://"; public static final String ENV_PREFIX = "env://"; public static final String WEBREPORT_PREFIX = "webreport://"; + public static final String SEPARATOR = "/"; private FILEFactory() { } From 94679a83332eedf6bf71cb8286212ebd51ea3b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 19:55:33 +0800 Subject: [PATCH 095/113] =?UTF-8?q?CHART-22936=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=8E=A7=E4=BB=B6=E6=A0=87=E9=A2=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=85=AC=E5=BC=8F=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index f053b09d61..a04acb83de 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -10,6 +10,7 @@ import com.fr.chart.base.AttrChangeConfig; import com.fr.chart.base.AttrChangeType; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.SwitchTitle; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.foldablepane.UIExpandablePane; @@ -238,13 +239,14 @@ public class ChangeConfigPane extends BasicBeanPane { private void populateSwitchTitlePane(int chartIndex, ChartCollection collection) { Chart chart = collection.getChart(chartIndex, Chart.class); - Object switchTitle = chart.getSwitchTitle(); + SwitchTitle switchTitle = chart.getSwitchTitle(); + Object content = switchTitle.getContent(); String result = StringUtils.EMPTY; - if (switchTitle != null) { - if (switchTitle instanceof BaseFormula) { - result = ((BaseFormula) switchTitle).getContent(); + if (content != null) { + if (content instanceof BaseFormula) { + result = ((BaseFormula) content).getContent(); } else { - result = Utils.objectToString(switchTitle); + result = Utils.objectToString(content); } } TinyFormulaPane title = new TinyFormulaPane(); @@ -345,7 +347,7 @@ public class ChangeConfigPane extends BasicBeanPane { } else { titleObj = titleString; } - collection.getChart(i, Chart.class).setSwitchTitle(titleObj); + collection.getChart(i, Chart.class).setSwitchTitle(new SwitchTitle(titleObj)); } } From 40192acd81c796cdf979584b6d96ad1cc5bb781a Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 18 Feb 2022 10:46:45 +0800 Subject: [PATCH 096/113] =?UTF-8?q?REPORT-66966=20FR11=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E6=94=BE=E5=9C=A8=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=8D=A0=E4=BD=8D=E5=9D=97=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E8=B0=83=E6=95=B4=E5=B0=BA=E5=AF=B8=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=A8=A1=E6=9D=BF=E5=86=8D=E6=89=93=E5=BC=80=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E5=86=8D=E6=8B=96=E6=8B=BD=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E7=BB=84=E4=BB=B6=E5=B0=BA=E5=AF=B8?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=92=8C=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=9D=97=E9=87=8D=E5=8F=A0=E9=94=99=E4=B9=B1=E7=9A=84=E7=8E=B0?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/fit/NewJForm.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index 60bd8d5427..660a5c483e 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -179,11 +179,13 @@ public class NewJForm extends JForm { FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) adapter; layoutAdapter.setEdit(true); layoutAdapter.calculateBounds(backupBounds, xwTitleLayout.getBounds(), xwTitleLayout, row, difference); + } else { + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout); + if (parent != null && parent.toData() != null) { + parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds()); + } } - XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout); - if (parent != null && parent.toData() != null) { - parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds()); - } + } From f2c131a71e7b19948e36176355f3b87492cef32d Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 18 Feb 2022 11:12:03 +0800 Subject: [PATCH 097/113] =?UTF-8?q?REPORT-66767=20=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=95=B0=E6=8D=AE=E9=9B=86=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=AA=97=E5=8F=A3=E6=B2=A1=E6=9C=89=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/StoreProcedureDataWrapper.java | 109 +++++++++--------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index 08274fd71d..515bd8dd08 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -63,26 +63,27 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName) { this(component, storeProcedure, storeprocedureName, dsName, true); } - + /** - * @param: component loadingBar的父弹框(如果不设置父弹框的话,可能出现loadingBar隐藏在一个弹框后的情况) - * @param: storeProcedure 存储过程 - * @param: storeprocedureName 存储过程的名字(某些情况下可以为空) - * @param: dsName 存储过程一个返回数据集的名字 - * @param: needLoad 是否要加载 + * @param component loadingBar的父弹框(如果不设置父弹框的话,可能出现loadingBar隐藏在一个弹框后的情况) + * @param storeProcedure 存储过程 + * @param storeprocedureName 存储过程的名字(某些情况下可以为空) + * @param dsName 存储过程一个返回数据集的名字 + * @param needLoad 是否要加载 **/ public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this.dsName = dsName; this.storeProcedure = storeProcedure; this.storeProcedure.setCalculating(false); this.storeprocedureName = storeprocedureName; - if (needLoad) { - setWorker(); - } if (component == null) { component = new JFrame(); } + if (needLoad) { + setWorker(component); + } loadingBar = new AutoProgressBar(component, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { + @Override public void doMonitorCanceled() { getWorker().cancel(true); } @@ -93,16 +94,17 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { * 数据集执行结果返回的所有字段 * * @return 数据集执行结果返回的所有字段 - * - * - * @date 2014-12-3-下午7:43:17 - * - */ + * @date 2014-12-3-下午7:43:17 + */ + @Override public List calculateColumnNameList() { if (columnNameList != null) { return columnNameList; } - if (!createStore(false)) { + + try { + createStore(false); + } catch (Exception e) { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); return new ArrayList(); } @@ -114,11 +116,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { * 生成子节点 * * @return 节点数组 - * - * - * @date 2014-12-3-下午7:06:47 - * - */ + * @date 2014-12-3-下午7:06:47 + */ + @Override public ExpandMutableTreeNode[] load() { List namelist; if (storeProcedure.isCalculating()) { @@ -134,23 +134,16 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { return res; } - private boolean createStore(boolean needLoadingBar) { - try { - dataModels = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar); - if (dataModels == null || dataModels.length == 0) { - return false; - } - for (int i = 0; i < dataModels.length; i++) { - if (ComparatorUtils.equals(this.dsName, storeprocedureName + "_" + dataModels[i].getName())) { - procedureDataModel = dataModels[i]; + private void createStore(boolean needLoadingBar) throws Exception { + dataModels = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar); + if (dataModels != null && dataModels.length != 0) { + for (ProcedureDataModel dataModel : dataModels) { + if (ComparatorUtils.equals(this.dsName, storeprocedureName + "_" + dataModel.getName())) { + procedureDataModel = dataModel; break; } } - return true; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return false; } @Override @@ -159,17 +152,15 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { } /** - * 预览数据 - * - * @param previewModel 预览模式, 全部还是一个 - * - * - * @date 2014-12-3-下午7:05:50 - * - */ + * 预览数据 + * + * @param previewModel 预览模式, 全部还是一个 + * @date 2014-12-3-下午7:05:50 + */ public void previewData(final int previewModel) { this.previewModel = previewModel; connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) { + @Override public void doMonitorCanceled() { connectionBar.close(); worker.cancel(true); @@ -178,8 +169,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { worker.execute(); } - private void setWorker() { + private void setWorker(final Component parent) { worker = new SwingWorker() { + @Override protected Void doInBackground() throws Exception { loadingBar.close(); PreviewTablePane.resetPreviewTable(); @@ -195,6 +187,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { return null; } + @Override public void done() { try { get(); @@ -206,13 +199,15 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { case StoreProcedureDataWrapper.PREVIEW_ONE: previewData(); break; + default: + break; } } catch (Exception e) { + loadingBar.close(); if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); + FineJOptionPane.showMessageDialog(parent, e.getMessage()); } - loadingBar.close(); } } }; @@ -227,10 +222,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { /** * 预览返回的一个数据集 * - * - * @date 2014-12-3-下午7:42:53 - * - */ + * @date 2014-12-3-下午7:42:53 + */ + @Override public void previewData() { previewData(-1, -1); } @@ -240,13 +234,11 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { /** * 预览返回的一个数据集,带有显示值和实际值的标记结果 * - * @param keyIndex 实际值 - * @param valueIndex 显示值 - * - * - * @date 2014-12-3-下午7:42:27 - * - */ + * @param keyIndex 实际值 + * @param valueIndex 显示值 + * @date 2014-12-3-下午7:42:27 + */ + @Override public void previewData(final int keyIndex, final int valueIndex) { PreviewTablePane.previewStoreData(procedureDataModel, keyIndex, valueIndex); } @@ -257,7 +249,9 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { */ public void previewAllTable() { if (procedureDataModel == null) { - if (!createStore(true)) { + try { + createStore(true); + } catch (Exception e) { return; } } @@ -269,6 +263,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { return dsName; } + @Override public TableData getTableData() { return storeProcedure; } @@ -282,10 +277,12 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { * * @return 是否异常 */ + @Override public boolean isUnusual() { return false; } + @Override public boolean equals(Object obj) { return obj instanceof StoreProcedureDataWrapper && ComparatorUtils.equals(this.dsName, ((StoreProcedureDataWrapper) obj).getTableDataName()) From 6dbe6fa6ab99f93e9d109a6eba34944b9c4c82bd Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 21 Feb 2022 15:40:47 +0800 Subject: [PATCH 098/113] =?UTF-8?q?REPORT-58833=20js=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascript/JSContentWithDescriptionPane.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 469598a3f6..8e8ef45b9f 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -441,19 +441,21 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi Object value = helpDOCList.getSelectedValue(); if (value instanceof HelpDocument) { String url = ((HelpDocument) value).getDocumentUrl(); - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException ex) { - FineLoggerFactory.getLogger().error(ex.getMessage(), ex); - } catch (URISyntaxException ex) { - FineLoggerFactory.getLogger().error(ex.getMessage(), ex); - } + browse(url); } } } }); } + private void browse(String url){ + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException | URISyntaxException ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + } + private void initHelpDOCListRender() { helpDOCList.setCellRenderer(new DefaultListCellRenderer() { @Override From 1f7420988ad4b8ba0359b647d1e48c666b780c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 21 Feb 2022 16:29:27 +0800 Subject: [PATCH 099/113] =?UTF-8?q?REPORT-66947=20=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=8B=96=E5=87=BA=E5=8F=AF=E6=8B=96=E6=8B=BD=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=8F=8A?= =?UTF-8?q?=E6=97=B6=E6=B8=85=E7=90=86=E5=86=85=E5=AD=98=E9=87=8C=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E7=9A=84=E4=B8=8A=E6=AC=A1dropTarget=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=EF=BC=8C=E9=9C=80=E8=A6=81=E6=B8=85=E7=90=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/FormCreatorDropTarget.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 62e256379c..1c873417a7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -87,6 +87,7 @@ public class FormCreatorDropTarget extends DropTarget { cancelPromptWidgetForbidEnter(); // 隐藏组件图标 designer.resetDraggingPosition(); + designer.clearDropTarget(); designer.setPainter(null); designer.repaint(); } From eb9039dd3bccf8ddb70af702849d4f80dbb9cbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 21 Feb 2022 16:50:34 +0800 Subject: [PATCH 100/113] REPORT-66947 --- .../java/com/fr/design/mainframe/FormCreatorDropTarget.java | 1 - .../src/main/java/com/fr/design/mainframe/FormDesigner.java | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 1c873417a7..62e256379c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -87,7 +87,6 @@ public class FormCreatorDropTarget extends DropTarget { cancelPromptWidgetForbidEnter(); // 隐藏组件图标 designer.resetDraggingPosition(); - designer.clearDropTarget(); designer.setPainter(null); designer.repaint(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 2b43265f9a..7837f8b008 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1248,7 +1248,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @param currentDragEvent */ public void startDraggingNewWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) { - if (currentDragEvent == null || this.getDropTarget() != null) { + if (currentDragEvent == null) { return; } @@ -1270,7 +1270,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @param currentDragEvent */ public void startDraggingFormWidget(XCreator xCreator, MouseEvent startDragEvent, MouseEvent currentDragEvent) { - if (currentDragEvent == null || this.getDropTarget() != null) { + if (currentDragEvent == null) { return; } backUpCreator(xCreator); From 6ddf7a3e6115907e1423b042fcd8b8da67b3aca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 21 Feb 2022 17:38:28 +0800 Subject: [PATCH 101/113] REPORT-66939 --- .../main/java/com/fr/design/mainframe/FormDesigner.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 7837f8b008..24ed004fff 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1318,7 +1318,14 @@ public class FormDesigner extends TargetComponent implements TreeSelection DraggingModel model = this.draggingModel; MouseEvent dragEvent = model.getCurrentDragEvent(); XCreator hotspot = this.getComponentAt(dragEvent.getX(), dragEvent.getY()); - return XCreatorUtils.getHotspotContainer(hotspot); + XLayoutContainer container = XCreatorUtils.getHotspotContainer(hotspot); + XLayoutContainer topLayout = container.getTopLayout(); + // REPORT-66939 Tab比较特殊,它是又多个LayoutContainer组成,直接返回container会导致误判,需要先找到最上层topLayout,取其父layout才是正确结果 + if (topLayout != null && container != topLayout) { + return (XLayoutContainer) topLayout.getParent(); + } else { + return container; + } } /** From 5d9a14d44b6d86c7af2dde4fdbc831dc5d1ed81a Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 22 Feb 2022 10:10:46 +0800 Subject: [PATCH 102/113] =?UTF-8?q?REPORT-66690=20tab=E5=9D=97=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=B8=8D=E5=85=81=E8=AE=B8=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/cardlayout/XWCardTagLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 850378af21..ec070ad867 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -8,6 +8,7 @@ import com.fr.base.ScreenResolution; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter; +import com.fr.design.designer.beans.models.ModelUtil; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -136,6 +137,9 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard); fitLayout.setTabNameIndex(getTabNameIndex()); XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension()); + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + ModelUtil.renameWidgetName(formDesigner.getTarget(), tabFitLayout); WCardTagLayout layout = (WCardTagLayout) this.toData(); if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){ From dd883671f81cd7b47fe5ee306b565e24807aa0b9 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 22 Feb 2022 14:31:38 +0800 Subject: [PATCH 103/113] =?UTF-8?q?REPORT-64014=20=E5=B1=82=E6=AC=A1?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E4=BC=98=E5=8C=96=201.=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=B8=89=E4=B8=AA=E5=B1=82=E6=AC=A1=E5=9D=90=E6=A0=87=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=EF=BC=9B=202.=E4=BF=AE=E6=94=B9=E5=85=AC=E5=BC=8FSORT?= =?UTF-8?q?=E3=80=81MOM=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 28bb985552..6e128a4356 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -36,6 +36,7 @@ import java.util.Comparator; import java.util.Enumeration; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -46,6 +47,7 @@ public final class FunctionConstants { public static NameAndFunctionList COMMON = getCommonFunctionList(); public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); public static FunctionGroup ALL = getAllFunctionGroup(); + public static List abandonFormulas = Arrays.asList("CIRCULAR", "CROSSLAYERTOTAL", "HIERARCHY", "LAYERTOTAL"); static { loadEmbededFunctions(); @@ -54,7 +56,8 @@ public final class FunctionConstants { /** * Don't let anyone instantiate this class. */ - private FunctionConstants() {} + private FunctionConstants() { + } private static void loadEmbededFunctions() { String pkgName = "com.fr.function"; @@ -88,7 +91,10 @@ public final class FunctionConstants { Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); if (StableUtils.classInstanceOf(cls, iface)) { Function inst; - inst = (Function)cls.newInstance(); + inst = (Function) cls.newInstance(); + if (abandonFormulas.contains(inst.getClass().getSimpleName())) { + continue; + } for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { if (EMBFUNCTION.test(inst)) { break; @@ -300,11 +306,12 @@ public final class FunctionConstants { Collections.addAll(all, CUSTOM.getDescriptions()); //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); - if(!containers.isEmpty()){ - for(Mutable container : containers){ - Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); + if (!containers.isEmpty()) { + for (Mutable container : containers) { + Collections.addAll(all, createFunctionGroup(((FunctionDefContainer) container)).getDescriptions()); } } + all = all.stream().filter(n -> !abandonFormulas.contains(n.getName())).collect(Collectors.toList()); Collections.sort(all, new Comparator() { @Override From ebeedc191f1c3eee268191b559d072333d446a68 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 22 Feb 2022 15:04:27 +0800 Subject: [PATCH 104/113] =?UTF-8?q?REPORT-67092=20=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9?= 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 205ad01ffb..e53649ee1a 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 @@ -71,6 +71,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Tue, 22 Feb 2022 15:04:59 +0800 Subject: [PATCH 105/113] =?UTF-8?q?REPORT-67095=E3=80=90=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=E3=80=91=E8=80=81=E6=A8=A1=E5=BC=8F-PC?= =?UTF-8?q?=E7=AB=AF=E8=87=AA=E9=80=82=E5=BA=94=E5=B1=9E=E6=80=A7=E9=80=89?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=8A=A5=E8=A1=A8=E5=9D=97=E9=80=89=E2=80=9C?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E2=80=9D=EF=BC=8C=E6=AD=A4=E6=97=B6=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E7=94=BB=E5=B8=83=E9=87=8C=E7=9A=84=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=8D=B3=E6=8F=90=E7=A4=BA=E4=BA=86=E2=80=9C=E5=B7=B2=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=BB=98=E8=AE=A4=E8=87=AA=E9=80=82=E5=BA=94=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E2=80=9D=EF=BC=8C=E5=8F=88=E6=9C=89Pc=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E8=87=AA=E9=80=82=E5=BA=94=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E4=B8=94web=E9=A2=84=E8=A7=88=E7=9A=84?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E7=9C=8B=E8=B5=B7=E6=9D=A5=E6=98=AF=E7=AC=A6?= =?UTF-8?q?=E5=90=88Pc=E6=B5=8F=E8=A7=88=E5=99=A8=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E8=AE=BE=E7=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XElementCase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index bdaf40d226..2f4a699379 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -20,6 +20,7 @@ import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; @@ -127,7 +128,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme private CRPropertyDescriptor getReportFitEditor() { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FitProvider wbTpl = designer.getTarget(); - ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); + //这边获取到的全局要考虑到服务器的配置 + ReportFitAttr fitAttr = wbTpl.getReportFitAttr() == null ? ReportFitConfig.getInstance().getFrmFitAttr() : wbTpl.getReportFitAttr(); ElementCaseEditor editor = this.toData(); //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) if (editor.getFitStateInPC() == 0) { From 0dea88f5a0e09ea5e86659aa44c3704b268deef4 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 24 Feb 2022 10:33:00 +0800 Subject: [PATCH 106/113] =?UTF-8?q?KERNEL-10259=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=80=BB=E8=BE=91=E9=87=8D=E6=9E=84=201.?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=9D=A5=E6=BA=90=E6=94=B6=E9=9B=86=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/DesignModelAdapter.java | 13 +++++++------ .../com/fr/design/mainframe/FormModelAdapter.java | 7 ++++--- .../fr/design/mainframe/WorkBookModelAdapter.java | 5 +++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 3eb3b78579..013c703fb2 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -4,6 +4,7 @@ import com.fr.base.Parameter; import com.fr.base.ParameterConfig; import com.fr.base.TableData; import com.fr.base.io.BaseBook; +import com.fr.base.param.ParameterSource; import com.fr.data.TableDataSource; import com.fr.data.operator.DataOperator; import com.fr.design.file.HistoryTemplateListCache; @@ -19,8 +20,8 @@ import com.fr.stable.Filter; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.js.WidgetName; - import com.fr.util.ParameterApplyHelper; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -283,9 +284,9 @@ public abstract class DesignModelAdapter map, ParameterProvider[] parameterProviders, Filter filter) { if (filter != null) { - ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); + ParameterApplyHelper.addPara2Map(map, parameterProviders, filter, null, ParameterSource.DEFAULT_SOURCE); } else { - ParameterApplyHelper.addPara2Map(map, parameterProviders); + ParameterApplyHelper.addPara2Map(map, parameterProviders, null, ParameterSource.DEFAULT_SOURCE); } } @@ -378,7 +379,7 @@ public abstract class DesignModelAdapter map) { // 添加全局参数 Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters(); - ParameterApplyHelper.addPara2Map(map, glbParas); + ParameterApplyHelper.addPara2Map(map, glbParas, null, ParameterSource.GLOBAL_SOURCE); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index bf047a3bee..1230e0fae3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.Parameter; import com.fr.base.TableData; +import com.fr.base.param.ParameterSource; import com.fr.data.TableDataSource; import com.fr.design.DesignModelAdapter; import com.fr.design.file.HistoryTemplateListPane; @@ -14,8 +15,8 @@ import com.fr.script.Calculator; import com.fr.stable.EmbParaFilter; import com.fr.stable.ParameterProvider; import com.fr.stable.js.WidgetName; - import com.fr.util.ParameterApplyHelper; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -55,7 +56,7 @@ public class FormModelAdapter extends DesignModelAdapter> Map map = new HashMap<>(); addGlobalParameters(map); updateTableDataParameters(oldName, tdName, tableData, map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); - ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters(), null, ParameterSource.DEFAULT_SOURCE); parameters = map.values().toArray(new Parameter[0]); jTemplate.populateParameter(); } @@ -158,7 +159,7 @@ public class FormModelAdapter extends DesignModelAdapter> addTableDataParameters(map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); - ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters(), null, ParameterSource.DEFAULT_SOURCE); return map.values().toArray(new Parameter[0]); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index 53f193be74..6cbc0142ed 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.Parameter; import com.fr.base.TableData; +import com.fr.base.param.ParameterSource; import com.fr.data.TableDataSource; import com.fr.design.DesignModelAdapter; import com.fr.design.bridge.DesignToolbarProvider; @@ -17,8 +18,8 @@ import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.js.WidgetName; - import com.fr.util.ParameterApplyHelper; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -139,7 +140,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter Date: Mon, 28 Feb 2022 16:48:03 +0800 Subject: [PATCH 107/113] =?UTF-8?q?REPORT-66771=20FR11=E8=80=81=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8-=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=8E=A7=E4=BB=B6=E5=9D=90=E6=A0=87=E8=B6=85=E8=BF=87?= =?UTF-8?q?960=E4=B8=94=E8=AE=BE=E8=AE=A1=E7=94=BB=E5=B8=83=E9=87=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0=E8=AF=A5=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=80=81=E9=A2=84=E8=A7=88=E4=B8=8B=E7=9C=8B?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E8=AF=A5=E6=8E=A7=E4=BB=B6=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=B8=8B=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=201=E3=80=81=E5=9C=A8=E4=BF=AE=E6=94=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=90=8C=E6=97=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E7=9A=84width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWParameterLayout.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index a41ec46f6f..aacdf6d04b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -270,4 +270,16 @@ public class XWParameterLayout extends XWAbsoluteLayout { public boolean isTopable() { return false; } + + /** + * 修改form布局的宽度时,需要同时修改表单参数界面的布局的宽度。 + * */ + @Override + public void doLayout() { + layout(); + if (data != null && data instanceof WParameterLayout) { + ((WParameterLayout) data).setDesignWidth(getWidth()); + } + } + } From 2625e624d14ad149bdaa507a6d64f1983ad225cc Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Tue, 1 Mar 2022 11:05:39 +0800 Subject: [PATCH 108/113] =?UTF-8?q?REPORT-64011=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=A7=E6=96=87=E6=9C=AC=20-=20=E5=9B=9E=E9=80=80=E5=90=8E?= =?UTF-8?q?=E5=A4=8D=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellOtherSetPane.java | 171 +++++++++++++++++- 1 file changed, 161 insertions(+), 10 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 efab3fc66e..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 @@ -12,8 +12,10 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; 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.layout.VerticalFlowLayout; @@ -58,6 +60,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private static final int HEAD_HEIGTH = 24; private static final int COMBO_WIDTH = 154; private static final int BUTTON_GROUP_WIDTH = 140; + private static final double f = TableLayout.FILL; + private static final double p = TableLayout.PREFERRED; // normal private UIButtonGroup autoshrik; @@ -67,8 +71,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIComboBox showContent; + //内容提示 + private UIButtonGroup tooltipButtonGroup; + private CardLayout tooltipLayout; + private JPanel tooltipPane; private UITextField tooltipTextField; + //文本超出时隐藏 + private UICheckBox textOverflowCheckBox; + private UIComboBox showPartComboBox; + private CardLayout showPartLayout; + private JPanel showPartPane; + private UISpinner showCharNums; + private UIComboBox textOverflowTypeComboBox; + private UITextField fileNameTextField; // 分页 @@ -214,17 +230,16 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private JPanel seniorUpPane() { JPanel pane = new JPanel(new BorderLayout()); // TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。 + pane.add(createTextOverflowPane(), BorderLayout.SOUTH); pane.add(createShowContentPane(), BorderLayout.CENTER); pane.add(createSeniorCheckPane(), BorderLayout.NORTH); return pane; } private JPanel createShowContentPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p, p, p}; double[] colSize = {f, COMBO_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; JPanel fileNamePane = createNormal(); fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); @@ -233,21 +248,96 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UIComponentUtils.setLineWrap(showContentLabel); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); - JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); - toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); + tooltipLayout = new CardLayout(); + tooltipPane = new JPanel(tooltipLayout); + tooltipPane.add(new JPanel(), "none"); + tooltipPane.add(tooltipTextField, "content"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); + tooltipButtonGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (tooltipButtonGroup.getSelectedIndex() == 0) { + tooltipPane.setPreferredSize(new Dimension(154, 20)); + tooltipLayout.show(tooltipPane, "content"); + } else { + tooltipLayout.show(tooltipPane, "none"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + } + } + }); Component[][] components = new Component[][]{ new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 - new Component[]{toolTipLabel, toolTipTextFieldWrapper} + new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" + new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行 }; JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0)); + showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); return showContentPane; } + private JPanel createTextOverflowPane() { + showPartLayout = new CardLayout(); + showPartPane = new JPanel(showPartLayout); + showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10); + JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0)); + showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST); + showPartNumPane.add(showCharNums, BorderLayout.CENTER); + showPartPane.add(new JPanel(), "none"); + showPartPane.add(showPartNumPane, "content"); + showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")}); + showPartComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + 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)); + } + } + }); + + textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); + UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":"); + UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":"); + Component[][] textOverflowComponents = new Component[][]{ + new Component[]{showPartLabel, showPartComboBox, showPartPane}, + new Component[]{hideTypeLabel, textOverflowTypeComboBox, null} + }; + JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p}); + textOverflowComPane.setVisible(false); + textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); + textOverflowCheckBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED); + if (e.getStateChange() == ItemEvent.SELECTED) { + 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)); + } + noAutoRadioButton.setSelected(true); + } + } + }); + JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + dynamicPaneWrapper.add(textOverflowComPane); + JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH); + textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER); + textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + return textOverflowPane; + } + private JPanel createSeniorCheckPane() { previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); @@ -371,6 +461,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); + tooltipButtonGroup.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group")); + textOverflowCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); + showPartComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart")); + showCharNums.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")); + textOverflowTypeComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); } @@ -429,7 +524,40 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else { showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); } - tooltipTextField.setText(cellGUIAttr.getTooltipText()); + if (cellGUIAttr.isCustomTooltip()) { + tooltipButtonGroup.setSelectedIndex(0); + tooltipTextField.setText(cellGUIAttr.getTooltipText()); + } else { + tooltipButtonGroup.setSelectedIndex(1); + } + if (tooltipButtonGroup.getSelectedIndex() == 0) { + tooltipPane.setPreferredSize(new Dimension(100, 20)); + tooltipLayout.show(tooltipPane, "content"); + } else { + tooltipLayout.show(tooltipPane, "none"); + tooltipPane.setPreferredSize(new Dimension(0, 0)); + } + tooltipPane.setVisible(true); + if (cellGUIAttr.isHideTextWhenOverflow()) { + textOverflowCheckBox.setSelected(true); + if (cellGUIAttr.isShowCharNum()) { + showPartComboBox.setSelectedIndex(0); + showCharNums.setValue(cellGUIAttr.getShowCharNums()); + } else { + showPartComboBox.setSelectedIndex(1); + } + showPartPane.setVisible(true); + if (cellGUIAttr.isTextOverflowEllipsis()) { + textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis")); + } else { + 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(); // 分页 if (cellPageAttr == null) { cellPageAttr = new CellPageAttr(); @@ -521,7 +649,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setFileName(fileNameTextField.getText()); } } - + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"))) { + cellGUIAttr.setCustomTooltip(tooltipButtonGroup.getSelectedIndex() == 0); + if (tooltipButtonGroup.getSelectedIndex() == 0) { + if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { + cellGUIAttr.setTooltipText(fieldName); + } else { + cellGUIAttr.setTooltipText(tooltipTextField.getText()); + } + } else if (tooltipButtonGroup.getSelectedIndex() == 1) { + cellGUIAttr.setTooltipText("=$$$"); + } + } if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) { if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { cellGUIAttr.setTooltipText(fieldName); @@ -529,6 +668,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setTooltipText(tooltipTextField.getText()); } } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"))) { + cellGUIAttr.setHideTextWhenOverflow(textOverflowCheckBox.isSelected()); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"))) { + cellGUIAttr.setShowCharNum(showPartComboBox.getSelectedIndex() == 0); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"))) { + cellGUIAttr.setShowCharNums((int) showCharNums.getValue()); + } + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"))) { + cellGUIAttr.setTextOverflowEllipsis(textOverflowTypeComboBox.getSelectedIndex() == 0); + } // 如果与默认的CellGUIAttr相同,就不用保存这个属性了 if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) { cellElement.setCellGUIAttr(cellNullGUIAttr); From 6118879924df0be164216987c067b6e4f552f619 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 1 Mar 2022 11:23:52 +0800 Subject: [PATCH 109/113] =?UTF-8?q?KERNEL-9928=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=201.=E6=B0=B4=E5=8D=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/report/ReportWatermarkAction.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java index a07f42456f..92d14334d6 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java @@ -1,8 +1,6 @@ package com.fr.design.actions.report; import com.fr.base.iofile.attr.WatermarkAttr; - -import com.fr.base.svg.IconUtils; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; @@ -39,7 +37,7 @@ public class ReportWatermarkAction extends JWorkBookAction { return; } final WorkBook wbTpl = jwb.getTarget(); - WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplate(wbTpl); + WatermarkAttr watermark = ReportUtils.getWatermarkAttrFromTemplateAndGlobal(wbTpl); final WatermarkSettingPane watermarkPane = new WatermarkSettingPane(); watermarkPane.populate(watermark); watermarkPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { From 1911ebba5145bfff6ad86d95152f7473a2dde50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 1 Mar 2022 20:33:30 +0800 Subject: [PATCH 110/113] =?UTF-8?q?CHART-23035=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E8=BD=B4=E6=A0=87=E7=AD=BE=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9D=87=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/axis/VanChartBaseAxisPane.java | 4 ++-- .../axis/gauge/VanChartGaugeDetailAxisPane.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index a6f6671007..29bbf6a9bb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -569,7 +569,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } //标签 - private void populateLabel(VanChartAxis axis) { + protected void populateLabel(VanChartAxis axis) { if (showLabel != null) { showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); } @@ -813,7 +813,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } //标签 - private void updateLabel(VanChartAxis axis) { + protected void updateLabel(VanChartAxis axis) { if (showLabel != null) { axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index aa2c2a3fd3..8a13e188dd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -186,25 +186,35 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { public void populateBean(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; labelTextAttrPane.populate(axis.getTextAttr()); + super.populateBean(gaugeAxis); + } + + @Override + protected void populateLabel(VanChartAxis axis) { + VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; if (mainTickColor != null) { mainTickColor.setSelectObject(gaugeAxis.getMainTickColor()); } if (secTickColor != null) { secTickColor.setSelectObject(gaugeAxis.getSecTickColor()); } - super.populateBean(gaugeAxis); } public void updateBean(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; TextAttr textAttr = axis.getTextAttr(); labelTextAttrPane.update(textAttr); + super.updateBean(gaugeAxis); + } + + @Override + protected void updateLabel(VanChartAxis axis) { + VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; if (mainTickColor != null) { gaugeAxis.setMainTickColor(mainTickColor.getSelectObject()); } if (secTickColor != null) { gaugeAxis.setSecTickColor(secTickColor.getSelectObject()); } - super.updateBean(gaugeAxis); } } \ No newline at end of file From 37cbf75c647f680fa0d820a83c1adc6b38709b73 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 25 Feb 2022 10:42:39 +0800 Subject: [PATCH 111/113] =?UTF-8?q?KERNEL-10254=20FVS=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E6=94=B9=E6=88=90=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E7=9A=84=E8=A1=A8=E6=A0=BC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 将报表块表格编辑器等组件与JForm/XElementCase解耦, 方便fvs复用 【改动思路】 同上 --- .../com/fr/design/mainframe/BaseJForm.java | 7 +++- .../com/fr/design/mainframe/JDashboard.java | 10 ++++++ .../form/FormElementCaseDesigner.java | 11 +++++-- .../form/FormElementCasePaneDelegate.java | 21 +++++++++--- .../form/FormReportComponentComposite.java | 33 +++++++++++-------- .../fr/design/mainframe/form/FormTabPane.java | 23 +++++++++---- 6 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java index d3cff1ff95..dc36836c16 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java @@ -10,7 +10,7 @@ import javax.swing.JComponent; * Date: 13-7-15 * Time: 上午10:28 */ -public interface BaseJForm extends JTemplateProvider { +public interface BaseJForm extends JTemplateProvider, JDashboard { String XML_TAG = "JForm"; int FORM_TAB = 0; @@ -58,4 +58,9 @@ public interface BaseJForm extends JTemplateProvider { * @param ecContainer ElementCase所在container */ void tabChanged(int index, FormElementCaseContainerProvider ecContainer); + + @Override + default void switchToDashBoardEditor() { + tabChanged(FORM_TAB); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java b/designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java new file mode 100644 index 0000000000..d2b45f4ea1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java @@ -0,0 +1,10 @@ +package com.fr.design.mainframe; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/3/1 + */ +public interface JDashboard { + void switchToDashBoardEditor(); +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 481ab540bf..71d34ff445 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -30,6 +30,7 @@ import com.fr.design.selection.SelectableElement; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionListener; import com.fr.form.FormElementCaseProvider; +import com.fr.form.fit.common.LightTool; import com.fr.form.main.Form; import com.fr.grid.Grid; import com.fr.grid.selection.CellSelection; @@ -69,8 +70,12 @@ public class FormElementCaseDesigner } public FormElementCaseDesigner(T sheet, Form form) { + this(sheet, form.getFormMobileAttr().isMobileOnly(), LightTool.containNewFormFlag(form)); + } + + public FormElementCaseDesigner(T sheet, boolean isMobileOnly, boolean isNewForm) { super(sheet); - elementCasePane = initElementCasePane(sheet, form); + elementCasePane = initElementCasePane(sheet, isMobileOnly, isNewForm); this.setLayout(FRGUIPaneFactory.createBorderLayout()); elementCasePane.setSelection(getDefaultSelectElement()); this.add(elementCasePane, BorderLayout.CENTER); @@ -84,8 +89,8 @@ public class FormElementCaseDesigner } - protected FormElementCasePaneDelegate initElementCasePane(T sheet, Form form){ - return new FormElementCasePaneDelegate((FormElementCase) sheet, form); + protected FormElementCasePaneDelegate initElementCasePane(T sheet, boolean isMobileOnly, boolean isNewForm){ + return new FormElementCasePaneDelegate((FormElementCase) sheet, isMobileOnly, isNewForm); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java index 5961700e26..cd46f9de1c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java @@ -9,6 +9,7 @@ import com.fr.design.actions.form.FormECFrozenAction; import com.fr.design.designer.creator.XElementCase; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fit.NewUIModeCellElementPainter; import com.fr.design.fit.common.FormDesignerUtil; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -40,13 +41,16 @@ import java.awt.Rectangle; */ public class FormElementCasePaneDelegate extends ElementCasePane{ - public FormElementCasePaneDelegate(FormElementCase sheet, Form form) { + this(sheet, form.getFormMobileAttr().isMobileOnly(), LightTool.containNewFormFlag(form)); + } + + public FormElementCasePaneDelegate(FormElementCase sheet, boolean isMobileOnly, boolean isNewForm) { super(sheet); - this.getGrid().setPaginateLineShowType(form.getFormMobileAttr().isMobileOnly() + this.getGrid().setPaginateLineShowType(isMobileOnly ? Grid.SINGLE_HORIZONTAL_PAGINATE_LINE : Grid.NO_PAGINATE_LINE); - if (LightTool.containNewFormFlag(form)){ + if (isNewForm){ this.getGrid().setCellElementPainter(new NewUIModeCellElementPainter()); } this.addSelectionChangeListener(new SelectionListener() { @@ -68,8 +72,17 @@ public class FormElementCasePaneDelegate extends ElementCasePane template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (!(template instanceof JForm)) { + return rectangle; + } + + FormDesigner designer = ((JForm) template).getFormDesign(); + if (designer == null) { + return rectangle; + } + XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), (FormElementCase) elementCase); if (xElementCase != null) { rectangle.setBounds(xElementCase.getBounds()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java index 05c3b13ec0..5fdc4b011b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.form; import com.fr.base.DynamicUnitList; import com.fr.base.ScreenResolution; -import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -11,9 +10,11 @@ import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JDashboard; +import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JFormSliderPane; -import com.fr.design.mainframe.ReportComponent; -import com.fr.design.mainframe.ReportComponentCompositeMouseWheelHandler; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JTemplateProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; @@ -24,11 +25,11 @@ import com.fr.report.worksheet.FormElementCase; import com.fr.stable.AssistUtils; import com.fr.stable.Constants; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; /** * 整个FormElementCase编辑区域 包括滚动条、中间的grid或者聚合块、下面的sheetTab @@ -40,19 +41,19 @@ public class FormReportComponentComposite extends JComponent implements TargetMo private static final int MIN = 10; private static final int DIR = 10; private static final double MIN_TIME = 0.4; - public FormElementCaseDesigner elementCaseDesigner; - private BaseJForm jForm; + public final FormElementCaseDesigner elementCaseDesigner; + private final JTemplateProvider jTemplate; - private FormTabPane sheetNameTab; + private final FormTabPane sheetNameTab; private JPanel hbarContainer; private JFormSliderPane jSliderContainer; - public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { - this.jForm = jform; + public FormReportComponentComposite(JTemplateProvider jTemplate, JDashboard jDashboard, FormElementCaseDesigner elementCaseDesign, String ecContainerName) { + this.jTemplate = jTemplate; this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.elementCaseDesigner = elementCaseDesign; this.add(elementCaseDesigner, BorderLayout.CENTER); - sheetNameTab = new FormTabPane(ecContainer, jform); + sheetNameTab = new FormTabPane(ecContainerName, jDashboard); this.add(createSouthControlPane(), BorderLayout.SOUTH); jSliderContainer.addValueChangeListener(showValSpinnerChangeListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(new FormReportComponentCompositeMouseWheelHandler(this)); @@ -60,6 +61,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION); } + public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { + this(jform, jform, elementCaseDesign, ecContainer.getElementCaseContainerName()); + } + ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -167,7 +172,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo } public void setComposite() { - DesignerContext.getDesignerFrame().resetToolkitByPlus((ToolBarMenuDockPlus) jForm); + DesignerContext.getDesignerFrame().resetToolkitByPlus((ToolBarMenuDockPlus) jTemplate); this.validate(); this.repaint(40); } @@ -182,7 +187,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo * 模板更新 */ public void fireTargetModified() { - jForm.fireTargetModified(); + jTemplate.fireTargetModified(); } public JFormSliderPane getSliderContainer() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java index f158b39360..dca7029047 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormTabPane.java @@ -5,6 +5,7 @@ import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.JDashboard; import com.fr.form.FormElementCaseContainerProvider; @@ -27,8 +28,8 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio private static final int GAP = 5; //间隔 - private BaseJForm form; - private FormElementCaseContainerProvider elementCase; + private JDashboard jDashboard; + private final String elementCaseContainerName; //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 private double specialLocation1 = 2.5; @@ -48,8 +49,12 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio private int selectedIndex = -1; public FormTabPane(FormElementCaseContainerProvider elementCase, BaseJForm form){ - this.elementCase = elementCase; - this.form = form; + this(elementCase.getElementCaseContainerName(), form); + } + + public FormTabPane(String elementCaseContainerName, JDashboard jDashboard){ + this.elementCaseContainerName = elementCaseContainerName; + this.jDashboard = jDashboard; this.setLayout(new BorderLayout(0, 0)); this.addMouseListener(this); this.addMouseMotionListener(this); @@ -57,12 +62,16 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio this.setForeground(new Color(99, 99, 99)); } + public String getElementCaseContainerName() { + return elementCaseContainerName; + } + public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; calculateECWidth(); paintFormTab(g2d, 0, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form"), POLY_SHEET_ICON); - paintECTab(g2d, formTabWidth, elementCase.getElementCaseContainerName(), WORK_SHEET_ICON); + paintECTab(g2d, formTabWidth, getElementCaseContainerName(), WORK_SHEET_ICON); } /** @@ -165,7 +174,7 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio private void calculateECWidth() { FontMetrics fm = GraphHelper.getFontMetrics(this.getFont()); int charWidth = fm.charWidth('M'); - String ECName = elementCase.getElementCaseContainerName(); + String ECName = getElementCaseContainerName(); ecTabWidth = Math.max(ecTabWidth,fm.stringWidth(ECName) + charWidth * 2 + ADD_WIDTH_BY_SHEETNAME) ; } @@ -177,7 +186,7 @@ public class FormTabPane extends JComponent implements MouseListener, MouseMotio public void mouseClicked(MouseEvent e) { selectedIndex = getTabIndex(e.getX()); if (selectedIndex == FORM_INDEX) { - form.tabChanged(FORM_INDEX); + jDashboard.switchToDashBoardEditor(); } repaint(); } From 3418096cef65b89120db69798efa72765e83bac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 2 Mar 2022 09:44:16 +0800 Subject: [PATCH 112/113] =?UTF-8?q?CHART-23035=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E8=BD=B4=E6=A0=87=E7=AD=BE=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9D=87=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/gauge/VanChartGaugeDetailAxisPane.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index 8a13e188dd..7817b75f58 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -192,6 +192,10 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { @Override protected void populateLabel(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + + if (showLabel != null) { + showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); + } if (mainTickColor != null) { mainTickColor.setSelectObject(gaugeAxis.getMainTickColor()); } @@ -210,6 +214,10 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { @Override protected void updateLabel(VanChartAxis axis) { VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + + if (showLabel != null) { + axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); + } if (mainTickColor != null) { gaugeAxis.setMainTickColor(mainTickColor.getSelectObject()); } From b37653b5e70f43ed23b3e4d33f800f1d083e11fc Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 2 Mar 2022 11:39:11 +0800 Subject: [PATCH 113/113] =?UTF-8?q?REPORT-65140=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=9B=BE=E8=A1=A8=E5=9D=97=E5=9C=A8=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=8A=E6=94=B9=E5=8F=98=E5=A4=A7=E5=B0=8F=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E4=BF=9D=E5=AD=98=E5=9C=A8=20xml=20?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E7=9A=84=20elementcaseEdito=20=E7=9A=84?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E4=BE=9D=E7=84=B6=E6=98=AF=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XWFitLayout.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index ea61700522..886089a0be 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -764,6 +764,7 @@ public class XWFitLayout extends XLayoutContainer { creator.setBackupBound(creator.getBounds()); } } + LayoutUtils.layoutContainer(this); } private Rectangle recalculateWidgetBounds(Rectangle rec, int[] hors, int[] veris) { @@ -831,11 +832,7 @@ public class XWFitLayout extends XLayoutContainer { this.remove(oldCreator); this.add(newCreator); dealDirections(newCreator, false); - //对于新增的绝对布局的组件,需要更新下内部组件的大小 - if (newCreator.acceptType(XWAbsoluteLayout.class)){ - ((XWAbsoluteLayout) newCreator).updateBoundsWidget(); - newCreator.setBackupBound(newCreator.getBounds()); - } + this.updateBoundsWidget(); isRefreshing = false; LayoutUtils.layoutContainer(this); }