From 4a5ff5cd8ee1bfa707448c7f43285fa358aa83a9 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 12 Oct 2021 14:51:43 +0800 Subject: [PATCH 001/152] =?UTF-8?q?REPORT-59476=20&&=20REPORT-59475=20?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C=E8=A7=84?= =?UTF-8?q?=E5=88=99=E6=94=AF=E6=8C=81=E5=9B=BD=E9=99=85=E5=8C=96=20&&=20?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=94=AF=E6=8C=81=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/ErrorMsgTextFieldAdapter.java | 11 ++++ .../fr/design/beans/UITextFieldAdapter.java | 46 ++++++++++++++ .../com/fr/design/fun/RegPaneProvider.java | 11 ++++ .../design/fun/TextFieldAdapterProvider.java | 11 ++++ .../fun/impl/AbstractRegPaneProvider.java | 22 +++++++ .../AbstractTextFieldAdapterProvider.java | 22 +++++++ .../fr/design/gui/frpane/RegFieldPane.java | 60 ++++++++++--------- .../ui/designer/FieldEditorDefinePane.java | 53 ++++++++-------- .../designer/TextFieldEditorDefinePane.java | 35 +++++++---- .../widget/ui/FieldEditorDefinePane.java | 42 ++++++------- .../widget/ui/TextFieldEditorDefinePane.java | 20 +++++-- 11 files changed, 242 insertions(+), 91 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java create mode 100644 designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java diff --git a/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java b/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java new file mode 100644 index 000000000..e2444a4ec --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java @@ -0,0 +1,11 @@ +package com.fr.design.beans; + +import javax.swing.JComponent; + +public interface ErrorMsgTextFieldAdapter { + void setText(String str); + + String getText(); + + JComponent getErrorMsgTextField(); +} diff --git a/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java b/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java new file mode 100644 index 000000000..48fa6944f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java @@ -0,0 +1,46 @@ +package com.fr.design.beans; + +import com.fr.design.gui.itextfield.UITextField; + +import javax.swing.JComponent; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +public class UITextFieldAdapter implements ErrorMsgTextFieldAdapter { + private final UITextField uiTextField = new UITextField(); + + public UITextFieldAdapter(){ + addDocumentListener(); + } + @Override + public void setText(String str) { + uiTextField.setText(str); + } + + @Override + public String getText() { + return uiTextField.getText(); + } + + public void addDocumentListener() { + uiTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + uiTextField.setToolTipText(uiTextField.getText()); + } + }); + } + + @Override + public JComponent getErrorMsgTextField() { + return uiTextField; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java new file mode 100644 index 000000000..26fe62b5e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.fun; + +import com.fr.design.gui.frpane.RegFieldPane; +import com.fr.stable.fun.mark.Immutable; + +public interface RegPaneProvider extends Immutable { + int CURRENT_LEVEL = 1; + String XML_TAG = "RegPaneProvider"; + + RegFieldPane createRegPane(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java b/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java new file mode 100644 index 000000000..7ab8c782b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.fun; + +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.stable.fun.mark.Immutable; + +public interface TextFieldAdapterProvider extends Immutable { + String XML_TAG = "TextFieldAdapterProvider"; + int CURRENT_LEVEL = 1; + + ErrorMsgTextFieldAdapter createTextFieldAdapter(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java new file mode 100644 index 000000000..98185f2a5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.RegPaneProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Joe + * 2021/10/8 15:19 + */ +@API(level = RegPaneProvider.CURRENT_LEVEL) +public abstract class AbstractRegPaneProvider implements RegPaneProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java new file mode 100644 index 000000000..bc0836eb4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.TextFieldAdapterProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Joe + * 2021/10/8 15:17 + */ +@API(level = TextFieldAdapterProvider.CURRENT_LEVEL) +public abstract class AbstractTextFieldAdapterProvider implements TextFieldAdapterProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java index 5d37fb4a9..38e33514b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java @@ -1,21 +1,25 @@ package com.fr.design.gui.frpane; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.RegExp; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; /** * Created by kerry on 2017/9/4. @@ -23,7 +27,7 @@ import java.awt.*; public class RegFieldPane extends RegPane { protected RegErrorMsgPane regErrorMsgPane; - public RegFieldPane(){ + public RegFieldPane() { this(ALL_REG_TYPE); } @@ -39,8 +43,8 @@ public class RegFieldPane extends RegPane { @Override public void regChangeAction() { - RegExp regExp = (RegExp)getRegComboBox().getSelectedItem(); - if(regExp instanceof NoneReg){ + RegExp regExp = (RegExp) getRegComboBox().getSelectedItem(); + if (regExp instanceof NoneReg) { regErrorMsgPane.setVisible(false); return; } @@ -67,33 +71,35 @@ public class RegFieldPane extends RegPane { } private static class RegErrorMsgPane extends BasicPane { - private UITextField regErrorMsgField; + private ErrorMsgTextFieldAdapter errorMsgTextFieldAdapter; public RegErrorMsgPane() { + initRegErrorMsgField(); + setStyle(); + } + + private void setStyle() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); - initRegErrorMsgField(); UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); tipLabel.setPreferredSize(new Dimension(60, 20)); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); this.add(panel); } private void initRegErrorMsgField() { - regErrorMsgField = new UITextField(); - regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextFieldAdapter = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextFieldAdapter = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextFieldAdapter = new UITextFieldAdapter(); - public void removeUpdate(DocumentEvent e) { - regErrorMsgField.setToolTipText(regErrorMsgField.getText()); - } - }); + } } @Override @@ -102,11 +108,11 @@ public class RegFieldPane extends RegPane { } public void populate(TextEditor textEditor) { - regErrorMsgField.setText(textEditor.getRegErrorMessage()); + errorMsgTextFieldAdapter.setText(textEditor.getRegErrorMessage()); } public void update(TextEditor textEditor) { - textEditor.setRegErrorMessage(regErrorMsgField.getText()); + textEditor.setRegErrorMessage(errorMsgTextFieldAdapter.getText()); } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 45c2cd968..4ee699e0f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -1,9 +1,17 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -11,19 +19,19 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.FieldEditor; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 - protected UITextField errorMsgTextField; + protected ErrorMsgTextFieldAdapter errorMsgTextField; protected JPanel validatePane; protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; @@ -40,7 +48,6 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fontSizePane = new FontSizeComboPane(); - errorMsgTextField = new UITextField(); JPanel contentPane = this.setFirstContentPane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.add(contentPane, BorderLayout.CENTER); @@ -76,23 +83,17 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initErrorMsgPane() { // 错误信息 - errorMsgTextField = new UITextField(); -// // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextField = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextField = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextField = new UITextFieldAdapter(); + } } @@ -111,7 +112,7 @@ public abstract class FieldEditorDefinePane extends Abstr validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); errorTipPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); borderPane.add(errorTipPane, BorderLayout.CENTER); allowBlankCheckBox.addItemListener(new ItemListener() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java index 2baea973c..6e6a2ff14 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java @@ -1,7 +1,9 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.RegPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.ilable.UILabel; @@ -11,10 +13,12 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.TextEditor; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -65,27 +69,36 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{widgetValueLabel, formWidgetValuePane}, + new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} }; double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}}; + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); boundsPane.add(panel); return boundsPane; } - public JPanel setValidatePane(){ + public JPanel setValidatePane() { return regPane; } - protected RegFieldPane createRegPane() { - return new RegFieldPane(); + RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); + if (provider == null) { + return new RegFieldPane(); + } + + try { + return provider.createRegPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new RegFieldPane(); + } } @Override @@ -102,7 +115,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected TextEditor updateSubFieldEditorBean() { - TextEditor ob = (TextEditor)creator.toData(); + TextEditor ob = (TextEditor) creator.toData(); this.regPane.update(ob); ob.setWaterMark(waterMarkDictPane.getText()); formWidgetValuePane.update(ob); diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java index 9c20dfb65..07faec922 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -1,19 +1,21 @@ package com.fr.design.widget.ui; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.TextFieldAdapterProvider; 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.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.FieldEditor; +import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ItemEvent; @@ -22,7 +24,7 @@ import java.awt.event.ItemListener; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 - protected UITextField errorMsgTextField; + protected ErrorMsgTextFieldAdapter errorMsgTextField; protected JPanel validatePane; public FieldEditorDefinePane() { @@ -45,23 +47,17 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initErrorMsgPane() { // 错误信息 - errorMsgTextField = new UITextField(); -// // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider == null) { + errorMsgTextField = new UITextFieldAdapter(); + return; + } + try { + errorMsgTextField = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextField = new UITextFieldAdapter(); + } } @Override @@ -101,7 +97,7 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); borderPane.add(errorTipPane, BorderLayout.CENTER); allowBlankCheckBox.addItemListener(new ItemListener() { @@ -117,7 +113,7 @@ public abstract class FieldEditorDefinePane extends Abstr new Component[]{allowBlankCheckBox}, new Component[]{borderPane}, }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); validatePane.add(panel, BorderLayout.NORTH); diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index d74d31c50..72e93e28c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,14 +1,16 @@ package com.fr.design.widget.ui; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.RegPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.TextEditor; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -60,7 +62,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane protected RegFieldPane createRegPane() { - return new RegFieldPane(); + RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); + if (provider == null) { + return new RegFieldPane(); + } + + try { + return provider.createRegPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new RegFieldPane(); + } } @Override From 82c3c094e5eb91f8119bb6f93e50eb670d3c04da Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 12 Oct 2021 17:45:11 +0800 Subject: [PATCH 002/152] =?UTF-8?q?REPORT-59089=20=E3=80=90=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E5=A4=9A=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E4=B8=BB=E9=A2=98=E7=9A=84=E5=8B=BE=E9=80=89?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=9C=89=E7=82=B9=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 调整下宽度和主题列表实现 【改动思路】 同上 --- .../mainframe/theme/TemplateThemeGridControlPane.java | 4 ++-- .../mainframe/theme/TemplateThemeGridPagesPane.java | 5 ----- .../fr/design/mainframe/theme/TemplateThemeGridPane.java | 9 ++++++++- .../theme/dialog/TemplateThemeGridPagesDialog.java | 4 +--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java index 6e04cb06f..f721923e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java @@ -52,7 +52,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; * Created by Starryi on 2021/8/13 */ public class TemplateThemeGridControlPane extends BasicPane { - public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10; + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 20; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; private final RemoveThemeAction removeAction; private final UIButton setTheme4NewTemplateButton; @@ -92,7 +92,7 @@ public class TemplateThemeGridControlPane extends Basic private void initializePane() { setLayout(FRGUIPaneFactory.createBorderLayout()); - setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); + setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); add(createActionsContainer(), BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java index 855e2bf78..fa8207696 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -34,7 +34,6 @@ import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; -import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; @@ -286,16 +285,12 @@ public class TemplateThemeGridPagesPane extends JPanel { } public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane { - public static final int CONTENT_WIDTH = TemplateThemeGridControlPane.CONTENT_WIDTH + 4; - public static final int CONTENT_HEIGHT = TemplateThemeGridControlPane.CONTENT_HEIGHT + 10; - private final UITabbedPane tabbedPane; private final TemplateThemeGridControlPane formThemesManagerPane; private final TemplateThemeGridControlPane reportThemesManagerPane; public TemplateThemeManagingPane() { setLayout(FRGUIPaneFactory.createBorderLayout()); - setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); tabbedPane = new UITabbedPane(); add(tabbedPane, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java index 3b9cb7bdc..2af4950f5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java @@ -8,6 +8,8 @@ import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -68,7 +70,12 @@ public class TemplateThemeGridPane extends BasicPane { contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP)); fillContentListPane(); - UIScrollPane scrollPane = new UIScrollPane(contentListPane); + JPanel wrapper1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapper1.add(contentListPane, BorderLayout.NORTH); + JPanel wrapper2 = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapper2.add(wrapper1, BorderLayout.WEST); + + UIScrollPane scrollPane = new UIScrollPane(wrapper2); scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); 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 9711e8e8a..917f078d5 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 @@ -1,7 +1,5 @@ package com.fr.design.mainframe.theme.dialog; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -16,7 +14,7 @@ import javax.swing.JPanel; * Created by Starryi on 2021/8/13 */ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener { - public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40; + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 48; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; protected TemplateThemeGridPagesPane overallPane; From db98d5412d61f470b92be970311ad6c14439a6fc Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 13 Oct 2021 14:48:36 +0800 Subject: [PATCH 003/152] =?UTF-8?q?REPORT-58193=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E5=89=A5=E7=A6=BB=E4=BA=8C=E6=9C=9F-?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8=E5=9F=8B=E7=82=B9-marketCl?= =?UTF-8?q?ick=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index d792f0eca..7b3d4d239 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -96,7 +96,8 @@ public class FormWidgetDetailPane extends FormDockView{ } headGroup = new UIHeadGroup(paneNames) { protected void tabChanged(int newSelectedIndex) { - if (newSelectedIndex == 1) { + //初始化还未展示的时候不需要收集其 marketClick + if (this.isShowing() && newSelectedIndex == 1) { ComponentCollector.getInstance().collectMarkerClick(); } cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); From fde1a587e2248dab3d19a5275e0b65d9302ae7d1 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 14 Oct 2021 16:06:44 +0800 Subject: [PATCH 004/152] =?UTF-8?q?REPORT-60561=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94-=E6=A0=B7=E5=BC=8F=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/report/fit/BaseFitAttrPane.java | 37 ++++++++++++------- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../fr/design/webattr/ServerFitAttrPane.java | 13 ++++++- 3 files changed, 36 insertions(+), 16 deletions(-) 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 31ea6417b..31afb3347 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 @@ -17,7 +17,6 @@ import com.fr.report.fit.ReportFitAttr; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -33,6 +32,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; public abstract class BaseFitAttrPane extends BasicBeanPane { protected JPanel contentJPanel; + protected UILabel belowSetLabel; protected UIComboBox itemChoose; protected java.util.List fitAttrModelList = new ArrayList<>(); @@ -97,7 +97,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); + attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); contentJPanel.add(attrJPanel); } @@ -136,9 +136,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { 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(); @@ -188,29 +197,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { protected void initComponents() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - contentJPanel = new JPanel(); - contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); + contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0); this.add(contentJPanel); initItemChoose(); + initPrompt(); } private void initItemChoose() { - JPanel chooseJPanel = new JPanel(); - chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); ItemListener itemListener = getItemListener(); itemChoose = new UIComboBox(getItemNames()); itemChoose.addItemListener(itemListener); - UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); + belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); + JPanel hSpaceLabel = new JPanel(); + hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0); JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ - belowSetLabel, itemChoose}, FlowLayout.LEFT, BELOW_SET_COMPONENT_HSPACE); + belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT); chooseJPanel.add(buttonPane); - chooseJPanel.setPreferredSize(new Dimension(500, 50)); - JPanel jPanel = new JPanel(); - jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel.add(chooseJPanel, BorderLayout.WEST); - - contentJPanel.add(jPanel); + chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + contentJPanel.add(chooseJPanel); } @@ -221,6 +227,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } + protected void initPrompt() { + } + protected void refresh() { validate(); repaint(); 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 0bee88e90..6d7bf83ae 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 @@ -576,7 +576,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Fri, 15 Oct 2021 14:29:41 +0800 Subject: [PATCH 005/152] =?UTF-8?q?REPORT-60504=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=A1=8C=E6=95=B0=E5=88=86=E9=A1=B5-?= =?UTF-8?q?=E2=80=9C=E5=88=86=E9=A1=B5=E8=A1=8C=E6=95=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E2=80=9D=E6=8E=A7=E4=BB=B6=E6=8E=A7=E4=BB=B6=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 9b1097d37..7c8ae3c6b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -49,6 +49,7 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.PageFixedRowComboBox; import com.fr.form.ui.Password; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; @@ -98,6 +99,7 @@ public class FormWidgetDefinePaneFactoryBase { defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); + defineMap.put(PageFixedRowComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); From f0442da478781daf7b736f7172328e09c5c7c720 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 18 Oct 2021 10:34:06 +0800 Subject: [PATCH 006/152] =?UTF-8?q?REPORT-60752=20=E3=80=9010.0=E3=80=91ta?= =?UTF-8?q?b=E7=BB=84=E4=BB=B6=EF=BC=8C=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E4=BB=8E=E9=BB=98=E8=AE=A4=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E5=90=8E=E4=B8=8D=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=85=B3=E9=97=AD=E7=AA=97=E5=8F=A3=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E8=BF=9B=E5=85=A5=E5=90=8E=EF=BC=8C=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E4=BC=9A=E6=98=BE=E7=A4=BA=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=BF=98=E6=98=AF=E9=BB=98=E8=AE=A4=E6=89=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/accessibles/AbstractTemplateStylePane.java | 4 ++++ .../widget/accessibles/AccessibleTemplateStyleEditor.java | 5 +++++ .../widget/accessibles/MobileTemplateStylePane.java | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java index 482b2cebc..399047a85 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java @@ -7,4 +7,8 @@ public abstract class AbstractTemplateStylePane extends BasicPane { public abstract void populate(T ob); public abstract T update(); + + public AbstractTemplateStylePane generateCleanPane() { + return this; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java index 195a92e8a..4f863e28b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java @@ -32,6 +32,11 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { setValue(stylePane.update()); fireStateChanged(); } + + @Override + public void doCancel() { + stylePane = stylePane.generateCleanPane(); + } }); stylePane.populate(getValue()); dlg.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 38f70de81..55c543b8f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -44,12 +44,14 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane> extraStyle = new HashSet<>(); + private WCardTagLayout tagLayout; public MobileTemplateStylePane(WCardTagLayout tagLayout){ init(tagLayout); } public void init(WCardTagLayout tagLayout){ this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.tagLayout = tagLayout; listModel = new DefaultListModel(); card = new CardLayout(); right = FRGUIPaneFactory.createCardLayout_S_Pane(); @@ -147,4 +149,9 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane generateCleanPane() { + return new MobileTemplateStylePane(this.tagLayout); + } } From 3cefa616a2b21d5115cbc54ffb5c604936ae6f89 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 18 Oct 2021 10:56:02 +0800 Subject: [PATCH 007/152] =?UTF-8?q?CHART-21219=20=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=BD=A2=E7=8A=B6=E6=9F=B1=E5=BD=A2=E5=9B=BE=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/component/VanChartHtmlLabelPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java index 0e9cc416f..ebff936c1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java @@ -5,6 +5,7 @@ import com.fr.design.constants.KeyWords; import com.fr.design.gui.autocomplete.AutoCompletion; import com.fr.design.gui.autocomplete.BasicCompletion; import com.fr.design.gui.autocomplete.DefaultCompletionProvider; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; @@ -45,7 +46,7 @@ public class VanChartHtmlLabelPane extends JPanel { private UICheckBox isCustomHeight; private UITextField customHeight; - private VanChartStylePane parent; + private AbstractAttrNoScrollPane parent; private JPanel widthAndHeightPane; @@ -53,7 +54,7 @@ public class VanChartHtmlLabelPane extends JPanel { contentTextArea.setText(text); } - public void setParent(VanChartStylePane parent) { + public void setParent(AbstractAttrNoScrollPane parent) { this.parent = parent; } @@ -126,7 +127,7 @@ public class VanChartHtmlLabelPane extends JPanel { }; } - private void fireJSChange() { + protected void fireJSChange() { if (parent != null) { parent.attributeChanged(); } From b3e55a4fdd64f60a5bb7553d9b30fe1ff7452dc5 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 18 Oct 2021 15:47:41 +0800 Subject: [PATCH 008/152] =?UTF-8?q?REPORT-59814=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=20groupingDetail=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=98=AF=E7=A9=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/collect/ComponentCollector.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index 3ea805deb..2c24cdf57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -288,12 +288,17 @@ public class ComponentCollector implements XMLable { private JSONArray getGroupingDetail() { JSONArray ja = JSONFactory.createJSON(JSON.ARRAY); - Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); - for(Group group : groups) { - JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); - jo.put(GROUP_NAME, group.getGroupName()); - jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length); - ja.add(jo); + try { + DefaultShareGroupManager.getInstance().refresh(); + Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); + for(Group group : groups) { + JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); + jo.put(GROUP_NAME, group.getGroupName()); + jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length); + ja.add(jo); + } + } catch (Exception e) { + e.printStackTrace(); } return ja; } From bfc1f47a0600e75ba5ce906c5c5097b3da30217d Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Tue, 19 Oct 2021 09:43:00 +0800 Subject: [PATCH 009/152] =?UTF-8?q?KERNEL-8509=20fix:=20=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=90=91=E5=AF=BC=E9=87=8D=E6=9E=84=E5=AF=BC=E8=87=B4=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=A4=B1=E8=B4=A5=E3=80=82=E8=BF=99=E9=87=8C=E9=80=82?= =?UTF-8?q?=E9=85=8D=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/start/LifecycleFatalErrorHandler.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java index a59d15faf..446253e90 100644 --- a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java +++ b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java @@ -11,11 +11,11 @@ import com.fr.exit.DesignerExiter; import com.fr.general.IOUtils; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StableUtils; import com.fr.stable.lifecycle.ErrorType; +import com.fr.stable.lifecycle.ErrorTypeHelper; import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.project.ProjectConstants; @@ -34,13 +34,7 @@ public class LifecycleFatalErrorHandler { private Map map = new HashMap<>(); private LifecycleFatalErrorHandler() { - for (ErrorType type : ErrorType.values()) { - if (ErrorType.FINEDB.equals(type)) { - map.put(type, FineDBHandler.SELF); - } else { - map.put(type, DefaultHandler.SELF); - } - } + map.put(ErrorTypeHelper.FINEDB, FineDBHandler.SELF); } public static LifecycleFatalErrorHandler getInstance() { @@ -50,7 +44,12 @@ public class LifecycleFatalErrorHandler { public void handle(FineLifecycleFatalError fatal) { SplashContext.getInstance().hide(); FineProcessContext.getParentPipe().fire(new CarryMessageEvent(ReportState.STOP.getValue())); - map.get(fatal.getErrorType()).handle(fatal); + + Handler handler = map.get(fatal.getErrorType()); + if (handler == null) { + handler = DefaultHandler.SELF; + } + handler.handle(fatal); } interface Handler { From bd4d66f66cb73fe01206c9916ae902672a027756 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 19 Oct 2021 09:44:08 +0800 Subject: [PATCH 010/152] =?UTF-8?q?REPORT-59814=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/share/collect/ComponentCollector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index 2c24cdf57..47b7dc7ef 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -298,7 +298,7 @@ public class ComponentCollector implements XMLable { ja.add(jo); } } catch (Exception e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage()); } return ja; } From 051cf462140f5abb1deeaae5786bd5e2294c6428 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Tue, 19 Oct 2021 14:26:40 +0800 Subject: [PATCH 011/152] =?UTF-8?q?BI-95654=20=20=20=E6=8B=B7=E8=B4=9D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=97=B6=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E4=BA=86identity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 1e3f96a98..daa408ab6 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -9,6 +9,7 @@ import com.fr.design.fun.ConnectionProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.i18n.Toolkit; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; @@ -18,13 +19,14 @@ import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; +import javax.swing.SwingUtilities; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.UUID; /** * Connection List Pane. @@ -159,4 +161,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject()); } } + + @Override + public void onCopyItem() { + super.onCopyItem(); + ListModelElement selectedValue = getSelectedValue(); + // identity 需要重置 + if (selectedValue != null && selectedValue.wrapper != null) { + Object temp = ((NameObject) selectedValue.wrapper).getObject(); + if (temp instanceof JDBCDatabaseConnection) { + JDBCDatabaseConnection object = (JDBCDatabaseConnection) temp; + object.setIdentity(UUID.randomUUID().toString()); + } + } + } } From 689adf8a38ee1f4dfc49bd4ac73a4e471098c8cd Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 19 Oct 2021 19:13:14 +0800 Subject: [PATCH 012/152] =?UTF-8?q?REPORT-60661=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96url=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/help/AboutPane.java | 3 +- .../design/actions/help/TutorialAction.java | 3 +- .../data/datapane/connect/JDBCDefPane.java | 4 +- .../com/fr/design/i18n/UrlI18nManager.java | 97 +++++++++++++++++++ .../mainframe/check/CheckFontInfoDialog.java | 4 +- .../src/main/java/com/fr/env/HelpLink.java | 4 +- .../com/fr/design/i18n/url_en.properties | 7 ++ .../com/fr/design/i18n/url_ja_JP.properties | 7 ++ .../com/fr/design/i18n/url_ko_KR.properties | 1 + .../com/fr/design/i18n/url_zh.properties | 7 ++ .../com/fr/design/i18n/url_zh_TW.properties | 7 ++ .../gui/xpane/BorderLineAndImagePane.java | 3 +- .../designer/mobile/ParaMobileDefinePane.java | 3 +- 13 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java create mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_en.properties create mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties create mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties create mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties create mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index 615854088..b369911bf 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -9,6 +9,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; @@ -82,7 +83,7 @@ public class AboutPane extends JPanel { addPhoneAndQQPane(contentPane); // 官网 - JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); + JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), UrlI18nManager.getInstance().getI18nUrl("website")); // 支持邮箱 String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index f1094d331..bf7dd942d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions.help; import com.fr.design.i18n.Toolkit; +import com.fr.design.i18n.UrlI18nManager; import com.fr.design.login.AbstractDesignerSSO; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; @@ -28,7 +29,7 @@ public class TutorialAction extends AbstractDesignerSSO { @Override public String getJumpUrl() { - return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com"); + return UrlI18nManager.getInstance().getI18nUrl("help"); } public String getOffLineWarnMessage() { 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 0da46965b..6f8e737ae 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 @@ -10,6 +10,7 @@ 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.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -159,7 +160,8 @@ public class JDBCDefPane extends JPanel { odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); odbcTipsLink.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { - String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); + //String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); + String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help"); BrowseUtils.browser(url); } }); diff --git a/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java b/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java new file mode 100644 index 000000000..aa498213e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java @@ -0,0 +1,97 @@ +package com.fr.design.i18n; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.locale.LocaleBundle; +import com.fr.locale.LocaleFiles; +import com.fr.locale.LocaleManager; +import com.fr.locale.impl.FineLocaleManager; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + + +public class UrlI18nManager { + private static final String I18N_URL_PATH = "com/fr/design/i18n/url"; + + private static UrlI18nManager instance = new UrlI18nManager(); + + public static UrlI18nManager getInstance() { + return instance; + } + + private LocaleManager localeManager = FineLocaleManager.create(); + + private UrlI18nManager() { + localeManager.addResource(I18N_URL_PATH); + } + + public String getI18nUrl(String key) { + String i18NUrl = getI18nUrlFromCloudCenter(key); + if (StringUtils.isBlank(i18NUrl)) { + i18NUrl = getI18nUrlFromLocal(key); + } + return i18NUrl; + } + + private String getI18nUrlFromCloudCenter(String key) { + List availableKeys = getCloudCenterAvailableKeys(key); + for (String availableKey : availableKeys) { + String i18NUrl = CloudCenter.getInstance().acquireConf(availableKey); + if (!StringUtils.isBlank(i18NUrl)) { + return i18NUrl; + } + } + return StringUtils.EMPTY; + } + + private List getCloudCenterAvailableKeys(String key) { + List availableKeys = new ArrayList<>(); + availableKeys.add(key + "." + GeneralContext.getLocale() + "." + ProductConstants.MAIN_VERSION); + availableKeys.add(key + "." + Locale.ENGLISH + "." + ProductConstants.MAIN_VERSION); + availableKeys.add(key + "." + Locale.CHINA + "." + ProductConstants.MAIN_VERSION); + availableKeys.add(key + "." + GeneralContext.getLocale()); + availableKeys.add(key + "." + Locale.ENGLISH); + availableKeys.add(key + "." + Locale.CHINA); + availableKeys.add(key + "." + ProductConstants.MAIN_VERSION); + availableKeys.add(key); + return availableKeys; + } + + private String getI18nUrlFromLocal(String key) { + List availableLocales = getAvailableLocales(); + LocaleBundle localeBundle = null; + for (Locale availableLocale : availableLocales) { + localeBundle = localeManager.getLocalBundle(availableLocale); + if (isExist(localeBundle, localeManager, key)) { + break; + } + } + if (localeBundle != null) { + return localeBundle.getText(localeManager, key); + } else { + return StringUtils.EMPTY; + } + } + + private List getAvailableLocales() { + List availableLocales = new ArrayList<>(); + availableLocales.add(GeneralContext.getLocale()); + availableLocales.add(Locale.ENGLISH); + availableLocales.add(Locale.CHINA); + return availableLocales; + } + + private boolean isExist(LocaleBundle localeBundle, LocaleManager localeManager, String key) { + List filesList = localeManager.getReverseList(); + for (LocaleFiles files : filesList) { + if (files.contains(localeBundle.getLocale(), key)) { + return true; + } + } + return false; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java index 0671ed1b6..86021733d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java @@ -5,6 +5,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; +import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; @@ -49,7 +50,8 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener { JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"), Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"), - CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html")); + UrlI18nManager.getInstance().getI18nUrl("help.install.font") + ); linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink")); messagePanel.add(linkMessage); diff --git a/designer-base/src/main/java/com/fr/env/HelpLink.java b/designer-base/src/main/java/com/fr/env/HelpLink.java index c717ce6ea..b0d5eab32 100644 --- a/designer-base/src/main/java/com/fr/env/HelpLink.java +++ b/designer-base/src/main/java/com/fr/env/HelpLink.java @@ -1,5 +1,6 @@ package com.fr.env; +import com.fr.design.i18n.UrlI18nManager; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; import com.fr.locale.InterProviderFactory; @@ -18,8 +19,7 @@ public class HelpLink { public static String getLink(String solution) { Map map = new HashMap<>(); - LocaleMark linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class); - String link = linkMark.getValue(); + String link = UrlI18nManager.getInstance().getI18nUrl("help.remote.design"); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), StringUtils.EMPTY); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link); diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties new file mode 100644 index 000000000..7f4fafc35 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties @@ -0,0 +1,7 @@ +help=https://help.fanruan.com/finereport-en/ +help.remote.design=https://help.fanruan.com/finereport-en/doc-view-3862.html?source=4 +odbc.help=https://help.fanruan.com/finereport-en/doc-view-289.html +plugin.mobile.style=https://help.fanruan.com/finereport-en/doc-view-2656.html +help.install.font=https://help.fanruan.com/finereport-en/doc-view-3875.html +website=https://www.finereport.com/en/ +nine.point.help=https://help.fanruan.com/finereport-en/doc-view-3876.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties new file mode 100644 index 000000000..6d0a960fa --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties @@ -0,0 +1,7 @@ +help=https://help.fanruan.com/finereport-jp/ +help.remote.design=https://help.fanruan.com/finereport-jp/doc-view-3891.html +odbc.help=https://help.fanruan.com/finereport-jp/doc-view-289.html +plugin.mobile.style=https://help.fanruan.com/finereport-jp/doc-view-2656.html +help.install.font=https://help.fanruan.com/finereport-jp/doc-view-3892.html +website=https://www.finereport.com/jp/ +nine.point.help=https://help.fanruan.com/finereport-jp/doc-view-3896.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties new file mode 100644 index 000000000..407896231 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties @@ -0,0 +1 @@ +website=https://www.finereport.com/kr/ \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties new file mode 100644 index 000000000..ef25a7bf8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties @@ -0,0 +1,7 @@ +help=https://help.fanruan.com/finereport/ +help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html +odbc.help=https://help.fanruan.com/finereport/doc-view-289.html +plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html +help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html +website=https://www.finereport.com/ +nine.point.help=https://help.fanruan.com/finereport/doc-view-4135.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties new file mode 100644 index 000000000..1a207e9f3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties @@ -0,0 +1,7 @@ +help=https://help.fanruan.com/finereport-tw/ +help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html +odbc.help=https://help.fanruan.com/finereport/doc-view-289.html +plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html +help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html +website=https://www.finereport.com/tw/ +nine.point.help=https://help.fanruan.com/finereport-tw/doc-view-4519.html \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 0f2b853d1..3d2e86c59 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -20,6 +20,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -121,7 +122,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { public void actionPerformed(ActionEvent e) { Desktop desktop = Desktop.getDesktop(); try { - desktop.browse(new URI(TWEAK_NINE_POINT_HELP_URL)); + desktop.browse(new URI(UrlI18nManager.getInstance().getI18nUrl("nine.point.help"))); } catch (IOException | URISyntaxException ioException) { ioException.printStackTrace(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 906fa6e55..759a05ba7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -9,6 +9,7 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -104,7 +105,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { @Override public void mouseClicked(MouseEvent e) { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style"))); + Desktop.getDesktop().browse(new URI(UrlI18nManager.getInstance().getI18nUrl("plugin.mobile.style"))); } catch (Exception exp) { FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } From 4da049f96bc2d7ab40137c405024d21bcb97582a Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 19 Oct 2021 20:05:41 +0800 Subject: [PATCH 013/152] =?UTF-8?q?REPORT-60661=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96url=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/help/AboutPane.java | 2 +- .../design/actions/help/TutorialAction.java | 3 +- .../data/datapane/connect/JDBCDefPane.java | 3 +- .../com/fr/design/i18n/UrlI18nManager.java | 97 ------------------- .../mainframe/check/CheckFontInfoDialog.java | 3 +- .../src/main/java/com/fr/env/HelpLink.java | 5 +- .../com/fr/design/i18n/url_en.properties | 7 -- .../com/fr/design/i18n/url_ja_JP.properties | 7 -- .../com/fr/design/i18n/url_ko_KR.properties | 1 - .../com/fr/design/i18n/url_zh.properties | 7 -- .../com/fr/design/i18n/url_zh_TW.properties | 7 -- .../gui/xpane/BorderLineAndImagePane.java | 2 +- .../designer/mobile/ParaMobileDefinePane.java | 2 +- 13 files changed, 8 insertions(+), 138 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java delete mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_en.properties delete mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties delete mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties delete mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties delete mode 100644 designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index b369911bf..eaff26ba5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -9,12 +9,12 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; +import com.fr.i18n.UrlI18nManager; import com.fr.locale.InterProviderFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index bf7dd942d..4f06b1c56 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,12 +1,11 @@ package com.fr.design.actions.help; import com.fr.design.i18n.Toolkit; -import com.fr.design.i18n.UrlI18nManager; import com.fr.design.login.AbstractDesignerSSO; import com.fr.design.menu.MenuKeySet; -import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; +import com.fr.i18n.UrlI18nManager; import com.fr.stable.CommonUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; 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 6f8e737ae..a5b8fc347 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 @@ -10,15 +10,14 @@ 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.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.BrowseUtils; import com.fr.file.filter.ChooseFileFilter; -import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; +import com.fr.i18n.UrlI18nManager; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; diff --git a/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java b/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java deleted file mode 100644 index aa498213e..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.fr.design.i18n; - -import com.fr.general.CloudCenter; -import com.fr.general.GeneralContext; -import com.fr.locale.LocaleBundle; -import com.fr.locale.LocaleFiles; -import com.fr.locale.LocaleManager; -import com.fr.locale.impl.FineLocaleManager; -import com.fr.stable.ProductConstants; -import com.fr.stable.StringUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - - -public class UrlI18nManager { - private static final String I18N_URL_PATH = "com/fr/design/i18n/url"; - - private static UrlI18nManager instance = new UrlI18nManager(); - - public static UrlI18nManager getInstance() { - return instance; - } - - private LocaleManager localeManager = FineLocaleManager.create(); - - private UrlI18nManager() { - localeManager.addResource(I18N_URL_PATH); - } - - public String getI18nUrl(String key) { - String i18NUrl = getI18nUrlFromCloudCenter(key); - if (StringUtils.isBlank(i18NUrl)) { - i18NUrl = getI18nUrlFromLocal(key); - } - return i18NUrl; - } - - private String getI18nUrlFromCloudCenter(String key) { - List availableKeys = getCloudCenterAvailableKeys(key); - for (String availableKey : availableKeys) { - String i18NUrl = CloudCenter.getInstance().acquireConf(availableKey); - if (!StringUtils.isBlank(i18NUrl)) { - return i18NUrl; - } - } - return StringUtils.EMPTY; - } - - private List getCloudCenterAvailableKeys(String key) { - List availableKeys = new ArrayList<>(); - availableKeys.add(key + "." + GeneralContext.getLocale() + "." + ProductConstants.MAIN_VERSION); - availableKeys.add(key + "." + Locale.ENGLISH + "." + ProductConstants.MAIN_VERSION); - availableKeys.add(key + "." + Locale.CHINA + "." + ProductConstants.MAIN_VERSION); - availableKeys.add(key + "." + GeneralContext.getLocale()); - availableKeys.add(key + "." + Locale.ENGLISH); - availableKeys.add(key + "." + Locale.CHINA); - availableKeys.add(key + "." + ProductConstants.MAIN_VERSION); - availableKeys.add(key); - return availableKeys; - } - - private String getI18nUrlFromLocal(String key) { - List availableLocales = getAvailableLocales(); - LocaleBundle localeBundle = null; - for (Locale availableLocale : availableLocales) { - localeBundle = localeManager.getLocalBundle(availableLocale); - if (isExist(localeBundle, localeManager, key)) { - break; - } - } - if (localeBundle != null) { - return localeBundle.getText(localeManager, key); - } else { - return StringUtils.EMPTY; - } - } - - private List getAvailableLocales() { - List availableLocales = new ArrayList<>(); - availableLocales.add(GeneralContext.getLocale()); - availableLocales.add(Locale.ENGLISH); - availableLocales.add(Locale.CHINA); - return availableLocales; - } - - private boolean isExist(LocaleBundle localeBundle, LocaleManager localeManager, String key) { - List filesList = localeManager.getReverseList(); - for (LocaleFiles files : filesList) { - if (files.contains(localeBundle.getLocale(), key)) { - return true; - } - } - return false; - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java index 86021733d..a8c19c697 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java @@ -5,11 +5,10 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; -import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.CloudCenter; import com.fr.general.IOUtils; +import com.fr.i18n.UrlI18nManager; import javax.swing.BorderFactory; import javax.swing.JDialog; diff --git a/designer-base/src/main/java/com/fr/env/HelpLink.java b/designer-base/src/main/java/com/fr/env/HelpLink.java index b0d5eab32..133a23490 100644 --- a/designer-base/src/main/java/com/fr/env/HelpLink.java +++ b/designer-base/src/main/java/com/fr/env/HelpLink.java @@ -1,8 +1,7 @@ package com.fr.env; -import com.fr.design.i18n.UrlI18nManager; -import com.fr.general.locale.LocaleCenter; -import com.fr.general.locale.LocaleMark; + +import com.fr.i18n.UrlI18nManager; import com.fr.locale.InterProviderFactory; import com.fr.stable.StringUtils; import java.util.HashMap; diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties deleted file mode 100644 index 7f4fafc35..000000000 --- a/designer-base/src/main/resources/com/fr/design/i18n/url_en.properties +++ /dev/null @@ -1,7 +0,0 @@ -help=https://help.fanruan.com/finereport-en/ -help.remote.design=https://help.fanruan.com/finereport-en/doc-view-3862.html?source=4 -odbc.help=https://help.fanruan.com/finereport-en/doc-view-289.html -plugin.mobile.style=https://help.fanruan.com/finereport-en/doc-view-2656.html -help.install.font=https://help.fanruan.com/finereport-en/doc-view-3875.html -website=https://www.finereport.com/en/ -nine.point.help=https://help.fanruan.com/finereport-en/doc-view-3876.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties deleted file mode 100644 index 6d0a960fa..000000000 --- a/designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties +++ /dev/null @@ -1,7 +0,0 @@ -help=https://help.fanruan.com/finereport-jp/ -help.remote.design=https://help.fanruan.com/finereport-jp/doc-view-3891.html -odbc.help=https://help.fanruan.com/finereport-jp/doc-view-289.html -plugin.mobile.style=https://help.fanruan.com/finereport-jp/doc-view-2656.html -help.install.font=https://help.fanruan.com/finereport-jp/doc-view-3892.html -website=https://www.finereport.com/jp/ -nine.point.help=https://help.fanruan.com/finereport-jp/doc-view-3896.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties deleted file mode 100644 index 407896231..000000000 --- a/designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties +++ /dev/null @@ -1 +0,0 @@ -website=https://www.finereport.com/kr/ \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties deleted file mode 100644 index ef25a7bf8..000000000 --- a/designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties +++ /dev/null @@ -1,7 +0,0 @@ -help=https://help.fanruan.com/finereport/ -help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html -odbc.help=https://help.fanruan.com/finereport/doc-view-289.html -plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html -help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html -website=https://www.finereport.com/ -nine.point.help=https://help.fanruan.com/finereport/doc-view-4135.html \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties deleted file mode 100644 index 1a207e9f3..000000000 --- a/designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties +++ /dev/null @@ -1,7 +0,0 @@ -help=https://help.fanruan.com/finereport-tw/ -help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html -odbc.help=https://help.fanruan.com/finereport/doc-view-289.html -plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html -help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html -website=https://www.finereport.com/tw/ -nine.point.help=https://help.fanruan.com/finereport-tw/doc-view-4519.html \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 3d2e86c59..6e8cac0d8 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -20,7 +20,6 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -32,6 +31,7 @@ import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.LayoutBorderStyle; import com.fr.general.Background; import com.fr.general.IOUtils; +import com.fr.i18n.UrlI18nManager; import com.fr.stable.Constants; import com.fr.stable.GraphDrawHelper; import com.fr.stable.ProjectLibrary; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 759a05ba7..be598f553 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -9,7 +9,6 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.UrlI18nManager; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -22,6 +21,7 @@ import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.general.CloudCenter; +import com.fr.i18n.UrlI18nManager; import com.fr.log.FineLoggerFactory; import com.fr.report.mobile.EmptyMobileParamStyle; From a931c0d0525376546169595cc3dcf2f63a49e409 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 19 Oct 2021 20:07:50 +0800 Subject: [PATCH 014/152] =?UTF-8?q?REPORT-60661=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96url=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 1 - 1 file changed, 1 deletion(-) 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 a5b8fc347..1f9b90dbb 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 @@ -159,7 +159,6 @@ public class JDBCDefPane extends JPanel { odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); odbcTipsLink.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { - //String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help"); BrowseUtils.browser(url); } From 47b00511334c3c1e35d2267eada86623a72314de Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 Oct 2021 15:30:26 +0800 Subject: [PATCH 015/152] =?UTF-8?q?REPORT-61356=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=81=9C=E7=95=99=E7=9A=84=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8F=98=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/NorthRegionContainerPane.java | 79 ++++++++++++++----- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index b07071057..05198ba0e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -17,6 +17,8 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; @@ -38,6 +40,17 @@ public class NorthRegionContainerPane extends JPanel { private JMenuBar menuBar; + private PluginFilter pluginFilter = new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }; + + private volatile boolean existDesignExtraPlugin; + public static NorthRegionContainerPane getInstance() { if (THIS == null) { synchronized (NorthRegionContainerPane.class) { @@ -66,34 +79,64 @@ public class NorthRegionContainerPane extends JPanel { //hugh: private修改为protected方便oem的时候修改右上的组件构成 //顶部日志+登陆按钮 final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + initPluginListener(northEastPane, ad); + refreshNorthEastPane(northEastPane, ad); + return northEastPane; + } + + private void initPluginListener(JPanel northEastPane, ToolBarMenuDock ad) { //优先级为-1,保证最后全面刷新一次 - GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { + PluginEventListener pluginOnRunOrStopListener = new PluginEventListener(-1) { @Override public void on(PluginEvent event) { - - refreshNorthEastPane(northEastPane, ad); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (DesignerContext.getDesignerFrame() == null) { - return; - } - DesignerContext.getDesignerFrame().refresh(); - DesignerContext.getDesignerFrame().repaint(); - } - }); + refreshAll(northEastPane, ad); } - }, new PluginFilter() { + }; + // 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件 + PluginEventListener afterAllPluginsActiveListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + //优先级为-1,保证最后全面刷新一次 + GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter); + // 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件 + boolean needRefresh = DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isVisible() && existDesignExtraPlugin; + if (needRefresh) { + refreshAll(northEastPane, ad); + } + } + }; + PluginEventListener beforeAllPluginStopListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginListenerRegistration.getInstance().stopListen(pluginOnRunOrStopListener); + } + }; + PluginEventListener pluginEventListener = new PluginEventListener() { @Override - public boolean accept(PluginContext context) { + public void on(PluginEvent event) { + existDesignExtraPlugin = true; + } + }; + GeneralContext.listenPluginRunningChanged(pluginEventListener, pluginFilter); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActiveListener); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllStop, beforeAllPluginStopListener); - return context.contain(PluginModule.ExtraDesign); + } + + private void refreshAll(JPanel northEastPane, ToolBarMenuDock ad) { + refreshNorthEastPane(northEastPane, ad); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + DesignerContext.getDesignerFrame().refresh(); + DesignerContext.getDesignerFrame().repaint(); } }); - refreshNorthEastPane(northEastPane, ad); - return northEastPane; } private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { From 793caec8900b40ee63f4c9c597273d2c3b050090 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 Oct 2021 15:51:30 +0800 Subject: [PATCH 016/152] =?UTF-8?q?REPORT-60253=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=9B=86=E5=AF=BC=E5=87=BA=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=90=8E=EF=BC=8C=E6=A8=A1=E6=9D=BF=E4=BB=8E=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=88=87=E6=8D=A2=E5=88=B0=E8=BF=9C=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E5=88=87=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0=EF=BC=8C?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E4=BF=9D=E5=AD=98=E6=A8=A1=E6=9D=BF=E4=BC=9A?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=20=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=EF=BC=8C=E6=9C=89npe=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 4 +++- .../main/java/com/fr/design/mainframe/JTemplateFactory.java | 5 ++++- 2 files changed, 7 insertions(+), 2 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 f2e3470a8..1ccc07303 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 @@ -381,7 +381,9 @@ public abstract class JTemplate> */ @Deprecated public void refreshResource() { - refreshResource(this.editingFILE); + if (JTemplateFactory.isAvailable()) { + refreshResource(this.editingFILE); + } } public void refreshResource(FILE file) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java index 5e75cc64b..9aa8204d6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java @@ -93,4 +93,7 @@ public final class JTemplateFactory { ALL_APP.remove(app); } } -} \ No newline at end of file + + public static boolean isAvailable() { + return !ALL_APP.isEmpty(); + }} \ No newline at end of file From c43a01c40c3b87a17c868aa157d4bfd112727566 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 Oct 2021 16:33:58 +0800 Subject: [PATCH 017/152] =?UTF-8?q?REPORT-61356=20=20fix=20=E7=BB=9F?= =?UTF-8?q?=E4=B8=80api=E4=BD=BF=E7=94=A8=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/NorthRegionContainerPane.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index 05198ba0e..91899e5b5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -18,7 +18,6 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; -import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; @@ -110,7 +109,7 @@ public class NorthRegionContainerPane extends JPanel { PluginEventListener beforeAllPluginStopListener = new PluginEventListener() { @Override public void on(PluginEvent event) { - PluginListenerRegistration.getInstance().stopListen(pluginOnRunOrStopListener); + GeneralContext.stopListenPlugin(pluginOnRunOrStopListener); } }; PluginEventListener pluginEventListener = new PluginEventListener() { @@ -120,8 +119,8 @@ public class NorthRegionContainerPane extends JPanel { } }; GeneralContext.listenPluginRunningChanged(pluginEventListener, pluginFilter); - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActiveListener); - PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllStop, beforeAllPluginStopListener); + GeneralContext.listenPlugin(PluginEventType.AfterAllActive, afterAllPluginsActiveListener); + GeneralContext.listenPlugin(PluginEventType.BeforeAllStop, beforeAllPluginStopListener); } From 35e7d2d23f9e4ab3353a9836d71b9a2b8c360775 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 11:34:39 +0800 Subject: [PATCH 018/152] =?UTF-8?q?CHART-21391=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E7=BB=84=E5=90=88=E5=9B=BE=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=20=E7=B1=BB=E5=9E=8B=E9=9D=A2=E6=9D=BF=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/chart/ChartEditPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 70b7130f1..6b75dff69 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -22,9 +22,11 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.form.main.Form; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; @@ -334,7 +336,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare String chartID = chart.getID(); boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); - return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex); + boolean duchampCustomChart = ChartEditContext.duchampMode() + && VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID.equals(chartID); + + return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex) || duchampCustomChart; } return false; } From ba77f3016e1a04befe88a64bd8c42a7dbbdef960 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 14:50:45 +0800 Subject: [PATCH 019/152] =?UTF-8?q?CHART-21357=20fix:=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E8=BD=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/config/DefaultStyleConstants.java | 89 +++++++++++++++++++ .../chart/config/DefaultStyleHelper4Van.java | 87 ++++++++++++++++++ .../VanChartCustomPlotSelectPane.java | 3 +- .../designer/style/axis/VanChartAxisPane.java | 7 +- .../VanChartAxisScrollPaneWithTypeSelect.java | 9 +- 5 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java new file mode 100644 index 000000000..e529fc1d6 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java @@ -0,0 +1,89 @@ +package com.fr.van.chart.config; + +import com.fr.base.ChartPreStyleConfig; +import com.fr.chart.base.ChartBaseUtils; +import com.fr.chart.base.ChartConstants; +import com.fr.general.Background; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; +import com.fr.stable.CodeUtils; +import com.fr.stable.Constants; + +import java.awt.Color; +import java.awt.Font; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/25 + */ +public class DefaultStyleConstants { + static final FRFont TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 14, new Color(241, 246, 255)); + static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + + static final FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(200, 211, 228)); + static final Color AXIS_LINE = new Color(46, 75, 102); + static final Color GRID_LINE = new Color(30, 55, 78); + + static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + static final Color DATA_SHEET_BORDER = new Color(46, 75, 102); + + static final Color BORDER = Color.BLACK; + static final int BORDER_WIDTH = Constants.LINE_NONE; + static final int SPECIAL_BORDER_WIDTH = Constants.LINE_THIN; + + static final FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 10, new Color(232, 232, 232)); + + static final Color GAUGE_PANE_BACK_COLOR = null; + static final Color GAUGE_HINGE = null; + static final Color GAUGE_PANE_BACK_COLOR_4_RING = new Color(72, 73, 79); + static final Color GAUGE_SLOT_BACKGROUND_COLOR = new Color(72, 73, 79); + private static final String FONT_NAME = ChartBaseUtils.getLocalDefaultFont("verdana"); + static final FRFont THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 9, new Color(232, 232, 232));//试管仪表盘标签的默认样式 + static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 8, new Color(159, 173, 191)); + static final FRFont RING_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//百分比圆环仪表盘值标签的默认样式 + static final FRFont POINTER_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//多指针仪表盘值标签的默认样式 + static final FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 10, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式 + + static final Color MAP_NULL_VALUE_COLOR = new Color(168, 168, 168); + static final Color MAP_BORDER = Color.BLACK; + static final Color MAP_LEGEND_BACK = Color.BLACK; + static final Color MAP_TITLE_BACK = Color.BLACK; + + static final Color DRILL_MAP_DRILL_TOOLS_BACK = Color.BLACK; + static final float DRILL_MAP_DRILL_TOOLS_BACK_OPACITY = 0.8f; + + //todo vancharts + private static final Color GANTT_OUT_LINE = GRID_LINE; + private static final FRFont GANTT_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 8, new Color(217, 217, 217)); + private static final Color GANTT_BORDER_LINE = new Color(30, 36, 58); + private static final Color GAUGE_TICK = new Color(39, 49, 71); + + static final Background BACK = null; + + static String COLORS = null; + + static { + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); + try { + DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); + // 没有经典高亮, 用新特性 + if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { + DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); + } + // 没有新特性, 用第一个配色 + if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { + if (config.names().hasNext()) { + + String name = GeneralUtils.objectToString(config.names().next()); + if (config.getPreStyle(name) != null) { + DefaultStyleConstants.COLORS = name; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java new file mode 100644 index 000000000..b65e7eecb --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -0,0 +1,87 @@ +package com.fr.van.chart.config; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.AttrFillStyle; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.DataSheet; +import com.fr.config.predefined.ColorFillStyle; +import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.map.VanChartMapPlot; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/10/22 + * vanchart的专门写一个,因为主体代码 新增y轴 组合图新增图表都要用 + */ +public class DefaultStyleHelper4Van { + + public static void dealVanPlot(Plot plot) { + if (plot instanceof VanChartPlot) { + VanChartPlot vanChartPlot = (VanChartPlot) plot; + + ColorFillStyle colorFillStyle = new ColorFillStyle(); + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); + } + plotFillStyle.setColorFillStyle(colorFillStyle); + + if (vanChartPlot.getLegend() != null) { + vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); + } + + if (vanChartPlot instanceof VanChartRectanglePlot) { + VanChartRectanglePlot vanChartRectanglePlot = (VanChartRectanglePlot) vanChartPlot; + + for (VanChartAxis axis : vanChartRectanglePlot.getXAxisList()) { + dealAxisDefault(axis); + } + for (VanChartAxis axis : vanChartRectanglePlot.getYAxisList()) { + dealAxisDefault(axis); + } + } + + dealBorder(vanChartPlot); + + DataSheet dataSheet = vanChartPlot.getDataSheet(); + dataSheet.getTextAttr().setFRFont(DefaultStyleConstants.DATA_SHEET); + dataSheet.setBorderColor(DefaultStyleConstants.DATA_SHEET_BORDER); + } + + } + + public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); + axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); + axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); + axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); + return axis; + } + + private static void dealBorder(VanChartPlot vanChartPlot) { + ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder != null) { + attrBorder.setBorderColor(DefaultStyleConstants.BORDER); + attrBorder.setBorderStyle(defaultBorderWidth(vanChartPlot)); + } + } + + private static int defaultBorderWidth(VanChartPlot vanChartPlot) { + //pie multipie treemap map drillmap heatmap + if (vanChartPlot instanceof PiePlot4VanChart + || vanChartPlot instanceof VanChartMapPlot) { + return DefaultStyleConstants.SPECIAL_BORDER_WIDTH; + } + return DefaultStyleConstants.BORDER_WIDTH; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java index 8f7b9557d..b5a8a13f9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -6,13 +6,13 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.custom.CustomPlotDesignerPaneFactory; import javax.swing.JOptionPane; @@ -260,6 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane { CustomPlotType customPlotType = selectedPlotTypeList.get(i); if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); + DefaultStyleHelper4Van.dealVanPlot(vanChartPlot); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); //设置公共属性 setCommonAttr(vanChartPlot, customPlot); 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 5c71317f2..e8379e78b 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 @@ -14,16 +14,17 @@ import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.axis.component.VanChartAxisButtonPane; import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.awt.BorderLayout; -import java.awt.CardLayout; /** * 样式-坐标轴界面 @@ -104,6 +105,7 @@ public class VanChartAxisPane extends BasicBeanPane { List xAxisList = editingPlot.getXAxisList(); VanChartAxis axis = editingPlot.createXAxis(name, VanChartConstants.AXIS_BOTTOM); xAxisList.add(axis); + DefaultStyleHelper4Van.dealAxisDefault(axis); VanChartXYAxisPaneInterface axisPane = initXAxisPane(axis); axisPane.populate(axis); @@ -119,6 +121,7 @@ public class VanChartAxisPane extends BasicBeanPane { List yAxisList = editingPlot.getYAxisList(); VanChartAxis axis = editingPlot.createYAxis(name, VanChartConstants.AXIS_LEFT); yAxisList.add(axis); + DefaultStyleHelper4Van.dealAxisDefault(axis); VanChartXYAxisPaneInterface axisPane = initYAxisPane(axis); axisPane.populate(axis); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java index ef042e0f2..daa7ca3c9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java @@ -1,15 +1,16 @@ package com.fr.van.chart.designer.style.axis; import com.fr.chart.chartattr.Axis; -import com.fr.design.i18n.Toolkit; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.plugin.chart.type.AxisType; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -83,9 +84,9 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll public void populate(VanChartAxis axis){ AxisType axisType = axis.getAxisType(); - textAxisPane.populateBean(new VanChartAxis(axis.getAxisName(), axis.getPosition())); - timeAxisPane.populateBean(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition())); - valueAxisPane.populateBean(new VanChartValueAxis(axis.getAxisName(), axis.getPosition())); + textAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartAxis(axis.getAxisName(), axis.getPosition()))); + timeAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition()))); + valueAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartValueAxis(axis.getAxisName(), axis.getPosition()))); if(ComparatorUtils.equals(axisType, AxisType.AXIS_CATEGORY)){ textAxisPane.populateBean(axis); } else if(ComparatorUtils.equals(axisType, AxisType.AXIS_TIME)){ From 19bdeeacc366d9c8268ee9dff1ab80ddbd94b237 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 15:24:06 +0800 Subject: [PATCH 020/152] =?UTF-8?q?CHART-21376=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=BB=84=E5=90=88=E5=9B=BE=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=20=E9=BB=98=E8=AE=A4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/config/DefaultStyleHelper4Van.java | 91 ++++++++++++++++++- .../VanChartCustomPlotSelectPane.java | 2 +- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index b65e7eecb..95eee394a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -7,11 +7,17 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.DataSheet; import com.fr.config.predefined.ColorFillStyle; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrLabelDetail; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.GaugeStyle; /** * @author shine @@ -21,7 +27,39 @@ import com.fr.plugin.chart.map.VanChartMapPlot; */ public class DefaultStyleHelper4Van { - public static void dealVanPlot(Plot plot) { + public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { + dealVanPlotCommonAttr(plot); + switch (customPlotType) { + case PIE: + case DIFFERENT_PIE: + case SAME_PIE: + dealPie(plot); + break; + case SLOT: + case POINTER_360: + case POINTER_180: + case CUVETTE: + case RING: + dealGauge(plot); + break; + case COLUMN: + case LINE: + case AREA: + case BUBBLE: + case RADAR: + case STACK_RADAR: + case SCATTER: + default: + break; + } + + } + + + public static void dealVanPlotCommonAttr(Plot plot) { + if (!ChartEditContext.duchampMode()) { + return; + } if (plot instanceof VanChartPlot) { VanChartPlot vanChartPlot = (VanChartPlot) plot; @@ -60,6 +98,9 @@ public class DefaultStyleHelper4Van { } public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + if (!ChartEditContext.duchampMode()) { + return axis; + } axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); @@ -84,4 +125,52 @@ public class DefaultStyleHelper4Van { } return DefaultStyleConstants.BORDER_WIDTH; } + + static void dealPie(Plot plot) { + if (plot instanceof PiePlot4VanChart) { + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class); + if (attrLabel == null) { + attrLabel = ((PiePlot4VanChart) plot).getDefaultAttrLabel(); + defaultAttr.addDataSeriesCondition(attrLabel); + } + attrLabel.getSecondLabelDetail().getTextAttr().setFRFont(DefaultStyleConstants.PIE_CATEGORY_LABEL); + } + } + + static void dealGauge(Plot param) { + if (!(param instanceof VanChartGaugePlot)) { + return; + } + VanChartGaugePlot plot = (VanChartGaugePlot) param; + plot.getGaugeDetailStyle().setPaneBackgroundColor(plot.getGaugeStyle() == GaugeStyle.RING ? DefaultStyleConstants.GAUGE_PANE_BACK_COLOR_4_RING : DefaultStyleConstants.GAUGE_PANE_BACK_COLOR); + plot.getGaugeDetailStyle().setSlotBackgroundColor(DefaultStyleConstants.GAUGE_SLOT_BACKGROUND_COLOR); + plot.getGaugeDetailStyle().setHingeColor(DefaultStyleConstants.GAUGE_HINGE); + + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class); + if (attrLabel != null) { + AttrLabelDetail detail = attrLabel.getAttrLabelDetail(); + AttrLabelDetail valueDetail = attrLabel.getGaugeValueLabelDetail(); + + switch (plot.getGaugeStyle()) { + case POINTER: + case POINTER_SEMI: + detail.getContent().getCategoryFormat().setEnable(false); + detail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_CATE_LABEL_FONT); + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_VALUE_LABEL_FONT); + break; + case RING: + case SLOT: + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.RING_VALUE_LABEL_FONT); + break; + case THERMOMETER: + detail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT); + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT); + plot.getGaugeAxis().getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_AXIS_LABEL); + break; + } + + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java index b5a8a13f9..99498c58a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -260,7 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane { CustomPlotType customPlotType = selectedPlotTypeList.get(i); if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); - DefaultStyleHelper4Van.dealVanPlot(vanChartPlot); + DefaultStyleHelper4Van.dealVanPlot4Custom(vanChartPlot, customPlotType); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); //设置公共属性 setCommonAttr(vanChartPlot, customPlot); From 283fddcfb24cc7d36c6733bf3a80a2b2bd9844b2 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 17:02:47 +0800 Subject: [PATCH 021/152] for duchamp mode --- .../chart/config/DefaultStyleHelper4Van.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index 95eee394a..5f7e318a7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -23,11 +23,14 @@ import com.fr.plugin.chart.type.GaugeStyle; * @author shine * @version 10.0 * Created by shine on 2021/10/22 - * vanchart的专门写一个,因为主体代码 新增y轴 组合图新增图表都要用 + * vanchart的抽出来,因为主体代码 新增y轴 组合图新增图表都要用 */ public class DefaultStyleHelper4Van { public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { + if (!ChartEditContext.duchampMode()) { + return; + } dealVanPlotCommonAttr(plot); switch (customPlotType) { case PIE: @@ -55,8 +58,18 @@ public class DefaultStyleHelper4Van { } + public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + if (!ChartEditContext.duchampMode()) { + return axis; + } + axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); + axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); + axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); + axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); + return axis; + } - public static void dealVanPlotCommonAttr(Plot plot) { + static void dealVanPlotCommonAttr(Plot plot) { if (!ChartEditContext.duchampMode()) { return; } @@ -97,17 +110,6 @@ public class DefaultStyleHelper4Van { } - public static VanChartAxis dealAxisDefault(VanChartAxis axis) { - if (!ChartEditContext.duchampMode()) { - return axis; - } - axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); - axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); - axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); - axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); - return axis; - } - private static void dealBorder(VanChartPlot vanChartPlot) { ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); From a9ca1e5700d3f06ff440ef949337ebf28032a420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 22 Oct 2021 22:36:31 +0800 Subject: [PATCH 022/152] =?UTF-8?q?REPORT-60538=20=E8=8B=B1=E6=97=A5?= =?UTF-8?q?=E9=9F=A9=E7=8E=AF=E5=A2=83=E6=9C=AA=E5=B1=8F=E8=94=BD=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=BB=84=E4=BB=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 1db9c38c3..309594a67 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; +import com.fr.general.GeneralContext; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -174,7 +175,8 @@ public class FormWidgetDetailPane extends FormDockView{ private void initPaneList() { paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); - paneList.add(OnlineWidgetRepoPane.getInstance()); + if (GeneralContext.isChineseEnv()) { + paneList.add(OnlineWidgetRepoPane.getInstance()); + } } - } From 2aa50641b5cec8c6086d3881bc118606ae72d1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 25 Oct 2021 10:12:57 +0800 Subject: [PATCH 023/152] =?UTF-8?q?REPORT-60538=20=E6=94=B9=E7=94=A8Locale?= =?UTF-8?q?Center=E5=9B=BD=E9=99=85=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/locale/impl/OnlineWidgetsMark.java | 26 +++++++++++++++++++ .../mainframe/FormWidgetDetailPane.java | 11 +++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java new file mode 100644 index 000000000..f5614fed9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java @@ -0,0 +1,26 @@ +package com.fr.design.locale.impl; + +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +public class OnlineWidgetsMark implements LocaleMark { + private Map map = new HashMap<>(); + + public OnlineWidgetsMark() { + map.put(Locale.CHINA, true); + map.put(Locale.TAIWAN, true); + map.put(Locale.US, false); + map.put(Locale.KOREA, false); + map.put(Locale.JAPAN, false); + } + + @Override + public Boolean getValue() { + Boolean result = map.get(GeneralContext.getLocale()); + return result == null ? false : result; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index f2268c86c..75f4b2692 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -6,10 +6,13 @@ import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.locale.impl.OnlineWidgetsMark; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -173,7 +176,13 @@ public class FormWidgetDetailPane extends FormDockView{ private void initPaneList() { paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); - paneList.add(OnlineWidgetRepoPane.getInstance()); + if (isShowOnlineWidgetRepoPane()) { + paneList.add(OnlineWidgetRepoPane.getInstance()); + } } + private boolean isShowOnlineWidgetRepoPane() { + LocaleMark mark = LocaleCenter.getMark(OnlineWidgetsMark.class); + return mark.getValue(); + } } From 7651eb4a229ae0a2d47abaa61e21e5fc332e0946 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 25 Oct 2021 10:34:17 +0800 Subject: [PATCH 024/152] =?UTF-8?q?REPORT-55377=20=E5=8D=87=E7=BA=A7=20tom?= =?UTF-8?q?cat=20=E7=89=88=E6=9C=AC=E4=BF=AE=E5=A4=8D=E5=85=AC=E5=BC=80?= =?UTF-8?q?=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index da6b0daf8..bf1616759 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,7 @@ allprojects { implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swag:1.0' implementation 'net.java.dev.jna:jna:5.4.0' - implementation 'org.apache.tomcat:tomcat-catalina:8.5.69' + implementation 'org.apache.tomcat:tomcat-catalina:8.5.72' implementation 'io.socket:socket.io-client:0.7.0' implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.core:fine-core:' + frDevVersion From 3c7aed8fc59b62cd0a40539af9ae7470173e40f9 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 25 Oct 2021 14:21:34 +0800 Subject: [PATCH 025/152] =?UTF-8?q?REPORT-60356=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A811.0=E9=80=82=E9=85=8D-10.0=E6=89=93=E4=B8=8D=E5=BC=80?= =?UTF-8?q?11.0=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97=E5=92=8C=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=BC=B9=E7=AA=97=EF=BC=88=E6=8F=90=E7=A4=BA=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F=E5=B7=B2=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=EF=BC=89=E5=90=8C=E6=97=B6=E6=89=93=E5=BC=80=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE=E5=BC=B9=E7=AA=97=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/app/CptApp.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java index 431b401fc..876270c87 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java @@ -100,8 +100,7 @@ class CptApp extends AbstractWorkBookApp { final JDialog jd = new JDialog(); // 模态一下,因为可能会多个样式丢失 - // jd.setModal(true); - jd.setAlwaysOnTop(true); + jd.setModal(true); jd.setSize(450, 150); jd.setResizable(false); jd.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); From 0a6bbd3517217a5ff09258084ff2fd1bfa95acc0 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 26 Oct 2021 13:53:09 +0800 Subject: [PATCH 026/152] =?UTF-8?q?CHART-21418=20fix:=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=BC=B9=E6=A1=86=20=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E4=BB=8EdisplayComponent=E4=B8=8A=E9=9D=A2=E7=A6=BB?= =?UTF-8?q?=E5=BC=80=E7=9A=84=EF=BC=8C=E9=9A=90=E8=97=8F=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/style/AbstractSelectBox.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 1d66094f1..7ebaa9d9d 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -6,7 +6,11 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; +import java.awt.Rectangle; import java.awt.RenderingHints; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -94,6 +98,18 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou hidePopupMenu(); } }); + + displayComponent.addMouseListener(new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + Rectangle rectangle = displayComponent.getBounds(); + if (e.getY() < rectangle.y) { + //如果是从displayComponent上面离开的,隐藏弹出界面。 + hidePopupMenu(); + } + + } + }); } public void setEnabled(boolean enabled) { From 0dfea644723e97c69c6f9e35daedba21f757dece Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 26 Oct 2021 14:54:17 +0800 Subject: [PATCH 027/152] =?UTF-8?q?REPORT-61471=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96url=E9=80=82=E9=85=8D-=E9=9F=A9=E6=96=87url-=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=AE=BE=E8=AE=A1=E5=B8=B8=E8=A7=81=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E7=AA=97=E6=98=BE=E7=A4=BA=E5=92=8C=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=9C=B0=E5=9D=80=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/design/dialog/UIDetailErrorLinkDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java index b9854c6bc..24ff7e10c 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java @@ -92,7 +92,7 @@ public class UIDetailErrorLinkDialog extends UIDialog { contentPane.add(link, BorderLayout.SOUTH); // 确定 + 取消 - JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_10)); + JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_5)); actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Report_OK"))); actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"))); this.getContentPane().add(topPane, BorderLayout.NORTH); From 56df61ca0a6abf5bfe38522b7bbfbe9355008b0a Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 27 Oct 2021 12:59:53 +0800 Subject: [PATCH 028/152] =?UTF-8?q?REPORT-50016=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=A0=BC=E7=BB=84-?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8D=E5=8D=95=E5=85=83=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/SmartInsertDBManipulationPane.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 7b7867372..3818f1ac8 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 @@ -431,7 +431,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (oriCellSelection != null && isSameStartPoint(cellselection, oriCellSelection)) { dealDragSelection(add, cellselection, newValue); } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { - dealSelectColRow(add, cellselection); + dealSelectColRow(add, cellselection, newValue); } else { ColumnRow columnRow = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); String allColumnRow = newValue.toString(); @@ -503,12 +503,15 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); } - private void dealSelectColRow(ColumnRowGroup add, CellSelection se) { + private void dealSelectColRow(ColumnRowGroup add, CellSelection se, ColumnRowGroup newValue) { int c = se.getColumn(), cs = se.getColumnSpan(), r = se.getRow(), rs = se.getRowSpan(); for (int i = 0; i < cs; i++) { for (int j = 0; j < rs; j++) { - add.addColumnRow(ColumnRow.valueOf(c + i, r + j)); + ColumnRow columnRow = ColumnRow.valueOf(c + i, r + j); + if (!newValue.contains(columnRow)) { + add.addColumnRow(columnRow); + } } } } From 0210104f7ca9b774b38889992f200af6cdf8b5f1 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 27 Oct 2021 15:12:16 +0800 Subject: [PATCH 029/152] =?UTF-8?q?CHART-20951=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=9B=BE=E8=A1=A8=20?= =?UTF-8?q?=E8=AD=A6=E6=88=92=E7=BA=BF=E6=96=87=E5=AD=97=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/van/chart/config/DefaultStyleConstants.java | 2 ++ .../com/fr/van/chart/config/DefaultStyleHelper4Van.java | 8 ++++++++ .../designer/style/background/ChartNameObjectCreator.java | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java index e529fc1d6..6d0de41ce 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java @@ -26,6 +26,8 @@ public class DefaultStyleConstants { static final Color AXIS_LINE = new Color(46, 75, 102); static final Color GRID_LINE = new Color(30, 55, 78); + static final FRFont ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(255, 0, 0)); + static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); static final Color DATA_SHEET_BORDER = new Color(46, 75, 102); diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index 5f7e318a7..d6fc30bd5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -9,6 +9,7 @@ import com.fr.chart.chartglyph.DataSheet; import com.fr.config.predefined.ColorFillStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -69,6 +70,13 @@ public class DefaultStyleHelper4Van { return axis; } + public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { + if (!ChartEditContext.duchampMode()) { + return; + } + vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); + } + static void dealVanPlotCommonAttr(Plot plot) { if (!ChartEditContext.duchampMode()) { return; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java index 8a5a33ca8..4d8bbe990 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java @@ -3,10 +3,11 @@ package com.fr.van.chart.designer.style.background; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; -import com.fr.log.FineLoggerFactory; import com.fr.general.NameObject; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.stable.Nameable; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -37,6 +38,7 @@ public class ChartNameObjectCreator extends NameObjectCreator { VanChartAlertValue vanChartAlertValue = constructor.newInstance(); vanChartAlertValue.setAxisNamesArray((String[]) object); vanChartAlertValue.setAxisName(((String[]) object)[0]); + DefaultStyleHelper4Van.dealAxisAlert(vanChartAlertValue); return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue); } catch (NoSuchMethodException e) { From 50533781060d763e223179dc75c829bfe5c0558a Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 27 Oct 2021 17:28:05 +0800 Subject: [PATCH 030/152] =?UTF-8?q?REPORT-61652=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94-=E6=A0=B7=E5=BC=8F=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E4=BC=98=E5=8C=96-=E6=9F=90=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=9B=BD=E9=99=85=E5=8C=96=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/fit/BaseFitAttrPane.java | 5 +++-- .../fr/design/report/fit/menupane/ReportFitAttrAction.java | 5 +++-- .../resources/com/fr/design/i18n/dimension_en.properties | 6 +++++- .../resources/com/fr/design/i18n/dimension_ja_JP.properties | 6 +++++- .../resources/com/fr/design/i18n/dimension_ko_KR.properties | 6 +++++- .../resources/com/fr/design/i18n/dimension_zh.properties | 6 +++++- .../resources/com/fr/design/i18n/dimension_zh_TW.properties | 6 +++++- .../fr/design/actions/server/ServerConfigManagerAction.java | 3 ++- 8 files changed, 33 insertions(+), 10 deletions(-) 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 31afb3347..1a3126182 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 @@ -5,6 +5,7 @@ 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; @@ -90,9 +91,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } for (int i = 0; i < columnSize.length; i++) { if (i == 0) { - columnSize[i] = 80; + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();; } else { - columnSize[i] = 100; + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth();; } } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 36328d9bd..c1dd3afd6 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -4,6 +4,7 @@ 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.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -66,13 +67,13 @@ public class ReportFitAttrAction extends JTemplateAction { private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { attrPane.populateBean(fitAttr); - UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { wbTpl.setReportFitAttr(attrPane.updateBean()); jwb.fireTargetModified(); } - }); + }, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog")); dialog.setVisible(true); } diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index b69ede5ea..686c3da8a 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=490*95 com.fr.design.version.detail.label=750*30 com.fr.design.version.detail.dialog=900*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 -com.fr.design.web.pane.text.field=450*20 \ No newline at end of file +com.fr.design.web.pane.text.field=450*20 +com.fr.design.actions.server.dialog=800*630 +com.fr.design.report.fit.templatePane.dialog=800*400 +com.fr.design.report.fit.firstColumn=120*20 +com.fr.design.report.fit.column=160*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index 7d09dee4d..5937b272a 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=430*95 com.fr.design.version.detail.label=650*30 com.fr.design.version.detail.dialog=800*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 -com.fr.design.web.pane.text.field=400*20 \ No newline at end of file +com.fr.design.web.pane.text.field=400*20 +com.fr.design.actions.server.dialog=700*630 +com.fr.design.report.fit.templatePane.dialog=600*400 +com.fr.design.report.fit.firstColumn=170*20 +com.fr.design.report.fit.column=100*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 28823bf1a..5615b3555 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=450*95 com.fr.design.version.detail.label=700*30 com.fr.design.version.detail.dialog=850*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 -com.fr.design.web.pane.text.field=450*20 \ No newline at end of file +com.fr.design.web.pane.text.field=450*20 +com.fr.design.actions.server.dialog=700*630 +com.fr.design.report.fit.templatePane.dialog=600*400 +com.fr.design.report.fit.firstColumn=130*20 +com.fr.design.report.fit.column=100*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index 56998f7f7..c507fcc08 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=230*95 com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.dialog=600*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 -com.fr.design.web.pane.text.field=450*20 \ No newline at end of file +com.fr.design.web.pane.text.field=450*20 +com.fr.design.actions.server.dialog=700*630 +com.fr.design.report.fit.templatePane.dialog=600*400 +com.fr.design.report.fit.firstColumn=80*20 +com.fr.design.report.fit.column=100*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index 58e6ae121..8a383a438 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=230*95 com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.dialog=600*500 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 -com.fr.design.web.pane.text.field=450*20 \ No newline at end of file +com.fr.design.web.pane.text.field=450*20 +com.fr.design.actions.server.dialog=700*630 +com.fr.design.report.fit.templatePane.dialog=600*400 +com.fr.design.report.fit.firstColumn=80*20 +com.fr.design.report.fit.column=100*20 \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java index 601605418..9b8c6744e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java @@ -9,6 +9,7 @@ import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.EditReportServerParameterPane; @@ -25,7 +26,7 @@ import java.awt.event.ActionEvent; * Server Config Manager */ public class ServerConfigManagerAction extends UpdateAction { - public static final Dimension DEFAULT = new Dimension(700, 630); + public static final Dimension DEFAULT = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.actions.server.dialog"); public ServerConfigManagerAction() { this.setMenuKeySet(SERVER_CONFIG_MANAGER); From fd87cb7b7e2f824067713f3f3205bc62ea33e7d3 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 27 Oct 2021 17:56:08 +0800 Subject: [PATCH 031/152] =?UTF-8?q?REPORT-61652=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94-=E6=A0=B7=E5=BC=8F=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E4=BC=98=E5=8C=96-=E6=9F=90=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=9B=BD=E9=99=85=E5=8C=96=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/fit/BaseFitAttrPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1a3126182..7a2e0e472 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 @@ -91,9 +91,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { } for (int i = 0; i < columnSize.length; i++) { if (i == 0) { - columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();; + 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();; + columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth(); } } From c08b5b0213a60fbe15683f4516c56e0217f8bc92 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 28 Oct 2021 14:08:35 +0800 Subject: [PATCH 032/152] update --- .../fr/design/style/AbstractSelectBox.java | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 7ebaa9d9d..41eeacdba 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -1,5 +1,19 @@ package com.fr.design.style; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.style.background.BackgroundJComponent; +import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.Constants; + +import javax.swing.AbstractButton; +import javax.swing.JPanel; +import javax.swing.border.AbstractBorder; +import javax.swing.event.AncestorEvent; +import javax.swing.event.AncestorListener; +import javax.swing.plaf.ButtonUI; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -8,27 +22,10 @@ import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; import java.awt.RenderingHints; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import javax.swing.AbstractButton; -import javax.swing.JPanel; -import javax.swing.border.AbstractBorder; -import javax.swing.event.AncestorEvent; -import javax.swing.event.AncestorListener; -import javax.swing.plaf.ButtonUI; - -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUIPaintUtils; -import com.fr.design.style.background.BackgroundJComponent; -import com.fr.stable.Constants; - /** * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2011-10-31 下午03:28:31 类说明: 抽象出来的弹出box. 可以弹出颜色选择, 图案选择, 纹理选择. From 930d95a4528ebe1748f92a406c39ea87a1fee189 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 28 Oct 2021 17:42:02 +0800 Subject: [PATCH 033/152] =?UTF-8?q?REPORT-61736=20=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=83=8C=E6=99=AF=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BD=8D=E7=BD=AE=EF=BC=8C=E6=9D=A1=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=A1=86=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java | 2 ++ 1 file changed, 2 insertions(+) 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 452deb5c8..fc4b8e368 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 @@ -163,6 +163,8 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { try { latch.await(); } catch (InterruptedException ignore) { + } finally { + setShowDialogState(false); } return selectedFiles.length > 0 ? JFileChooser.APPROVE_OPTION : JFileChooser.CANCEL_OPTION; } From ff61af8327d38f61a21242cb9b26af911ebd3b22 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 2 Nov 2021 09:38:33 +0800 Subject: [PATCH 034/152] =?UTF-8?q?REPORT-61900=20=E3=80=90=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=8F=B3=E4=B8=8B=E8=A7=92?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E6=94=B9=E6=88=90=E5=85=B3=E9=97=AD=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E4=B8=8D=E6=98=AF=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改国际化文本 【改动思路】 同上 --- .../design/mainframe/theme/TemplateThemeGridPagesPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java index bfef5179a..36e962c6a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -139,7 +139,7 @@ public class TemplateThemeGridPagesPane extends JPanel { public UIButton[] createRightButtons() { UIButton[] buttons = new UIButton[] {}; buttons = ArrayUtils.addAll(buttons, createExtraButtons()); - buttons = ArrayUtils.addAll(buttons, createCompleteButton()); + buttons = ArrayUtils.addAll(buttons, createCloseButton()); return buttons; } @@ -180,8 +180,8 @@ public class TemplateThemeGridPagesPane extends JPanel { return uiButtonList.toArray(new UIButton[]{}); } - private UIButton createCompleteButton() { - UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete")); + private UIButton createCloseButton() { + UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close")); button.setName(COMPLETE_BUTTON); button.addActionListener(new ActionListener() { @Override From 3dc7263f558ce06d7dcc5bf38419cb9ba0dbe883 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 2 Nov 2021 11:19:06 +0800 Subject: [PATCH 035/152] =?UTF-8?q?REPORT-59614=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E6=97=A0=E6=8E=A8=E9=80=81=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 1 + 1 file changed, 1 insertion(+) 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 fba15b043..2cb2099bf 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 @@ -115,6 +115,7 @@ public class DesignerSocketIO { private static IO.Options createOptions() { IO.Options options = new IO.Options(); + options.path = WebSocketConfig.getInstance().getSocketContext(); try { if (ComparatorUtils.equals(currentProtocol, HTTPS)) { options.sslContext = getSSLContext(); From 62ef8a99b1ecf184ea9520b7c72f64422721ac8e Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 2 Nov 2021 19:02:16 +0800 Subject: [PATCH 036/152] =?UTF-8?q?REPORT-61654=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E9=9D=9E=E4=B8=AD=E6=96=87=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E5=AD=97=E4=BD=93=E7=BC=BA=E5=A4=B1=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=9A=84=E5=BC=B9=E7=AA=97=E5=86=85=E5=AE=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/design/i18n/dimension_ko_KR.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 5615b3555..96a966f8b 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -1,5 +1,5 @@ com.fr.design.mainframe.check.CheckButton=230*118 -com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=490*185 +com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=550*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 com.fr.env.RemoteEnvPane.dialog=458*132 From 6c33a708599a073dd546368d395afa42799ff2fd Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 3 Nov 2021 11:34:06 +0800 Subject: [PATCH 037/152] =?UTF-8?q?REPORT-61654=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E9=9D=9E=E4=B8=AD=E6=96=87=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E5=AD=97=E4=BD=93=E7=BC=BA=E5=A4=B1=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=9A=84=E5=BC=B9=E7=AA=97=E5=86=85=E5=AE=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/com/fr/design/i18n/dimension_en.properties | 2 +- .../resources/com/fr/design/i18n/dimension_ja_JP.properties | 2 +- .../main/resources/com/fr/design/i18n/dimension_zh.properties | 2 +- .../resources/com/fr/design/i18n/dimension_zh_TW.properties | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index 686c3da8a..786fe2ad0 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -1,6 +1,6 @@ com.fr.design.mainframe.check.CheckButton=305*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=630*185 -com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=630*31 +com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=570*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=630*280 com.fr.design.report.ReportColumnsPane=800*600 com.fr.env.RemoteEnvPane.dialog=458*132 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index 5937b272a..0956fa79d 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -1,6 +1,6 @@ com.fr.design.mainframe.check.CheckButton=280*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=610*185 -com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=610*31 +com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=550*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280 com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.design.version.check.dialog=430*95 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index c507fcc08..931b79b44 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -1,7 +1,7 @@ # \u9ED8\u8BA4\u4E3A\u7C7B\u7684\u5168\u9650\u5B9A\u540D\uFF08\u53EF\u81EA\u5B9A\u4E49key\uFF09= width * height com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 -com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 +com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=325*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.env.RemoteEnvPane.dialog=308*132 com.fr.design.version.check.dialog=230*95 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index 8a383a438..8ea7fd7c2 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -1,6 +1,6 @@ com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 -com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 +com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=325*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.env.RemoteEnvPane.dialog=308*132 com.fr.design.version.check.dialog=230*95 From 6026f0d575fd41c4ce7f68da6ee22e5f63bf8e82 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 3 Nov 2021 15:47:22 +0800 Subject: [PATCH 038/152] =?UTF-8?q?REPORT-60887=20MAC=20OS=20x=E7=94=B5?= =?UTF-8?q?=E8=84=91=E4=B8=8A=20=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=A3=98=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 3 ++ .../designer/ui/PopupDialogContext.java | 47 +++++++++++++++++++ .../designer/ui/SelectedPopupDialog.java | 17 +++++++ 3 files changed, 67 insertions(+) create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java 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 87a1926cb..86db17a11 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 @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.ui.PopupDialogContext; import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -778,6 +779,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (popup == null) { popup = new SelectedPopupDialog(this, designer); } + PopupDialogContext.checkSelectedPop(this); JFrame frame = LogMessageBar.getInstance().getLogFrame(); if (frame!= null && frame.isActive()) { return; @@ -876,6 +878,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (popup != null) { popup.setVisible(false); } + PopupDialogContext.checkSelectedPop(this); } public void processPopup(boolean canVisible) { diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java new file mode 100644 index 000000000..06fb2cb76 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java @@ -0,0 +1,47 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + + +/** + * 把弹窗统一管理起来 防止出现异常情况下游离的弹窗 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/11/02 + */ +public class PopupDialogContext { + + private static List dialogs = new ArrayList<>(); + + public static void add(SelectedPopupDialog selectedPopupDialog) { + if (dialogs.contains(selectedPopupDialog)) { + return; + } + dialogs.add(selectedPopupDialog); + } + + public static void remove(SelectedPopupDialog selectedPopupDialog) { + dialogs.remove(selectedPopupDialog); + } + + public static void checkSelectedPop(XCreator creator) { + Iterator iterator = dialogs.iterator(); + List removedDialog = new ArrayList<>(); + while (iterator.hasNext()) { + SelectedPopupDialog dialog = iterator.next(); + if (dialog.isVisible() && creator != dialog.getCreator()) { + iterator.remove(); + removedDialog.add(dialog); + } + } + for (SelectedPopupDialog dialog : removedDialog) { + dialog.setVisible(false); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index 44978ad66..22f0d3760 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -25,11 +25,14 @@ public class SelectedPopupDialog extends JDialog { private boolean canVisible = true; + private final XCreator creator; + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame()); this.setUndecorated(true); this.setModal(false); this.setFocusableWindowState(false); + this.creator = creator; controlPanel = new PopupControlPanel(creator, designer); this.getContentPane().add(controlPanel); this.setSize(controlPanel.getDefaultDimension()); @@ -44,6 +47,16 @@ public class SelectedPopupDialog extends JDialog { return controlPanel.hasVisibleButtons(); } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + PopupDialogContext.add(this); + } else { + PopupDialogContext.remove(this); + } + } + public void setRelativeBounds(Rectangle rectangle) { this.controlPanel.setRelativeBounds(rectangle); } @@ -55,4 +68,8 @@ public class SelectedPopupDialog extends JDialog { public void setCanVisible(boolean canVisible) { this.canVisible = canVisible; } + + public XCreator getCreator() { + return this.creator; + } } From 40ed97e4dfbb45924a278a3b17756af66ac02377 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 3 Nov 2021 20:17:59 +0800 Subject: [PATCH 039/152] =?UTF-8?q?REPORT-60153=20=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=8C=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/DesignerCloudURLManager.java | 180 +++++++++++ .../mainframe/EastRegionContainerPane.java | 11 +- .../com/fr/design/mainframe/JTemplate.java | 8 +- .../reuse/ComponentReuseNotificationInfo.java | 71 +++-- .../mainframe/reuse/ReuseGuideDialog.java | 169 ---------- .../mainframe/share/ComponentShareUtil.java | 95 ++++++ .../share/collect/ComponentCollector.java | 102 +++--- .../ComponentReuseNotificationInfoTest.java | 7 +- .../design/mainframe/FormParaWidgetPane.java | 2 - .../mainframe/FormWidgetDetailPane.java | 10 +- .../java/com/fr/design/mainframe/JForm.java | 15 +- .../mainframe/ReuseTriggerPointManager.java | 217 ------------- .../adaptve/config/ReuseNotifyInfo.java | 30 -- .../adaptve/config/TriggerPointProvider.java | 20 -- .../config/impl/CellStyleTriggerPoint.java | 28 -- .../CellValueImageChangeTriggerPoint.java | 27 -- .../share/AbstractWidgetSelectPane.java | 3 +- .../mainframe/share/Bean/FilterTypeInfo.java | 44 +++ .../share/Bean/WidgetFilterInfo.java | 60 ++++ .../share/Bean/WidgetFilterTypeInfo.java | 93 ++++++ .../config/ComponentReuseConfigManager.java | 82 +++++ .../mainframe/share/constants/StyleTheme.java | 14 +- .../generate/task/ComponentUploader.java | 2 +- .../share/sort/OnlineWidgetSortType.java | 4 +- .../ui/block/AbstractOnlineWidgetBlock.java | 11 +- .../mainframe/share/ui/block/BezierCubic.java | 53 ++++ .../share/ui/block/LocalWidgetBlock.java | 14 +- .../share/ui/block/OnlineWidgetBlock.java | 10 +- .../share/ui/block/PreviewWidgetBlock.java | 131 +++++++- .../mainframe/share/ui/local/ToolbarPane.java | 2 + .../AbstractOnlineWidgetSelectPane.java | 244 +++++++++++++++ .../online/AbstractOnlineWidgetShowPane.java | 78 +++-- .../share/ui/online/CarouselStateManger.java | 65 ++++ .../ui/online/OnlineResourceManager.java | 53 ---- .../share/ui/online/OnlineWidgetRepoPane.java | 16 +- .../ui/online/OnlineWidgetSelectPane.java | 212 +------------ .../share/ui/online/OnlineWidgetShowPane.java | 30 +- .../share/ui/online/OnlineWidgetTabPane.java | 20 +- .../ui/online/embed/AnimatePopupDialog.java | 46 +++ .../share/ui/online/embed/EmbedPane.java | 156 ++++++++++ .../embed/FirstDragAnimateStateManager.java | 44 +++ .../embed/OnlineEmbedFilterSelectPane.java | 169 ++++++++++ .../embed/OnlineEmbedFilterShowPane.java | 47 +++ .../share/ui/online/embed/PreviewDialog.java | 40 +++ .../resource/OnlineResourceManager.java | 64 ++++ .../online/{ => resource}/ResourceLoader.java | 2 +- .../OnlineWidgetPackagesShowPane.java | 12 +- .../ui/widgetfilter/FilterConfigPane.java | 265 ++++++++++++++++ .../share/ui/widgetfilter/FilterPane.java | 29 +- .../ui/widgetfilter/FilterPopupPane.java | 191 +----------- .../ui/widgetfilter/LocalFilterPopupPane.java | 6 +- .../ui/widgetfilter/LocalWidgetFilter.java | 2 +- .../LocalWidgetFilterCategory.java | 50 +-- .../widgetfilter/OnlineFilterPopupPane.java | 10 +- .../mainframe/share/util/DownloadUtils.java | 17 +- .../mainframe/share/util/OnlineShopUtils.java | 293 ++++++++++++++++++ .../share/util/ShareFilterConstants.java | 17 + .../widget/ui/designer/NewFormPane.java | 3 +- .../com/fr/design/form/images/drag_hand.png | Bin 0 -> 967 bytes .../ReuseTriggerPointManagerTest.java | 45 --- .../theme/DownloadComponentPackageGuide.java | 4 +- .../share/ui/generate/ShareGeneratePane.java | 2 +- 62 files changed, 2545 insertions(+), 1202 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/ReuseTriggerPointManager.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/ReuseNotifyInfo.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/TriggerPointProvider.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellStyleTriggerPoint.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellValueImageChangeTriggerPoint.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/Bean/FilterTypeInfo.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterInfo.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterTypeInfo.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/BezierCubic.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineResourceManager.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/AnimatePopupDialog.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/FirstDragAnimateStateManager.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java rename designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/{ => resource}/ResourceLoader.java (76%) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareFilterConstants.java create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/drag_hand.png delete mode 100644 designer-form/src/test/java/com/fr/design/mainframe/ReuseTriggerPointManagerTest.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java new file mode 100644 index 000000000..5749eeb3b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java @@ -0,0 +1,180 @@ +package com.fr.design; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.general.CloudCenter; +import com.fr.general.CloudCenterConfig; +import com.fr.general.http.HttpToolbox; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReaderHelper; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; +import com.fr.third.org.apache.commons.io.FileUtils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * Created by kerry on 2021/10/22 + */ +public class DesignerCloudURLManager implements XMLable { + private static final String CLOUD_URL_INFO = "cloudUrl.info"; + private static final String ROOT_XML_TAG = "CloudUrlInfoList"; + private static final String CHILD_XML_TAG = "CloudUrlInfo"; + private final Map urlMap = new HashMap<>(); + + public static DesignerCloudURLManager getInstance() { + return DesignerCloudURLManager.HOLDER.singleton; + } + + private final ExecutorService executorService = Executors.newSingleThreadExecutor(new NamedThreadFactory("TestCloudConnectThread")); + + private volatile boolean testResult; + + + private static class HOLDER { + private static final DesignerCloudURLManager singleton = new DesignerCloudURLManager(); + } + + private DesignerCloudURLManager() { + loadURLXMLFile(); + } + + public String acquireUrlByKind(String key) { + String url = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + if (StringUtils.isEmpty(url)) { + return urlMap.getOrDefault(key, StringUtils.EMPTY); + } + if (!urlMap.containsKey(key) || !url.equals(urlMap.get(key))) { + urlMap.put(key, url); + saveURLXMLFile(); + } + return url; + } + + + public void testConnect() { + executorService.submit(() -> { + testResult = isOnline(); + }); + } + + public boolean isConnected() { + return testResult; + } + + public boolean isOnline() { + if (CloudCenterConfig.getInstance().isOnline()) { + String ping = acquireUrlByKind("ping"); + if (StringUtils.isNotEmpty(ping)) { + try { + return StringUtils.isEmpty(HttpToolbox.get(ping)); + } catch (Exception ignore) { + } + } + } + return false; + } + + + /** + * 加载本地 url 管理文件 + */ + private void loadURLXMLFile() { + if (!getInfoFile().exists()) { + return; + } + XMLableReader reader = null; + try (InputStream in = new FileInputStream(getInfoFile())) { + // XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了 + reader = XMLReaderHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER); + if (reader == null) { + return; + } + reader.readXMLObject(this); + } catch (FileNotFoundException e) { + // do nothing + } catch (XMLStreamException | IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (XMLStreamException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + private File getInfoFile() { + + File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), CLOUD_URL_INFO)); + try { + if (!file.exists()) { + file.createNewFile(); + } + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + return file; + } + + /** + * 保存到本地 URL 管理文件中,存放在 .Finereport110 中 + */ + void saveURLXMLFile() { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLTools.writeOutputStreamXML(this, out); + out.flush(); + out.close(); + String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); + FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8); + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage()); + } + } + + + @Override + public void readXML(XMLableReader reader) { + String tagName = reader.getTagName(); + if (tagName.equals(CHILD_XML_TAG)) { + String key = reader.getAttrAsString("key", StringUtils.EMPTY); + String value = reader.getAttrAsString("url", StringUtils.EMPTY); + this.urlMap.put(key, value); + } + } + + @Override + public void writeXML(XMLPrintWriter xmlPrintWriter) { + xmlPrintWriter.startTAG(ROOT_XML_TAG); + Iterator> iterable = urlMap.entrySet().iterator(); + while (iterable.hasNext()) { + Map.Entry entry = iterable.next(); + xmlPrintWriter.startTAG(CHILD_XML_TAG).attr("key", entry.getKey()).attr("url", entry.getValue()).end(); + } + xmlPrintWriter.end(); + } + + @Override + public Object clone() throws CloneNotSupportedException { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a6734da91..43097e366 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -13,7 +13,6 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; -import com.fr.design.mainframe.reuse.ReuseGuideDialog; import com.fr.design.mainframe.reuse.SnapChatKeys; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.notification.SnapChat; @@ -292,7 +291,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 控件设置 PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ComponentCollector.getInstance().clickComponentSetting(); + } + }); // 条件属性 PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, @@ -538,9 +542,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public PromptWindow getWidgetLibPromptWindow() { - if (!getWidgetLibSnapChat().hasRead()) { - return new ReuseGuideDialog(DesignerContext.getDesignerFrame()); - } return null; } 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 f09b9ebb7..ad1d03940 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 @@ -124,6 +124,7 @@ public abstract class JTemplate> protected U undoState; protected U authorityUndoState = null; protected T template; // 当前模板 + private boolean isNewCreateTpl = false; //当前模板是否为新建模板 /** * 模板过程的相关信息 * @@ -198,7 +199,8 @@ public abstract class JTemplate> designModel = createDesignModel(parameters); } addCenterPane(); - if (isNewFile) { + isNewCreateTpl = isNewFile; + if (isNewCreateTpl) { // REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果 setUpTheme4NewTemplate(); } @@ -959,6 +961,10 @@ public abstract class JTemplate> return true; } + public boolean isNewCreateTpl(){ + return isNewCreateTpl; + } + protected boolean export() throws Exception { return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java index 3d305d8ac..5011ef2bd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.reuse; -import com.fr.design.DesignerEnvManager; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; @@ -17,51 +16,56 @@ public class ComponentReuseNotificationInfo implements XMLable { return INSTANCE; } - private long lastNotifyTime = 0; + private boolean clickedWidgetLib = false; - private int notifiedNumber = 0; + private long firstDragEndTime = 0L; - private boolean clickedWidgetLib = false; + private boolean completeEmbedFilter = false; - private long lastGuidePopUpTime = 0; + private boolean firstDrag = true; private String historyCreatedReuses = "[]"; - public long getLastNotifyTime() { - return lastNotifyTime; + private boolean widgetLibHasRefreshed = false; + + public boolean isClickedWidgetLib() { + return clickedWidgetLib; } - public void setLastNotifyTime(long lastNotifyTime) { - this.lastNotifyTime = lastNotifyTime; + public void setClickedWidgetLib(boolean clickedWidgetLib) { + this.clickedWidgetLib = clickedWidgetLib; } - public int getNotifiedNumber() { - return notifiedNumber; + public boolean isCompleteEmbedFilter() { + return completeEmbedFilter; } - public void setNotifiedNumber(int notifiedNumber) { - this.notifiedNumber = notifiedNumber; + public void setCompleteEmbedFilter(boolean completeEmbedFilter) { + this.completeEmbedFilter = completeEmbedFilter; } - public boolean isClickedWidgetLib() { - return clickedWidgetLib; + public long getFirstDragEndTime() { + return firstDragEndTime; } - public void setClickedWidgetLib(boolean clickedWidgetLib) { - this.clickedWidgetLib = clickedWidgetLib; + public void setFirstDragEndTime(long firstDragEndTime) { + this.firstDragEndTime = firstDragEndTime; + } + + public boolean isFirstDrag() { + return firstDrag; } - public long getLastGuidePopUpTime() { - return lastGuidePopUpTime; + public void setFirstDrag(boolean firstDrag) { + this.firstDrag = firstDrag; } - public void setLastGuidePopUpTime(long lastGuidePopUpTime) { - this.lastGuidePopUpTime = lastGuidePopUpTime; + public boolean isWidgetLibHasRefreshed() { + return widgetLibHasRefreshed; } - public void updateLastGuidePopUpTime() { - this.setLastGuidePopUpTime(System.currentTimeMillis()); - DesignerEnvManager.getEnvManager().saveXMLFile(); + public void setWidgetLibHasRefreshed(boolean widgetLibHasRefreshed) { + this.widgetLibHasRefreshed = widgetLibHasRefreshed; } public String getHistoryCreatedReuses() { @@ -74,21 +78,24 @@ public class ComponentReuseNotificationInfo implements XMLable { @Override public void readXML(XMLableReader reader) { - this.setLastNotifyTime(reader.getAttrAsLong("lastNotifyTime", 0L)); - this.setNotifiedNumber(reader.getAttrAsInt("notifiedNumber", 0)); this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false)); - this.setLastGuidePopUpTime(reader.getAttrAsLong("lastGuidePopUpTime", 0L)); + this.setCompleteEmbedFilter(reader.getAttrAsBoolean("hasCompleteEmbedFilter", false)); + this.setWidgetLibHasRefreshed(reader.getAttrAsBoolean("widgetLibHasRefreshed", false)); + this.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true)); this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]")); + this.setFirstDragEndTime(reader.getAttrAsLong("firstDragEndTime", 0L)); } @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG("ComponentReuseNotificationInfo"); - writer.attr("lastNotifyTime", this.lastNotifyTime) - .attr("notifiedNumber", this.notifiedNumber) - .attr("clickedWidgetLib", this.clickedWidgetLib) - .attr("lastGuidePopUpTime", this.lastGuidePopUpTime) - .attr("historyCreatedReuses", this.historyCreatedReuses);; + writer.attr("clickedWidgetLib", this.clickedWidgetLib) + .attr("hasCompleteEmbedFilter", this.completeEmbedFilter) + .attr("firstDrag", this.firstDrag) + .attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed) + .attr("firstDragEndTime", this.firstDragEndTime) + .attr("historyCreatedReuses", this.historyCreatedReuses); + ; writer.end(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java deleted file mode 100644 index a0e916659..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.fr.design.mainframe.reuse; - -import com.fr.base.background.ColorBackground; -import com.fr.design.dialog.UIDialog; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.PromptWindow; -import com.fr.design.mainframe.share.collect.ComponentCollector; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.RenderingHints; -import java.awt.geom.RoundRectangle2D; - -public class ReuseGuideDialog extends UIDialog implements PromptWindow { - InnerDialog innerDialog; - private static final Dimension DEFAULT = new Dimension(735, 510); - - public ReuseGuideDialog(Frame parent) { - super(parent); - } - - @Override - public void showWindow() { - innerDialog = new InnerDialog(this); - JPanel backGroundPane = new JPanel() { - @Override - protected void paintComponent(Graphics g) { - Image icon = IOUtils.readImage("com/fr/base/images/share/background.png");// 003.jpg是测试图片在项目的根目录下 - g.drawImage(icon, 0, 0, getSize().width, getSize().height, this);// 图片会自动缩放 - } - }; - add(backGroundPane, BorderLayout.CENTER); - initStyle(); - innerDialog.showWindow(); - } - - private void initStyle() { - setSize(DEFAULT); - setUndecorated(true); - setBackground(new Color(0, 0, 0, 0)); - GUICoreUtils.centerWindow(this); - } - - @Override - public void hideWindow() { - ComponentReuseNotificationInfo.getInstance().updateLastGuidePopUpTime(); - this.setVisible(false); - if (innerDialog != null) { - innerDialog.setVisible(false); - innerDialog.dispose(); - innerDialog = null; - } - this.dispose(); - } - - @Override - public void checkValid() { - - } - - class InnerDialog extends UIDialog { - private final Dimension DEFAULT = new Dimension(700, 475); - private static final int TITLE_FONT_SIZE = 20; - - public InnerDialog(Dialog dialog) { - super(dialog); - } - - public void showWindow() { - add(createCenterPanel(), BorderLayout.CENTER); - add(createSouthPanel(), BorderLayout.SOUTH); - add(createNorthPanel(), BorderLayout.NORTH); - showDialog(); - } - - private JPanel createNorthPanel() { - JPanel northPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - - //右上角关闭按钮 - JButton button = new JButton(new ImageIcon(IOUtils.readImage("/com/fr/base/images/share/close.png").getScaledInstance(15, 15, Image.SCALE_SMOOTH))); - button.setBorder(null); - button.setOpaque(false); - button.addActionListener(e -> ReuseGuideDialog.this.hideWindow()); - - northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 15)); - northPanel.setOpaque(false); - northPanel.add(button); - return northPanel; - } - - private JPanel createCenterPanel() { - JPanel centerPanel = new JPanel(new BorderLayout()); - - UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Component")); - UILabel imageLabel = new UILabel(new ImageIcon(IOUtils.readImage("com/fr/design/images/dashboard/guide.png").getScaledInstance(DEFAULT.width, DEFAULT.height, Image.SCALE_SMOOTH))); - titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, TITLE_FONT_SIZE)); - titleLabel.setBorder(BorderFactory.createEmptyBorder()); - - JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - panel.setOpaque(false); - panel.add(titleLabel); - - centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - centerPanel.setOpaque(false); - centerPanel.add(imageLabel, BorderLayout.CENTER); - centerPanel.add(panel, BorderLayout.NORTH); - return centerPanel; - } - - private JPanel createSouthPanel() { - JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - JButton button = new JButton(Toolkit.i18nText("Fine-Design_Share_Try_Drag")) { - @Override - public void paint(Graphics g) { - ColorBackground buttonBackground = ColorBackground.getInstance(Color.decode("#419BF9")); - Graphics2D g2d = (Graphics2D) g; - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - buttonBackground.paint(g2d, new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 8, 8)); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - super.paint(g); - } - }; - button.setBorder(null); - button.setForeground(Color.WHITE); - button.setOpaque(false); - button.addActionListener(e -> ReuseGuideDialog.this.hideWindow()); - - southPanel.setBorder(BorderFactory.createEmptyBorder(0, 290, 19, 290)); - southPanel.setPreferredSize(new Dimension(DEFAULT.width, 51)); - southPanel.setOpaque(false); - southPanel.add(button); - return southPanel; - } - - /** - * 显示窗口 - */ - private void showDialog() { - setSize(DEFAULT); - setUndecorated(true); - GUICoreUtils.centerWindow(this); - setModalityType(ModalityType.APPLICATION_MODAL); - ReuseGuideDialog.this.setVisible(true); - setVisible(true); - } - - @Override - public void checkValid() { - - } - } -} 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 new file mode 100644 index 000000000..8940b6c89 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java @@ -0,0 +1,95 @@ +package com.fr.design.mainframe.share; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; +import com.fr.form.share.constants.ComponentPath; +import com.fr.form.share.group.filter.ReuFilter; +import com.fr.design.DesignerCloudURLManager; +import com.fr.workspace.WorkContext; + +/** + * Created by kerry on 2021/10/27 + */ +public class ComponentShareUtil { + private ComponentShareUtil() { + + } + + /** + * 判断是否需要切换到在线组件库 + * + * @return + */ + public static boolean needSwitch2OnlineTab() { + return DesignerCloudURLManager.getInstance().isConnected() && !hasTouched() && isCurrentTplNewCreate(); + } + + /** + * 判断是否可触达 + * + * @return boolean + */ + public static boolean hasTouched() { + String sharePath = ComponentPath.SHARE_PATH.path(); + String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter()); + return components != null && components.length > 6; + } + + /** + * 判断当前模板是否是新建模板 + * + * @return boolean + */ + public static boolean isCurrentTplNewCreate() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return jTemplate.isNewCreateTpl(); + } + + /** + * 判断是否需要展示嵌入式筛选面板 + * + * @return boolean + */ + public static boolean needShowEmbedFilterPane() { + return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate(); + } + + /** + * 判断是否需要展示首次拖拽动效 + * + * @return boolean + */ + public static boolean needShowFirstDragAnimate() { + return ComponentReuseNotificationInfo.getInstance().isFirstDrag() && !hasTouched(); + } + + /** + * 完成嵌入式筛选 + */ + public static void completeEmbedFilter() { + boolean changed = false; + if (!ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { + ComponentReuseNotificationInfo.getInstance().setWidgetLibHasRefreshed(true); + changed = true; + } + if (!ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter()) { + ComponentReuseNotificationInfo.getInstance().setCompleteEmbedFilter(true); + changed = true; + } + if (changed) { + DesignerEnvManager.getEnvManager().saveXMLFile(); + } + } + + /** + * 记录组件库刷新 + */ + public static void recordWidgetLibHasRefreshed() { + if (!ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { + ComponentReuseNotificationInfo.getInstance().setWidgetLibHasRefreshed(true); + DesignerEnvManager.getEnvManager().saveXMLFile(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index b66495d12..db9fbe43b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -4,6 +4,7 @@ import com.fr.base.io.XMLReadHelper; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.constants.ComponentPath; @@ -19,7 +20,6 @@ import com.fr.json.JSONException; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.context.PluginContexts; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -48,10 +48,6 @@ import java.util.Iterator; public class ComponentCollector implements XMLable { private static final long ONE_MINUTE = 60 * 1000L; - private static final int REUSE_INFO_FIRST_POPUP = 1; - - private static final int REUSE_INFO_SECOND_POPUP = 2; - private static final String SIMPLE_DATE_PATTERN = "yyyy-MM-dd"; private static final String XML = "ComponentCollector"; @@ -98,11 +94,11 @@ public class ComponentCollector implements XMLable { private static final String MARKET_CLICK = "marketClick"; - private static final String PROMPT_JUMP = "promptJump"; + private static final String FIRST_SHOW_REACT = "firstShowReact"; - private static final String TOOLBAR_JUMP = "toolbarJump"; + private static final String EMBEDED_FILTER_REACT = "embededFilterReact"; - private static final String POPUP_JUMP = "popupJump"; + private static final String DYNAMIC_EFFECT_REACT = "dynamicEffectReact"; private static final String uuid = DesignerEnvManager.getEnvManager().getUUID(); @@ -116,11 +112,11 @@ public class ComponentCollector implements XMLable { private int cmpBoardClick = 0; - private int promptJump = 0; + private int firstShowReact = 0; - private int toolbarJump = 0; + private int embededFilterReact = 0; - private int popupJump = 0; + private int dynamicEffectReact = 0; private JSONArray activateRecord = JSONFactory.createJSON(JSON.ARRAY); @@ -291,7 +287,7 @@ public class ComponentCollector implements XMLable { try { DefaultShareGroupManager.getInstance().refresh(); Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); - for(Group group : groups) { + for (Group group : groups) { JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); jo.put(GROUP_NAME, group.getGroupName()); jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length); @@ -338,37 +334,47 @@ public class ComponentCollector implements XMLable { saveInfo(); } - public void collectPromptJumpWhenJump(){ - if (ComponentReuseNotificationInfo.getInstance().getNotifiedNumber() == REUSE_INFO_FIRST_POPUP) { - this.promptJump = 1; - saveInfo(); - }else if(ComponentReuseNotificationInfo.getInstance().getNotifiedNumber() == REUSE_INFO_SECOND_POPUP){ - this.promptJump = 2; - saveInfo(); + public void collectFirstShowReact(int flag) { + if (this.firstShowReact == flag) { + return; } + this.firstShowReact = flag; + saveInfo(); } - - public void collectPromptJumpWhenShow() { - if (ComponentReuseNotificationInfo.getInstance().getNotifiedNumber() == REUSE_INFO_SECOND_POPUP) { - this.promptJump = -1; + public void clickComponentSetting() { + if (!ComponentShareUtil.needShowEmbedFilterPane()) { + return; + } + boolean changed = false; + int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; + if (this.firstShowReact != firstShowReact) { + this.firstShowReact = firstShowReact; + changed = true; + } + if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { + this.embededFilterReact = -1; + changed = true; + } + if (changed) { saveInfo(); } } - public void collectToolbarJump() { - if (this.toolbarJump == 0) { - this.toolbarJump = 1; - saveInfo(); + public void collectEmbededFilterReact(int flag) { + if (this.embededFilterReact == flag) { + return; } - + this.embededFilterReact = flag; + saveInfo(); } - public void collectPopupJump() { - long currentTime = System.currentTimeMillis(); - long lastGuidePopUpTime = ComponentReuseNotificationInfo.getInstance().getLastGuidePopUpTime(); - if (currentTime - lastGuidePopUpTime <= ONE_MINUTE && this.popupJump == 0) { - this.popupJump = 1; + public void collectDynamicEffectReact() { + if (this.dynamicEffectReact == 1) { + return; + } + if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) { + this.dynamicEffectReact = 1; saveInfo(); } } @@ -468,6 +474,10 @@ public class ComponentCollector implements XMLable { this.generateCmpNumber = reader.getAttrAsInt("generateCmpNumber", 0); this.uploadCmpNumber = reader.getAttrAsInt("uploadCmpNumber", 0); + this.firstShowReact = reader.getAttrAsInt(FIRST_SHOW_REACT, 0); + this.embededFilterReact = reader.getAttrAsInt(EMBEDED_FILTER_REACT, 0); + this.dynamicEffectReact = reader.getAttrAsInt(DYNAMIC_EFFECT_REACT, 0); + String activateRecordStr = reader.getAttrAsString("activateRecord", StringUtils.EMPTY); activateRecord = parseJSONArray(activateRecordStr); String generateCmpRecordStr = reader.getAttrAsString("generateCmpRecord", StringUtils.EMPTY); @@ -475,13 +485,9 @@ public class ComponentCollector implements XMLable { this.helpConfigInfo = parseJSONArray(reader.getAttrAsString(HELP_CONFIG_INFO, StringUtils.EMPTY)); this.helpConfigUseInfo = parseJSONArray(reader.getAttrAsString(HELP_CONFIG_USE_INFO, StringUtils.EMPTY)); - this.searchContent = parseJSONArray(reader.getAttrAsString(SEARCH_CONTENT,StringUtils.EMPTY)); + this.searchContent = parseJSONArray(reader.getAttrAsString(SEARCH_CONTENT, StringUtils.EMPTY)); this.filterContent = parseJSONArray(reader.getAttrAsString(FILTER_CONTENT, StringUtils.EMPTY)); this.sortType = parseJSONArray(reader.getAttrAsString(SORT_TYPE, StringUtils.EMPTY)); - this.promptJump = reader.getAttrAsInt(PROMPT_JUMP, 0); - this.toolbarJump = reader.getAttrAsInt(TOOLBAR_JUMP, 0); - this.popupJump = reader.getAttrAsInt(POPUP_JUMP, 0); - } } @@ -515,9 +521,9 @@ public class ComponentCollector implements XMLable { .attr(SEARCH_CONTENT, searchContent.toString()) .attr(FILTER_CONTENT, filterContent.toString()) .attr(SORT_TYPE, sortType.toString()) - .attr(PROMPT_JUMP, promptJump) - .attr(TOOLBAR_JUMP, toolbarJump) - .attr(POPUP_JUMP, popupJump) + .attr(FIRST_SHOW_REACT, firstShowReact) + .attr(EMBEDED_FILTER_REACT, embededFilterReact) + .attr(DYNAMIC_EFFECT_REACT, dynamicEffectReact) .end(); } @@ -542,15 +548,9 @@ public class ComponentCollector implements XMLable { jo.put(SEARCH_CONTENT, searchContent.toString()); jo.put(FILTER_CONTENT, filterContent.toString()); jo.put(SORT_TYPE, sortType.toString()); - jo.put("guideInfo", assembleGuideInfo()); - return jo.toString(); - } - - private String assembleGuideInfo() { - JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); - jo.put(PROMPT_JUMP, promptJump) - .put(TOOLBAR_JUMP, toolbarJump) - .put(POPUP_JUMP, popupJump); + jo.put(FIRST_SHOW_REACT, firstShowReact); + jo.put(EMBEDED_FILTER_REACT, embededFilterReact); + jo.put(DYNAMIC_EFFECT_REACT, dynamicEffectReact); return jo.toString(); } @@ -603,7 +603,7 @@ public class ComponentCollector implements XMLable { return JSONFactory.createJSON(JSON.ARRAY); } - public void clear(){ + public void clear() { clearActiveRecord(); clearGenerateCmpRecord(); clearFilterContent(); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfoTest.java b/designer-base/src/test/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfoTest.java index c90e7a8b0..409539001 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfoTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfoTest.java @@ -18,13 +18,11 @@ public class ComponentReuseNotificationInfoTest { @Test public void testReadXML() { try { - XMLableReader xmlReader = XMLableReader.createXMLableReader(new StringReader("\n")); + XMLableReader xmlReader = XMLableReader.createXMLableReader(new StringReader("\n")); ComponentReuseNotificationInfo notificationInfo = ComponentReuseNotificationInfo.getInstance(); notificationInfo.readXML(xmlReader); xmlReader.close(); - Assert.assertEquals(2, notificationInfo.getNotifiedNumber()); Assert.assertEquals(true, notificationInfo.isClickedWidgetLib()); - Assert.assertEquals(1620612153215L, notificationInfo.getLastNotifyTime()); } catch (XMLStreamException e) { Assert.fail(e.getMessage()); } @@ -35,12 +33,11 @@ public class ComponentReuseNotificationInfoTest { StringWriter sw = new StringWriter(); XMLPrintWriter writer = XMLPrintWriter.create(new PrintWriter(sw)); ComponentReuseNotificationInfo notificationInfo = ComponentReuseNotificationInfo.getInstance(); - notificationInfo.setNotifiedNumber(1); notificationInfo.writeXML(writer); writer.flush(); writer.close(); Assert.assertEquals("\n" + - "\n", sw.toString()); + "\n", sw.toString()); } } 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 09e02ac67..891ddf026 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 @@ -17,7 +17,6 @@ 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.collect.ComponentCollector; import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.UserDefinedWidgetConfig; @@ -253,7 +252,6 @@ public class FormParaWidgetPane extends JPanel { @Override public void mouseClicked(MouseEvent e) { FormWidgetDetailPane.getInstance().enterWidgetLib(); - ComponentCollector.getInstance().collectToolbarJump(); } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index f44b9ca72..5bf6a9385 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -7,8 +7,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.locale.impl.ShowOnlineWidgetMark; -import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.general.locale.LocaleCenter; @@ -106,17 +106,20 @@ public class FormWidgetDetailPane extends FormDockView{ } cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); } - }; - headGroup.setSelectedIndex(ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib() ? 0 : ONLINE_TAB); + }; + headGroup.setSelectedIndex(ComponentShareUtil.needSwitch2OnlineTab() ? ONLINE_TAB : 0); this.add(headGroup, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } + + public void resetEmptyPane(){ this.isEmptyPane = false; } + /** * 清除数据 */ @@ -178,6 +181,7 @@ public class FormWidgetDetailPane extends FormDockView{ paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); if (isShowOnlineWidgetRepoPane()) { + OnlineWidgetRepoPane.getInstance().refresh(); paneList.add(OnlineWidgetRepoPane.getInstance()); } } 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 bc0c75b30..6d0147b60 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 @@ -7,7 +7,6 @@ import com.fr.base.Releasable; import com.fr.base.extension.FileExtension; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.theme.FormTheme; -import com.fr.base.theme.FormThemeConfig; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeCompatible; import com.fr.base.theme.TemplateThemeConfig; @@ -50,6 +49,8 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; +import com.fr.design.mainframe.share.collect.ComponentCollector; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.template.info.JFormProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; @@ -350,13 +351,6 @@ public class JForm extends JTemplate implements BaseJForm jt) { - ReuseTriggerPointManager.getInstance().registerJForm(JForm.this); - } @Override @@ -900,9 +894,14 @@ public class JForm extends JTemplate implements BaseJForm map = new HashMap<>(); - - private List listeners = new ArrayList<>(); - - private ReuseTriggerPointManager() { - if (!hasNotifiedTwice()) { - List list = getTriggerPoints(); - for (TriggerPointProvider triggerPoint : list) { - Listener listener = new Listener() { - @Override - public void on(Event event, Null o) { - triggerPoint.triggerAction(); - } - }; - EventDispatcher.listen(triggerPoint.triggerEvent(), listener); - listeners.add(listener); - } - - } - } - - private List getTriggerPoints() { - List list = new ArrayList<>(); - list.add(new CellStyleTriggerPoint()); - list.add(new CellValueImageChangeTriggerPoint()); - return list; - } - - - public boolean hasNotifiedTwice() { - return ComponentReuseNotificationInfo.getInstance().getNotifiedNumber() >= 2; - } - - - private void reCount() { - //重新计次数 - Iterator> iterator = map.entrySet().iterator(); - while (iterator.hasNext()) { - iterator.next().getValue().reset(); - } - } - - private void writeTriggerInfo2xml() { - int number = ComponentReuseNotificationInfo.getInstance().getNotifiedNumber() + 1; - ComponentReuseNotificationInfo.getInstance().setNotifiedNumber(number); - ComponentReuseNotificationInfo.getInstance().setLastNotifyTime(System.currentTimeMillis()); - DesignerEnvManager.getEnvManager().saveXMLFile(); - //如果已经提示过两次了 - if (hasNotifiedTwice()) { - for (Listener listener : listeners) { - EventDispatcher.stopListen(listener); - } - this.map.clear(); - } - } - - public boolean needTrigger() { - boolean result = true; - if (ComponentReuseNotificationInfo.getInstance().getLastNotifyTime() > 0L) { - result = System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getLastNotifyTime() > ONE_WEEK_TIME; - } - return !hasNotifiedTwice() && result; - } - - - public void registerJForm(JForm jForm) { - if (!hasNotifiedTwice()) { - this.map.put(jForm, new ReuseNotifyInfo()); - } - - } - - public void removeJForm(JForm jForm) { - if (!hasNotifiedTwice()) { - this.map.remove(jForm); - } - } - - - public ReuseNotifyInfo getReuseNotifyInfo() { - JTemplate currentJTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (!(currentJTemplate instanceof JForm && hasUseReuseComponent((JForm) currentJTemplate)) - && !ReuseTriggerPointManager.getInstance().needTrigger()) { - return null; - } - return map.get(currentJTemplate); - } - - public void reuseNotify(ReuseNotifyInfo notifyInfo) { - if (notifyInfo.matchCondition()) { - ReuseTriggerPointManager.getInstance().reCount(); - //弹出提示框 - JTemplate currentJTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - DesignerToastMsgUtil.toastPrompt(createReusePrompt((JForm) currentJTemplate)); - ReuseTriggerPointManager.getInstance().writeTriggerInfo2xml(); - ComponentCollector.getInstance().collectPromptJumpWhenShow(); - } - } - - - private boolean hasUseReuseComponent(JForm jForm) { - Form form = jForm.getTarget(); - List extendSharableWidgetList = new ArrayList<>(); - Form.traversalWidget(form.getContainer(), new WidgetGather() { - @Override - public void dealWith(Widget widget) { - ExtendSharableAttrMark attrMark = ((AbstractBorderStyleWidget) widget).getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG); - if (attrMark != null && StringUtils.isNotEmpty(attrMark.getShareId())) { - extendSharableWidgetList.add(widget); - } - } - - @Override - public boolean dealWithAllCards() { - return true; - } - }, AbstractBorderStyleWidget.class); - return extendSharableWidgetList.size() > 0; - } - - - private JPanel createReusePrompt(JForm jForm) { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Component_Reuse_Try_Prompt")), BorderLayout.WEST); - UILabel reuseLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Component")); - reuseLabel.addMouseListener(new MouseListener() { - @Override - public void mouseClicked(MouseEvent e) { - jForm.tabChanged(0); - FormWidgetDetailPane.getInstance().enterWidgetLib(); - ComponentCollector.getInstance().collectPromptJumpWhenJump(); - } - - @Override - public void mousePressed(MouseEvent e) { - - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - }); - reuseLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); - reuseLabel.setForeground(Color.BLUE); - reuseLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - jPanel.add(reuseLabel, BorderLayout.CENTER); - return jPanel; - } - - -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/ReuseNotifyInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/ReuseNotifyInfo.java deleted file mode 100644 index 17aa1a631..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/ReuseNotifyInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fr.design.mainframe.adaptve.config; - -/** - * Created by kerry on 5/7/21 - */ -public class ReuseNotifyInfo { - private static final int CELL_STYLE_MODIFY_MAX_NUMBER = 3; - private static final int CELL_IMAGE_VALUE_MODIFY_MAX_NUMBER = 1; - private int cellStyleModifiedNumber = 0; - private int cellImageValueNumber = 0; - - public void addCellStyleModify() { - cellStyleModifiedNumber++; - } - - - public void addCellImageValueModify() { - cellImageValueNumber++; - } - - public boolean matchCondition() { - return cellStyleModifiedNumber >= CELL_STYLE_MODIFY_MAX_NUMBER - || cellImageValueNumber >= CELL_IMAGE_VALUE_MODIFY_MAX_NUMBER; - } - - public void reset() { - this.cellImageValueNumber = 0; - this.cellStyleModifiedNumber = 0; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/TriggerPointProvider.java b/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/TriggerPointProvider.java deleted file mode 100644 index 5fa4db80f..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/TriggerPointProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fr.design.mainframe.adaptve.config; - - -import com.fr.event.Event; - -/** - * Created by kerry on 4/29/21 - */ -public interface TriggerPointProvider { - /** - * 触发后的操作 - */ - void triggerAction(); - - /** - * 触发事件 - * @return - */ - Event triggerEvent(); -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellStyleTriggerPoint.java b/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellStyleTriggerPoint.java deleted file mode 100644 index 47055eec1..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellStyleTriggerPoint.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.mainframe.adaptve.config.impl; - -import com.fr.design.mainframe.DesignOperationEvent; -import com.fr.design.mainframe.ReuseTriggerPointManager; -import com.fr.design.mainframe.adaptve.config.ReuseNotifyInfo; -import com.fr.design.mainframe.adaptve.config.TriggerPointProvider; -import com.fr.event.Event; - -/** - * Created by kerry on 5/7/21 - */ -public class CellStyleTriggerPoint implements TriggerPointProvider { - @Override - public void triggerAction() { - ReuseNotifyInfo notifyInfo = ReuseTriggerPointManager.getInstance().getReuseNotifyInfo(); - if (notifyInfo == null) { - return; - } - notifyInfo.addCellStyleModify(); - ReuseTriggerPointManager.getInstance().reuseNotify(notifyInfo); - - } - - @Override - public Event triggerEvent() { - return DesignOperationEvent.CELL_STYLE_MODIFY; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellValueImageChangeTriggerPoint.java b/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellValueImageChangeTriggerPoint.java deleted file mode 100644 index 1429ebeab..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/adaptve/config/impl/CellValueImageChangeTriggerPoint.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.design.mainframe.adaptve.config.impl; - -import com.fr.design.mainframe.DesignOperationEvent; -import com.fr.design.mainframe.ReuseTriggerPointManager; -import com.fr.design.mainframe.adaptve.config.ReuseNotifyInfo; -import com.fr.design.mainframe.adaptve.config.TriggerPointProvider; -import com.fr.event.Event; - -/** - * Created by kerry on 5/7/21 - */ -public class CellValueImageChangeTriggerPoint implements TriggerPointProvider { - @Override - public void triggerAction() { - ReuseNotifyInfo notifyInfo = ReuseTriggerPointManager.getInstance().getReuseNotifyInfo(); - if (notifyInfo == null) { - return; - } - notifyInfo.addCellImageValueModify(); - ReuseTriggerPointManager.getInstance().reuseNotify(notifyInfo); - } - - @Override - public Event triggerEvent() { - return DesignOperationEvent.CELL_IMAGE_VALUE_MODIFY; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/AbstractWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/AbstractWidgetSelectPane.java index 1b36f08d1..b87b8534e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/AbstractWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/AbstractWidgetSelectPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.share; import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane; -import com.fr.design.mainframe.share.ui.base.LocalWidgetPopupPreviewPane; import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -44,7 +43,7 @@ public abstract class AbstractWidgetSelectPane extends JPanel { if (!previewPane.isVisible() && comp.getWidth() != 0 && comp.getHeight() != 0) { //父容器是GroupPane,要获得的是GroupPane的父容器 - Container parentContainer =getParentContainer(); + Container parentContainer = getParentContainer(); previewPane.populateBean(comp); int popupPosY = comp.getLocationOnScreen().y - parentContainer.getLocationOnScreen().y; if (previewPane.getHeight() + popupPosY > parentContainer.getHeight() + SCROLL_BAR_HEIGHT) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/FilterTypeInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/FilterTypeInfo.java new file mode 100644 index 000000000..a7f9509af --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/FilterTypeInfo.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe.share.Bean; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2021/11/1 + */ +public class FilterTypeInfo { + private String title; + private String key; + private final List filterTypeInfos = new ArrayList<>(); + + public FilterTypeInfo(String title, String key){ + this.title = title; + this.key = key; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public void addFilterType(WidgetFilterTypeInfo info){ + this.filterTypeInfos.add(info); + } + + public List getFilterTypeInfos(){ + return filterTypeInfos; + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterInfo.java new file mode 100644 index 000000000..2cd282b4e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterInfo.java @@ -0,0 +1,60 @@ +package com.fr.design.mainframe.share.Bean; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-10-23 + */ +public class WidgetFilterInfo { + private String name; + private String id; + private String type; + private List childFilterInfo = new ArrayList<>(); + + public WidgetFilterInfo(String name, String id, String type) { + this.name = name; + this.id = id; + this.type = type; + } + + public WidgetFilterInfo() { + + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public void addChildFilterInfo(WidgetFilterInfo filterInfo) { + this.childFilterInfo.add(filterInfo); + } + + public List getInnerFilterInfo() { + return childFilterInfo; + } + + public boolean hasChildFilter() { + return childFilterInfo.size() > 0; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterTypeInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterTypeInfo.java new file mode 100644 index 000000000..fddd4e147 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/Bean/WidgetFilterTypeInfo.java @@ -0,0 +1,93 @@ +package com.fr.design.mainframe.share.Bean; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.util.ShareFilterConstants; +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-10-21 + */ +public class WidgetFilterTypeInfo { + private static final String KEY_SPLIT_CHAR = "@"; + private String title; + private String key; + private List filterItems = new ArrayList<>(); + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public List getFilterItems() { + return filterItems; + } + + public void addFilterItem(WidgetFilterInfo filterInfo) { + this.filterItems.add(filterInfo); + } + + + public static WidgetFilterTypeInfo parseFromJSONObject(JSONObject jsonObject) { + WidgetFilterTypeInfo typeInfo = new WidgetFilterTypeInfo(); + typeInfo.setTitle(jsonObject.getString("title")); + typeInfo.setKey(jsonObject.getString("key")); + JSONArray ja = jsonObject.getJSONArray("items"); + if (ComparatorUtils.equals(typeInfo.getKey(), ShareFilterConstants.STYLE_FILTER_KEY)) { + createStyleFilterType(ja, typeInfo); + } else { + for (int i = 0; i < ja.size(); i++) { + JSONObject jo = ja.getJSONObject(i); + WidgetFilterInfo info = new WidgetFilterInfo(); + info.setId(jo.getString("id")); + info.setName(jo.optString("name")); + info.setType(parseType(typeInfo.getKey())); + typeInfo.addFilterItem(info); + } + } + + return typeInfo; + } + + private static void createStyleFilterType(JSONArray ja, WidgetFilterTypeInfo typeInfo) { + WidgetFilterInfo dark = new WidgetFilterInfo(); + dark.setName(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Dark_Style")); + WidgetFilterInfo light = new WidgetFilterInfo(); + light.setName(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Light_Style")); + typeInfo.addFilterItem(dark); + typeInfo.addFilterItem(light); + for (int i = 0; i < ja.size(); i++) { + JSONObject jo = ja.getJSONObject(i); + WidgetFilterInfo info = new WidgetFilterInfo(); + info.setId(jo.getString("id")); + info.setName(jo.optString("name")); + info.setType(parseType(typeInfo.getKey())); + if (ComparatorUtils.equals(jo.getInt("themeColor"), 0)) { + dark.addChildFilterInfo(info); + } else { + light.addChildFilterInfo(info); + } + } + } + + private static String parseType(String text) { + return text.split(KEY_SPLIT_CHAR)[1]; + } + + +} 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 new file mode 100644 index 000000000..78bc8af67 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/config/ComponentReuseConfigManager.java @@ -0,0 +1,82 @@ +package com.fr.design.mainframe.share.config; + +import com.fr.design.DesignerCloudURLManager; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +/** + * Created by kerry on 2020-12-14 + */ +public class ComponentReuseConfigManager { + + private static class Holder { + private static final ComponentReuseConfigManager HOLDER = new ComponentReuseConfigManager(); + } + + private static final String PROPERTIES_FILE_NAME = "reuse.properties"; + private static final String MINI_SHOP_URL = "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"; + + public static ComponentReuseConfigManager getInstance() { + return ComponentReuseConfigManager.Holder.HOLDER; + } + + private Properties properties; + + private ComponentReuseConfigManager() { + } + + private File getReusePropertyFile() { + File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), PROPERTIES_FILE_NAME)); + return file; + } + + private String loadAttribute(String key, String defaultValue) { + if (properties == null) { + properties = new Properties(); + File file = getReusePropertyFile(); + if (!file.exists()) { + return defaultValue; + } + try { + InputStream in = new FileInputStream(file); + properties.load(in); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + String p = properties.getProperty(key); + if (StringUtils.isEmpty(p)) { + p = defaultValue; + } + return p; + } + + + public String getMiniShopUrl() { + return loadAttribute(MINI_SHOP_URL, DesignerCloudURLManager.getInstance().acquireUrlByKind("af.reuseInfo")); + } + + public String getComponentUploadUrl() { + //云中心暂时没有上传网址,这边默认值为空,后续再添加 + return loadAttribute(COMPONENT_UPLOAD_URL, StringUtils.EMPTY); + } + + public String getMarketLoginUrl() { + return loadAttribute(MARKET_LOGIN_URL, DesignerCloudURLManager.getInstance().acquireUrlByKind("market.login")); + } + + public boolean supportUploadReu() { + String uploadReuSupport = loadAttribute(UPLOAD_REU_SUPPORT, "false"); + return Boolean.valueOf(uploadReuSupport); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/constants/StyleTheme.java b/designer-form/src/main/java/com/fr/design/mainframe/share/constants/StyleTheme.java index 1738eb5cb..777d7a120 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/constants/StyleTheme.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/constants/StyleTheme.java @@ -1,11 +1,11 @@ package com.fr.design.mainframe.share.constants; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.mainframe.share.util.ShareFilterConstants; import com.fr.form.share.bean.StyleThemeBean; -import com.fr.form.share.bean.WidgetFilterInfo; -import com.fr.form.share.bean.WidgetFilterTypeInfo; -import com.fr.form.share.constants.ShareComponentConstants; -import com.fr.form.share.utils.ShareUtils; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; import com.fr.general.ComparatorUtils; import java.util.ArrayList; @@ -54,13 +54,13 @@ public enum StyleTheme { * @return List */ public static List getStyleThemeTypeInfo() { - List widgetFilterTypeInfos = ShareUtils.getWidgetFilterTypeInfos(); + List widgetFilterTypeInfos = OnlineShopUtils.getWidgetFilterTypeInfos(); if (widgetFilterTypeInfos.isEmpty()) { return types(); } WidgetFilterTypeInfo styleThemeFilterInfo = new WidgetFilterTypeInfo(); for (WidgetFilterTypeInfo typeInfo : widgetFilterTypeInfos) { - if (ComparatorUtils.equals(ShareComponentConstants.STYLE_THEME_KEY, typeInfo.getKey())) { + if (ComparatorUtils.equals(ShareFilterConstants.STYLE_FILTER_KEY, typeInfo.getKey())) { styleThemeFilterInfo = typeInfo; break; } @@ -70,7 +70,7 @@ public enum StyleTheme { Iterator infoIterator = filterInfoList.iterator(); while (infoIterator.hasNext()) { WidgetFilterInfo filterInfo = infoIterator.next(); - if (!ComparatorUtils.equals(ShareComponentConstants.ALL_STYLE_THEME, filterInfo.getId())) { + if (!ComparatorUtils.equals(ShareFilterConstants.ALL_STYLE_THEME, filterInfo.getId())) { resultList.add(new StyleThemeBean(filterInfo.getId(), filterInfo.getName())); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java index ef74d3420..36014905b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.share.generate.task; import com.fr.config.MarketConfig; import com.fr.design.i18n.Toolkit; -import com.fr.form.share.config.ComponentReuseConfigManager; +import com.fr.design.mainframe.share.config.ComponentReuseConfigManager; import com.fr.design.mainframe.share.generate.ComponentBanner; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; 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 437835662..ef5ecbbf8 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 @@ -1,9 +1,9 @@ package com.fr.design.mainframe.share.sort; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.bean.SortParameter; -import com.fr.form.share.utils.ShareUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; @@ -21,7 +21,7 @@ public enum OnlineWidgetSortType implements SortType { COMPOSITE { @Override public void sort(OnlineShareWidget[] widgetProviders) { - Map parameterMap = ShareUtils.getCompositeSortPara(); + Map parameterMap = OnlineShopUtils.getCompositeSortPara(); Arrays.sort(widgetProviders, new Comparator() { @Override public int compare(OnlineShareWidget o1, OnlineShareWidget o2) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 8f3a91471..17e3f4547 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -4,9 +4,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction; import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction; import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupMenu; -import com.fr.design.mainframe.share.ui.online.OnlineResourceManager; -import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; -import com.fr.design.mainframe.share.ui.online.ResourceLoader; +import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; +import com.fr.design.mainframe.share.ui.online.resource.OnlineResourceManager; +import com.fr.design.mainframe.share.ui.online.resource.ResourceLoader; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.constants.ShareComponentConstants; @@ -30,10 +30,10 @@ import java.net.URL; */ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock implements ResourceLoader { - private final OnlineWidgetSelectPane parentPane; + private final AbstractOnlineWidgetSelectPane parentPane; private UILabel coverLabel; - public AbstractOnlineWidgetBlock(OnlineShareWidget widget, OnlineWidgetSelectPane parentPane) { + public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { super(widget); this.parentPane = parentPane; } @@ -78,7 +78,6 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock private boolean isEdit; private boolean isMarked; private boolean pressed; - private boolean hover; + private final Icon markedMode = IOUtils.readIcon("/com/fr/base/images/share/marked.png"); private final Icon unMarkedMode = IOUtils.readIcon("/com/fr/base/images/share/unmarked.png"); @@ -152,6 +148,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock pressed = true; } + @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); @@ -174,7 +171,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock @Override public void mouseEntered(MouseEvent e) { super.mouseEntered(e); - hover = true; + } @Override @@ -182,25 +179,24 @@ public class LocalWidgetBlock extends PreviewWidgetBlock super.mouseExited(e); this.mouseHover = false; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - hover = false; this.repaint(); } @Override public void mouseDragged(MouseEvent e) { + super.mouseDragged(e); if (DesignModeContext.isAuthorityEditing() || lastPressEvent == null || isEdit) { return; } hidePreview(); - ComponentCollector.getInstance().collectPopupJump(); Object source = e.getSource(); if (source instanceof LocalWidgetBlock) { LocalWidgetBlock no = (LocalWidgetBlock) e.getSource(); if (no == null) { return; } - XCreator xCreator= transformXCreator(no); + XCreator xCreator = transformXCreator(no); if (xCreator == null) { return; } 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 325e28afe..56ba0d657 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 @@ -12,6 +12,7 @@ import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.share.collect.ComponentCollector; +import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.group.DefaultShareGroup; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; @@ -73,7 +74,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { private static final BufferedImage WIDGET_DOWNLOAD_ICON = IOUtils.readImage("/com/fr/base/images/share/download.png"); private static final BufferedImage WIDGET_DOWNLOADING_ICON = IOUtils.readImage("/com/fr/base/images/share/downloading.png"); - public OnlineWidgetBlock(OnlineShareWidget widget, OnlineWidgetSelectPane parentPane) { + public OnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { super(widget, parentPane); this.add(createSouthPane(widget), BorderLayout.SOUTH); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); @@ -145,13 +146,13 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { @Override public void mouseDragged(MouseEvent e) { + super.mouseDragged(e); if (DesignModeContext.isAuthorityEditing() || !checkWidgetInstalled()) { return; } if (lastPressEvent == null) { return; } - ComponentCollector.getInstance().collectPopupJump(); Object source = e.getSource(); Widget creatorSource; String shareId; @@ -269,6 +270,11 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { return ShareUtils.getElCaseBindInfoById(widget.getUuid()) != null; } + protected boolean checkWidget(){ + return checkWidgetInstalled(); + } + + private Group getDefaultGroup() { return DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME); } 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 65a429458..d55228b19 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 @@ -1,24 +1,40 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; +import com.fr.design.mainframe.share.ComponentShareUtil; +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.share.constants.ShareComponentConstants; +import com.fr.module.ModuleContext; import org.jetbrains.annotations.NotNull; - import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.Point; import java.awt.Rectangle; +import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.Serializable; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; /** * Created by kerry on 2020-10-21 @@ -27,6 +43,18 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe protected T widget; private boolean showing = false; private final JPopupMenu rightClickPopupMenu; + private long lastStallTime = 0; + protected boolean hover; + private static final int ANIMATE_START_TIME = 1000; + private static final int ANIMATE_TIME = 2000; + private AnimatePopupDialog animatePopupDialog; + + private AWTEventListener awtEventListener; + + private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1}; + private static final String FIRST_DRAG_ANIMATE = "first_drag_animate"; + private final ScheduledExecutorService firstDragCheckService = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("first_drag_check")); + public PreviewWidgetBlock(T widget) { this.widget = widget; @@ -76,12 +104,14 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private void showPreviewPane() { synchronized (this) { + CarouselStateManger.getInstance().suspend(); if (!showing) { showPreview(widget); showing = true; } } } + protected abstract String getWidgetUuid(); protected abstract void showPreview(T widget); @@ -89,6 +119,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe protected abstract void hidePreview(); private void hidePreviewPane() { + CarouselStateManger.getInstance().start(); if (showing) { hidePreview(); showing = false; @@ -99,6 +130,9 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe @Override public void mouseClicked(MouseEvent e) { + if (SwingUtilities.isRightMouseButton(e) && FirstDragAnimateStateManager.getInstance().animating()) { + FirstDragAnimateStateManager.getInstance().stopAnimate(); + } this.hidePreviewPane(); } @@ -114,21 +148,92 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe @Override public void mouseEntered(MouseEvent e) { + hover = true; + if (ComponentShareUtil.needShowFirstDragAnimate() && checkWidget()) { + schedule(ANIMATE_START_TIME); + awtEventListener = event -> { + if (!this.isShowing()) { + return; + } + if (event instanceof MouseEvent) { + Point selectPanePoint = this.getLocationOnScreen(); + Dimension selectPaneDimension = this.getSize(); + Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); + if (FirstDragAnimateStateManager.getInstance().animating() && + !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { + FirstDragAnimateStateManager.getInstance().stopAnimate(); + } + } + }; + + java.awt.Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.MOUSE_EVENT_MASK); + } + } + + protected boolean checkWidget() { + return true; + } + + private void animate(ScheduledExecutorService service) { + CarouselStateManger.getInstance().suspend(); + AtomicInteger atomicInteger = new AtomicInteger(0); + BezierCubic cubic = new BezierCubic(ANIMATE_CONTROL_VALUE[0], ANIMATE_CONTROL_VALUE[1], ANIMATE_CONTROL_VALUE[2], ANIMATE_CONTROL_VALUE[3]); + Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5); + Point endPoint = calculateEndPoint(); + ComponentReuseNotificationInfo.getInstance().setFirstDrag(false); + DesignerEnvManager.getEnvManager().saveXMLFile(); + FirstDragAnimateStateManager.getInstance().startAnimate(); + service.scheduleAtFixedRate(() -> { + if (FirstDragAnimateStateManager.getInstance().isStop()) { + service.shutdown(); + if (animatePopupDialog != null) { + animatePopupDialog.setVisible(false); + } + ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis()); + DesignerEnvManager.getEnvManager().saveXMLFile(); + java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); + CarouselStateManger.getInstance().start(); + return; + } + double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic); + if (progress >= 1) { + atomicInteger.set(0); + } + double x = startPoint.x * 1D + (endPoint.x - startPoint.x) * progress; + double y = ((endPoint.y - startPoint.y) * 1D / (endPoint.x - startPoint.x)) * ((int) x - startPoint.x) + startPoint.y; + animatePopupDialog.setLocation((int) x, (int) y); + }, 0, 20, TimeUnit.MILLISECONDS); + } + + private Point calculateEndPoint() { + Point basePoint = EastRegionContainerPane.getInstance().getLocationOnScreen(); + Dimension dimension = EastRegionContainerPane.getInstance().getSize(); + return new Point(basePoint.x + 20 - this.getWidth() / 2, basePoint.y + dimension.height / 3 - this.getHeight() / 2); + } + + public double calXProgress(int time, BezierCubic cubic) { + return cubic.solve(time * 1D / ANIMATE_TIME); } @Override public void mouseExited(MouseEvent e) { + hover = false; this.hidePreviewPane(); + } @Override public void mouseDragged(MouseEvent e) { - + ComponentCollector.getInstance().collectDynamicEffectReact(); + if (FirstDragAnimateStateManager.getInstance().animating()) { + FirstDragAnimateStateManager.getInstance().stopAnimate(); + } } @Override public void mouseMoved(MouseEvent e) { + lastStallTime = System.currentTimeMillis(); Dimension dimension = getCoverDimension(); Rectangle containerRec = new Rectangle(0, 0, dimension.width, dimension.height); if (!isRightClickPopupMenuVisible()) { @@ -140,6 +245,26 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } } + private void schedule(long timeOut) { + firstDragCheckService.schedule(new Runnable() { + @Override + public void run() { + if (!hover) { + return; + } + long interval = System.currentTimeMillis() - lastStallTime; + if (interval < timeOut) { + schedule(ANIMATE_START_TIME - interval); + return; + } + animatePopupDialog = new AnimatePopupDialog(getCoverImage(), new Point(PreviewWidgetBlock.this.getLocationOnScreen().x, PreviewWidgetBlock.this.getLocationOnScreen().y)); + ScheduledExecutorService service = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(FIRST_DRAG_ANIMATE)); + + animate(service); + } + }, timeOut, TimeUnit.MILLISECONDS); + } + @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; @@ -152,4 +277,6 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe this.removeMouseListener(this); this.removeMouseMotionListener(this); } + + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java index c720e7f9c..af94033b3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java @@ -9,6 +9,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.sort.WidgetSortType; import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.design.mainframe.share.ui.base.SortPopupMenuItem; @@ -112,6 +113,7 @@ class ToolbarPane extends JPanel { e -> { filterPanel.reset(); LocalWidgetRepoPane.getInstance().refreshPane(); + ComponentShareUtil.recordWidgetLibHasRefreshed(); } ); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java new file mode 100644 index 000000000..f85f30b62 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java @@ -0,0 +1,244 @@ +package com.fr.design.mainframe.share.ui.online; + +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.share.AbstractWidgetSelectPane; +import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane; +import com.fr.design.mainframe.share.ui.base.LoadingPane; +import com.fr.design.mainframe.share.ui.base.NoMatchPane; +import com.fr.design.mainframe.share.ui.base.PagingFiledPane; +import com.fr.design.mainframe.share.ui.block.OnlineWidgetBlock; +import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock; +import com.fr.design.mainframe.share.ui.online.resource.OnlineResourceManager; +import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.form.share.base.DataLoad; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.constants.ShareComponentConstants; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingWorker; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.util.concurrent.ExecutionException; + +/** + * Created by kerry on 2021/10/22 + */ +public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSelectPane { + protected static final int H_GAP = 5; + protected static final int V_GAP = 10; + + protected enum PaneStatue {NORMAL, NO_MATCH, LOADING, DISCONNECTED} + + private OnlineShareWidget[] sharableWidgetProviders; + private PagingFiledPane pagingFiledPane; + private JPanel contentPane; + private UIScrollPane scrollPane; + private FilterPane filterPane; + private final int widgetsPerNum; + private CardLayout cardLayout; + + public AbstractOnlineWidgetSelectPane(OnlineShareWidget[] providers, FilterPane filterPane, int widgetsPerNum) { + this(providers, widgetsPerNum); + this.filterPane = filterPane; + } + + public AbstractOnlineWidgetSelectPane(final DataLoad dataLoad, FilterPane filterPane, final int widgetsPerNum) { + this(dataLoad, widgetsPerNum); + this.filterPane = filterPane; + } + + public AbstractOnlineWidgetSelectPane(OnlineShareWidget[] providers, int widgetsPerNum) { + this.widgetsPerNum = widgetsPerNum; + sharableWidgetProviders = providers; + init(); + initPagingPane(); + switchPane(createComponents()); + } + + public AbstractOnlineWidgetSelectPane(final DataLoad dataLoad, final int widgetsPerNum) { + this.widgetsPerNum = widgetsPerNum; + init(); + //异步获取组件信息 + new SwingWorker() { + @Override + protected OnlineWidgetSelectPane.PaneStatue doInBackground() { + sharableWidgetProviders = dataLoad.load(); + initPagingPane(); + return createComponents(); + } + + @Override + protected void done() { + try { + switchPane(get()); + fireAfterDataLoad(); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.execute(); + } + + private void init() { + cardLayout = new CardLayout(); + this.setLayout(cardLayout); + // 设置面板的边框 ,距离上、左、下、右 的距离 + this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(new LoadingPane(), OnlineWidgetSelectPane.PaneStatue.LOADING.name()); + this.add(new NoMatchPane(), OnlineWidgetSelectPane.PaneStatue.NO_MATCH.name()); + this.add(contentPane, OnlineWidgetSelectPane.PaneStatue.NORMAL.name()); + switchPane(OnlineWidgetSelectPane.PaneStatue.LOADING); + } + + public int getSharableWidgetNum() { + return sharableWidgetProviders == null ? 0 : sharableWidgetProviders.length; + } + + public OnlineShareWidget[] getSharableWidgetProviders() { + return sharableWidgetProviders; + } + + /** + * 切换需要显示的面板 + */ + protected void switchPane(OnlineWidgetSelectPane.PaneStatue statue) { + if (statue == OnlineWidgetSelectPane.PaneStatue.DISCONNECTED) { + OnlineWidgetRepoPane.getInstance().switch2InternetErrorPane(); + return; + } + cardLayout.show(this, statue.name()); + if (statue == OnlineWidgetSelectPane.PaneStatue.NORMAL) { + //异步加载组件缩略图 + OnlineResourceManager.getInstance().loadImage(); + } + } + + protected void fireAfterDataLoad(){ + + } + + private void synchronizedLoadingContent() { + new SwingWorker() { + @Override + protected OnlineWidgetSelectPane.PaneStatue doInBackground() { + return createComponents(); + } + + @Override + protected void done() { + try { + switchPane(get()); + //加载之后设置下标记符 + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.execute(); + } + + private void initPagingPane() { + this.pagingFiledPane = new PagingFiledPane(sharableWidgetProviders.length, widgetsPerNum); + this.pagingFiledPane.registerChangeListener(event -> { + AbstractOnlineWidgetSelectPane.this.switchPane(OnlineWidgetSelectPane.PaneStatue.LOADING); + synchronizedLoadingContent(); + OnlineWidgetRepoPane.getInstance().completeEmbedFilter(); + + }); + pagingFiledPane.setEnable(pagePaneEnable()); + } + + protected OnlineWidgetSelectPane.PaneStatue createComponents() { + if (ArrayUtils.isEmpty(sharableWidgetProviders)) { + return OnlineWidgetSelectPane.PaneStatue.NO_MATCH; + } + if (!OnlineShopUtils.testConnection()) { + return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED; + } + OnlineResourceManager.getInstance().cancelLoad(); + + contentPane.removeAll(); + scrollPane = createScrollPane(); + + contentPane.add(scrollPane, BorderLayout.CENTER); + contentPane.add(this.pagingFiledPane, BorderLayout.SOUTH); + return OnlineWidgetSelectPane.PaneStatue.NORMAL; + } + + protected UIScrollPane createScrollPane() { + OnlineShareWidget[] showWidgets = getShowWidgets(); + JPanel widgetPane = createWidgetPane(); + widgetPane.setLayout(new FlowLayout(FlowLayout.LEFT, H_GAP, V_GAP)); + for (OnlineShareWidget provider : showWidgets) { + PreviewWidgetBlock widgetButton = createWidgetBlock(provider); + widgetPane.add(widgetButton); + } + widgetPane.setPreferredSize(new Dimension(240, getPaneHeight(showWidgets.length))); + + UIScrollPane scrollPane = new UIScrollPane(createContentPane(widgetPane)); + setScrollPaneStyle(scrollPane); + return scrollPane; + } + + protected OnlineShareWidget[] getShowWidgets(){ + return this.pagingFiledPane.getShowItems(this.sharableWidgetProviders); + } + + protected JPanel createWidgetPane() { + return new JPanel(); + } + + protected JPanel createContentPane(JPanel widgetPane) { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(widgetPane, BorderLayout.CENTER); + return panel; + } + + protected boolean pagePaneEnable() { + return true; + } + + protected void setScrollPaneStyle(UIScrollPane scrollPane) { + scrollPane.setBorder(null); + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setWheelScrollingEnabled(filterPane == null || !filterPane.isShowPopup()); + } + + protected PreviewWidgetBlock createWidgetBlock(OnlineShareWidget provider) { + return new OnlineWidgetBlock(provider, this); + } + + protected int getPaneHeight(int count) { + return (count + 1) / 2 * (ShareComponentConstants.SHARE_BLOCK_HEIGHT + V_GAP); + } + + public void setWidgetPaneScrollEnable(boolean enable) { + if (scrollPane != null) { + scrollPane.setWheelScrollingEnabled(enable); + } + } + + @Override + protected AbstractWidgetPopupPreviewPane createPopupPreviewPane() { + return new OnlineWidgetPopupPreviewPane(); + } + + protected Container getParentContainer() { + return this.getParent(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java index 117ac0ab8..62000b2d8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java @@ -3,15 +3,16 @@ package com.fr.design.mainframe.share.ui.online; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.share.sort.OnlineWidgetSortType; +import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ui.base.FlexSearchFieldPane; import com.fr.design.mainframe.share.ui.base.LoadingPane; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; -import com.fr.form.share.utils.ShareUtils; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; - import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingWorker; @@ -39,28 +40,31 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { private JPanel componentSelectPane; private JPanel searchResultShowPane; private JPanel mainCenterPane; - private FilterPane filterPane; + protected FilterPane filterPane; private JPanel centerPane; private SortTabPane sortTabPane; private final JPanel loadingPane = new LoadingPane(); - private OnlineShareWidget[] sharableWidgetProviders; + protected OnlineShareWidget[] sharableWidgetProviders; //主面板和搜索面板的cardLayout private CardLayout mainCardLayout; - public AbstractOnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders) { + this(sharableWidgetProviders, OnlineWidgetSortType.COMPOSITE); + } + + public AbstractOnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders, OnlineWidgetSortType sortType) { this.sharableWidgetProviders = sharableWidgetProviders; this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel contentPane = initContentPane(); + JPanel contentPane = initContentPane(sortType); this.add(contentPane, BorderLayout.CENTER); } - protected JPanel initContentPane() { + protected JPanel initContentPane(OnlineWidgetSortType sortType) { JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - OnlineWidgetSortType.COMPOSITE.sort(sharableWidgetProviders); + sortType.sort(sharableWidgetProviders); componentSelectPane = createOnlineWidgetSelectPane(sharableWidgetProviders); centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); centerPane.add(componentSelectPane, BorderLayout.CENTER); @@ -68,6 +72,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { filterPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8)); initFilterPaneListener(filterPane); sortTabPane = new SortTabPane(); + this.sortTabPane.setIndex(sortType.ordinal()); initSortTabPane(sortTabPane); FlexSearchFieldPane flexSearchPane = new FlexSearchFieldPane(filterPane); initSearchTextFieldPaneListener(flexSearchPane); @@ -77,7 +82,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { northPane.add(sortTabPane, BorderLayout.SOUTH); initNorthPane(jPanel, northPane); - searchResultShowPane = createOnlineWidgetSelectPane(new OnlineShareWidget[]{}); + this.searchResultShowPane = initSearchResultShowPane(sharableWidgetProviders); mainCardLayout = new CardLayout(); mainCenterPane = new JPanel(mainCardLayout); mainCenterPane.add(centerPane, MAIN_FILTER_TAB_PANE); @@ -93,7 +98,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { } - protected OnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { + protected AbstractOnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { return new OnlineWidgetSelectPane(sharableWidgetProviders, filterPane, 50); } @@ -101,6 +106,17 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { return new OnlineWidgetSelectPane(dataLoad, filterPane, 50); } + + protected AbstractOnlineWidgetSelectPane manualCreateOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { + ComponentShareUtil.completeEmbedFilter(); + return createOnlineWidgetSelectPane(sharableWidgetProviders); + } + + protected OnlineWidgetSelectPane manualCreateOnlineWidgetSelectPane(DataLoad dataLoad) { + ComponentShareUtil.completeEmbedFilter(); + return createOnlineWidgetSelectPane(dataLoad); + } + protected FilterPane createFilterPane() { return FilterPane.createOnlineFilterPane(); } @@ -126,12 +142,15 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { if (searchResultShowPane != null) { mainCenterPane.remove(searchResultShowPane); } - this.searchResultShowPane = createOnlineWidgetSelectPane(widgets.toArray(new OnlineShareWidget[widgets.size()])); + searchResultShowPane = manualCreateOnlineWidgetSelectPane(sharableWidgetProviders); this.mainCenterPane.add(searchResultShowPane, SEARCH_RESULT_PANE); this.mainCardLayout.show(mainCenterPane, SEARCH_RESULT_PANE); this.validate(); this.repaint(); + } + protected JPanel initSearchResultShowPane(OnlineShareWidget[] widgets) { + return new JPanel(); } public void initFilterPaneListener(FilterPane filterPane) { @@ -139,21 +158,30 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { @Override public void stateChanged(final ChangeEvent e) { String filterStr = e.getSource().toString(); - centerPane.remove(componentSelectPane); - componentSelectPane = createOnlineWidgetSelectPane(() -> { - sharableWidgetProviders = new OnlineShareWidget[0]; - sharableWidgetProviders = getSharableWidgetArr(filterStr); - return sharableWidgetProviders; - }); - centerPane.add(componentSelectPane, BorderLayout.CENTER); - AbstractOnlineWidgetShowPane.this.validate(); - AbstractOnlineWidgetShowPane.this.repaint(); + filterStateChanged(filterStr); } }); } - protected OnlineShareWidget[] getSharableWidgetArr( String filterStr){ - return ShareUtils.getFilterWidgets(filterStr); + public void filterStateChanged(String filterStr) { + replaceSelectPane(manualCreateOnlineWidgetSelectPane(() -> { + sharableWidgetProviders = new OnlineShareWidget[0]; + sharableWidgetProviders = getSharableWidgetArr(filterStr); + return sharableWidgetProviders; + })); + } + + + protected void replaceSelectPane(AbstractOnlineWidgetSelectPane selectPane) { + centerPane.remove(componentSelectPane); + componentSelectPane = selectPane; + centerPane.add(componentSelectPane, BorderLayout.CENTER); + AbstractOnlineWidgetShowPane.this.validate(); + AbstractOnlineWidgetShowPane.this.repaint(); + } + + protected OnlineShareWidget[] getSharableWidgetArr(String filterStr) { + return OnlineShopUtils.getFilterWidgets(filterStr); } public void initSearchTextFieldPaneListener(FlexSearchFieldPane searchFieldPane) { @@ -167,6 +195,10 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { }); } + public void setFilterItems(List selectedFilters) { + this.filterPane.setFilter(selectedFilters); + } + public void initSortTabPane(SortTabPane sortTabPane) { } @@ -236,7 +268,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { @Override protected Boolean doInBackground() { sortType.sort(sharableWidgetProviders); - componentSelectPane = createOnlineWidgetSelectPane(sharableWidgetProviders); + componentSelectPane = manualCreateOnlineWidgetSelectPane(sharableWidgetProviders); return true; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java new file mode 100644 index 000000000..cd818f42e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java @@ -0,0 +1,65 @@ +package com.fr.design.mainframe.share.ui.online; + + +import java.util.concurrent.CountDownLatch; + +/** + * Created by kerry on 2021/10/22 + */ +public class CarouselStateManger { + + private CarouseState state; + + private final CountDownLatch countDownLatch = new CountDownLatch(1); + + + public static CarouselStateManger getInstance() { + return CarouselStateManger.HOLDER.singleton; + } + + private static class HOLDER { + private static CarouselStateManger singleton = new CarouselStateManger(); + } + + private CarouselStateManger() { + + } + + public void countDown() { + countDownLatch.countDown(); + } + + public void countDownLatchAwait() throws InterruptedException { + countDownLatch.await(); + } + + public void start() { + this.state = CarouseState.RUNNING; + } + + public boolean running() { + return this.state == CarouseState.RUNNING; + } + + public void suspend() { + this.state = CarouseState.SUSPEND; + } + + public boolean isSuspend() { + return this.state == CarouseState.SUSPEND; + } + + public void stop() { + this.state = CarouseState.STOP; + } + + public boolean stopped() { + return this.state == CarouseState.STOP; + } + + enum CarouseState { + RUNNING, + SUSPEND, + STOP + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineResourceManager.java deleted file mode 100644 index 6a99209d3..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineResourceManager.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fr.design.mainframe.share.ui.online; - -import javax.swing.SwingWorker; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by kerry on 2020-12-10 - */ -public class OnlineResourceManager { - private static class HOLDER { - private static final OnlineResourceManager singleton = new OnlineResourceManager(); - } - - private OnlineResourceManager(){ - - } - - public static OnlineResourceManager getInstance() { - return HOLDER.singleton; - } - - private SwingWorker swingWorker; - - private final List loaderList = new ArrayList<>(); - - public void cancelLoad() { - if (swingWorker != null) { - swingWorker.cancel(true); - } - this.loaderList.clear(); - } - - public void addLoader(ResourceLoader loader) { - this.loaderList.add(loader); - } - - public void loadImage() { - swingWorker = new SwingWorker() { - @Override - protected Boolean doInBackground() { - for (ResourceLoader loader : loaderList) { - loader.load(); - } - return true; - } - }; - swingWorker.execute(); - - } - - -} 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 3a1df9f72..fcc59771e 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 @@ -7,8 +7,8 @@ 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.util.OnlineShopUtils; import com.fr.form.share.bean.OnlineShareWidget; -import com.fr.form.share.utils.ShareUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -48,7 +48,7 @@ public class OnlineWidgetRepoPane extends BasicPane { return true; } try{ - sharableWidgets = ShareUtils.getAllSharableWidgetsFromShop(); + sharableWidgets = OnlineShopUtils.getAllSharableWidgetsFromShop(); return true; } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -222,4 +222,16 @@ public class OnlineWidgetRepoPane extends BasicPane { return tipLabel; } + public void refresh() { + if (componentTabPane != null) { + this.componentTabPane.refreshPane(); + } + } + + + public void completeEmbedFilter(){ + if (componentTabPane != null) { + this.componentTabPane.completeEmbedFilter(); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetSelectPane.java index c1a556fc5..cd7c81821 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetSelectPane.java @@ -1,231 +1,29 @@ package com.fr.design.mainframe.share.ui.online; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.share.AbstractWidgetSelectPane; -import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane; -import com.fr.design.mainframe.share.ui.base.LoadingPane; -import com.fr.design.mainframe.share.ui.base.NoMatchPane; -import com.fr.design.mainframe.share.ui.base.PagingFiledPane; -import com.fr.design.mainframe.share.ui.block.OnlineWidgetBlock; -import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; -import com.fr.form.share.constants.ShareComponentConstants; -import com.fr.form.share.utils.ShareUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.ArrayUtils; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.util.concurrent.ExecutionException; /** * Created by kerry on 2020-10-19 */ -public class OnlineWidgetSelectPane extends AbstractWidgetSelectPane { - protected static final int H_GAP = 5; - protected static final int V_GAP = 10; - - enum PaneStatue {NORMAL, NO_MATCH, LOADING, DISCONNECTED} - - private OnlineShareWidget[] sharableWidgetProviders; - private PagingFiledPane pagingFiledPane; - private JPanel contentPane; - private UIScrollPane scrollPane; - private FilterPane filterPane; - private final int widgetsPerNum; - private CardLayout cardLayout; +public class OnlineWidgetSelectPane extends AbstractOnlineWidgetSelectPane { public OnlineWidgetSelectPane(OnlineShareWidget[] providers, FilterPane filterPane, int widgetsPerNum) { - this(providers, widgetsPerNum); - this.filterPane = filterPane; + super(providers, filterPane, widgetsPerNum); } public OnlineWidgetSelectPane(final DataLoad dataLoad, FilterPane filterPane, final int widgetsPerNum) { - this(dataLoad, widgetsPerNum); - this.filterPane = filterPane; + super(dataLoad, filterPane, widgetsPerNum); } public OnlineWidgetSelectPane(OnlineShareWidget[] providers, int widgetsPerNum) { - this.widgetsPerNum = widgetsPerNum; - sharableWidgetProviders = providers; - init(); - initPagingPane(); - switchPane(createComponents()); + super(providers, widgetsPerNum); } public OnlineWidgetSelectPane(final DataLoad dataLoad, final int widgetsPerNum) { - this.widgetsPerNum = widgetsPerNum; - init(); - //异步获取组件信息 - new SwingWorker() { - @Override - protected PaneStatue doInBackground() { - sharableWidgetProviders = dataLoad.load(); - initPagingPane(); - return createComponents(); - } - - @Override - protected void done() { - try { - switchPane(get()); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }.execute(); - } - - private void init() { - cardLayout = new CardLayout(); - this.setLayout(cardLayout); - // 设置面板的边框 ,距离上、左、下、右 的距离 - this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(new LoadingPane(), PaneStatue.LOADING.name()); - this.add(new NoMatchPane(), PaneStatue.NO_MATCH.name()); - this.add(contentPane, PaneStatue.NORMAL.name()); - switchPane(PaneStatue.LOADING); - } - - public int getSharableWidgetNum() { - return sharableWidgetProviders == null ? 0 : sharableWidgetProviders.length; - } - - public OnlineShareWidget[] getSharableWidgetProviders() { - return sharableWidgetProviders; - } - - /** - * 切换需要显示的面板 - */ - private void switchPane(PaneStatue statue) { - if (statue == PaneStatue.DISCONNECTED) { - OnlineWidgetRepoPane.getInstance().switch2InternetErrorPane(); - return; - } - cardLayout.show(this, statue.name()); - if (statue == PaneStatue.NORMAL) { - //异步加载组件缩略图 - OnlineResourceManager.getInstance().loadImage(); - } - } - - private void synchronizedLoadingContent() { - new SwingWorker() { - @Override - protected PaneStatue doInBackground() { - return createComponents(); - } - - @Override - protected void done() { - try { - switchPane(get()); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }.execute(); - } - - private void initPagingPane() { - this.pagingFiledPane = new PagingFiledPane(sharableWidgetProviders.length, widgetsPerNum); - this.pagingFiledPane.registerChangeListener(event -> { - OnlineWidgetSelectPane.this.switchPane(PaneStatue.LOADING); - synchronizedLoadingContent(); - }); - pagingFiledPane.setEnable(pagePaneEnable()); - } - - private PaneStatue createComponents() { - if (ArrayUtils.isEmpty(sharableWidgetProviders)) { - return PaneStatue.NO_MATCH; - } - if (!ShareUtils.testConnection()) { - return PaneStatue.DISCONNECTED; - } - OnlineResourceManager.getInstance().cancelLoad(); - - contentPane.removeAll(); - scrollPane = createScrollPane(); - - contentPane.add(scrollPane, BorderLayout.CENTER); - contentPane.add(this.pagingFiledPane, BorderLayout.SOUTH); - return PaneStatue.NORMAL; + super(dataLoad, widgetsPerNum); } - private UIScrollPane createScrollPane() { - OnlineShareWidget[] showWidgets = this.pagingFiledPane.getShowItems(this.sharableWidgetProviders); - JPanel widgetPane = createWidgetPane(); - widgetPane.setLayout(new FlowLayout(FlowLayout.LEFT, H_GAP, V_GAP)); - for (OnlineShareWidget provider : showWidgets) { - PreviewWidgetBlock widgetButton = createWidgetBlock(provider); - widgetPane.add(widgetButton); - } - widgetPane.setPreferredSize(new Dimension(240, getPaneHeight(showWidgets.length))); - - UIScrollPane scrollPane = new UIScrollPane(createContentPane(widgetPane)); - setScrollPaneStyle(scrollPane); - return scrollPane; - } - - protected JPanel createWidgetPane() { - return new JPanel(); - } - - protected JPanel createContentPane(JPanel widgetPane) { - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(widgetPane, BorderLayout.CENTER); - return panel; - } - - protected boolean pagePaneEnable() { - return true; - } - - protected void setScrollPaneStyle(UIScrollPane scrollPane) { - scrollPane.setBorder(null); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setWheelScrollingEnabled(filterPane == null || !filterPane.isShowPopup()); - } - - protected PreviewWidgetBlock createWidgetBlock(OnlineShareWidget provider) { - return new OnlineWidgetBlock(provider, this); - } - - protected int getPaneHeight(int count) { - return (count + 1) / 2 * (ShareComponentConstants.SHARE_BLOCK_HEIGHT + V_GAP); - } - - public void setWidgetPaneScrollEnable(boolean enable) { - if (scrollPane != null) { - scrollPane.setWheelScrollingEnabled(enable); - } - } - - @Override - protected AbstractWidgetPopupPreviewPane createPopupPreviewPane() { - return new OnlineWidgetPopupPreviewPane(); - } - - protected Container getParentContainer() { - return this.getParent(); - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java index a599980ce..0f0b5d7db 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java @@ -4,9 +4,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.sort.OnlineWidgetSortType; import com.fr.design.mainframe.share.ui.base.FlexSearchFieldPane; +import com.fr.design.mainframe.share.ui.online.embed.OnlineEmbedFilterSelectPane; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; -import com.fr.form.share.utils.ShareUtils; import com.fr.stable.StringUtils; import javax.swing.event.ChangeEvent; @@ -31,8 +33,13 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane { private String lastFilter = StringUtils.EMPTY; private int lastSortTabSelectedIndex = 0; - public OnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders) { - super(sharableWidgetProviders); + public OnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders, OnlineWidgetSortType sortType) { + super(sharableWidgetProviders, sortType); + lastSortTabSelectedIndex = sortType.ordinal(); + } + + public OnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProvider) { + super(sharableWidgetProvider); } @Override @@ -109,7 +116,7 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane { } protected OnlineShareWidget[] getSharableWidgetArr( String filterStr){ - OnlineShareWidget[] onlineShareWidgets = ShareUtils.getFilterWidgets(filterStr); + OnlineShareWidget[] onlineShareWidgets = OnlineShopUtils.getFilterWidgets(filterStr); OnlineWidgetSortType.values()[lastSortTabSelectedIndex].sort(onlineShareWidgets); return onlineShareWidgets; } @@ -117,7 +124,6 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane { @Override public void initSortTabPane(SortTabPane sortTabPane) { super.initSortTabPane(sortTabPane); - lastSortTabSelectedIndex = sortTabPane.getIndex(); sortTabPane.registerSortTabMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -149,4 +155,18 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane { private void collectSortType(String sortType) { ComponentCollector.getInstance().collectSortType(sortType); } + + public OnlineEmbedFilterSelectPane animate(String filterStr) { + OnlineEmbedFilterSelectPane pane = new OnlineEmbedFilterSelectPane(new DataLoad() { + @Override + public OnlineShareWidget[] load() { + sharableWidgetProviders = getSharableWidgetArr(filterStr); + return sharableWidgetProviders; + } + }, filterPane, 50); + replaceSelectPane(pane); + return pane; + + } + } 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 4553f7879..96c3e2825 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 @@ -3,6 +3,9 @@ package com.fr.design.mainframe.share.ui.online; import com.fr.design.gui.ibutton.UITabGroup; import com.fr.design.layout.FRGUIPaneFactory; 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.widgetpackage.OnlineWidgetPackagesShowPane; import com.fr.form.share.bean.OnlineShareWidget; @@ -20,10 +23,12 @@ import java.util.List; 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 CardLayout cardLayout; private JPanel centerPane; private boolean packagePaneCreated = false; private List tabChangeListeners; + private OnlineEmbedFilterShowPane embedFilterShowPane; public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) { tabChangeListeners = new ArrayList<>(); @@ -34,7 +39,9 @@ public class OnlineWidgetTabPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.cardLayout = new CardLayout(); this.centerPane = new JPanel(cardLayout); + this.centerPane.add(new OnlineWidgetShowPane(sharableWidgets), COMPONENT); + this.centerPane.add( embedFilterShowPane = new OnlineEmbedFilterShowPane(new OnlineWidgetShowPane(sharableWidgets, OnlineWidgetSortType.SALES)), COMPONENT_EMBED); //延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载 UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { public void tabChanged(int newSelectedIndex) { @@ -42,8 +49,9 @@ public class OnlineWidgetTabPane extends JPanel { changeListener.tabChange(newSelectedIndex); } if (newSelectedIndex == 0) { - cardLayout.show(centerPane, COMPONENT); + cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); } else { + ComponentShareUtil.completeEmbedFilter(); ComponentCollector.getInstance().collectCmpPktClick(); //延迟组件包面板的初始化,防止组件面板里组件和缩略图和组件包面板里组件的缩略图一起加载 if (!packagePaneCreated) { @@ -64,11 +72,20 @@ public class OnlineWidgetTabPane extends JPanel { this.add(centerPane, BorderLayout.CENTER); } + public void completeEmbedFilter(){ + if (embedFilterShowPane!= null){ + embedFilterShowPane.completeEmbedFilter(); + } + } + public void addTabChangeListener(TabChangeListener listener) { if (!tabChangeListeners.contains(listener)) { tabChangeListeners.add(listener); } } + public void refreshPane() { + this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); + } public void removeTabChangeListener(TabChangeListener listener) { tabChangeListeners.remove(listener); @@ -77,4 +94,5 @@ public class OnlineWidgetTabPane extends JPanel { public interface TabChangeListener extends EventListener { void tabChange(int selectedIndex); } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/AnimatePopupDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/AnimatePopupDialog.java new file mode 100644 index 000000000..960d1c0de --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/AnimatePopupDialog.java @@ -0,0 +1,46 @@ +package com.fr.design.mainframe.share.ui.online.embed; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.general.IOUtils; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JDialog; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Point; + +/** + * Created by kerry on 2021/10/22 + */ +public class AnimatePopupDialog extends JDialog { + private static final Icon DRAG_HAND = IOUtils.readIcon("/com/fr/design/form/images/drag_hand.png"); + + public AnimatePopupDialog(Image image, Point initialPosition) { + super(DesignerContext.getDesignerFrame()); + Container container = getContentPane(); + setUndecorated(true); + JPanel jPanel = new JPanel() { + @Override + public void paint(Graphics g) { + super.paint(g); + DRAG_HAND.paintIcon(this, g, (this.getWidth() - 20) / 2, (this.getHeight() - 20) / 2); + } + }; + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + jPanel.add(new UILabel(new ImageIcon(image)), BorderLayout.CENTER); + container.add(jPanel, BorderLayout.CENTER); + setSize(123, 70); + this.setLocation(initialPosition); + this.setVisible(true); + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java new file mode 100644 index 000000000..04680753b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -0,0 +1,156 @@ +package com.fr.design.mainframe.share.ui.online.embed; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; +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.collect.ComponentCollector; +import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.ui.util.UIUtil; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.module.ModuleContext; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.image.BufferedImage; +import java.util.List; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import static javax.swing.JOptionPane.WARNING_MESSAGE; + +/** + * Created by kerry on 2021/10/21 + */ +public class EmbedPane extends JPanel { + private static final String EMBED_PANE_TIMER = "EMBED_PANE_TIMER"; + private static final Color BORDER_COLOR = Color.decode("#D9DADD"); + private static final Color SEARCH_BUTTON_COLOR = Color.decode("#419BF9"); + private Image image; + + public EmbedPane(OnlineEmbedFilterShowPane showPane) { + this.addMouseListener(new MouseAdapter() { + }); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createLineBorder(BORDER_COLOR)); + this.add(initCenterPane(showPane), BorderLayout.CENTER); + } + + private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { + JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + jPanel.setBackground(Color.WHITE); + jPanel.setPreferredSize(new Dimension(200, 200)); + jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + + FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { + @Override + public String assembleFilter() { + return OnlineShopUtils.assembleFilter(getFilterList()); + } + }; + UIButton searchBtn = initSearchBtn(filterConfigPane, showPane); + filterConfigPane.setBorder(null); + UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip")); + tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + jPanel.add(tipLabel, BorderLayout.NORTH); + jPanel.add(filterConfigPane, BorderLayout.CENTER); + JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + southPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); + southPane.setBackground(Color.WHITE); + southPane.add(searchBtn, BorderLayout.CENTER); + southPane.setPreferredSize(new Dimension(212, 24)); + jPanel.add(southPane, BorderLayout.SOUTH); + + return jPanel; + } + + private UIButton initSearchBtn(FilterConfigPane filterConfigPane, OnlineEmbedFilterShowPane showPane) { + UIButton searchBtn = new UIButton(Toolkit.i18nText("Fine-Design_Share_Online_Query_Recommend_Component")); + searchBtn.setUI(new UIButtonUI() { + @Override + protected void paintBorder(Graphics g, UIButton b) { + Color oldColor = g.getColor(); + g.setColor(SEARCH_BUTTON_COLOR); + g.drawRoundRect(0, 0, b.getWidth(), b.getHeight(), 2, 2); + g.setColor(oldColor); + } + }); + searchBtn.setForeground(SEARCH_BUTTON_COLOR); + searchBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String filterStr = filterConfigPane.assembleFilter(); + if (StringUtils.isEmpty(filterStr)) { + FineJOptionPane.showMessageDialog(EmbedPane.this, + Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Warning_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Message"), WARNING_MESSAGE, + UIManager.getIcon("OptionPane.warningIcon")); + ComponentCollector.getInstance().collectEmbededFilterReact(2); + return; + } + showPane.filterStateChanged(filterStr); + animateHide(showPane, filterConfigPane.getFilterList()); + ComponentCollector.getInstance().collectEmbededFilterReact(1); + } + }); + return searchBtn; + } + + + public void animateHide(OnlineEmbedFilterShowPane showPane, List selectedFilters) { + //先生成图片 + image = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_ARGB); + this.paint(image.getGraphics()); + ScheduledExecutorService service = createToastScheduleExecutorService(); + this.removeAll(); + service.scheduleAtFixedRate(() -> { + Dimension dimension = EmbedPane.this.getSize(); + Point point = EmbedPane.this.getLocation(); + if (dimension.width <= 0 || dimension.height <= 0) { + EmbedPane.this.setVisible(false); + service.shutdown(); + try { + showPane.animate(selectedFilters); + } catch (InterruptedException e) { + + } + } + UIUtil.invokeAndWaitIfNeeded(() -> { + Dimension newDimension = new Dimension(dimension.width - 25, dimension.height - 30); + EmbedPane.this.setSize(newDimension); + EmbedPane.this.setLocation(point.x + 25, 0); + }); + + }, 0, 60, TimeUnit.MILLISECONDS); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + if (image != null) { + g.drawImage(image, 0, 0, EmbedPane.this.getWidth(), EmbedPane.this.getHeight(), null); + } + + } + + private ScheduledExecutorService createToastScheduleExecutorService() { + return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(EMBED_PANE_TIMER)); + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/FirstDragAnimateStateManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/FirstDragAnimateStateManager.java new file mode 100644 index 000000000..f226b3229 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/FirstDragAnimateStateManager.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe.share.ui.online.embed; + + +/** + * Created by kerry on 2021/10/29 + */ +public class FirstDragAnimateStateManager { + + public static FirstDragAnimateStateManager getInstance() { + return FirstDragAnimateStateManager.HOLDER.singleton; + } + + private static class HOLDER { + private static final FirstDragAnimateStateManager singleton = new FirstDragAnimateStateManager(); + } + + private FirstDragAnimateStateManager() { + + } + + private STATE state; + + public void startAnimate() { + this.state = STATE.ANIMATING; + } + + public boolean animating() { + return this.state == STATE.ANIMATING; + + } + + public void stopAnimate() { + this.state = STATE.STOP; + } + + public boolean isStop() { + return this.state == STATE.STOP; + } + + enum STATE { + ANIMATING, + STOP + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java new file mode 100644 index 000000000..f1069ba3f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -0,0 +1,169 @@ +package com.fr.design.mainframe.share.ui.online.embed; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; +import com.fr.design.mainframe.share.ui.online.CarouselStateManger; +import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; +import com.fr.form.share.base.DataLoad; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.constants.ShareComponentConstants; +import com.fr.log.FineLoggerFactory; +import com.fr.module.ModuleContext; +import com.fr.stable.EncodeConstants; +import com.fr.third.springframework.web.util.UriUtils; + +import javax.imageio.ImageIO; +import javax.swing.JPanel; +import java.awt.AWTEvent; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.AWTEventListener; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.URL; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Created by kerry on 2021/10/22 + */ +public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane { + private static final String CAROUSEL_PREVIEW = "carousel_preview"; + private OnlineShareWidget[] showWidgets; + + private PreviewDialog previewDialog; + private JPanel widgetPane; + + private final AWTEventListener awtEventListener; + + public OnlineEmbedFilterSelectPane(final DataLoad dataLoad, FilterPane filterPane, int widgetsPerNum) { + super(dataLoad, filterPane, widgetsPerNum); + awtEventListener = event -> { + if (event instanceof MouseEvent) { + if (((MouseEvent) event).getClickCount() > 0) { + Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); + Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); + Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); + if (CarouselStateManger.getInstance().running() && + !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { + CarouselStateManger.getInstance().stop(); + } + } + + } + }; + + java.awt.Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.MOUSE_EVENT_MASK); + } + + protected UIScrollPane createScrollPane() { + showWidgets = getShowWidgets(); + widgetPane = createWidgetPane(); + widgetPane.setLayout(new FlowLayout(FlowLayout.LEFT, H_GAP, V_GAP)); + + previewDialog = new PreviewDialog(); + + widgetPane.setPreferredSize(new Dimension(240, getPaneHeight(showWidgets.length))); + UIScrollPane scrollPane = new UIScrollPane(createContentPane(widgetPane)); + setScrollPaneStyle(scrollPane); + return scrollPane; + } + + + protected void fireAfterDataLoad() { + super.fireAfterDataLoad(); + CarouselStateManger.getInstance().countDown(); + } + + public void animate() throws InterruptedException { + CarouselStateManger.getInstance().countDownLatchAwait(); + AtomicInteger integer = new AtomicInteger(0); + showCurrentLoadBlock(integer, widgetPane); + this.repaint(); + previewDialog.setVisible(true); + CarouselStateManger.getInstance().start(); + } + + private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { + ScheduledExecutorService service = createToastScheduleExecutorService(); + OnlineShareWidget shareWidget = showWidgets[integer.get()]; + widgetPane.add(createWidgetBlock(shareWidget), 0); + this.doLayout(); + this.validate(); + this.repaint(); + previewDialog.setImage(getPreviewImage(shareWidget)); + //展示弹出框 + service.schedule(new Runnable() { + @Override + public void run() { + if (CarouselStateManger.getInstance().stopped()) { + stopCarouse(integer); + return; + } + if (integer.get() == showWidgets.length - 1) { + CarouselStateManger.getInstance().stop(); + previewDialog.setVisible(false); + return; + } + integer.incrementAndGet(); + if (!CarouselStateManger.getInstance().isSuspend()) { + showCurrentLoadBlock(integer, widgetPane); + } else { + pollingCarouselState(integer, widgetPane); + } + } + }, 500, TimeUnit.MILLISECONDS); + } + + private void pollingCarouselState(AtomicInteger integer, JPanel widgetPane) { + ScheduledExecutorService service = createToastScheduleExecutorService(); + service.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + if (CarouselStateManger.getInstance().stopped()) { + stopCarouse(integer); + return; + } + if (!CarouselStateManger.getInstance().isSuspend()) { + showCurrentLoadBlock(integer, widgetPane); + service.shutdown(); + } + } + }, 0, 500, TimeUnit.MILLISECONDS); + } + + private void stopCarouse(AtomicInteger integer) { + previewDialog.setVisible(false); + loadRestShowWidgets(integer.get() + 1); + java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); + } + + private void loadRestShowWidgets(int startIndex) { + for (int i = startIndex; i < showWidgets.length; i++) { + OnlineShareWidget shareWidget = showWidgets[i]; + widgetPane.add(createWidgetBlock(shareWidget)); + } + this.doLayout(); + this.validate(); + this.repaint(); + } + + public Image getPreviewImage(OnlineShareWidget widget) { + try { + return ImageIO.read(new URL(UriUtils.encodePath(widget.getPicPath(), EncodeConstants.ENCODING_UTF_8))); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return ShareComponentConstants.DEFAULT_COVER; + } + } + + private ScheduledExecutorService createToastScheduleExecutorService() { + return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW)); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java new file mode 100644 index 000000000..11e39c923 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java @@ -0,0 +1,47 @@ +package com.fr.design.mainframe.share.ui.online.embed; + +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.share.ComponentShareUtil; +import com.fr.design.mainframe.share.ui.online.OnlineWidgetShowPane; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.util.List; + +/** + * Created by kerry on 2021/10/22 + */ +public class OnlineEmbedFilterShowPane extends JPanel { + private final OnlineWidgetShowPane onlineWidgetShowPane; + private final EmbedPane embedPane; + + private OnlineEmbedFilterSelectPane selectPane; + + public OnlineEmbedFilterShowPane(OnlineWidgetShowPane onlineWidgetShowPane) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + embedPane = new EmbedPane(this); + embedPane.setLocation(10, 0); + embedPane.setSize(228, 273); + this.add(embedPane); + this.onlineWidgetShowPane = onlineWidgetShowPane; + this.add(onlineWidgetShowPane, BorderLayout.CENTER); + } + + public void filterStateChanged(String filterStr) { + selectPane = onlineWidgetShowPane.animate(filterStr); + } + + public void animate(List selectedFilters) throws InterruptedException { + onlineWidgetShowPane.setFilterItems(selectedFilters); + selectPane.animate(); + } + + public void completeEmbedFilter(){ + if (embedPane!= null && embedPane.isShowing()){ + this.remove(embedPane); + ComponentShareUtil.completeEmbedFilter(); + this.doLayout(); + this.repaint(); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java new file mode 100644 index 000000000..086f4d2bd --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java @@ -0,0 +1,40 @@ +package com.fr.design.mainframe.share.ui.online.embed; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; + +import javax.swing.ImageIcon; +import javax.swing.JDialog; +import java.awt.Image; + + +/** + * Created by kerry on 2021/10/22 + */ +public class PreviewDialog extends JDialog { + + public PreviewDialog() { + super(DesignerContext.getDesignerFrame()); + setUndecorated(true); + setSize(300, 300); + adjustLocation(); + this.setVisible(false); + } + + public void setImage(Image image) { + this.getContentPane().removeAll(); + this.getContentPane().add(new UILabel(new ImageIcon(image))); + this.doLayout(); + this.validate(); + this.repaint(); + } + + public void adjustLocation() { + + this.setLocation( + EastRegionContainerPane.getInstance().getX() - 300, + 20 + ); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java new file mode 100644 index 000000000..3915a84dd --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java @@ -0,0 +1,64 @@ +package com.fr.design.mainframe.share.ui.online.resource; + +import javax.swing.SwingWorker; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + +/** + * Created by kerry on 2020-12-10 + */ +public class OnlineResourceManager { + private static class HOLDER { + private static final OnlineResourceManager singleton = new OnlineResourceManager(); + } + + private OnlineResourceManager() { + + } + + public static OnlineResourceManager getInstance() { + return HOLDER.singleton; + } + + private SwingWorker swingWorker; + + + private final BlockingQueue loaderBlockingQueue = new ArrayBlockingQueue(100); + + public void cancelLoad() { + if (swingWorker != null) { + swingWorker.cancel(true); + } + this.loaderBlockingQueue.clear(); + } + + public void addLoader(ResourceLoader loader) { + try { + this.loaderBlockingQueue.put(loader); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public void loadImage() { + swingWorker = new SwingWorker() { + @Override + protected Boolean doInBackground() { + while (!swingWorker.isCancelled()) { + ResourceLoader loader = null; + try { + loader = loaderBlockingQueue.take(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + loader.load(); + } + return true; + } + }; + swingWorker.execute(); + + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/ResourceLoader.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java similarity index 76% rename from designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/ResourceLoader.java rename to designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java index a57a64588..fee705f8a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/ResourceLoader.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.share.ui.online; +package com.fr.design.mainframe.share.ui.online.resource; /** * Created by kerry on 2020-12-10 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 662df3d8d..169759362 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 @@ -9,11 +9,15 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.share.sort.OnlineWidgetSortType; import com.fr.design.mainframe.share.ui.base.MouseClickListener; +import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetShowPane; import com.fr.design.mainframe.share.ui.online.OnlineDownloadPackagePane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.utils.ShareUtils; @@ -51,8 +55,8 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { super(sharableWidgetProviders); } - protected JPanel initContentPane() { - JPanel firstPane = super.initContentPane(); + protected JPanel initContentPane(OnlineWidgetSortType sortType) { + JPanel firstPane = super.initContentPane(sortType); cardLayout = new CardLayout(); centerPane = new JPanel(cardLayout); centerPane.add(firstPane, WIDGETS_INFO); @@ -132,7 +136,7 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { } - protected OnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { + protected AbstractOnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { return new OnlineWidgetPackageSelectPane(filterPackageWidget(sharableWidgetProviders), 10, this); } @@ -154,7 +158,7 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane { String id = widgetPackage.getId(); currentPackageId = id; boolean containsCache = cachePanelMap.containsKey(id); - onlineWidgetSelectPane = containsCache ? cachePanelMap.get(id) : new OnlineWidgetSelectPane(() -> ShareUtils.getPackageWidgets(widgetPackage), 50); + onlineWidgetSelectPane = containsCache ? cachePanelMap.get(id) : new OnlineWidgetSelectPane(() -> OnlineShopUtils.getPackageWidgets(widgetPackage), 50); downloadLabel.setVisible(!containsCache); showWidgetDetailPane(onlineWidgetSelectPane); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java new file mode 100644 index 000000000..31df72f99 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java @@ -0,0 +1,265 @@ +package com.fr.design.mainframe.share.ui.widgetfilter; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2021/11/1 + */ +public abstract class FilterConfigPane extends JPanel { + private static final Color BORDER_COLOR = Color.decode("#D9DADD"); + private static final String FILTER_ALL_ID = "0"; + + public static final int CONTENT_WIDTH = 225; + + private final List filterList = new ArrayList<>(); + private final List checkBoxList = new ArrayList<>(); + private boolean reset = false; + private boolean showChildNode; + + + public FilterConfigPane(List widgetFilterCategories, boolean showChildNode) { + this.showChildNode = showChildNode; + initPane(widgetFilterCategories); + } + + public FilterConfigPane(List widgetFilterCategories) { + this(widgetFilterCategories, true); + } + + + private void initPane(List widgetFilterCategories) { + this.setBackground(Color.WHITE); + this.setBorder(BorderFactory.createLineBorder(BORDER_COLOR)); + this.setForeground(Color.decode("#FFFFFF")); + this.setLayout(new BorderLayout()); + this.add(createVerticalFlowPane(widgetFilterCategories), BorderLayout.CENTER); + } + + public boolean hasFilter() { + return filterList.size() > 0; + } + + public List getFilterList() { + return filterList; + } + + private JPanel createVerticalFlowPane(List widgetFilterCategories) { + JPanel verticalFlowPane = new JPanel(); + verticalFlowPane.setBackground(Color.WHITE); + VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10); + layout.setAlignLeft(true); + verticalFlowPane.setLayout(layout); + + verticalFlowPane.setBackground(Color.WHITE); + verticalFlowPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + + for (FilterTypeInfo filterTypeInfo : widgetFilterCategories) { + verticalFlowPane.add(createCategoryPane(filterTypeInfo)); + } + + return verticalFlowPane; + } + + + private JPanel createTypeFilterPane(WidgetFilterTypeInfo widgetFilterTypeInfo) { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.setBackground(Color.WHITE); + UILabel titleLabel = new UILabel(widgetFilterTypeInfo.getTitle() + ":"); + titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, titleLabel.getFont().getSize())); + jPanel.add(titleLabel, BorderLayout.NORTH); + jPanel.add(createCategoryDetailPane(widgetFilterTypeInfo), BorderLayout.CENTER); + return jPanel; + } + + private JPanel createCategoryPane(FilterTypeInfo filterTypeInfo) { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.setBackground(Color.WHITE); + UILabel titleLabel = new UILabel(filterTypeInfo.getTitle()); + titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20)); + titleLabel.setOpaque(true); + titleLabel.setBackground(Color.decode("#EDEDEE")); + jPanel.add(titleLabel, BorderLayout.NORTH); + jPanel.add(createCategoryDetailPane(filterTypeInfo.getFilterTypeInfos()), BorderLayout.CENTER); + return jPanel; + } + + private JPanel createCategoryDetailPane(List filterTypeInfoList) { + + if (filterTypeInfoList.size() == 1) { + return createCategoryDetailPane(filterTypeInfoList.get(0)); + } + + JPanel contentPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + contentPane.setBackground(Color.WHITE); + for (WidgetFilterTypeInfo info : filterTypeInfoList) { + contentPane.add(createTypeFilterPane(info)); + } + return contentPane; + } + + private JPanel createCategoryDetailPane(WidgetFilterTypeInfo filterTypeInfo) { + JPanel contentPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); + contentPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + contentPane.setBackground(Color.WHITE); + contentPane.setPreferredSize(new Dimension(CONTENT_WIDTH, calculateDetailPaneHeight(filterTypeInfo))); + for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) { + if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { + continue; + } + FilterCheckBox checkBox = createCheckBox(filterInfo); + contentPane.add(checkBox); + if (showChildNode && filterInfo.hasChildFilter()) { + alignmentFilling(contentPane); + createChildPane(filterInfo.getInnerFilterInfo(), contentPane, checkBox); + alignmentFilling(contentPane); + } + } + return contentPane; + } + + private void alignmentFilling(JPanel contentPane) { + if (contentPane.getComponentCount() % 2 == 1) { + contentPane.add(new UILabel("")); + } + } + + private FilterCheckBox createCheckBox(WidgetFilterInfo filterInfo) { + final FilterCheckBox checkBox = new FilterCheckBox(filterInfo.getName(), filterInfo); + checkBox.setBackground(Color.WHITE); + checkBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (checkBox.isSelected() && !checkBox.getFilterInfo().hasChildFilter()) { + filterList.add(filterInfo); + } else if (filterList.contains(filterInfo)) { + filterList.remove(filterInfo); + } + if (reset) { + return; + } + fireSelectedChanged(new ChangeEvent(assembleFilter())); + } + }); + checkBoxList.add(checkBox); + return checkBox; + } + + private void createChildPane(List childFilterInfo, JPanel contentPane, FilterCheckBox parentCheckBox) { + List childCheckboxList = new ArrayList<>(); + for (WidgetFilterInfo filterInfo : childFilterInfo) { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.setBackground(Color.WHITE); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 16, 0, 0)); + FilterCheckBox checkBox = createCheckBox(filterInfo); + checkBox.addItemListener(e -> { + if (this.reset) { + return; + } + this.reset = true; + parentCheckBox.setSelected(allChildSelected(childCheckboxList)); + this.reset = false; + }); + childCheckboxList.add(checkBox); + jPanel.add(checkBox, BorderLayout.CENTER); + contentPane.add(jPanel); + } + parentCheckBox.addItemListener(e -> { + if (this.reset) { + return; + } + this.reset = true; + for (FilterCheckBox checkBox : childCheckboxList) { + checkBox.setSelected(parentCheckBox.isSelected()); + } + this.reset = false; + }); + } + + private boolean allChildSelected(List childCheckboxList) { + boolean flag = true; + for (FilterCheckBox checkBox : childCheckboxList) { + flag &= checkBox.isSelected(); + } + return flag; + } + + private int calculateDetailPaneHeight(WidgetFilterTypeInfo filterTypeInfo) { + int displayCount = 0; + for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) { + if (!ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { + displayCount++; + } + if (filterInfo.getInnerFilterInfo().size() > 0 && showChildNode) { + displayCount += (1 + filterInfo.getInnerFilterInfo().size()); + } + } + return ((displayCount + 1) / 2) * 27; + } + + + public abstract String assembleFilter(); + + public void setFilters(List selectedFilterNames) { + reset = true; + filterList.clear(); + for (FilterCheckBox checkBox : checkBoxList) { + if (selectedFilterNames.contains(checkBox.getFilterInfo().getName())) { + checkBox.setSelected(true); + filterList.add(checkBox.getFilterInfo()); + } + } + reset = false; + } + + public void reset() { + reset = true; + for (FilterCheckBox checkBox : checkBoxList) { + checkBox.setSelected(false); + } + filterList.clear(); + fireSelectedChanged(new ChangeEvent(StringUtils.EMPTY)); + reset = false; + } + + protected void fireSelectedChanged(ChangeEvent changeEvent) { + + } + + private class FilterCheckBox extends UICheckBox { + private WidgetFilterInfo filterInfo; + + public FilterCheckBox(String string, WidgetFilterInfo filterInfo) { + super(string); + this.filterInfo = filterInfo; + } + + public WidgetFilterInfo getFilterInfo() { + return this.filterInfo; + } + + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java index 7623c2e0a..77e863177 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java @@ -5,8 +5,10 @@ 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.MouseClickListener; -import com.fr.form.share.bean.WidgetFilterTypeInfo; -import com.fr.form.share.utils.ShareUtils; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.util.ShareFilterConstants; import com.fr.general.ComparatorUtils; import com.fr.invoke.Reflect; @@ -35,10 +37,6 @@ import java.util.List; * Created by kerry on 2020-10-21 */ public class FilterPane extends JPanel { - public static final String SOURCE_FILTER_KEY = "2@source"; - public static final String CHART_FILTER_KEY = "3@chart"; - public static final String REPORT_FILTER_KEY = "4@report"; - private static final Icon FILTER_COMBO = BaseUtils.readIcon("/com/fr/base/images/share/filter_combo.png"); private static final Icon FILTER_COMBO_UP = BaseUtils.readIcon("/com/fr/base/images/share/filter_combo_up.png"); private final UILabel filterLabel; @@ -115,10 +113,9 @@ public class FilterPane extends JPanel { public static FilterPane createOnlinePackageFilterPane() { FilterPane pane = new FilterPane() { @Override - protected List loadFilterCategories() { - List filterTypeInfos = super.loadFilterCategories(); - filterTypeInfos.removeIf(info -> ComparatorUtils.equals(FilterPane.CHART_FILTER_KEY, info.getKey()) - || ComparatorUtils.equals(FilterPane.REPORT_FILTER_KEY, info.getKey())); + protected List loadFilterCategories() { + List filterTypeInfos = super.loadFilterCategories(); + filterTypeInfos.removeIf(info -> ComparatorUtils.equals(ShareFilterConstants.WIDGET_TYPE_FILTER_KEY, info.getKey())); return filterTypeInfos; } }; @@ -166,8 +163,8 @@ public class FilterPane extends JPanel { java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); } - protected List loadFilterCategories() { - return ShareUtils.getWidgetFilterTypeInfos(); + protected List loadFilterCategories() { + return OnlineShopUtils.getShowFilterTypeInfos(); } private boolean isCanHide(MouseEvent mv, JPanel jPanel) { @@ -208,6 +205,14 @@ public class FilterPane extends JPanel { switchToNoFilter(); } + public void setFilter(List selectedFilters){ + List selectedFilterNames = new ArrayList<>(); + for(WidgetFilterInfo filterInfo : selectedFilters){ + selectedFilterNames.add(filterInfo.getName()); + } + filterPopupPane.setFilters(selectedFilterNames); + } + private void switchToNoFilter() { filterLabel.setText(Toolkit.i18nText("Fine-Design_Share_Online_No_Filter")); filterLabel.setForeground(Color.decode("#8F8F92")); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java index f0d3714c7..94a96b4b1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java @@ -1,203 +1,32 @@ package com.fr.design.mainframe.share.ui.widgetfilter; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.VerticalFlowLayout; -import com.fr.form.share.bean.WidgetFilterInfo; -import com.fr.form.share.bean.WidgetFilterTypeInfo; -import com.fr.general.ComparatorUtils; -import com.fr.stable.StringUtils; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; -import javax.swing.BorderFactory; -import javax.swing.JPanel; import javax.swing.event.ChangeEvent; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.ArrayList; import java.util.List; /** * @Author: Yuan.Wang * @Date: 2020/11/11 */ -public abstract class FilterPopupPane extends JPanel { - private static final Color BORDER_COLOR = Color.decode("#D9DADD"); - private static final String FILTER_ALL_ID = "0"; +public abstract class FilterPopupPane extends FilterConfigPane { - public static final int CONTENT_WIDTH = 225; + private final FilterPane filterPane; - FilterPane filterPane; - private List filterList = new ArrayList<>(); - private final List checkBoxList = new ArrayList<>(); - private boolean reset = false; - - public FilterPopupPane(FilterPane filterPane, List widgetFilterCategories) { + public FilterPopupPane(FilterPane filterPane, List widgetFilterCategories) { + super(widgetFilterCategories); this.filterPane = filterPane; - initPane(widgetFilterCategories); - } - - private void initPane(List widgetFilterCategories) { - this.setBackground(Color.WHITE); - this.setBorder(BorderFactory.createLineBorder(BORDER_COLOR)); - this.setForeground(Color.decode("#FFFFFF")); - this.setLayout(new BorderLayout()); - this.add(createVerticalFlowPane(widgetFilterCategories), BorderLayout.CENTER); - } - - public boolean hasFilter() { - return filterList.size() > 0; - } - - protected List getFilterList() { - return filterList; } - private JPanel createVerticalFlowPane(List widgetFilterCategories) { - - List topWidgetTypeFilter = new ArrayList<>(); - List widgetTypeFilter = new ArrayList<>(); - List otherWidgetTypeFilter = new ArrayList<>(); - - for (WidgetFilterTypeInfo info : widgetFilterCategories) { - if (ComparatorUtils.equals(FilterPane.CHART_FILTER_KEY, info.getKey()) - || ComparatorUtils.equals(FilterPane.REPORT_FILTER_KEY, info.getKey())) { - widgetTypeFilter.add(info); - } else if (ComparatorUtils.equals(FilterPane.SOURCE_FILTER_KEY, info.getKey())) { - topWidgetTypeFilter.add(info); - } else { - otherWidgetTypeFilter.add(info); - } - } - - JPanel verticalFlowPane = new JPanel(); - verticalFlowPane.setBackground(Color.WHITE); - VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10); - layout.setAlignLeft(true); - verticalFlowPane.setLayout(layout); - - verticalFlowPane.setBackground(Color.WHITE); - verticalFlowPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - - for (WidgetFilterTypeInfo info : topWidgetTypeFilter) { - verticalFlowPane.add(createOtherCategoryPane(info)); - } - if (widgetTypeFilter.size() > 0) { - verticalFlowPane.add(createWidgetTypeFilterPane(widgetTypeFilter)); - } - for (WidgetFilterTypeInfo info : otherWidgetTypeFilter) { - verticalFlowPane.add(createOtherCategoryPane(info)); - } - return verticalFlowPane; + public void setFilters(List selectedFilterNames) { + super.setFilters(selectedFilterNames); + filterPane.changeFilterButtonStatus(hasFilter()); } - private JPanel createWidgetTypeFilterPane(List widgetTypeFilter) { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBackground(Color.WHITE); - UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type")); - titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20)); - titleLabel.setOpaque(true); - titleLabel.setBackground(Color.decode("#EDEDEE")); - jPanel.add(titleLabel, BorderLayout.NORTH); - - JPanel contentPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); - contentPane.setBackground(Color.WHITE); - for (WidgetFilterTypeInfo info : widgetTypeFilter) { - contentPane.add(createTypeFilterPane(info)); - } - jPanel.add(contentPane, BorderLayout.CENTER); - return jPanel; - } - private JPanel createTypeFilterPane(WidgetFilterTypeInfo widgetFilterTypeInfo) { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBackground(Color.WHITE); - UILabel titleLabel = new UILabel(widgetFilterTypeInfo.getTitle() + ":"); - titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, titleLabel.getFont().getSize())); - jPanel.add(titleLabel, BorderLayout.NORTH); - jPanel.add(createCategoryDetailPane(widgetFilterTypeInfo), BorderLayout.CENTER); - return jPanel; - } - - private JPanel createOtherCategoryPane(WidgetFilterTypeInfo filterTypeInfo) { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBackground(Color.WHITE); - UILabel titleLabel = new UILabel(filterTypeInfo.getTitle()); - titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20)); - titleLabel.setOpaque(true); - titleLabel.setBackground(Color.decode("#EDEDEE")); - jPanel.add(titleLabel, BorderLayout.NORTH); - jPanel.add(createCategoryDetailPane(filterTypeInfo), BorderLayout.CENTER); - return jPanel; - } - - private JPanel createCategoryDetailPane(WidgetFilterTypeInfo filterTypeInfo) { - JPanel contentPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - contentPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); - contentPane.setBackground(Color.WHITE); - int displayCount = 0; - for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) { - if (!ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { - displayCount++; - } - } - int contentPaneHeight = ((displayCount + 1) / 2) * 27; - contentPane.setPreferredSize(new Dimension(CONTENT_WIDTH, contentPaneHeight)); - for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) { - if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { - continue; - } - final UICheckBox checkBox = new UICheckBox(filterInfo.getName()); - checkBox.setBackground(Color.WHITE); - - checkBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (reset) { - return; - } - if (checkBox.isSelected()) { - filterList.add(filterInfo); - } else if (filterList.contains(filterInfo)) { - filterList.remove(filterInfo); - } - checkFilterButtonStatus(); - filterPane.fireChangeListener(new ChangeEvent(assembleFilter())); - } - }); - - - checkBoxList.add(checkBox); - contentPane.add(checkBox); - } - return contentPane; - } - - protected abstract String assembleFilter(); - - private void checkFilterButtonStatus() { + protected void fireSelectedChanged(ChangeEvent changeEvent){ filterPane.changeFilterButtonStatus(hasFilter()); + filterPane.fireChangeListener(changeEvent); } - - public void reset() { - reset = true; - for (UICheckBox checkBox : checkBoxList) { - checkBox.setSelected(false); - } - filterList.clear(); - checkFilterButtonStatus(); - filterPane.fireChangeListener(new ChangeEvent(StringUtils.EMPTY)); - reset = false; - } - } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalFilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalFilterPopupPane.java index 5a589d32c..373d7d01c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalFilterPopupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalFilterPopupPane.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe.share.ui.widgetfilter; -import com.fr.form.share.bean.WidgetFilterTypeInfo; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; import com.fr.stable.StringUtils; import java.util.ArrayList; @@ -11,12 +11,12 @@ import java.util.List; * @Date: 2020/11/11 */ public class LocalFilterPopupPane extends FilterPopupPane { - public LocalFilterPopupPane(FilterPane pane, List loadFilterCategories) { + public LocalFilterPopupPane(FilterPane pane, List loadFilterCategories) { super(pane, loadFilterCategories); } @Override - protected String assembleFilter() { + public String assembleFilter() { LocalWidgetFilter.getInstance().setFilterList(getFilterList() == null ? new ArrayList<>() : getFilterList()); return StringUtils.EMPTY; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilter.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilter.java index 259e6fcc9..4e7f43214 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilter.java @@ -3,7 +3,7 @@ package com.fr.design.mainframe.share.ui.widgetfilter; import com.fr.design.i18n.Toolkit; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.SharableWidgetProvider; -import com.fr.form.share.bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; import com.fr.design.mainframe.share.constants.DisplayDevice; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java index 9e5d4f34e..b6abbe76c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java @@ -1,7 +1,10 @@ package com.fr.design.mainframe.share.ui.widgetfilter; -import com.fr.form.share.bean.WidgetFilterInfo; -import com.fr.form.share.bean.WidgetFilterTypeInfo; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; +import com.fr.design.mainframe.share.util.ShareFilterConstants; import java.util.ArrayList; import java.util.List; @@ -12,33 +15,39 @@ import java.util.List; */ public class LocalWidgetFilterCategory { - public static List getLocalCategory() { - List category = new ArrayList<>(); + public static List getLocalCategory() { + List category = new ArrayList<>(); WidgetFilterTypeInfo source = new WidgetFilterTypeInfo(); - source.setTitle("来源"); - source.setKey("2@source"); + source.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Source")); + source.setKey(ShareFilterConstants.SOURCE_TYPE_FILTER_KEY); source.addFilterItem(new WidgetFilterInfo("本地", "1", "source")); source.addFilterItem(new WidgetFilterInfo("商城", "2", "source")); source.addFilterItem(new WidgetFilterInfo("全部", "0", "source")); + FilterTypeInfo sourceTypeInfo = new FilterTypeInfo(source.getTitle(), source.getKey()); + sourceTypeInfo.addFilterType(source); WidgetFilterTypeInfo displayDevice = new WidgetFilterTypeInfo(); - displayDevice.setTitle("展示终端"); - displayDevice.setKey("1@displayDevice"); + displayDevice.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Show_Device")); + displayDevice.setKey(ShareFilterConstants.SHOW_TERMINAL_FILTER_KEY); displayDevice.addFilterItem(new WidgetFilterInfo("PC端", "1", "displayDevice")); displayDevice.addFilterItem(new WidgetFilterInfo("移动端", "2", "displayDevice")); displayDevice.addFilterItem(new WidgetFilterInfo("全部", "0", "displayDevice")); + FilterTypeInfo showDeviceTypeInfo = new FilterTypeInfo(displayDevice.getTitle(), displayDevice.getKey()); + showDeviceTypeInfo.addFilterType(displayDevice); WidgetFilterTypeInfo fee = new WidgetFilterTypeInfo(); - fee.setTitle("价格"); - fee.setKey("2@fee"); + fee.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Price")); + fee.setKey(ShareFilterConstants.FEE_FILTER_KEY); fee.addFilterItem(new WidgetFilterInfo("付费", "2", "fee")); fee.addFilterItem(new WidgetFilterInfo("免费", "1", "fee")); fee.addFilterItem(new WidgetFilterInfo("全部", "0", "fee")); + FilterTypeInfo feeTypeInfo = new FilterTypeInfo(fee.getTitle(), fee.getKey()); + feeTypeInfo.addFilterType(fee); WidgetFilterTypeInfo chart = new WidgetFilterTypeInfo(); chart.setTitle("基础元素"); - chart.setKey("3@chart"); + chart.setKey(ShareFilterConstants.CHART_FILTER_KEY); chart.addFilterItem(new WidgetFilterInfo("柱形图/条形图", "1", "chart")); chart.addFilterItem(new WidgetFilterInfo("折线图", "3", "chart")); chart.addFilterItem(new WidgetFilterInfo("组合图", "4", "chart")); @@ -52,7 +61,7 @@ public class LocalWidgetFilterCategory { WidgetFilterTypeInfo report = new WidgetFilterTypeInfo(); report.setTitle("综合应用"); - report.setKey("4@report"); + report.setKey(ShareFilterConstants.REPORT_FILTER_KEY); report.addFilterItem(new WidgetFilterInfo("指标卡", "1", "report")); report.addFilterItem(new WidgetFilterInfo("标题头", "2", "report")); report.addFilterItem(new WidgetFilterInfo("特殊功能卡", "4", "report")); @@ -60,21 +69,24 @@ public class LocalWidgetFilterCategory { report.addFilterItem(new WidgetFilterInfo("移动目录导航", "6", "report")); report.addFilterItem(new WidgetFilterInfo("填报", "8", "report")); report.addFilterItem(new WidgetFilterInfo("全部", "0", "report")); + FilterTypeInfo widgetTypeInfo = new FilterTypeInfo(Toolkit.i18nText("Fine-Design_Share_Filter_Widget_Type"), ShareFilterConstants.WIDGET_TYPE_FILTER_KEY); + widgetTypeInfo.addFilterType(chart); + widgetTypeInfo.addFilterType(report); WidgetFilterTypeInfo style = new WidgetFilterTypeInfo(); - style.setTitle("风格"); - style.setKey("5@style"); + style.setTitle(Toolkit.i18nText("Fine-Design_Share_Filter_Style")); + style.setKey(ShareFilterConstants.STYLE_FILTER_KEY); style.addFilterItem(new WidgetFilterInfo("简约清新", "1", "style")); style.addFilterItem(new WidgetFilterInfo("商务稳重", "2", "style")); style.addFilterItem(new WidgetFilterInfo("活泼绚丽", "3", "style")); style.addFilterItem(new WidgetFilterInfo("酷炫科技", "4", "style")); style.addFilterItem(new WidgetFilterInfo("其他风格", "5", "style")); style.addFilterItem(new WidgetFilterInfo("全部", "0", "style")); - - category.add(displayDevice); - category.add(source); - category.add(chart); - category.add(report); + FilterTypeInfo styleTypeInfo = new FilterTypeInfo(style.getTitle(), style.getKey()); + styleTypeInfo.addFilterType(style); + category.add(sourceTypeInfo); + category.add(widgetTypeInfo); + category.add(showDeviceTypeInfo); return category; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/OnlineFilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/OnlineFilterPopupPane.java index 2543b4a77..46f521916 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/OnlineFilterPopupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/OnlineFilterPopupPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.share.ui.widgetfilter; -import com.fr.form.share.bean.WidgetFilterTypeInfo; -import com.fr.form.share.utils.ShareUtils; +import com.fr.design.mainframe.share.util.OnlineShopUtils; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; import java.util.List; @@ -11,12 +11,12 @@ import java.util.List; */ public class OnlineFilterPopupPane extends FilterPopupPane { - public OnlineFilterPopupPane(FilterPane filterPane, List widgetFilterCategories) { + public OnlineFilterPopupPane(FilterPane filterPane, List widgetFilterCategories) { super(filterPane, widgetFilterCategories); } - protected String assembleFilter() { - return ShareUtils.assembleFilter(getFilterList()); + public String assembleFilter() { + return OnlineShopUtils.assembleFilter(getFilterList()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index 83ca9a6a3..398cac95e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -6,7 +6,6 @@ import com.fr.design.extra.PluginConstants; import com.fr.form.share.base.CancelCheck; import com.fr.form.share.constants.ShareComponentConstants; import com.fr.ftp.util.Base64; -import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -39,19 +38,23 @@ import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; import java.security.spec.X509EncodedKeySpec; -import static com.fr.form.share.constants.ShareComponentConstants.REU_INFO_PATH; - /** * created by Harrison on 2020/05/27 **/ public class DownloadUtils { - private static final String REUSES_URL = StableUtils.pathJoin(ShareComponentConstants.REU_INFO_PATH, "file/download"); - private static final String PACKAGE_REUSES_URL = StableUtils.pathJoin(ShareComponentConstants.REU_INFO_PATH, "package/download/"); private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" + "tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" + "nMdTIrkz8tYkG3QoFQIDAQAB"; + private static String getReusesUrl() { + return StableUtils.pathJoin(OnlineShopUtils.getReuInfoPath(), "file/download"); + } + + private static String getPackageReusesUrl() { + return StableUtils.pathJoin(OnlineShopUtils.getReuInfoPath(), "package/download/"); + } + private static CloseableHttpClient createClient() { @@ -65,7 +68,7 @@ public class DownloadUtils { @NotNull public static String download(String id, String fileName, com.fr.design.extra.Process process) throws Exception { - CloseableHttpResponse fileRes = getHttpResponse(REUSES_URL, id); + CloseableHttpResponse fileRes = getHttpResponse(getReusesUrl(), id); if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); } @@ -103,7 +106,7 @@ public class DownloadUtils { public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception { - CloseableHttpResponse fileRes = getHttpResponse(PACKAGE_REUSES_URL, id); + CloseableHttpResponse fileRes = getHttpResponse(getPackageReusesUrl(), id); if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); } 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 new file mode 100644 index 000000000..4e442981a --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java @@ -0,0 +1,293 @@ +package com.fr.design.mainframe.share.util; + +import com.fr.design.DesignerCloudURLManager; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.bean.SortParameter; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; +import com.fr.design.mainframe.share.config.ComponentReuseConfigManager; +import com.fr.general.ComparatorUtils; +import com.fr.general.http.HttpClient; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import java.net.HttpURLConnection; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * Created by kerry on 2021/11/3 + */ +public class OnlineShopUtils { + + private static final String CHART = "chart"; + private static final String REPORT = "report"; + private static final String CID_PREFIX = "cid"; + private static final String CHART_IDS = "123457"; + + private OnlineShopUtils() { + + } + + public static String getReuInfoPath() { + return ComponentReuseConfigManager.getInstance().getMiniShopUrl(); + } + + private static String getWidgetReusePath() { + return getReuInfoPath(); + } + + private static String getPackageChildrenPath() { + return StableUtils.pathJoin(getReuInfoPath(), "children/"); + } + + private static String getWidgetFilterPath() { +// return StableUtils.pathJoin(getReuInfoPath(), "filter"); + return "http://192.168.5.83:3008/reuses/filter"; + } + + private static String getGetCompositeSortParaPath() { + return StableUtils.pathJoin(getReuInfoPath(), "sort_parameter"); + } + + private static String getTestConnectionUrl() { + return DesignerCloudURLManager.getInstance().acquireUrlByKind("ping"); + } + + public static List getShowFilterTypeInfos() { + List filterTypeInfos = new ArrayList<>(); + List widgetFilterTypeInfos = getWidgetFilterTypeInfos(); + FilterTypeInfo widgetTypeInfo = + new FilterTypeInfo(Toolkit.i18nText("Fine-Design_Share_Filter_Widget_Type"), ShareFilterConstants.WIDGET_TYPE_FILTER_KEY); + for (WidgetFilterTypeInfo info : widgetFilterTypeInfos) { + if (ComparatorUtils.equals(ShareFilterConstants.CHART_FILTER_KEY, info.getKey()) + || ComparatorUtils.equals(ShareFilterConstants.REPORT_FILTER_KEY, info.getKey())) { + widgetTypeInfo.addFilterType(info); + if (!filterTypeInfos.contains(widgetTypeInfo)) { + filterTypeInfos.add(widgetTypeInfo); + } + } else { + FilterTypeInfo typeInfo = new FilterTypeInfo(info.getTitle(), info.getKey()); + typeInfo.addFilterType(info); + filterTypeInfos.add(typeInfo); + } + } + filterTypeInfos.sort(Comparator.comparingInt(o -> OnlineFilterType.parse(o.getKey()).ordinal())); + return filterTypeInfos; + } + + enum OnlineFilterType { + SHOW_DEVICE(ShareFilterConstants.SHOW_TERMINAL_FILTER_KEY), + STYLE(ShareFilterConstants.STYLE_FILTER_KEY), + WIDGET_TYPE(ShareFilterConstants.WIDGET_TYPE_FILTER_KEY), + FEE(ShareFilterConstants.FEE_FILTER_KEY), + VERSION(ShareFilterConstants.VERSION_FILTER_KEY); + private String flag; + + private OnlineFilterType(String flag) { + this.flag = flag; + } + + public static OnlineFilterType parse(String flag) { + for (OnlineFilterType filterType : values()) { + if (ComparatorUtils.equals(filterType.flag, flag)) { + return filterType; + } + } + return SHOW_DEVICE; + } + } + + public static List getEmbPaneShowFilterTypeInfos() { + List filterTypeInfos = new ArrayList<>(); + List widgetFilterTypeInfos = getWidgetFilterTypeInfos(); + WidgetFilterTypeInfo widgetTypeFilterInfo = new WidgetFilterTypeInfo(); + widgetTypeFilterInfo.setTitle(Toolkit.i18nText("Fine-Design_Share_Filter_Widget_Type")); + FilterTypeInfo widgetType = new FilterTypeInfo(widgetTypeFilterInfo.getTitle(), ShareFilterConstants.WIDGET_TYPE_FILTER_KEY); + widgetType.addFilterType(widgetTypeFilterInfo); + WidgetFilterInfo reportCard = new WidgetFilterInfo(); + reportCard.setName(Toolkit.i18nText("Fine-Design_Share_Online_Filter_Indicator_Card")); + WidgetFilterInfo chartType = new WidgetFilterInfo(); + chartType.setName(Toolkit.i18nText("Fine-Design_Share_Online_Filter_Chart")); + WidgetFilterInfo otherType = new WidgetFilterInfo(); + otherType.setName(Toolkit.i18nText("Fine-Design_Share_Online_Filter_Other_Type")); + widgetTypeFilterInfo.addFilterItem(reportCard); + widgetTypeFilterInfo.addFilterItem(chartType); + widgetTypeFilterInfo.addFilterItem(otherType); + for (WidgetFilterTypeInfo info : widgetFilterTypeInfos) { + if (ComparatorUtils.equals(ShareFilterConstants.SHOW_TERMINAL_FILTER_KEY, info.getKey())) { + FilterTypeInfo showTerminalInfo = new FilterTypeInfo(info.getTitle(), info.getKey()); + showTerminalInfo.addFilterType(info); + filterTypeInfos.add(showTerminalInfo); + + } else if (ComparatorUtils.equals(ShareFilterConstants.STYLE_FILTER_KEY, info.getKey())) { + FilterTypeInfo styleTypeInfo = new FilterTypeInfo(info.getTitle(), info.getKey()); + styleTypeInfo.addFilterType(info); + filterTypeInfos.add(styleTypeInfo); + } else if (ComparatorUtils.equals(ShareFilterConstants.REPORT_FILTER_KEY, info.getKey())) { + for (WidgetFilterInfo filterInfo : info.getFilterItems()) { + if (ComparatorUtils.equals(filterInfo.getId(), "1")) { + reportCard.addChildFilterInfo(filterInfo); + } else { + otherType.addChildFilterInfo(filterInfo); + } + } + } else if (ComparatorUtils.equals(ShareFilterConstants.CHART_FILTER_KEY, info.getKey())) { + for (WidgetFilterInfo filterInfo : info.getFilterItems()) { + if (filterInfo.getId() != null && CHART_IDS.contains(filterInfo.getId())) { + chartType.addChildFilterInfo(filterInfo); + } else { + otherType.addChildFilterInfo(filterInfo); + } + } + } + } + filterTypeInfos.add(widgetType); + return filterTypeInfos; + } + + + public static Map getCompositeSortPara() { + Map para = new HashMap<>(); + try { + JSONArray resultArr = getResultAttrFromUrl(getGetCompositeSortParaPath()); + int size = resultArr.size(); + for (int i = 0; i < size; i++) { + JSONObject jo = resultArr.getJSONObject(i); + SortParameter sortParameter = SortParameter.parseFromJSONObject(jo); + para.put(sortParameter.getParameter(), sortParameter); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return para; + } + + public static String assembleFilter(List filterInfos) { + List cidList = new ArrayList<>(); + Map queryParaMap = new HashMap<>(); + for (WidgetFilterInfo filterInfo : filterInfos) { + if (ComparatorUtils.equals(CHART, filterInfo.getType()) + || ComparatorUtils.equals(REPORT, filterInfo.getType())) { + cidList.add(filterInfo.getType() + "-" + filterInfo.getId()); + continue; + } + String queryValue = queryParaMap.get(filterInfo.getType()); + if (StringUtils.isNotEmpty(queryValue)) { + queryValue += "," + filterInfo.getId(); + } else { + queryValue = filterInfo.getId(); + } + queryParaMap.put(filterInfo.getType(), queryValue); + } + StringBuffer sb; + List queryCondition = new ArrayList<>(); + if (!cidList.isEmpty()) { + sb = new StringBuffer(); + sb.append(CID_PREFIX).append("=").append(StringUtils.join(",", cidList.toArray(new String[cidList.size()]))); + queryCondition.add(sb.toString()); + } + + Iterator> iterator = queryParaMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + sb = new StringBuffer(); + sb.append(entry.getKey()).append("=").append(entry.getValue()); + queryCondition.add(sb.toString()); + } + return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()])); + } + + public static boolean testConnection() { + HttpClient httpClient = new HttpClient(getTestConnectionUrl()); + httpClient.asGet(); + int responseCode = httpClient.getResponseCode(); + return responseCode == HttpURLConnection.HTTP_OK; + } + + + public static List[] getAllSharableWidgetsFromShop() throws Exception { + List[] sharableWidgetsArray = new List[]{new ArrayList<>(), new ArrayList<>()}; + JSONArray resultArr = getResultAttrFromUrl(getWidgetReusePath()); + int size = resultArr.size(); + for (int i = 0; i < size; i++) { + JSONObject jo = resultArr.getJSONObject(i); + OnlineShareWidget temp = OnlineShareWidget.parseFromJSONObject(jo); + if (temp.isWidgetPackage()) { + sharableWidgetsArray[1].add(temp); + } else { + sharableWidgetsArray[0].add(temp); + } + } + return sharableWidgetsArray; + } + + public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) { + String plistUrl = getPackageChildrenPath() + widgetPackage.getId(); + OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl); + for (OnlineShareWidget widget : widgets) { + widget.setParentPackage(widgetPackage); + } + return widgets; + } + + public static List getWidgetFilterTypeInfos() { + List result = new ArrayList<>(); + try { + JSONArray resultArr = getResultAttrFromUrl(getWidgetFilterPath()); + int size = resultArr.size(); + for (int i = 0; i < size; i++) { + JSONObject jo = resultArr.getJSONObject(i); + result.add(WidgetFilterTypeInfo.parseFromJSONObject(jo)); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return result; + } + + private static OnlineShareWidget[] getOnlineShareWidgets(String url) { + if (StringUtils.isNotBlank(url)) { + try { + JSONArray resultArr = getResultAttrFromUrl(url); + int size = resultArr.size(); + List onlineShareWidgets = new ArrayList<>(); + for (int i = 0; i < size; i++) { + JSONObject jo = resultArr.getJSONObject(i); + OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(jo); + if (!widget.isWidgetPackage()) { + onlineShareWidgets.add(widget); + } + } + return onlineShareWidgets.toArray(new OnlineShareWidget[onlineShareWidgets.size()]); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + return new OnlineShareWidget[]{}; + } + + public static OnlineShareWidget[] getFilterWidgets(String filterStr) { + + String plistUrl = getWidgetReusePath() + "?" + filterStr; + return getOnlineShareWidgets(plistUrl); + } + + private static JSONArray getResultAttrFromUrl(String url) { + HttpClient httpClient = new HttpClient(url); + httpClient.asGet(); + String responseText = httpClient.getResponseText(); + JSONObject resultJSONObject = new JSONObject(responseText); + return resultJSONObject.getJSONArray("result"); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareFilterConstants.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareFilterConstants.java new file mode 100644 index 000000000..e72e0e1b2 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareFilterConstants.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.share.util; + +/** + * Created by kerry on 2021/11/3 + */ +public class ShareFilterConstants { + public static final String CHART_FILTER_KEY = "3@chart"; + public static final String REPORT_FILTER_KEY = "4@report"; + public static final String SHOW_TERMINAL_FILTER_KEY = "4@displayDevice"; + public static final String STYLE_FILTER_KEY = "5@style"; + public static final String FEE_FILTER_KEY = "2@fee"; + public static final String VERSION_FILTER_KEY = "6@version"; + public static final String WIDGET_TYPE_FILTER_KEY = "1@widgetType"; + public static final String SOURCE_TYPE_FILTER_KEY = "2@source"; + + public static final String ALL_STYLE_THEME = "0"; +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java index 5e55b692d..f5121bef1 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java @@ -17,10 +17,10 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.main.Form; +import com.fr.design.DesignerCloudURLManager; import com.fr.form.ui.Widget; import com.fr.form.ui.container.OccupiedLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; -import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -65,6 +65,7 @@ public class NewFormPane extends BasicPane { this.add(createModuleListPane(), BorderLayout.WEST); this.add(createTemplateManagePane(), BorderLayout.CENTER); initWindow(); + DesignerCloudURLManager.getInstance().testConnect(); } private void initWindow() { diff --git a/designer-form/src/main/resources/com/fr/design/form/images/drag_hand.png b/designer-form/src/main/resources/com/fr/design/form/images/drag_hand.png new file mode 100644 index 0000000000000000000000000000000000000000..b160f32256ba8aa592078fe5c75d7a515367e044 GIT binary patch literal 967 zcmV;&133JNP)Px&fk{L`R5(wqlut-wR}_aoU*5!5M=Q)fQfZyhRwI;F2`FlzXs6gIICfk_6gpLG z#8{(PnJy}*1r^*BTqp=`jFB2_5W$61M5yj6ipEXF&O(S|x(G~3TIa>Yl#{*;QCjF? zEqy8yhq0dm zDS6;k;4R=yptZHN^{d(0S#!Fqot+&4v{!r^dyIWsdO7J9k%_V#FRZ)bOR_g{gc)NZ$*9336i0KWkGb16zxfVqZBsc>6GMa2WR+kLI1q$CLy zP)A1x+uPeTHa61P*~!`28HeQ8AjW*SiOp-}3}%gaCWdcA64 zVIk3I6!DyN&hhav85tSm=H_yEc*x-3V0>+D?HgbkI7_vjxK;`w#St&c^SG+2>f@!Q zCDme)6#uiFPA8k2o2;*|CyP;BT|e@uM{>D{EwEXy}d7($XX> z5D3uQ+xtw{^^nWudQa5%_4WM>e40|1J{;s-l!_-s(mTMD?Ck8Dnx@I9y3ln!8V-kl z0z$w?s;Zh}vDoiGmlPv)i>m`xEF=AP8<6giSmvIdrb2Eaqe`y%9Qf0Slgz8YR4YnO pO@`{ELIa$-iR^OFdD{0R@NWweQY1xvBE0|r002ovPDHLkV1lw#&A|Ww literal 0 HcmV?d00001 diff --git a/designer-form/src/test/java/com/fr/design/mainframe/ReuseTriggerPointManagerTest.java b/designer-form/src/test/java/com/fr/design/mainframe/ReuseTriggerPointManagerTest.java deleted file mode 100644 index 8a80e7f7d..000000000 --- a/designer-form/src/test/java/com/fr/design/mainframe/ReuseTriggerPointManagerTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fr.design.mainframe; - -import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; -import org.junit.Assert; -import org.junit.Test; - -/** - * Created by kerry on 5/10/21 - */ -public class ReuseTriggerPointManagerTest { - private static final long ONE_WEEK_TIME = 7 * 24 * 3600 * 1000L; - - - @Test - public void testNeedTrigger() { - ComponentReuseNotificationInfo notificationInfo = ComponentReuseNotificationInfo.getInstance(); - notificationInfo.setNotifiedNumber(0); - Assert.assertTrue(ReuseTriggerPointManager.getInstance().needTrigger()); - - notificationInfo.setNotifiedNumber(1); - Assert.assertTrue(ReuseTriggerPointManager.getInstance().needTrigger()); - - notificationInfo.setNotifiedNumber(2); - Assert.assertFalse(ReuseTriggerPointManager.getInstance().needTrigger()); - - notificationInfo.setNotifiedNumber(0); - notificationInfo.setLastNotifyTime(System.currentTimeMillis()); - Assert.assertFalse(ReuseTriggerPointManager.getInstance().needTrigger()); - - notificationInfo.setNotifiedNumber(1); - notificationInfo.setLastNotifyTime(System.currentTimeMillis()); - Assert.assertFalse(ReuseTriggerPointManager.getInstance().needTrigger()); - - - notificationInfo.setNotifiedNumber(1); - notificationInfo.setLastNotifyTime(System.currentTimeMillis() - ONE_WEEK_TIME - 1); - Assert.assertTrue(ReuseTriggerPointManager.getInstance().needTrigger()); - - - notificationInfo.setNotifiedNumber(2); - notificationInfo.setLastNotifyTime(System.currentTimeMillis()); - Assert.assertFalse(ReuseTriggerPointManager.getInstance().needTrigger()); - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 5d878a3c2..e9b1b8fc3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -30,8 +30,8 @@ import com.fr.design.mainframe.share.ui.block.OnlineWidgetPackageBlock; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetTabPane; import com.fr.design.mainframe.share.util.DownloadUtils; +import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.utils.ComponentUtils; -import com.fr.form.share.utils.ShareUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -86,7 +86,7 @@ public class DownloadComponentPackageGuide { GuideCreateUtils.showUnLoginAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); return false; - } else if (!ShareUtils.testConnection()) { + } else if (!OnlineShopUtils.testConnection()) { GuideCreateUtils.showNoNetworkAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); return false; diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index 2d027db89..5bbfc7a11 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -26,7 +26,7 @@ import com.fr.design.share.utils.EffectItemUtils; import com.fr.design.share.utils.ShareDialogUtils; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.Group; -import com.fr.form.share.config.ComponentReuseConfigManager; +import com.fr.design.mainframe.share.config.ComponentReuseConfigManager; import com.fr.form.share.exception.NetWorkFailedException; import com.fr.form.share.group.DefaultShareGroup; import com.fr.form.share.group.DefaultShareGroupManager; From 8f014fb5b78dd60918d9a746d24ea340c374935f Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Nov 2021 09:35:56 +0800 Subject: [PATCH 040/152] =?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 --- .../com/fr/design/mainframe/share/util/OnlineShopUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 4e442981a..9405ace59 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 @@ -51,8 +51,7 @@ public class OnlineShopUtils { } private static String getWidgetFilterPath() { -// return StableUtils.pathJoin(getReuInfoPath(), "filter"); - return "http://192.168.5.83:3008/reuses/filter"; + return StableUtils.pathJoin(getReuInfoPath(), "filter"); } private static String getGetCompositeSortParaPath() { From 9df5abe79cdb5a4b4334afbe0aae157db6139750 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 4 Nov 2021 10:22:07 +0800 Subject: [PATCH 041/152] =?UTF-8?q?REPORT-61306=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BC=A9=E6=94=BE=E6=97=B6=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E5=BC=B9=E7=AA=97=E6=9C=AA=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=85=E9=83=A8=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E8=80=8C=E6=98=AF=E5=9B=BA=E5=AE=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=9C=A8=E5=8F=B3=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/notification/ui/NotificationCenterDialog.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java index 10e10ecdb..2541d04b4 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java @@ -2,6 +2,7 @@ package com.fr.design.notification.ui; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.Notification; import com.fr.design.notification.NotificationCenter; import java.awt.BorderLayout; @@ -119,7 +120,7 @@ public class NotificationCenterDialog extends JDialog { if (winSize.width > screenSize.width) { winSize.width = screenSize.width; } - //这里设置位置:水平居中,竖直偏上 - win.setLocation(screenSize.width - winSize.width - 90, 50); + win.setLocation((DesignerContext.getDesignerFrame().getWidth() - winSize.width - 100 + DesignerContext.getDesignerFrame().getX()), + DesignerContext.getDesignerFrame().getY() + winSize.height); } } From 0e79734a55dd4db1f75463d2f4610286ec81ed20 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Nov 2021 10:35:28 +0800 Subject: [PATCH 042/152] =?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 --- .../fr/design/DesignerCloudURLManager.java | 19 +++++- .../LocalWidgetFilterCategory.java | 68 +++++++++---------- 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java index 5749eeb3b..c6e5e18cf 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java @@ -56,15 +56,28 @@ public class DesignerCloudURLManager implements XMLable { } public String acquireUrlByKind(String key) { - String url = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + String url = urlMap.getOrDefault(key, StringUtils.EMPTY); if (StringUtils.isEmpty(url)) { - return urlMap.getOrDefault(key, StringUtils.EMPTY); + //本地缓存中为空时,直接从云中心获取,获取完成后异步更新本地缓存文件 + String latestUrl = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + executorService.submit(() -> { + updateURLXMLFile(key, latestUrl); + }); + return url; } + //本地缓存不为空时,直接返回对应 url,同时异步更新 + executorService.submit(() -> { + String latestUrl = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + updateURLXMLFile(key, latestUrl); + }); + return url; + } + + private synchronized void updateURLXMLFile(String key, String url) { if (!urlMap.containsKey(key) || !url.equals(urlMap.get(key))) { urlMap.put(key, url); saveURLXMLFile(); } - return url; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java index b6abbe76c..1d17d3aa7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java @@ -21,54 +21,54 @@ public class LocalWidgetFilterCategory { WidgetFilterTypeInfo source = new WidgetFilterTypeInfo(); source.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Source")); source.setKey(ShareFilterConstants.SOURCE_TYPE_FILTER_KEY); - source.addFilterItem(new WidgetFilterInfo("本地", "1", "source")); - source.addFilterItem(new WidgetFilterInfo("商城", "2", "source")); - source.addFilterItem(new WidgetFilterInfo("全部", "0", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Local"), "1", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Shop"), "2", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "source")); FilterTypeInfo sourceTypeInfo = new FilterTypeInfo(source.getTitle(), source.getKey()); sourceTypeInfo.addFilterType(source); WidgetFilterTypeInfo displayDevice = new WidgetFilterTypeInfo(); displayDevice.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Show_Device")); displayDevice.setKey(ShareFilterConstants.SHOW_TERMINAL_FILTER_KEY); - displayDevice.addFilterItem(new WidgetFilterInfo("PC端", "1", "displayDevice")); - displayDevice.addFilterItem(new WidgetFilterInfo("移动端", "2", "displayDevice")); - displayDevice.addFilterItem(new WidgetFilterInfo("全部", "0", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_PC"), "1", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Mobile"), "2", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "displayDevice")); FilterTypeInfo showDeviceTypeInfo = new FilterTypeInfo(displayDevice.getTitle(), displayDevice.getKey()); showDeviceTypeInfo.addFilterType(displayDevice); WidgetFilterTypeInfo fee = new WidgetFilterTypeInfo(); fee.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Price")); fee.setKey(ShareFilterConstants.FEE_FILTER_KEY); - fee.addFilterItem(new WidgetFilterInfo("付费", "2", "fee")); - fee.addFilterItem(new WidgetFilterInfo("免费", "1", "fee")); - fee.addFilterItem(new WidgetFilterInfo("全部", "0", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Pay"), "2", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Free"), "1", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "fee")); FilterTypeInfo feeTypeInfo = new FilterTypeInfo(fee.getTitle(), fee.getKey()); feeTypeInfo.addFilterType(fee); WidgetFilterTypeInfo chart = new WidgetFilterTypeInfo(); - chart.setTitle("基础元素"); + chart.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Basic_Element")); chart.setKey(ShareFilterConstants.CHART_FILTER_KEY); - chart.addFilterItem(new WidgetFilterInfo("柱形图/条形图", "1", "chart")); - chart.addFilterItem(new WidgetFilterInfo("折线图", "3", "chart")); - chart.addFilterItem(new WidgetFilterInfo("组合图", "4", "chart")); - chart.addFilterItem(new WidgetFilterInfo("饼图", "2", "chart")); - chart.addFilterItem(new WidgetFilterInfo("仪表盘", "5", "chart")); - chart.addFilterItem(new WidgetFilterInfo("地图", "6", "chart")); - chart.addFilterItem(new WidgetFilterInfo("其他图表", "7", "chart")); - chart.addFilterItem(new WidgetFilterInfo("明细表", "8", "chart")); - chart.addFilterItem(new WidgetFilterInfo("基础控件", "9", "chart")); - chart.addFilterItem(new WidgetFilterInfo("全部", "0", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Bar_Chart"), "1", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Line_Chart"), "3", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Combination_Chart"), "4", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Pie_Chart"), "2", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Dashboard_Chart"), "5", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Map"), "6", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Other_Chart"), "7", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Detail_List"), "8", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Basic_Widget"), "9", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "chart")); WidgetFilterTypeInfo report = new WidgetFilterTypeInfo(); - report.setTitle("综合应用"); + report.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Comprehensive_Application")); report.setKey(ShareFilterConstants.REPORT_FILTER_KEY); - report.addFilterItem(new WidgetFilterInfo("指标卡", "1", "report")); - report.addFilterItem(new WidgetFilterInfo("标题头", "2", "report")); - report.addFilterItem(new WidgetFilterInfo("特殊功能卡", "4", "report")); - report.addFilterItem(new WidgetFilterInfo("多维度切换", "5", "report")); - report.addFilterItem(new WidgetFilterInfo("移动目录导航", "6", "report")); - report.addFilterItem(new WidgetFilterInfo("填报", "8", "report")); - report.addFilterItem(new WidgetFilterInfo("全部", "0", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Indicator_Card"), "1", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Title_Head"), "2", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Special_Function_Card"), "4", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Multi_Dimensional_Switch"), "5", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Move_Directory_Navigation"), "6", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Write_Report"), "8", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "report")); FilterTypeInfo widgetTypeInfo = new FilterTypeInfo(Toolkit.i18nText("Fine-Design_Share_Filter_Widget_Type"), ShareFilterConstants.WIDGET_TYPE_FILTER_KEY); widgetTypeInfo.addFilterType(chart); widgetTypeInfo.addFilterType(report); @@ -76,12 +76,12 @@ public class LocalWidgetFilterCategory { WidgetFilterTypeInfo style = new WidgetFilterTypeInfo(); style.setTitle(Toolkit.i18nText("Fine-Design_Share_Filter_Style")); style.setKey(ShareFilterConstants.STYLE_FILTER_KEY); - style.addFilterItem(new WidgetFilterInfo("简约清新", "1", "style")); - style.addFilterItem(new WidgetFilterInfo("商务稳重", "2", "style")); - style.addFilterItem(new WidgetFilterInfo("活泼绚丽", "3", "style")); - style.addFilterItem(new WidgetFilterInfo("酷炫科技", "4", "style")); - style.addFilterItem(new WidgetFilterInfo("其他风格", "5", "style")); - style.addFilterItem(new WidgetFilterInfo("全部", "0", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Simple_Fresh"), "1", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Business_Stable"), "2", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Lively_And_Bright"), "3", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Cool_Technology"), "4", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Other_Style"), "5", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "style")); FilterTypeInfo styleTypeInfo = new FilterTypeInfo(style.getTitle(), style.getKey()); styleTypeInfo.addFilterType(style); category.add(sourceTypeInfo); From 3084eef79d91008e5455ff8f1e9927ed48fad5dc Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Nov 2021 16:17:57 +0800 Subject: [PATCH 043/152] =?UTF-8?q?REPORT-60153=20=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=8C=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reuse/ComponentReuseNotificationInfo.java | 16 ++++++++-- .../mainframe/share/ComponentShareUtil.java | 6 +++- .../java/com/fr/design/mainframe/JForm.java | 6 +++- .../actions/DownloadSuitableThemeAction.java | 2 ++ .../share/ui/actions/Jump2DetailAction.java | 2 ++ .../ui/block/AbstractOnlineWidgetBlock.java | 17 +++++++--- .../share/ui/block/OnlineWidgetBlock.java | 15 +++++++-- .../share/ui/block/PreviewWidgetBlock.java | 12 +++---- .../AbstractOnlineWidgetSelectPane.java | 4 +++ .../share/ui/online/CarouselStateManger.java | 25 +++++++++++++-- .../embed/OnlineEmbedFilterSelectPane.java | 12 +++---- .../resource/OnlineResourceManager.java | 2 +- .../ui/widgetfilter/FilterConfigPane.java | 32 +++++++++++++++---- .../share/ui/widgetfilter/FilterPane.java | 6 +--- .../ui/widgetfilter/FilterPopupPane.java | 5 +-- .../mainframe/share/util/OnlineShopUtils.java | 15 ++++++++- 16 files changed, 136 insertions(+), 41 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java index 5011ef2bd..46ccef099 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java @@ -28,6 +28,8 @@ public class ComponentReuseNotificationInfo implements XMLable { private boolean widgetLibHasRefreshed = false; + private boolean completeFirstShowComponentLib = false; + public boolean isClickedWidgetLib() { return clickedWidgetLib; } @@ -68,6 +70,14 @@ public class ComponentReuseNotificationInfo implements XMLable { this.widgetLibHasRefreshed = widgetLibHasRefreshed; } + public boolean isCompleteFirstShowComponentLib() { + return completeFirstShowComponentLib; + } + + public void setCompleteFirstShowComponentLib(boolean completeFirstShowComponentLib) { + this.completeFirstShowComponentLib = completeFirstShowComponentLib; + } + public String getHistoryCreatedReuses() { return historyCreatedReuses; } @@ -79,7 +89,8 @@ public class ComponentReuseNotificationInfo implements XMLable { @Override public void readXML(XMLableReader reader) { this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false)); - this.setCompleteEmbedFilter(reader.getAttrAsBoolean("hasCompleteEmbedFilter", false)); + this.setCompleteEmbedFilter(reader.getAttrAsBoolean("completeEmbedFilter", false)); + this.setCompleteFirstShowComponentLib(reader.getAttrAsBoolean("completeFirstShowComponentLib", false)); this.setWidgetLibHasRefreshed(reader.getAttrAsBoolean("widgetLibHasRefreshed", false)); this.setFirstDrag(reader.getAttrAsBoolean("firstDrag", true)); this.setHistoryCreatedReuses(reader.getAttrAsString("historyCreatedReuses", "[]")); @@ -90,7 +101,8 @@ public class ComponentReuseNotificationInfo implements XMLable { public void writeXML(XMLPrintWriter writer) { writer.startTAG("ComponentReuseNotificationInfo"); writer.attr("clickedWidgetLib", this.clickedWidgetLib) - .attr("hasCompleteEmbedFilter", this.completeEmbedFilter) + .attr("completeEmbedFilter", this.completeEmbedFilter) + .attr("completeFirstShowComponentLib", this.completeFirstShowComponentLib) .attr("firstDrag", this.firstDrag) .attr("widgetLibHasRefreshed", this.widgetLibHasRefreshed) .attr("firstDragEndTime", this.firstDragEndTime) 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 8940b6c89..db53be726 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 @@ -48,7 +48,7 @@ public class ComponentShareUtil { } /** - * 判断是否需要展示嵌入式筛选面板 + * 判断是否在需要展示组件库界面 * * @return boolean */ @@ -56,6 +56,10 @@ public class ComponentShareUtil { return !ComponentReuseNotificationInfo.getInstance().isCompleteEmbedFilter() && !hasTouched() && isCurrentTplNewCreate(); } + public static boolean needShowComponentLib() { + return !ComponentReuseNotificationInfo.getInstance().isCompleteFirstShowComponentLib() && !hasTouched() && isCurrentTplNewCreate(); + } + /** * 判断是否需要展示首次拖拽动效 * 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 6d0147b60..6e16472df 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 @@ -13,6 +13,7 @@ import com.fr.base.theme.TemplateThemeConfig; 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; @@ -49,6 +50,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; +import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.template.info.JFormProcessInfo; @@ -894,8 +896,10 @@ public class JForm extends JTemplate implements BaseJForm implements ResourceLoader { - private final AbstractOnlineWidgetSelectPane parentPane; + protected final AbstractOnlineWidgetSelectPane parentPane; private UILabel coverLabel; + private Image coverImage; public AbstractOnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { super(widget); @@ -61,8 +63,12 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock { @Override 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 d55228b19..949719b85 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 @@ -48,7 +48,6 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private static final int ANIMATE_START_TIME = 1000; private static final int ANIMATE_TIME = 2000; private AnimatePopupDialog animatePopupDialog; - private AWTEventListener awtEventListener; private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1}; @@ -104,7 +103,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private void showPreviewPane() { synchronized (this) { - CarouselStateManger.getInstance().suspend(); + CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER); if (!showing) { showPreview(widget); showing = true; @@ -119,7 +118,6 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe protected abstract void hidePreview(); private void hidePreviewPane() { - CarouselStateManger.getInstance().start(); if (showing) { hidePreview(); showing = false; @@ -176,7 +174,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private void animate(ScheduledExecutorService service) { - CarouselStateManger.getInstance().suspend(); + CarouselStateManger.getInstance().suspend(CarouselStateManger.FIRST_DRAG_ANIMATE); AtomicInteger atomicInteger = new AtomicInteger(0); BezierCubic cubic = new BezierCubic(ANIMATE_CONTROL_VALUE[0], ANIMATE_CONTROL_VALUE[1], ANIMATE_CONTROL_VALUE[2], ANIMATE_CONTROL_VALUE[3]); Point startPoint = new Point(this.getLocationOnScreen().x - 5, this.getLocationOnScreen().y - 5); @@ -193,7 +191,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe ComponentReuseNotificationInfo.getInstance().setFirstDragEndTime(System.currentTimeMillis()); DesignerEnvManager.getEnvManager().saveXMLFile(); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); - CarouselStateManger.getInstance().start(); + CarouselStateManger.getInstance().start(CarouselStateManger.FIRST_DRAG_ANIMATE); return; } double progress = calXProgress(atomicInteger.getAndIncrement() * 20, cubic); @@ -220,7 +218,9 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe public void mouseExited(MouseEvent e) { hover = false; this.hidePreviewPane(); - + if(!FirstDragAnimateStateManager.getInstance().animating()){ + CarouselStateManger.getInstance().start(CarouselStateManger.MOUSE_HOVER); + } } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java index f85f30b62..4221e4b96 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java @@ -241,4 +241,8 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele protected Container getParentContainer() { return this.getParent(); } + + public void refreshUI() { + OnlineWidgetRepoPane.getInstance().repaint(); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java index cd818f42e..a0265d536 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java @@ -1,6 +1,9 @@ package com.fr.design.mainframe.share.ui.online; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + import java.util.concurrent.CountDownLatch; /** @@ -8,10 +11,18 @@ import java.util.concurrent.CountDownLatch; */ public class CarouselStateManger { + private static final String START_CAROUSEL ="START_CAROUSEL"; + public static final String RIGHT_CLICK ="RIGHT_CLICK"; + public static final String DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT"; + public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE"; + public static final String MOUSE_HOVER ="MOUSE_HOVER"; + private CarouseState state; private final CountDownLatch countDownLatch = new CountDownLatch(1); + private String suspendEvent; + public static CarouselStateManger getInstance() { return CarouselStateManger.HOLDER.singleton; @@ -37,12 +48,22 @@ public class CarouselStateManger { this.state = CarouseState.RUNNING; } + public void start(String startEvent) { + if (!this.stopped() && ComparatorUtils.equals(this.suspendEvent, startEvent)){ + this.state = CarouseState.RUNNING; + this.suspendEvent = StringUtils.EMPTY; + } + } + public boolean running() { return this.state == CarouseState.RUNNING; } - public void suspend() { - this.state = CarouseState.SUSPEND; + public void suspend(String externalSuspendEvent) { + if (!this.stopped()) { + this.state = CarouseState.SUSPEND; + this.suspendEvent = externalSuspendEvent; + } } public boolean isSuspend() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index f1069ba3f..b7f62e564 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -82,11 +82,10 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane public void animate() throws InterruptedException { CarouselStateManger.getInstance().countDownLatchAwait(); - AtomicInteger integer = new AtomicInteger(0); + AtomicInteger integer = new AtomicInteger(showWidgets.length-1); showCurrentLoadBlock(integer, widgetPane); this.repaint(); previewDialog.setVisible(true); - CarouselStateManger.getInstance().start(); } private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { @@ -105,12 +104,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane stopCarouse(integer); return; } - if (integer.get() == showWidgets.length - 1) { + if (integer.get() == 0) { CarouselStateManger.getInstance().stop(); + stopCarouse(integer); previewDialog.setVisible(false); return; } - integer.incrementAndGet(); + integer.decrementAndGet(); if (!CarouselStateManger.getInstance().isSuspend()) { showCurrentLoadBlock(integer, widgetPane); } else { @@ -139,12 +139,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane private void stopCarouse(AtomicInteger integer) { previewDialog.setVisible(false); - loadRestShowWidgets(integer.get() + 1); + loadRestShowWidgets(integer.get() - 1); java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); } private void loadRestShowWidgets(int startIndex) { - for (int i = startIndex; i < showWidgets.length; i++) { + for (int i = startIndex; i >= 0; i--) { OnlineShareWidget shareWidget = showWidgets[i]; widgetPane.add(createWidgetBlock(shareWidget)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java index 3915a84dd..4e10ff25b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java @@ -49,7 +49,7 @@ public class OnlineResourceManager { try { loader = loaderBlockingQueue.take(); } catch (InterruptedException e) { - e.printStackTrace(); + } loader.load(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java index 31df72f99..8808a5d75 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterConfigPane.java @@ -9,6 +9,7 @@ import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; +import com.fr.third.javax.annotation.Nullable; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -152,7 +153,7 @@ public abstract class FilterConfigPane extends JPanel { checkBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (checkBox.isSelected() && !checkBox.getFilterInfo().hasChildFilter()) { + if (checkBox.isSelected() && (!checkBox.getFilterInfo().hasChildFilter() || !showChildNode)) { filterList.add(filterInfo); } else if (filterList.contains(filterInfo)) { filterList.remove(filterInfo); @@ -222,16 +223,35 @@ public abstract class FilterConfigPane extends JPanel { public abstract String assembleFilter(); - public void setFilters(List selectedFilterNames) { + public void setFilters(List selectedFilters) { reset = true; filterList.clear(); + setFilterList(selectedFilters); + reset = false; + } + + private void setFilterList(List selectedFilters){ for (FilterCheckBox checkBox : checkBoxList) { - if (selectedFilterNames.contains(checkBox.getFilterInfo().getName())) { - checkBox.setSelected(true); - filterList.add(checkBox.getFilterInfo()); + String filterName = checkBox.getFilterInfo().getName(); + WidgetFilterInfo selectFilterInfo = getSelectFilterInfoByName(selectedFilters, filterName); + if (selectFilterInfo == null) { + continue; + } + checkBox.setSelected(true); + if (selectFilterInfo.hasChildFilter()) { + setFilterList(selectFilterInfo.getInnerFilterInfo()); } } - reset = false; + } + + @Nullable + private WidgetFilterInfo getSelectFilterInfoByName(List selectedFilters, String name) { + for (WidgetFilterInfo filterInfo : selectedFilters) { + if (ComparatorUtils.equals(filterInfo.getName(), name)) { + return filterInfo; + } + } + return null; } public void reset() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java index 77e863177..6713d94e2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java @@ -206,11 +206,7 @@ public class FilterPane extends JPanel { } public void setFilter(List selectedFilters){ - List selectedFilterNames = new ArrayList<>(); - for(WidgetFilterInfo filterInfo : selectedFilters){ - selectedFilterNames.add(filterInfo.getName()); - } - filterPopupPane.setFilters(selectedFilterNames); + filterPopupPane.setFilters(selectedFilters); } private void switchToNoFilter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java index 94a96b4b1..e0ec375bc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.share.ui.widgetfilter; import com.fr.design.mainframe.share.Bean.FilterTypeInfo; +import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; import javax.swing.event.ChangeEvent; import java.util.List; @@ -19,8 +20,8 @@ public abstract class FilterPopupPane extends FilterConfigPane { this.filterPane = filterPane; } - public void setFilters(List selectedFilterNames) { - super.setFilters(selectedFilterNames); + public void setFilters(List selectedFilters) { + super.setFilters(selectedFilters); filterPane.changeFilterButtonStatus(hasFilter()); } 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 9405ace59..7db6608c5 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 @@ -172,9 +172,10 @@ public class OnlineShopUtils { } public static String assembleFilter(List filterInfos) { + List allFilterInfos = getAllFilterInfoList(filterInfos); List cidList = new ArrayList<>(); Map queryParaMap = new HashMap<>(); - for (WidgetFilterInfo filterInfo : filterInfos) { + for (WidgetFilterInfo filterInfo : allFilterInfos) { if (ComparatorUtils.equals(CHART, filterInfo.getType()) || ComparatorUtils.equals(REPORT, filterInfo.getType())) { cidList.add(filterInfo.getType() + "-" + filterInfo.getId()); @@ -206,6 +207,18 @@ public class OnlineShopUtils { return StringUtils.join("&", queryCondition.toArray(new String[queryCondition.size()])); } + private static List getAllFilterInfoList(List filterInfos) { + List allFilterList = new ArrayList<>(); + for (WidgetFilterInfo filterInfo : filterInfos) { + if (filterInfo.hasChildFilter()) { + allFilterList.addAll(filterInfo.getInnerFilterInfo()); + } else { + allFilterList.add(filterInfo); + } + } + return allFilterList; + } + public static boolean testConnection() { HttpClient httpClient = new HttpClient(getTestConnectionUrl()); httpClient.asGet(); From ab86d37db01776bd73c7b9a5d0f3e6b25fc7f401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 4 Nov 2021 16:31:10 +0800 Subject: [PATCH 044/152] =?UTF-8?q?REPORT-59744=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E6=89=8B=E5=8A=A8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E5=A4=84=E4=BD=8D=E7=BD=AE=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/poly/group/PolyBoundsGroup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java b/designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java index aadeb0178..599a14f44 100644 --- a/designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java +++ b/designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java @@ -52,7 +52,7 @@ public class PolyBoundsGroup implements GroupModel { @Override public Object getValue(int row, int column) { UnitRectangle ur = block.getBounds(); - Rectangle r = ur.toRectangle(resolution); + Rectangle r = ur.toRoundRectangle(resolution); if (column == 0) { switch (row) { case 0: @@ -83,7 +83,7 @@ public class PolyBoundsGroup implements GroupModel { if (column == 1) { int v = value == null ? 0 : ((Number) value).intValue(); UnitRectangle ur = block.getBounds(); - Rectangle r = ur.toRectangle(resolution); + Rectangle r = ur.toRoundRectangle(resolution); switch (row) { case 0: r.x = v; From 6479efca90317e0ce14c9c78238d3ff0c366473c Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 4 Nov 2021 16:52:29 +0800 Subject: [PATCH 045/152] =?UTF-8?q?CHART-21418=20fix:=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=20=E5=8C=BA=E5=88=86=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E5=9C=A8=E4=B8=8A=E9=9D=A2=E8=BF=98=E6=98=AF=E4=B8=8B?= =?UTF-8?q?=E9=9D=A2=20=E5=A6=82=E6=9E=9C=E5=9C=A8=E4=B8=8A=E9=9D=A2=20?= =?UTF-8?q?=E5=88=99=E6=98=AF=E4=BB=8EdisplayComponent=E4=B8=8B=E9=9D=A2?= =?UTF-8?q?=E7=A6=BB=E5=BC=80=20=E9=9A=90=E8=97=8F=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/AbstractSelectBox.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 41eeacdba..4e82d3805 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -10,6 +10,7 @@ import com.fr.stable.Constants; import javax.swing.AbstractButton; import javax.swing.JPanel; +import javax.swing.JWindow; import javax.swing.border.AbstractBorder; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; @@ -20,6 +21,7 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; +import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.event.MouseAdapter; @@ -99,9 +101,25 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent.addMouseListener(new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { + if (!isPopupVisible()) { + //如果弹出框==null 或者 弹出框不可见 直接return + return; + } + Point popMenuP = getControlWindow().getLocation(); + Point displayComponentP = displayComponent.getLocationOnScreen(); + if (popMenuP.getX() < displayComponentP.getX() - 1) { + //如果 弹出框横向超出屏幕 往左调整了 和displayComponent横向错开 就不处理了 + return; + } + Rectangle rectangle = displayComponent.getBounds(); - if (e.getY() < rectangle.y) { - //如果是从displayComponent上面离开的,隐藏弹出界面。 + boolean bottomPopAndExitTop = displayComponentP.getY() < popMenuP.getY() && e.getY() <= rectangle.y; + boolean topPopAndExitBottom = displayComponentP.getY() > popMenuP.getY() && e.getY() >= rectangle.y + rectangle.getHeight(); + boolean exitLeftOrRight = rectangle.x > e.getX() || rectangle.x + rectangle.getWidth() < e.getX(); + if (bottomPopAndExitTop || topPopAndExitBottom || exitLeftOrRight) { + //弹出框在displayComponent下面 且 鼠标是从displayComponent上面离开的,隐藏弹出界面。 + //弹出框在displayComponent上面 且 鼠标是从displayComponent下面离开的,隐藏弹出界面。 + //鼠标从displayComponent左边 或者 右边 离开,隐藏弹出界面。 hidePopupMenu(); } From 103beaec4cf49352c9af70ad3ab77a930ec3c9dd Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 4 Nov 2021 17:23:38 +0800 Subject: [PATCH 046/152] =?UTF-8?q?REPORT-61610=20fix:=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E6=8A=A5=E9=94=99=20A.clas?= =?UTF-8?q?s=20can=20not=20cast=20to=20A.class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ChartPropertyPane.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 2d4d5fef6..c3918aba2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -10,12 +10,22 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.GeneralContext; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.injectable.SpecialLevel; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; import com.fr.stable.AssistUtils; import javax.swing.BorderFactory; @@ -39,8 +49,11 @@ public class ChartPropertyPane extends BaseChartPropertyPane { //ID一样的话 不用新建chartEditPane private String currentID; + private static PluginEventListener pluginEventListener; + private ChartPropertyPane() { initComponent(); + addListener(); } protected void initComponent() { @@ -48,6 +61,27 @@ public class ChartPropertyPane extends BaseChartPropertyPane { this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } + private void addListener() { + if (pluginEventListener != null) { + GeneralContext.stopListenPlugin(pluginEventListener); + } + pluginEventListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + //禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane + currentID = null; + } + }; + GeneralContext.listenPlugin(PluginEventType.AfterRun, pluginEventListener, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraChartDesign); + } + }); + } + @Override public void updateChartEditPane(String plotID) { if (!AssistUtils.equals(currentID, plotID)) { From cc3ae6732b1177ac0e68777c4b4c56d7e0eb7f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 4 Nov 2021 17:46:33 +0800 Subject: [PATCH 047/152] =?UTF-8?q?REPORT-61695=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8B=E7=BB=84=E4=BB=B6=E5=8F=B3=E4=BE=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=9D=A2=E6=9D=BF=E6=98=BE=E7=A4=BA=E2=80=9C=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E2=80=9D=EF=BC=8C=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=B8=8B=E6=98=BE=E7=A4=BA=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E2=80=9C=E6=8E=A7=E4=BB=B6=E4=BD=8D=E7=BD=AE=E2=80=9D=E2=80=9C?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=A4=A7=E5=B0=8F=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index ae3dfc255..99b1ddaa0 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -51,7 +51,7 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Form_Widget_Size")), ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; From 660f291c475ab8da8621e917bb49694d89a08216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 4 Nov 2021 20:23:06 +0800 Subject: [PATCH 048/152] =?UTF-8?q?REPORT-61618=20=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=94=9F=E6=88=90=E6=97=B6=E5=B8=A6=E2=80=9C?= =?UTF-8?q?-=E2=80=9D=EF=BC=8C=E5=AF=BC=E8=87=B4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E5=A4=B1=E6=95=88@Jaimme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/data/BasicTableDataUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java index 57c7e23a1..c711a1999 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java @@ -11,7 +11,7 @@ import com.fr.stable.StringUtils; * Created by hades on 2020/4/27 */ public abstract class BasicTableDataUtils { - private static final String SEPARATOR = "-"; + private static final String SEPARATOR = "_"; private static final int LEN = 2; From 08ec528ba25a6550e2e7115201b8c448018cbbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 4 Nov 2021 20:27:19 +0800 Subject: [PATCH 049/152] REPORT-61695 --- .../main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index 99b1ddaa0..ae3dfc255 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -51,7 +51,7 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Form_Widget_Size")), + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; From 9ecac9978a7342813635da46462e28e929082385 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 4 Nov 2021 20:54:03 +0800 Subject: [PATCH 050/152] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=EF=BC=9A=E6=AF=8F=E4=B8=AA=E5=AE=9E=E4=BE=8B=E5=90=84=E8=87=AA?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E6=8F=92=E4=BB=B6=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ChartPropertyPane.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index c3918aba2..135f14f6c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -49,8 +49,6 @@ public class ChartPropertyPane extends BaseChartPropertyPane { //ID一样的话 不用新建chartEditPane private String currentID; - private static PluginEventListener pluginEventListener; - private ChartPropertyPane() { initComponent(); addListener(); @@ -62,17 +60,13 @@ public class ChartPropertyPane extends BaseChartPropertyPane { } private void addListener() { - if (pluginEventListener != null) { - GeneralContext.stopListenPlugin(pluginEventListener); - } - pluginEventListener = new PluginEventListener() { + GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { @Override public void on(PluginEvent event) { //禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane currentID = null; } - }; - GeneralContext.listenPlugin(PluginEventType.AfterRun, pluginEventListener, new PluginFilter() { + }, new PluginFilter() { @Override public boolean accept(PluginContext context) { From 4ea706cf0c63fbafbca0cef02c7cc514d77e8e04 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 4 Nov 2021 20:55:09 +0800 Subject: [PATCH 051/152] update --- .../main/java/com/fr/design/mainframe/ChartPropertyPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 135f14f6c..7d787f15a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -10,18 +10,15 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; -import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.injectable.SpecialLevel; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; From d1bea1c69e96e1fa41308aadf5d35ca21f9b3b26 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 4 Nov 2021 21:05:08 +0800 Subject: [PATCH 052/152] =?UTF-8?q?REPORT-61410=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E9=A2=84=E8=A7=88=E6=97=B6=E5=8F=AF=E5=A4=8D=E5=88=B6?= =?UTF-8?q?-=E8=A1=A8=E5=A4=B4=E5=A4=8D=E5=88=B6=E9=97=AE=E9=A2=98=20&&=20?= =?UTF-8?q?REPORT-61409=20=E6=95=B0=E6=8D=AE=E9=9B=86=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E5=A4=8D=E5=88=B6-=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E6=97=B6=E6=98=BE=E7=A4=BA=E6=88=90Null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/preview/CopyableJTable.java | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java index eb8d188a1..a452a4d37 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java @@ -106,6 +106,7 @@ public class CopyableJTable extends SortableJTable { self.updateEndPoint(-1, column); self.refreshTable(); } + self.requestFocusInWindow(); } private int getColumn(MouseEvent e) { @@ -249,26 +250,9 @@ public class CopyableJTable extends SortableJTable { FineLoggerFactory.getLogger().info("copy cell value"); java.util.List> table = new ArrayList<>(); if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) { - for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) { - table.add(new ArrayList<>()); - for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) { - Object text = this.getTableValue(i, j); - table.get(table.size() - 1).add(text); - } - } + copyAreaData(table); } else if (pointList.size() > 0) { - Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY)); - int startRow = pointList.get(0).x; - int currentRow = startRow; - table.add(new ArrayList<>()); - for (Point point : pointList) { - while (currentRow < point.x) { - table.add(new ArrayList<>()); - currentRow++; - } - Object text = this.getTableValue(point.x, point.y); - table.get(table.size() - 1).add(text); - } + copyPointsData(table); } Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -276,6 +260,35 @@ public class CopyableJTable extends SortableJTable { clip.setContents(tText, null); } + private void copyAreaData(java.util.List> table) { + for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) { + table.add(new ArrayList<>()); + for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) { + Object text = this.getTableValue(i, j); + if (text != null) { + table.get(table.size() - 1).add(text); + } + } + } + } + + private void copyPointsData(java.util.List> table) { + Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY)); + int startRow = pointList.get(0).x; + int currentRow = startRow; + table.add(new ArrayList<>()); + for (Point point : pointList) { + while (currentRow < point.x) { + table.add(new ArrayList<>()); + currentRow++; + } + Object text = this.getTableValue(point.x, point.y); + if (text != null) { + table.get(table.size() - 1).add(text); + } + } + } + private Object getTableValue(int row, int col) { Object value = null; if (col > -1) { From 2f1b52bb97af8ce04c22a48047d9bb2c5f8263d5 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 4 Nov 2021 15:45:18 +0800 Subject: [PATCH 053/152] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E6=8D=A2=E8=A1=8C=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E9=A2=9C=E8=89=B2=E4=B8=8D=E7=AC=A6=E5=90=88=E9=A2=84?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 setEnable(false)会导致文字颜色始终为灰色 【改动思路】 使用setEditable替换原来的setEnable --- .../java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java index 13769cfc6..53de406af 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java @@ -37,7 +37,7 @@ public class LabelUtils { Font newFont = FRFont.getInstance(tipLabel.getFont().getFontName(), Font.PLAIN, 12); tipLabel.setFont(newFont); tipLabel.setBorder(BorderFactory.createEmptyBorder()); - tipLabel.setEnabled(false); + tipLabel.setEditable(false); tipLabel.setText(title); tipLabel.setLineWrap(true); tipLabel.setWrapStyleWord(true); From a875973026c58cb5b5d81dd142bfa0a429c38c9b Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 26 Oct 2021 10:52:40 +0800 Subject: [PATCH 054/152] =?UTF-8?q?REPORT-60601=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 共享组件数据模型中新增版本号,用于跟踪版本变化,同时其中的 设计器版本号属性用于判断组件是否兼容当前设计器 2. 组件创建面板中新增适配的设计器版本号设置项 3. 本地组件面板新增组件更新检测提示,以及更新遮罩进度界面 4. 实现本地组件是否存在更新的检测逻辑以及下载新版本reu的逻辑 5. 优化组件安装逻辑,安装新组件时,必须卸载同组内相同uid的旧组件文件(不同文件名的但相同uid的reu文件) 【改动思路】 同上 --- .../predefined/ui/PredefinedStyleBlock.java | 2 +- .../share/action/InstallComponentAction.java | 1 + .../share/ui/block/LocalWidgetBlock.java | 165 +++++++++-- .../share/ui/block/LocalWidgetUpdater.java | 154 ++++++++++ .../share/ui/block/OnlineWidgetBlock.java | 3 +- .../mainframe/share/ui/local/FramePane.java | 30 ++ .../mainframe/share/ui/local/GroupPane.java | 12 +- .../share/ui/local/LocalWidgetRepoPane.java | 264 ++++++++++++++++-- .../ui/local/LocalWidgetRepoUpdater.java | 140 ++++++++++ .../mainframe/share/ui/local/ToolbarPane.java | 6 + .../share/ui/local/WidgetSelectedManager.java | 11 +- .../online/OnlineWidgetPopupPreviewPane.java | 55 +++- .../mainframe/share/util/InstallUtils.java | 2 +- .../mainframe/share/util/OnlineShopUtils.java | 44 +++ .../share/ui/generate/ShareGeneratePane.java | 30 +- .../share/ui/generate/ShareMainPane.java | 79 +++++- 16 files changed, 924 insertions(+), 74 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/FramePane.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java index 67b369a6c..3508b3519 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java @@ -32,7 +32,7 @@ import java.awt.event.MouseListener; public class PredefinedStyleBlock extends JPanel { private PredefinedStyle previewObject; private PredefinedStyleSelectPane parentPane; - private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marked.png"); + private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marker_selected.png"); private static final Color BORDER_COLOR = new Color(141, 194, 249); private boolean mouseOver = false; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java index 6cb00b6ff..03e8ab2c0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java @@ -76,6 +76,7 @@ public class InstallComponentAction extends UpdateAction { try { InstallBackInfo info = get(); LocalWidgetRepoPane.getInstance().refreshAllGroupPane(); + LocalWidgetRepoPane.getInstance().doFetchAndCheckUpdate(); showMessageDialog(info); } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); 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 4b48126d0..6839ee41f 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 @@ -11,11 +11,11 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WidgetToolBarPane; -import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.group.ui.GroupMoveDialog; import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupAction; import com.fr.design.mainframe.share.ui.actions.SharedComponentPopupMenu; import com.fr.design.mainframe.share.ui.constants.ColorConstants; +import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoUpdater; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetSelectPane; import com.fr.design.mainframe.share.ui.local.WidgetSelectedManager; @@ -23,31 +23,42 @@ import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.DefaultSharableWidget; +import com.fr.form.share.Group; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.constants.ShareComponentConstants; -import com.fr.form.share.Group; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; import com.fr.general.IOUtils; import com.fr.stable.Constants; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import javax.swing.Action; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Composite; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Stroke; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; +import java.awt.font.FontRenderContext; +import java.awt.geom.Dimension2D; +import java.awt.image.BufferedImage; import java.util.UUID; /** @@ -65,13 +76,20 @@ public class LocalWidgetBlock extends PreviewWidgetBlock private boolean isMarked; private boolean pressed; - private final Icon markedMode = IOUtils.readIcon("/com/fr/base/images/share/marked.png"); - private final Icon unMarkedMode = IOUtils.readIcon("/com/fr/base/images/share/unmarked.png"); + private final Color COVER_COLOR = Color.decode("#333334"); + private final BufferedImage WIDGET_DOWNLOADING_ICON = IOUtils.readImage("/com/fr/base/images/share/downloading.png"); + private final BufferedImage WIDGET_UPDATABLE_ICON = IOUtils.readImage("/com/fr/base/images/share/updatable.png"); + private final Icon selectedMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_selected.png"); + private final Icon unselectedMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_unselected.png"); + private final Icon incompatibleMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_incompatible.png"); + + private final LocalWidgetUpdater updater; public LocalWidgetBlock(DefaultSharableWidget provider, LocalWidgetSelectPane parentPane) { super(provider); this.parentPane = parentPane; new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); + updater = new LocalWidgetUpdater(this); initUI(); } @@ -103,6 +121,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock return this.getWidget(); } + public LocalWidgetUpdater getUpdater() { + return updater; + } + @Override protected void showPreview(DefaultSharableWidget widget) { this.parentPane.showPreviewPane(this, widget.getId()); @@ -192,11 +214,21 @@ public class LocalWidgetBlock extends PreviewWidgetBlock hidePreview(); Object source = e.getSource(); if (source instanceof LocalWidgetBlock) { - LocalWidgetBlock no = (LocalWidgetBlock) e.getSource(); - if (no == null) { + LocalWidgetBlock widgetBlock = (LocalWidgetBlock) e.getSource(); + if (widgetBlock == null) { + return; + } + SharableWidgetProvider widget = widgetBlock.getWidget(); + if (widget == null) { return; } - XCreator xCreator = transformXCreator(no); + if (!widget.isCompatibleWithCurrentEnv()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip") + ); + return; + } + XCreator xCreator = transformXCreator(widgetBlock); if (xCreator == null) { return; } @@ -224,20 +256,121 @@ public class LocalWidgetBlock extends PreviewWidgetBlock @Override public void paint(Graphics g) { super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); + if (isUnusable) { + paintUnusableMask(g2d); + } + //绘制删除标志 if (isEdit) { - Icon icon = isMarked ? markedMode : unMarkedMode; - icon.paintIcon(this, g, MARK_START_X, 0); + paintEditingMarker(g2d); } - if (ComparatorUtils.equals(this, this.parentPane.getSelectedBlock()) || this.mouseHover) { - g.setColor(XCreatorConstants.FORM_BORDER_COLOR); - Rectangle rectangle = new Rectangle(); - rectangle.width = this.getWidth(); - rectangle.height = this.getHeight(); - GraphHelper.draw(g, rectangle, Constants.LINE_LARGE); + + boolean ishHighlighting = ComparatorUtils.equals(this, this.parentPane.getSelectedBlock()) || this.mouseHover; + if (ishHighlighting) { + paintHighlightBorder(g2d); + } + + if (getUpdater().isUpdating()) { + paintLoadingIndicator(g2d, getUpdater().getProcessValue()); + } else if (LocalWidgetRepoUpdater.getInstance().checkUpdate(getWidget()) != null) { + paintUpdatableMarker(g2d); } } + protected void paintUnusableMask(Graphics2D g2d) { + Color oldColor = g2d.getColor(); + Font oldFont = g2d.getFont(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Dimension coverDim = getCoverDimension(); + double canvasX = 0; + double canvasY = 0; + double canvasW = coverDim.getWidth(); + double canvasH = coverDim.getHeight(); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); + GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); + + String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); + Font tipFont = FRFont.getInstance().deriveFont(8F); + FontRenderContext frc = g2d.getFontRenderContext(); + double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); + Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); + double tipTextHeight = dim.getHeight(); + g2d.setColor(Color.WHITE); + g2d.setFont(tipFont); + GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); + + int markerX = (int) (canvasX + (canvasW - incompatibleMarker.getIconWidth()) / 2); + int markerY = (int) (canvasY + (canvasH - incompatibleMarker.getIconHeight()) / 2); + incompatibleMarker.paintIcon(this, g2d, markerX, markerY); + + g2d.setColor(oldColor); + g2d.setFont(oldFont); + } + + protected void paintEditingMarker(Graphics2D g2d) { + Icon icon = isMarked ? selectedMarker : unselectedMarker; + icon.paintIcon(this, g2d, MARK_START_X, 0); + } + + protected void paintHighlightBorder(Graphics2D g2d) { + g2d.setColor(XCreatorConstants.FORM_BORDER_COLOR); + Rectangle rectangle = new Rectangle(); + rectangle.width = this.getWidth(); + rectangle.height = this.getHeight(); + GraphHelper.draw(g2d, rectangle, Constants.LINE_LARGE); + } + + protected void paintUpdatableMarker(Graphics2D g2d) { + g2d.drawImage(WIDGET_UPDATABLE_ICON, 0, 0, 25, 14, null); + } + + protected void paintLoadingIndicator(Graphics2D g2d, double processValue) { + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + Composite oldComposite = g2d.getComposite(); + + int x = 0; + int y = 0; + int w = getWidth(); + int h = getHeight(); + + 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 = WIDGET_DOWNLOADING_ICON; + g2d.drawImage( + image, + (x + w / 2 - 12), + (y + h / 2 - 16), + image.getWidth(), + image.getHeight(), + null, + this + ); + + g2d.setStroke(XCreatorConstants.STROKE); + g2d.setColor(Color.decode("#419BF9")); + double arcAngle = 36 + 360 * 0.9 * processValue; + g2d.drawArc(x + w / 2 - 12, y + h / 2 - 16, 24, 24, 90, -(int) arcAngle); + + g2d.setColor(oldColor); + g2d.setStroke(oldStroke); + } + /** * 由鼠标释放时调用该方法来触发左键点击事件 */ @@ -259,7 +392,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock } } - private Group getGroup() { + public Group getGroup() { return parentPane.getGroup(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java new file mode 100644 index 000000000..083df1b4e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -0,0 +1,154 @@ +package com.fr.design.mainframe.share.ui.block; + +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.ui.online.OnlineWidgetRepoPane; +import com.fr.design.mainframe.share.util.DownloadUtils; +import com.fr.design.mainframe.share.util.ShareComponentUtils; +import com.fr.design.ui.util.UIUtil; +import com.fr.form.share.DefaultSharableWidget; +import com.fr.form.share.Group; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import javax.swing.SwingWorker; +import java.awt.Component; +import java.awt.Container; +import java.io.File; +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/10/26 + */ +public class LocalWidgetUpdater implements Process { + + private double processValue = -1; + public LocalWidgetBlock widgetBlock; + private SwingWorker worker; + + public LocalWidgetUpdater(LocalWidgetBlock widgetBlock) { + this.widgetBlock = widgetBlock; + } + + private DefaultSharableWidget getWidget() { + return this.widgetBlock.getWidget(); + } + + private Group getGroup() { + return this.widgetBlock.getGroup(); + } + + public double getProcessValue() { + return processValue; + } + public boolean isUpdating() { + return 0 <= processValue && processValue <= 1; + } + + public void updateWidget(String remoteLatestWidgetId, UpdateListener updateListener) { + if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { + ComponentCollector.getInstance().collectDownloadPktNum(); + } + + LocalWidgetUpdater.this.process(0.0D); + String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); + if (StringUtils.isEmpty(userName)) { + DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL); + return; + } + + final DefaultSharableWidget widget = getWidget(); + + worker = new SwingWorker() { + + @Override + protected Boolean doInBackground() { + if (isCancelled()) { + return false; + } + String filePath; + try { + filePath = DownloadUtils.download(remoteLatestWidgetId, widget.getName() + "." + widget.getId(), LocalWidgetUpdater.this); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + ShareComponentUtils.checkReadMe(); + //安装 + File file = new File(filePath); + try { + if (file.exists()) { + getGroup().installUniqueIdModule(file); + } + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + //删掉下载组件的目录 + StableUtils.deleteFile(file); + } + return true; + + } + + @Override + protected void done() { + LocalWidgetUpdater.this.process(-1.0); + boolean success = false; + try { + success = get(); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (updateListener != null) { + updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId()); + } + } + }; + + worker.execute(); + } + + public void cancelUpdate() { + if (worker.isDone() || worker.isCancelled()) { + return; + } + worker.cancel(true); + process(-1.0); + } + + @Override + public void process(Double processValue) { + this.processValue = processValue; + + UIUtil.invokeAndWaitIfNeeded(new Runnable() { + @Override + public void run() { + Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock); + widgetBlock.repaint(); + if (absoluteLayoutParent != null) { + // 位于Block上方的遮罩层也要重绘下,否则Block的内容会绘制到遮罩层上方 + absoluteLayoutParent.repaint(); + } + } + }); + } + + public Container getAbsoluteLayoutAncestor(Component component) { + Container container = component.getParent(); + while (container != null && container.getLayout() != null) { + container = container.getParent(); + } + return container; + } + + public interface UpdateListener { + void onUpdated(boolean success, String group, String id); + } +} 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 7512649d9..266a4e51b 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 @@ -18,7 +18,6 @@ import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.group.DefaultShareGroup; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; -import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareUIUtils; @@ -215,7 +214,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { //安装 File file = new File(filePath); try { - if (file.exists() && getDefaultGroup().installModule(file)) { + if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) { ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/FramePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/FramePane.java new file mode 100644 index 000000000..c6ebfdcd7 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/FramePane.java @@ -0,0 +1,30 @@ +package com.fr.design.mainframe.share.ui.local; + +import javax.swing.JPanel; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.LayoutManager2; +import java.io.Serializable; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/11/2 + */ +public class FramePane extends JPanel { + + public FramePane() { + setLayout(null); + } + + @Override + public void doLayout() { + super.doLayout(); + for (int i = 0; i < getComponentCount(); i++) { + getComponent(i).setSize(getSize()); + getComponent(i).setPreferredSize(getSize()); + getComponent(i).setBounds(0, 0, getWidth(), getHeight()); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java index 1e9ca55a1..905e9d87b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java @@ -15,9 +15,9 @@ import com.fr.design.mainframe.share.ui.base.PopupMenuItem; import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter; import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.share.Group; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.group.DefaultShareGroupManager; -import com.fr.form.share.Group; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -107,6 +107,10 @@ public class GroupPane extends JPanel { expendGroup(needExpendGroup); } + public LocalWidgetSelectPane getWidgetListPane() { + return contentPanel; + } + public void reCreateShowPane(SharableWidgetProvider[] widgets) { if (contentPanel != null) { contentPanel.hidePreviewPane(); @@ -374,6 +378,12 @@ public class GroupPane extends JPanel { return new GroupPane(group); } }, + EXPANDED { + @Override + public GroupPane creteGroupPane(Group group) { + return new GroupPane(group, true); + } + }, CLOSURE { @Override public GroupPane creteGroupPane(Group group) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index fad64627f..d9c979f43 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -1,17 +1,27 @@ package com.fr.design.mainframe.share.ui.local; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.share.sort.WidgetSortType; +import com.fr.design.mainframe.share.ui.base.DownloadProgressPane; +import com.fr.design.mainframe.share.ui.base.MouseClickListener; +import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock; +import com.fr.design.mainframe.share.ui.block.LocalWidgetUpdater; import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter; import com.fr.design.mainframe.share.util.InstallComponentHelper; import com.fr.design.mainframe.share.util.ShareComponentUtils; -import com.fr.form.share.group.DefaultShareGroupManager; +import com.fr.design.mainframe.theme.edit.ui.LabelUtils; 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.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -21,7 +31,17 @@ import javax.swing.JScrollPane; import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; @@ -30,10 +50,21 @@ import java.util.concurrent.atomic.AtomicBoolean; * Created by kerry on 2020-10-16 */ public class LocalWidgetRepoPane extends BasicPane { + private static class HOLDER { + private static final LocalWidgetRepoPane singleton = new LocalWidgetRepoPane(); + } + public static LocalWidgetRepoPane getInstance() { + return HOLDER.singleton; + } + + private int updateGuard = 0; + private Component updateTipPane; + private DownloadProgressPane updateProgressPane; private JPanel centerPane; private UIScrollPane groupsScrollPane; private JPanel groupsPane; + private ToolbarPane toolbarPane; private ManagePane managePane; private final Map groupPaneMap = new HashMap<>(); @@ -43,16 +74,10 @@ public class LocalWidgetRepoPane extends BasicPane { private String keyWord4Searching = StringUtils.EMPTY; private LocalWidgetRepoPane() { - setLayout(FRGUIPaneFactory.createBorderLayout()); - initPane(); - } - - public static LocalWidgetRepoPane getInstance() { - return HOLDER.singleton; - } - - private static class HOLDER { - private static final LocalWidgetRepoPane singleton = new LocalWidgetRepoPane(); + initializePane(this); + //新用户预装组件 + InstallComponentHelper.installPreComponent(); + doRefresh(); } public boolean isEditable() { @@ -63,16 +88,118 @@ public class LocalWidgetRepoPane extends BasicPane { return keyWord4Searching; } - /** - * 初始化 - */ - public void initPane() { - //新用户预装组件 - InstallComponentHelper.installPreComponent(); + private void initializePane(Container container) { + container.setLayout(new BorderLayout()); + + updateTipPane = createUpdateTipPane(); + container.add(updateTipPane, BorderLayout.NORTH); + + updateProgressPane = createUpdateMaskPane(); + FramePane framePane = new FramePane(); + + framePane.add(updateProgressPane); + framePane.add(createControlledMainPane(), BorderLayout.CENTER); + + add(framePane, BorderLayout.CENTER); + } + + private Component createUpdateTipPane() { + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createEmptyBorder(10, 10, 5, 10), + BorderFactory.createLineBorder(new Color(0xD9DADD), 1, true) + )); + + final JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); + content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + content.setBackground(Color.WHITE); + content.setOpaque(true); + + content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER); + + JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); + actionsPane.setOpaque(false); + actionsPane.setBackground(null); + + UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel")); + cancelUpgradeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + doQuitUpdateComponents(); + } + }); + + UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All")); + startUpgradeButton.setSelected(true); + startUpgradeButton.setForeground(Color.WHITE); + startUpgradeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + doUpdateComponents(); + } + }); + + actionsPane.add(cancelUpgradeButton); + actionsPane.add(startUpgradeButton); + content.add(actionsPane, BorderLayout.SOUTH); + container.add(content, BorderLayout.NORTH); + + DefaultShareGroupManager.getInstance().setChangeListener(new DefaultShareGroupManager.ComponentChangeListener() { + @Override + public void onComponentRemoved(String group, String id) { + List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); + if (updatableWidgetProviders.size() == 0 && updateTipPane != null) { + updateTipPane.setVisible(false); + } + } + }); + + return container; + } + + private DownloadProgressPane createUpdateMaskPane() { + DownloadProgressPane progressPane = new DownloadProgressPane(new MouseClickListener() { + @Override + public void mouseClicked(MouseEvent e) { + super.mouseClicked(e); + int returnVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Share_Download_Cancel_Confirm"), + Toolkit.i18nText("Fine-Design_Share_Group_Confirm"), + FineJOptionPane.OK_CANCEL_OPTION + ); + if (returnVal == FineJOptionPane.OK_OPTION) { + List blockList = getUpdatableBlocks(); + for (LocalWidgetBlock block: blockList) { + block.getUpdater().cancelUpdate(); + } + updateGuard = 0; + updateProgressPane.setVisible(false); + LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); + updater.clearUpdate(); + refreshAllGroupPane(); + } + } + }); + // 屏蔽被遮罩内容的鼠标处理,避免鼠标透穿 + progressPane.addMouseListener(new MouseAdapter() {}); + progressPane.updateProgress(0); + progressPane.setOpaque(true); + progressPane.setBackground(new Color(0.25F, 0.25F, 0.25F, 0.65F)); + // 更新遮罩层初始不可见 + progressPane.setVisible(false); + return progressPane; + } + + public Component createControlledMainPane() { + Container container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel componentLibPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); componentLibPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0)); - ToolbarPane toolbarPane = new ToolbarPane(); + toolbarPane = new ToolbarPane(); + toolbarPane.addFilterPopupStateChangeListener(state -> setWidgetPaneScrollEnable(!state)); + managePane = new ManagePane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -85,14 +212,14 @@ public class LocalWidgetRepoPane extends BasicPane { centerPane.add(LocalPaneStatus.EMPTY.getPanel(), LocalPaneStatus.EMPTY.name()); centerPane.add(LocalPaneStatus.LOADING.getPanel(), LocalPaneStatus.LOADING.name()); centerPane.add(LocalPaneStatus.INSTALLING.getPanel(), LocalPaneStatus.INSTALLING.name()); + cardLayout.show(centerPane, LocalPaneStatus.LOADING.name()); componentLibPanel.add(northPane, BorderLayout.NORTH); componentLibPanel.add(centerPane, BorderLayout.CENTER); - add(componentLibPanel, BorderLayout.CENTER); - cardLayout.show(centerPane, LocalPaneStatus.LOADING.name()); - toolbarPane.addFilterPopupStateChangeListener(state -> setWidgetPaneScrollEnable(!state)); - doRefresh(); + container.add(componentLibPanel, BorderLayout.CENTER); + + return container; } public void refreshAllGroupPane() { @@ -208,6 +335,7 @@ public class LocalWidgetRepoPane extends BasicPane { try { if (get()) { refreshAllGroupPane(); + doFetchAndCheckUpdate(); } } catch (InterruptedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -222,6 +350,74 @@ public class LocalWidgetRepoPane extends BasicPane { }.execute(); } + public void doFetchAndCheckUpdate() { + LocalWidgetRepoUpdater.getInstance().fetchComponentUpdates(new LocalWidgetRepoUpdater.FetchComponentUpdatesListener() { + @Override + public void onFetchedBefore() { + updateTipPane.setVisible(false); + } + + @Override + public void onFetchedAfter(boolean success, Map remoteLatestWidgets) { + if (success) { + List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); + updateTipPane.setVisible(updatableWidgetProviders.size() > 0); + if (updatableWidgetProviders.size() > 0) { + refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED); + } + } + } + }); + } + + public void doQuitUpdateComponents() { + LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); + updater.clearUpdate(); + if (updateTipPane != null) { + updateTipPane.setVisible(false); + } + } + + public void doUpdateComponents() { + if (updateGuard > 0) { + return; + } + + updateGuard = 0; + toolbarPane.reset(); + managePane.switchPanel(false); + switchPane(LocalPaneStatus.NORMAL); + refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED); + List blockList = getUpdatableBlocks(); + + if (blockList.size() == 0) { + return; + } + + updateTipPane.setVisible(false); + updateProgressPane.updateProgress(0.0F); + updateProgressPane.setVisible(true); + + LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); + for (LocalWidgetBlock block: blockList) { + OnlineShareWidget remoteLatestWidget = updater.checkUpdate(block.getWidget()); + block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() { + @Override + public void onUpdated(boolean success, String group, String id) { + updateGuard += 1; + updateProgressPane.updateProgress(1.0F * updateGuard / blockList.size()); + if (updateGuard == blockList.size()) { + updateGuard = 0; + updater.clearUpdate(); + updateProgressPane.setVisible(false); + refreshAllGroupPane(); + } + } + }); + } + } + + /** * 切换为要显示的面板 */ @@ -261,6 +457,30 @@ public class LocalWidgetRepoPane extends BasicPane { return groups.length == 1 && groups[0].getAllBindInfoList().length == 0; } + private List getUpdatableBlocks() { + List blockList = new ArrayList<>(); + + LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); + + for (GroupPane groupPane : groupPaneMap.values()) { + LocalWidgetSelectPane widgetListPane = groupPane.getWidgetListPane(); + int count = widgetListPane.getComponentCount(); + for (int i = 0; i < count; i++) { + Component component = widgetListPane.getComponent(i); + if (component instanceof LocalWidgetBlock) { + + LocalWidgetBlock widgetBlock = (LocalWidgetBlock) component; + SharableWidgetProvider localProvider = widgetBlock.getWidget(); + OnlineShareWidget remoteLatestWidget = updater.checkUpdate(localProvider); + if (remoteLatestWidget != null) { + blockList.add(widgetBlock); + } + } + } + } + return blockList; + } + @Override protected String title4PopupWindow() { return Toolkit.i18nText("Fine-Design_Share_Local_Widget"); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java new file mode 100644 index 000000000..03eb751f2 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java @@ -0,0 +1,140 @@ +package com.fr.design.mainframe.share.ui.local; + +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; +import com.fr.form.share.group.DefaultShareGroupManager; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.basic.version.Version; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; + +import javax.swing.SwingWorker; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/11/3 + */ +public class LocalWidgetRepoUpdater { + private LocalWidgetRepoUpdater() {} + private static class Holder { + public static LocalWidgetRepoUpdater INSTANCE = new LocalWidgetRepoUpdater(); + } + public static LocalWidgetRepoUpdater getInstance() { + return LocalWidgetRepoUpdater.Holder.INSTANCE; + } + + private final Map remoteLatestWidgetsBackup = new HashMap<>(); + + private final AtomicBoolean isCheckingComponentUpdates = new AtomicBoolean(false); + private SwingWorker checkingComponentsUpdateWorker; + + private Set getLocalWidgetIds() { + Set widgetIds = new HashSet<>(); + Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); + for (Group group: groups) { + SharableWidgetProvider[] widgetProviders = group.getAllBindInfoList(); + for (SharableWidgetProvider provider: widgetProviders) { + widgetIds.add(provider.getId()); + } + } + return widgetIds; + } + + public void clearUpdate() { + remoteLatestWidgetsBackup.clear(); + } + + public OnlineShareWidget checkUpdate(SharableWidgetProvider provider) { + OnlineShareWidget remoteLatestWidget = remoteLatestWidgetsBackup.get(provider.getId()); + if (remoteLatestWidget != null && StringUtils.isNotEmpty(remoteLatestWidget.getVersion())) { + Version remoteLatestVersion = Version.create(remoteLatestWidget.getVersion()); + Version localVersion = Version.create(provider.getVersion()); + + boolean isUpdatable = remoteLatestVersion.compareTo(localVersion) > 0; + if (isUpdatable) { + return remoteLatestWidget; + } + } + return null; + } + + public List getUpdatableWidgetProviders() { + List updatableProviders = new ArrayList<>(); + + Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); + for (Group group: groups) { + SharableWidgetProvider[] widgetProviders = group.getAllBindInfoList(); + for (SharableWidgetProvider widgetProvider: widgetProviders) { + if (checkUpdate(widgetProvider) != null) { + updatableProviders.add(widgetProvider); + } + } + } + return updatableProviders; + } + + public void fetchComponentUpdates(FetchComponentUpdatesListener listener) { + if (isCheckingComponentUpdates.get()) { + if (checkingComponentsUpdateWorker != null) { + checkingComponentsUpdateWorker.cancel(true); + } + } + + clearUpdate(); + listener.onFetchedBefore(); + checkingComponentsUpdateWorker = new SwingWorker() { + @Override + protected Boolean doInBackground() { + if (isCancelled()) { + return false; + } + if (isCheckingComponentUpdates.compareAndSet(false, true)) { + clearUpdate(); + + Set widgetIds = getLocalWidgetIds(); + String envVersion = ProductConstants.RELEASE_VERSION; + + List remoteLatestWidgetList = OnlineShopUtils.getLatestReusesByDesignerVersion(widgetIds, envVersion); + remoteLatestWidgetsBackup.clear(); + for (OnlineShareWidget widget: remoteLatestWidgetList) { + remoteLatestWidgetsBackup.put(widget.getUuid(), widget); + } + + return true; + } + return false; + } + + @Override + public void done() { + boolean success = false; + try { + success = get(); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + listener.onFetchedAfter(success, remoteLatestWidgetsBackup); + isCheckingComponentUpdates.set(false); + } + } + }; + + checkingComponentsUpdateWorker.execute(); + } + + public interface FetchComponentUpdatesListener { + void onFetchedBefore(); + void onFetchedAfter(boolean success, Map remoteLatestWidgets); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java index af94033b3..1aad30c1d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java @@ -118,6 +118,12 @@ class ToolbarPane extends JPanel { ); } + public void reset() { + filterPanel.reset(); + searchTextField.setText(StringUtils.EMPTY); + cardLayout.show(centerPane, NORMAL); + } + private FilterPane createFilterPane() { filterPanel = FilterPane.createLocalFilterPane(); filterPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/WidgetSelectedManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/WidgetSelectedManager.java index d211887f5..0afbe25d2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/WidgetSelectedManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/WidgetSelectedManager.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.share.ui.local; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.Group; +import com.fr.stable.StringUtils; import java.util.HashMap; import java.util.List; @@ -53,7 +55,11 @@ public class WidgetSelectedManager { */ public synchronized boolean unInstallSelect(String groupName, String uuid) { Group group = DefaultShareGroupManager.getInstance().getGroup(groupName); - return group != null && group.unInstallSelect(Stream.of(uuid).collect(Collectors.toList())); + boolean success = group != null && group.unInstallSelect(Stream.of(uuid).collect(Collectors.toList())); + if (success) { + DefaultShareGroupManager.getInstance().notifyComponentRemoved(groupName, uuid); + } + return success; } /** @@ -64,6 +70,9 @@ public class WidgetSelectedManager { for (String groupName : selectedWidgetMap.keySet()) { Group group = DefaultShareGroupManager.getInstance().getGroup(groupName); result &= group != null && group.unInstallSelect(selectedWidgetMap.get(groupName)); + if (result) { + DefaultShareGroupManager.getInstance().notifyComponentRemoved(groupName, StringUtils.EMPTY); + } } selectedWidgetMap.clear(); return result; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java index 3113fd06f..ab1793519 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java @@ -9,6 +9,9 @@ import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.general.FRFont; import com.fr.general.IOUtils; +import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionInterval; +import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -37,7 +40,7 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane private static final int POPUP_BOTTOM_HEIGHT = 54; private PreviewImagePane previewImagePane; - private UILabel versionLabel; + private UILabel compatibleEnVersionLabel; private UILabel downloadsLabel; private UILabel priceLabel; @@ -95,10 +98,10 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane } private JPanel createWidgetInfoPane() { - versionLabel = new UILabel(); - versionLabel.setVerticalAlignment(SwingConstants.CENTER); - versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F)); - versionLabel.setForeground(new Color(0x333334)); + compatibleEnVersionLabel = new UILabel(); + compatibleEnVersionLabel.setVerticalAlignment(SwingConstants.CENTER); + compatibleEnVersionLabel.setFont(FRFont.getInstance(compatibleEnVersionLabel.getFont()).deriveFont(12.0F)); + compatibleEnVersionLabel.setForeground(new Color(0x333334)); downloadsLabel = new UILabel(); downloadsLabel.setVerticalAlignment(SwingConstants.TOP); @@ -125,7 +128,7 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 1; - container.add(versionLabel, constraints); + container.add(compatibleEnVersionLabel, constraints); constraints.gridx = 0; constraints.gridy = 1; @@ -167,6 +170,18 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane @Override public void populateBean(PreviewWidgetBlock block) { OnlineShareWidget widget = block.getWidget(); + populateThemeName(widget); + populatePrice(widget); + populateCompatibleEnvVersion(widget); + + downloadsLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Download_Times") + ": " + widget.getDownloadTimes()); + previewImagePane.setPreviewImage(block.getPreviewImage()); + + int height = (suitableThemeNamePane.isVisible() ? POPUP_TOP_HEIGHT : 0) + 10 + previewImagePane.getPreferredSize().height + POPUP_BOTTOM_HEIGHT; + setPreferredSize(new Dimension(POPUP_WIDTH, height)); + } + + private void populateThemeName(OnlineShareWidget widget) { String themeName = widget.getThemeName(); if (StringUtils.isNotEmpty(themeName)) { suitableThemeNamePane.setVisible(true); @@ -174,19 +189,37 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane } else { suitableThemeNamePane.setVisible(false); } + } + private void populatePrice(OnlineShareWidget widget) { String priceText = "¥" + widget.getPrice(); if (widget.getPrice() <= 0) { priceText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Price_Free"); } priceLabel.setText(priceText); + } - versionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Version") + ": " + widget.getDesignerVersion()); - downloadsLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Download_Times") + ": " + widget.getDownloadTimes()); - previewImagePane.setPreviewImage(block.getPreviewImage()); + private void populateCompatibleEnvVersion(OnlineShareWidget widget) { + VersionInterval versionInterval = VersionIntervalFactory.create(widget.getDesignerVersion()); - int height = (suitableThemeNamePane.isVisible() ? POPUP_TOP_HEIGHT : 0) + 10 + previewImagePane.getPreferredSize().height + POPUP_BOTTOM_HEIGHT; - setPreferredSize(new Dimension(POPUP_WIDTH, height)); + Version floorVersion = versionInterval.floor(); + Version upperVersion = versionInterval.upper(); + + String compatibleEnVersion; + boolean includingMinVersion = versionInterval.contain(Version.create("0")); + boolean includingMaxVersion = versionInterval.contain(Version.create(Integer.toString(Integer.MAX_VALUE))); + + if (includingMinVersion && includingMaxVersion) { + compatibleEnVersion = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version_Interval_All"); + } else if (includingMinVersion) { + compatibleEnVersion = StringUtils.messageFormat(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version_Interval_Ceiling_Limit", upperVersion.getVersionStr())); + } else if (includingMaxVersion) { + compatibleEnVersion = StringUtils.messageFormat(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version_Interval_Floor_Limit", floorVersion.getVersionStr())); + } else { + compatibleEnVersion = floorVersion.getVersionStr() + "~" + upperVersion.getVersionStr(); + } + + compatibleEnVersionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version") + ": " + compatibleEnVersion); } private static class PreviewImagePane extends JPanel { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java index cd3e8c1ad..39a18ac2a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java @@ -117,7 +117,7 @@ public class InstallUtils { private static boolean installReuFile(Group group, File chosenFile, long installTime) { try { - if (!group.installModule(chosenFile)) { + if (!group.installUniqueIdModule(chosenFile)) { return false; } ShareUtils.recordInstallTime(chosenFile.getName(), installTime); 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 7db6608c5..67326c853 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 @@ -10,12 +10,14 @@ import com.fr.design.mainframe.share.Bean.WidgetFilterTypeInfo; import com.fr.design.mainframe.share.config.ComponentReuseConfigManager; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; +import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import java.io.IOException; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.Comparator; @@ -23,6 +25,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; /** * Created by kerry on 2021/11/3 @@ -58,6 +61,10 @@ public class OnlineShopUtils { return StableUtils.pathJoin(getReuInfoPath(), "sort_parameter"); } + private static String getLatestReusesPath() { + return StableUtils.pathJoin(getReuInfoPath(), "prompt/update/"); + } + private static String getTestConnectionUrl() { return DesignerCloudURLManager.getInstance().acquireUrlByKind("ping"); } @@ -294,6 +301,28 @@ public class OnlineShopUtils { return getOnlineShareWidgets(plistUrl); } + public static List getLatestReusesByDesignerVersion(Set reuseIds, String designerVersion) { + List result = new ArrayList<>(); + try { + JSONObject params = JSONObject.create(); + StringBuilder reuseIdsStr = new StringBuilder(); + for (String id: reuseIds) { + reuseIdsStr.append(id).append(","); + } + params.put("reuseIds", reuseIdsStr.toString()); + params.put("designerVersion", designerVersion); + JSONArray resultArr = postResultAttrFormUrl(getLatestReusesPath(), params); + int size = resultArr.size(); + for (int i = 0; i < size; i++) { + JSONObject jo = resultArr.getJSONObject(i); + result.add(OnlineShareWidget.parseFromJSONObject(jo)); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return result; + } + private static JSONArray getResultAttrFromUrl(String url) { HttpClient httpClient = new HttpClient(url); httpClient.asGet(); @@ -302,4 +331,19 @@ public class OnlineShopUtils { return resultJSONObject.getJSONArray("result"); } + private static JSONArray postResultAttrFormUrl(String url, JSONObject params) { + JSONArray result = JSONArray.create(); + try { + String responseText = HttpToolbox.post(url, params.toMap()); + if (StringUtils.isNotEmpty(responseText)) { + JSONObject resultJSONObject = new JSONObject(responseText); + result = resultJSONObject.getJSONArray("result"); + } + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + return result; + } + } diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index 5bbfc7a11..f71a504c8 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -131,6 +131,24 @@ public class ShareGeneratePane extends BasicPane { } }); + simplePane.getDesignerVersionField().getDocument().addDocumentListener(new DocumentListener() { + + @Override + public void changedUpdate(DocumentEvent e) { + validInput(); + } + + @Override + public void insertUpdate(DocumentEvent e) { + validInput(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + validInput(); + } + }); + uploadPane.getNameField().getDocument().addDocumentListener(new DocumentListener() { @Override @@ -159,13 +177,13 @@ public class ShareGeneratePane extends BasicPane { } private void validInput() { - String userInput = getSelectMainPane().getNameField().getText().trim(); + String name = getSelectMainPane().getNameField().getText().trim(); + boolean isValidName = StringUtils.isNotEmpty(name); - if (StringUtils.isEmpty(userInput)) { - dialog.setButtonEnabled(false); - } else { - dialog.setButtonEnabled(true); - } + boolean isValidDesignerVersion = getSelectMainPane().getDesignerVersionField().isValidVersion(); + + boolean isValidInput = isValidName && isValidDesignerVersion; + dialog.setButtonEnabled(isValidInput); } diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index ea5298cf2..ffeedb770 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -48,6 +48,8 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; import com.fr.stable.pinyin.PinyinHelper; + +import java.awt.TextField; import java.util.HashMap; import org.jetbrains.annotations.NotNull; @@ -90,7 +92,7 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE; **/ public class ShareMainPane extends JPanel { - private static final int COLUMN_ITEM_SIZE = 60; + private static final int COLUMN_ITEM_SIZE = 80; private static final int COLUMN_FIELD_WIDTH = 555; private static final int TEXT_FIELD_WIDTH = 160; private static final int TEXT_FIELD_HEIGHT = 21; @@ -101,7 +103,7 @@ public class ShareMainPane extends JPanel { private static final int COMBO_HEIGHT = 20; private static final int BTN_WIDTH = 70; private static final int BTN_HEIGHT = 20; - private static final int BASEPANE_VERTICAL_GAP = 2; + private static final int BASEPANE_VERTICAL_GAP = 10; private UIScrollPane mainPane = null; @@ -123,6 +125,7 @@ public class ShareMainPane extends JPanel { private UIComboBox styleComboBox = null; private UITextField nameField = new UITextField(); + private VersionIntervalField designerVersionField = new VersionIntervalField(); private PlaceholderTextArea content = new LeftWordsTextArea(); @@ -214,6 +217,9 @@ public class ShareMainPane extends JPanel { UILabel classifyLabel = ShareUIUtils.createCenterRightUILabel(Toolkit.i18nText("Fine-Design_Share_Classify")); JPanel classifyPane = createClassifyPane(); + UILabel designerVersionLabel = ShareUIUtils.createCenterRightUILabel(Toolkit.i18nText("Fine-Design_Share_Designer_Version")); + JPanel designerVersionPane = createDesignerVersionFiledPane(); + //样式风格 UILabel styleThemeLabel = ShareUIUtils.createCenterRightUILabel(Toolkit.i18nText("Fine-Design_Share_Style_Theme")); JPanel styleThemePane = createStyleThemePane(); @@ -231,35 +237,37 @@ public class ShareMainPane extends JPanel { JPanel innerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel infoPane; + Component[][] components; if (upload) { - Component[][] components = new Component[][]{ + components = new Component[][]{ new Component[]{nameLabel, symbolTextField}, new Component[]{coverLabel, coverImagePane}, new Component[]{vendorLabel, vendorPane}, new Component[]{deviceLabel, devicePane}, new Component[]{classifyLabel, classifyPane}, + new Component[]{designerVersionLabel, designerVersionPane}, new Component[]{styleThemeLabel, styleThemePane}, new Component[]{pluginLabel, pluginPane}, new Component[]{priceLabel, pricePane}, }; - double[] rowSize = {p, p, p, p, p, p, p, p}; - double[] columnSize = {COLUMN_ITEM_SIZE, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},{1, 1}, {1, 1}}; - infoPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_SMALL, BASEPANE_VERTICAL_GAP); } else { - Component[][] components = new Component[][]{ + components = new Component[][]{ new Component[]{nameLabel, symbolTextField}, new Component[]{coverLabel, coverImagePane}, new Component[]{deviceLabel, devicePane}, new Component[]{classifyLabel, classifyPane}, + new Component[]{designerVersionLabel, designerVersionPane}, new Component[]{localGroupLabel, localGroupPane} }; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {COLUMN_ITEM_SIZE, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1},{1, 1}, {1, 1}}; - infoPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_SMALL, BASEPANE_VERTICAL_GAP); } + double[] rowSize = new double[components.length]; + Arrays.fill(rowSize, p); + double[] columnSize = {COLUMN_ITEM_SIZE, p}; + int[][] rowCount = new int[components.length][2]; + Arrays.fill(rowCount, new int[] { 1, 1 }); + infoPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_SMALL, BASEPANE_VERTICAL_GAP); + String title = Toolkit.i18nText("Fine-Design_Share_Base_Info"); JPanel overviewPane = FRGUIPaneFactory.createTitledBorderPane(title); @@ -398,6 +406,16 @@ public class ShareMainPane extends JPanel { return pane; } + private JPanel createDesignerVersionFiledPane() { + designerVersionField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT)); + JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane(); + UILabel validSymbol = new UILabel(" *"); + symbolTextFiled.add(designerVersionField, BorderLayout.CENTER); + symbolTextFiled.add(validSymbol, BorderLayout.EAST); + + return symbolTextFiled; + } + private JPanel createLocalGroupPane() { JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2)); @@ -623,7 +641,7 @@ public class ShareMainPane extends JPanel { provider.setDisplayDevice(displayDevice()); provider.setParentClassify(classify(parentClassify.getSelectedItem())); provider.setChildClassify(classify(childClassify.getSelectedItem())); - provider.setDesignerVersion(ProductConstants.VERSION); + provider.setDesignerVersion(designerVersionField.getText()); provider.setVendor(loginLabel.getText()); provider.setFileName(provider.getNameWithID()); provider.setVendorUid(DesignerEnvManager.getEnvManager().getDesignerLoginUid()); @@ -655,6 +673,10 @@ public class ShareMainPane extends JPanel { return nameField; } + public VersionIntervalField getDesignerVersionField() { + return designerVersionField; + } + private String classify(Object classify) { return classify == null ? StringUtils.EMPTY : classify.toString(); @@ -723,4 +745,35 @@ public class ShareMainPane extends JPanel { } } + public static class VersionIntervalField extends UITextField { + private static final String allowCharAsString = "0123456789."; + + public VersionIntervalField() { + setDocument(new PlainDocument() { + + @Override + public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException { + if (str == null) { + return; + } + int count = str.length(); + for (int i = 0; i < count; i++) { + char c = str.charAt(i); + if (allowCharAsString.indexOf(c) < 0) { + java.awt.Toolkit.getDefaultToolkit().beep(); + return; + } + } + super.insertString(offset, str, attrSet); + } + }); + setPlaceholder(ProductConstants.RELEASE_VERSION); + setText(ProductConstants.RELEASE_VERSION); + } + + public boolean isValidVersion() { + String text = getText(); + return text.matches("(([0-9]|([1-9]([0-9]*))).){2}([0-9]|([1-9]([0-9]*)))"); + } + } } From 7e996b635a79c655a10730ab8bfd6dabe3c5d977 Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 5 Nov 2021 13:59:26 +0800 Subject: [PATCH 055/152] =?UTF-8?q?REPORT-62016=20BI=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/versioncheck/VersionCheckUtils.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index e5624c453..d2794cd6e 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -64,6 +64,11 @@ public class VersionCheckUtils { private static final String ID = "id"; private static final String VERSION = "version"; private static final String NAME = "name"; + private static final String RUNNING = "running"; + private static final String SYNC = "sync"; + private static final String GROUP = "group"; + private static final String BI = "bi"; + private static final String BIPREFIX = "com.finebi"; private static final Set pluginsNeedIgnore = new HashSet<>(); static { pluginsNeedIgnore.addAll(Arrays.asList( @@ -263,13 +268,10 @@ public class VersionCheckUtils { Map pluginsNameMap = ReportHelper.getPluginNameMap(); for (int i = 0; i < remotePlugins.size(); i++) { remotePlugin = remotePlugins.getJSONObject(i); - if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) { + if (isPluginNeedIgnore(remotePlugin)) { continue; } String remotePluginID = remotePlugin.getString(ID); - if (pluginsNeedIgnore.contains(remotePluginID)) { - continue; - } if (localPluginsMap.containsKey(remotePluginID)) { if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) { continue; @@ -290,6 +292,12 @@ public class VersionCheckUtils { return differentPlugins; } + private static boolean isPluginNeedIgnore(JSONObject remotePlugin) { + return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC)) + || (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX) + || pluginsNeedIgnore.contains(remotePlugin.getString(ID))); + } + public static JSONArray syncPlugins(JSONArray differentPlugins) { Set uninstallFailed = uninstallPlugins(differentPlugins); List plugins = getSyncPlugins(differentPlugins, uninstallFailed); From fd8213b03d3af41490fb403bfdc7083885b865f3 Mon Sep 17 00:00:00 2001 From: "Joe.Jiang" Date: Fri, 5 Nov 2021 14:18:37 +0800 Subject: [PATCH 056/152] =?UTF-8?q?REPORT-62179=20=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E7=9A=84=E6=9C=80=E5=A4=A7=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC=E6=A0=A1=E9=AA=8C=E9=9C=80=E6=94=AF=E6=8C=81=E5=85=AC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/NumberEditorValidatePane.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index d77e1e900..7fd88dd95 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -1,6 +1,10 @@ package com.fr.design.widget.component; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.ErrorMsgTextFieldAdapter; +import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.designer.IntervalConstants; +import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -9,6 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; @@ -35,7 +40,7 @@ public class NumberEditorValidatePane extends JPanel { private UISpinner minValueSpinner; private UISpinner decimalLength; private JPanel limitNumberPane; - private UITextField errorMsgTextField; + private ErrorMsgTextFieldAdapter errorMsgTextField; private JPanel errorMsgTextFieldPane; private ActionListener allowDecimalsListener; @@ -100,9 +105,20 @@ public class NumberEditorValidatePane extends JPanel { } private void initErrorMsgPane() { - errorMsgTextField = new UITextField(); + TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); + if (provider != null) { + try { + errorMsgTextField = provider.createTextFieldAdapter(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + errorMsgTextField = new UITextFieldAdapter(); + } + } else { + errorMsgTextField = new UITextFieldAdapter(); + } + errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); + new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); } From 0e529ab1a399ff47941b93af8550846923a71343 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 5 Nov 2021 15:53:19 +0800 Subject: [PATCH 057/152] =?UTF-8?q?REPORT-61610=20fix:=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E6=9C=80=E5=BC=80=E5=A7=8B=E5=85=B3=E4=BA=8E=20=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E7=9A=84=E5=9B=BE=E8=A1=A8=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E6=96=B0=E5=BB=BA=E5=9B=BE=E8=A1=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2=20=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ChartPropertyPane.java | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 7d787f15a..4efe977ff 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -16,14 +16,6 @@ import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.GeneralContext; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; -import com.fr.plugin.observer.PluginEventType; -import com.fr.stable.AssistUtils; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -43,12 +35,8 @@ public class ChartPropertyPane extends BaseChartPropertyPane { protected ChartEditPane chartEditPane; - //ID一样的话 不用新建chartEditPane - private String currentID; - private ChartPropertyPane() { initComponent(); - addListener(); } protected void initComponent() { @@ -56,33 +44,11 @@ public class ChartPropertyPane extends BaseChartPropertyPane { this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } - private void addListener() { - GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { - @Override - public void on(PluginEvent event) { - //禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane - currentID = null; - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraChartDesign); - } - }); - } - @Override public void updateChartEditPane(String plotID) { - if (!AssistUtils.equals(currentID, plotID)) { - chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); - chartEditPane.setContainer(container); - currentID = plotID; - resetChartEditPane(); - } else { - chartEditPane.resetLastChartCollection(); - } + chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); + chartEditPane.setContainer(container); + resetChartEditPane(); } @Override From 5144ea2216425e995910e6139f4c3e3873931438 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 5 Nov 2021 15:50:51 +0800 Subject: [PATCH 058/152] =?UTF-8?q?REPORT-60601=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 处理在线组件不兼容当前设计器的场景 2. 本地组件更新中时不能刷新本地组件列表界面 【改动思路】 同上 --- .../share/ui/block/OnlineWidgetBlock.java | 91 ++++++++++++++++--- .../share/ui/local/LocalWidgetRepoPane.java | 44 ++++++++- 2 files changed, 117 insertions(+), 18 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 266a4e51b..9f5873771 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 @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.base.GraphHelper; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; @@ -30,11 +31,13 @@ import com.fr.form.share.Group; import com.fr.form.share.utils.ShareUtils; import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.Widget; +import com.fr.general.FRFont; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.SwingConstants; @@ -47,6 +50,7 @@ import java.awt.Color; import java.awt.Composite; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; @@ -54,6 +58,8 @@ import java.awt.RenderingHints; import java.awt.Stroke; import java.awt.dnd.DnDConstants; import java.awt.event.MouseEvent; +import java.awt.font.FontRenderContext; +import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -73,6 +79,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { private static final BufferedImage WIDGET_INSTALLED_ICON = IOUtils.readImage("/com/fr/base/images/share/widget_installed.png"); private static final BufferedImage WIDGET_DOWNLOAD_ICON = IOUtils.readImage("/com/fr/base/images/share/download.png"); private static final BufferedImage WIDGET_DOWNLOADING_ICON = IOUtils.readImage("/com/fr/base/images/share/downloading.png"); + private static final Icon incompatibleMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_incompatible.png"); public OnlineWidgetBlock(OnlineShareWidget widget, AbstractOnlineWidgetSelectPane parentPane) { super(widget, parentPane); @@ -117,6 +124,9 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { @Override public void mouseEntered(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } super.mouseEntered(e); this.isMouseEnter = true; this.repaint(); @@ -124,6 +134,9 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { @Override public void mouseExited(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } super.mouseExited(e); this.isMouseEnter = false; this.repaint(); @@ -131,12 +144,18 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { @Override public void mousePressed(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } super.mousePressed(e); this.lastPressEvent = e; } @Override public void mouseClicked(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } super.mouseClicked(e); boolean isLeftClickDownloadIcon = e.getButton() != MouseEvent.BUTTON3 && getDownloadIconRec().contains(e.getX(), e.getY()); if (!isRightClickPopupMenuVisible() && isLeftClickDownloadIcon && !checkWidgetInstalled()) { @@ -146,6 +165,9 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { @Override public void mouseDragged(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } super.mouseDragged(e); if (DesignModeContext.isAuthorityEditing() || !checkWidgetInstalled()) { return; @@ -184,6 +206,21 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { } } + @Override + public void mouseMoved(MouseEvent e) { + if (!getWidget().isCompatibleWithCurrentEnv()) { + return; + } + super.mouseMoved(e); + if (checkWidgetInstalled()) { + this.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + } else if (getDownloadIconRec().contains(e.getX(), e.getY())) { + this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + } + private void downLoadWidget() { CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT); if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { @@ -249,19 +286,6 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { }.execute(); } - - @Override - public void mouseMoved(MouseEvent e) { - super.mouseMoved(e); - if (checkWidgetInstalled()) { - this.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - } else if (getDownloadIconRec().contains(e.getX(), e.getY())) { - this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } else { - this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - } - private Rectangle getDownloadIconRec() { return new Rectangle(ShareComponentConstants.SHARE_THUMB_WIDTH / 2 - 12, ShareComponentConstants.SHARE_BLOCK_HEIGHT / 2 - 16, 24, 24); } @@ -328,6 +352,47 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { g2d.setColor(Color.WHITE); g2d.setStroke(oldStroke); } + + boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv(); + if (isUnusable) { + paintUnusableMask((Graphics2D) g); + } + } + + protected void paintUnusableMask(Graphics2D g2d) { + Color oldColor = g2d.getColor(); + Font oldFont = g2d.getFont(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Dimension coverDim = getCoverDimension(); + double canvasX = 0; + double canvasY = 0; + double canvasW = coverDim.getWidth(); + double canvasH = coverDim.getHeight(); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); + + g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); + GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); + + String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); + Font tipFont = FRFont.getInstance().deriveFont(8F); + FontRenderContext frc = g2d.getFontRenderContext(); + double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); + Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); + double tipTextHeight = dim.getHeight(); + g2d.setColor(Color.WHITE); + g2d.setFont(tipFont); + GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); + + int markerX = (int) (canvasX + (canvasW - incompatibleMarker.getIconWidth()) / 2); + int markerY = (int) (canvasY + (canvasH - incompatibleMarker.getIconHeight()) / 2); + incompatibleMarker.paintIcon(this, g2d, markerX, markerY); + + g2d.setColor(oldColor); + g2d.setFont(oldFont); } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index d9c979f43..522574ce0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -223,10 +223,16 @@ public class LocalWidgetRepoPane extends BasicPane { } public void refreshAllGroupPane() { + if (isUpdating()) { + return; + } refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); } public void refreshAllGroupPane(GroupPane.GroupCreateStrategy createStrategy) { + if (isUpdating()) { + return; + } editable = false; groupPaneMap.clear(); if (groupsScrollPane != null) { @@ -249,21 +255,33 @@ public class LocalWidgetRepoPane extends BasicPane { } public void refreshPane() { + if (isUpdating()) { + return; + } managePane.switchPanel(false); switchPane(LocalPaneStatus.LOADING); doRefresh(); } public void switch2InstallingPane() { + if (isUpdating()) { + return; + } switchPane(LocalPaneStatus.INSTALLING); } public void refreshShowPanel(boolean isEdit) { + if (isUpdating()) { + return; + } this.editable = isEdit; refreshShowPanel(); } public void refreshShowPanel() { + if (isUpdating()) { + return; + } for (GroupPane groupPane : groupPaneMap.values()) { groupPane.refreshShowPanel(); } @@ -271,6 +289,9 @@ public class LocalWidgetRepoPane extends BasicPane { } public void refreshShowPanel(Group group) { + if (isUpdating()) { + return; + } if (groupPaneMap.containsKey(group.getGroupName())) { groupPaneMap.get(group.getGroupName()).refreshShowPanel(); } @@ -286,12 +307,18 @@ public class LocalWidgetRepoPane extends BasicPane { } public void removeGroup(String groupName) { + if (isUpdating()) { + return; + } JPanel jPanel = groupPaneMap.remove(groupName); groupsPane.remove(jPanel); switchPane(); } public void addGroup(Group group) { + if (isUpdating()) { + return; + } GroupPane groupPane = GroupPane.GroupCreateStrategy.DEFAULT.creteGroupPane(group); groupPaneMap.put(group.getGroupName(), groupPane); groupsPane.add(groupPane); @@ -383,7 +410,6 @@ public class LocalWidgetRepoPane extends BasicPane { return; } - updateGuard = 0; toolbarPane.reset(); managePane.switchPanel(false); switchPane(LocalPaneStatus.NORMAL); @@ -394,6 +420,8 @@ public class LocalWidgetRepoPane extends BasicPane { return; } + updateGuard = blockList.size(); + updateTipPane.setVisible(false); updateProgressPane.updateProgress(0.0F); updateProgressPane.setVisible(true); @@ -404,10 +432,9 @@ public class LocalWidgetRepoPane extends BasicPane { block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() { @Override public void onUpdated(boolean success, String group, String id) { - updateGuard += 1; - updateProgressPane.updateProgress(1.0F * updateGuard / blockList.size()); - if (updateGuard == blockList.size()) { - updateGuard = 0; + updateGuard -= 1; + updateProgressPane.updateProgress(1.0F - 1.0F * updateGuard / blockList.size()); + if (updateGuard == 0) { updater.clearUpdate(); updateProgressPane.setVisible(false); refreshAllGroupPane(); @@ -422,6 +449,9 @@ public class LocalWidgetRepoPane extends BasicPane { * 切换为要显示的面板 */ private void switchPane() { + if (isUpdating()) { + return; + } switchPane(getStatus()); } @@ -457,6 +487,10 @@ public class LocalWidgetRepoPane extends BasicPane { return groups.length == 1 && groups[0].getAllBindInfoList().length == 0; } + private boolean isUpdating() { + return updateGuard > 0; + } + private List getUpdatableBlocks() { List blockList = new ArrayList<>(); From 123f3ce4c2081431769ade5a50a48033af60722d Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 5 Nov 2021 16:44:26 +0800 Subject: [PATCH 059/152] =?UTF-8?q?REPORT-61654=20=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/design/i18n/dimension_ko_KR.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 96a966f8b..17031793f 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -1,7 +1,7 @@ com.fr.design.mainframe.check.CheckButton=230*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=550*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35 -com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 +com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=550*280 com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.design.version.check.dialog=450*95 com.fr.design.version.detail.label=700*30 From 66b7fe2181e29f044833a7cc9cb511db50ebd333 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 5 Nov 2021 16:57:54 +0800 Subject: [PATCH 060/152] =?UTF-8?q?CHART-21737=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=9B=BE=E8=A1=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E8=AE=BE=E7=BD=AE=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=85=8D=E8=89=B2=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/component/VanChartFillStylePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index 42e33b89c..3f7374c34 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane; import com.fr.design.utils.gui.GUICoreUtils; @@ -63,7 +64,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe } public void updateBean(AttrFillStyle attrFillStyle) { - if (getStyleSelectBox().getSelectedIndex() == 0) { + if (getStyleSelectBox().getSelectedIndex() == 0 && ChartEditContext.supportTheme()) { attrFillStyle.setThemed(true); return; } From 5226dd118d71685d81f330cf4823847cf1cb4f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 5 Nov 2021 18:10:14 +0800 Subject: [PATCH 061/152] =?UTF-8?q?REPORT-60528=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E5=9C=A8=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA?= =?UTF-8?q?tablayout=E9=AB=98=E5=BA=A6=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E5=88=A4=E6=96=AD=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRCardMainBorderLayoutAdapter.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 726c39706..dd9e03c8d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -64,21 +64,18 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { private boolean isBeyondMinConstraint(int minConstraint, int value) { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); - if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); - } else { - // 自适应布局平分高度导致变矮的场景 + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null && jt.getUndoManager().canUndo()) { + // 自适应布局平分高度导致变矮的场景,优先做撤销 UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null) { - jt.undo(); - } + jt.undo(); } }); - + } else if (container.getBackupBound() != null) { + // 手动拖动导致变矮的场景 + container.setSize(container.getBackupBound().getSize()); } return true; } else { From e8e61428e07b0ed71ea07b847a1b61e9e774833d Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 8 Nov 2021 11:09:41 +0800 Subject: [PATCH 062/152] =?UTF-8?q?REPORT-61788=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=BC=B9=E7=AA=97=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=E9=9D=9E=E5=B8=B8=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 创建组件的面板里需要获取组件样式风格列表,列表数据来自商城服务器端, 需要网络请求。在创建面板的时候,进行了同步请求,阻塞了EDT线程. 【改动思路】 使用 LazyComboBox 替换 UIComboBox --- .../fr/design/share/ui/generate/ShareMainPane.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index ffeedb770..b19dbd659 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -8,6 +8,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.LoginWebBridge; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.icontainer.UIScrollPane; @@ -50,6 +51,7 @@ import com.fr.stable.collections.combination.Pair; import com.fr.stable.pinyin.PinyinHelper; import java.awt.TextField; +import java.util.Collections; import java.util.HashMap; import org.jetbrains.annotations.NotNull; @@ -299,8 +301,13 @@ public class ShareMainPane extends JPanel { return styleComboBox.getSelectedItem() != null; } }; - this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new UIComboBox()); - this.styleComboBox.refreshBoxItems(StyleTheme.getStyleThemeTypeInfo()); + this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new LazyComboBox() { + @Override + public Object[] load() { + List themeBeanList = StyleTheme.getStyleThemeTypeInfo(); + return themeBeanList.toArray(); + } + }); styleComboBox.setPreferredSize(new Dimension(COMBO_WIDTH, COMBO_HEIGHT)); pane.add(styleComboBox); return pane; From aae3cc9d40238533d10446bd1de48a02006e06fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 8 Nov 2021 11:31:59 +0800 Subject: [PATCH 063/152] =?UTF-8?q?REPORT-57521=20=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E4=BB=A3=E7=A0=81-=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E6=97=B6websocket=E6=96=AD=E5=BC=80=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toast/DesignerToastMsgUtil.java | 15 +- .../mainframe/toast/ToastMsgDialog.java | 6 - .../mainframe/socketio/DesignerSocketIO.java | 142 +++++------------- 3 files changed, 37 insertions(+), 126 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java index 300f8537e..8c2ff7cc9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java @@ -31,14 +31,6 @@ public class DesignerToastMsgUtil { } - public static ToastMsgDialog createPromptDialog(String text) { - return createDialog(PROMPT_ICON, toastPane(text), DesignerContext.getDesignerFrame()); - } - - public static ToastMsgDialog createPromptDialog(JPanel contentPane) { - return createDialog(PROMPT_ICON, contentPane, DesignerContext.getDesignerFrame()); - } - public static void toastPrompt(JPanel contendPane) { toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame()); } @@ -76,11 +68,6 @@ public class DesignerToastMsgUtil { } private static void toastPane(Icon icon, JPanel contendPane, Window parent) { - ToastMsgDialog dialog = createDialog(icon, contendPane, parent); - dialog.setVisible(true); - } - - private static ToastMsgDialog createDialog(Icon icon, JPanel contendPane, Window parent) { JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel uiLabel = new UILabel(icon); uiLabel.setVerticalAlignment(SwingConstants.TOP); @@ -95,7 +82,7 @@ public class DesignerToastMsgUtil { } else { dialog = new ToastMsgDialog((Frame) parent, pane); } - return dialog; + dialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java index 69865c705..632454266 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java @@ -24,7 +24,6 @@ public class ToastMsgDialog extends UIDialog { private ScheduledExecutorService TIMER; private int hide_height = 0; private JPanel contentPane; - private boolean show = false; public ToastMsgDialog(Frame parent, JPanel panel) { super(parent); @@ -66,7 +65,6 @@ public class ToastMsgDialog extends UIDialog { public void display(JPanel outerJPanel) { - show = true; outerJPanel.setLocation(0, -hide_height); ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService(); TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() { @@ -100,7 +98,6 @@ public class ToastMsgDialog extends UIDialog { TIP_TOOL_TIMER.shutdown(); ToastMsgDialog.this.setVisible(false); ToastMsgDialog.this.dispose(); - ToastMsgDialog.this.show = false; } outerJPanel.setLocation(point.x, point.y - 5); Dimension dimension = ToastMsgDialog.this.getSize(); @@ -162,7 +159,4 @@ public class ToastMsgDialog extends UIDialog { super.dispose(); } - public boolean isShow() { - return show; - } } 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 5916b4f32..eeba97ae4 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 @@ -7,33 +7,20 @@ import com.fr.design.EnvChangeEntrance; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfoContext; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogger; -import com.fr.design.mainframe.share.ui.base.MouseClickListener; -import com.fr.design.mainframe.toast.DesignerToastMsgUtil; -import com.fr.design.mainframe.toast.ToastMsgDialog; import com.fr.design.ui.util.UIUtil; -import com.fr.design.utils.BrowseUtils; import com.fr.event.EventDispatcher; -import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; -import com.fr.third.org.apache.http.client.config.RequestConfig; -import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; -import com.fr.third.org.apache.http.client.methods.HttpGet; import com.fr.third.org.apache.http.conn.ssl.NoopHostnameVerifier; import com.fr.third.org.apache.http.conn.ssl.TrustSelfSignedStrategy; -import com.fr.third.org.apache.http.impl.client.CloseableHttpClient; -import com.fr.third.org.apache.http.impl.client.HttpClients; import com.fr.third.org.apache.http.ssl.SSLContexts; import com.fr.web.WebSocketConfig; import com.fr.web.socketio.WebSocketProtocol; @@ -42,27 +29,22 @@ import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; -import javax.net.ssl.SSLContext; -import javax.swing.BorderFactory; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.UIManager; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.event.MouseEvent; import java.io.File; import java.io.FileInputStream; +import java.security.KeyStore; +import java.util.Arrays; +import javax.net.ssl.SSLContext; +import javax.swing.*; import java.io.IOException; import java.net.URI; import java.net.URL; -import java.security.KeyStore; -import java.util.Arrays; import java.util.Timer; +import java.util.TimerTask; public class DesignerSocketIO { @@ -72,21 +54,18 @@ public class DesignerSocketIO { Disconnecting } - private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("websocketConnect", "https://help.fanruan.com/finereport/doc-view-2512.html"); private static final String HTTPS = "https"; private static final String HTTP = "http"; private static Socket socket = null; private static Status status = Status.Disconnected; private static Timer disConnectHintTimer = null; private static long disConnectHintTimerDelay = 3000; - private static final int TIMEOUT = 5000; //维护一个当前工作环境的uri列表 private static String[] uri; //维护一个关于uri列表的计数器 private static int count; // 当前webSocket选择的协议 private static String currentProtocol; - private static ToastMsgDialog dialog = null; public static void close() { @@ -153,7 +132,7 @@ public class DesignerSocketIO { String certPath = connection.getCertPath(); String certSecretKey = connection.getCertSecretKey(); if (StringUtils.isBlank(certPath) || StringUtils.isBlank(certSecretKey)) { - return SSLContexts.createDefault(); + return SSLContexts.createDefault(); } KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); try (FileInputStream keystore = new FileInputStream(new File(certPath))) { @@ -206,7 +185,6 @@ public class DesignerSocketIO { private static final Emitter.Listener failRetry = new Emitter.Listener() { @Override public void call(Object... args) { - showSocketDisconnectToast(); printLog(args, PrintEventLogImpl.WARN, "failed args: {}"); status = Status.Disconnecting; socket.close(); @@ -245,38 +223,41 @@ public class DesignerSocketIO { @Override public void call(Object... objects) { FineLoggerFactory.getLogger().info("start disConnectHintTimer"); - /* - * todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, - * socket 只用推日志和通知配置变更 - */ - printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}"); - if (status != Status.Disconnecting) { - dealWithSocketDisconnect(); - } - status = Status.Disconnected; + disConnectHintTimer = new Timer(); + disConnectHintTimer.schedule(new TimerTask() { + @Override + public void run() { + try { + /* + * todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, + * socket 只用推日志和通知配置变更 + */ + printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}"); + if (status != Status.Disconnecting) { + showConnectionLostDialog(); + } + status = Status.Disconnected; + } finally { + disConnectHintTimer.cancel(); + disConnectHintTimer = null; + } + } + }, disConnectHintTimerDelay); } }; - private static void dealWithSocketDisconnect() { - if (checkRPCConnect()) { - showSocketDisconnectToast(); - } else { - showRPCDisconnectDialog(); - } - } - - private static void showSocketDisconnectToast() { + private static void showConnectionLostDialog() { try { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - if (dialog == null) { - dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent()); - } - - if (!dialog.isShow()) { - dialog.setVisible(true); - } + FineJOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), + UIManager.getString("OptionPane.messageDialogTitle"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); + EnvChangeEntrance.getInstance().chooseEnv(); } }); } catch (Exception e) { @@ -284,57 +265,6 @@ public class DesignerSocketIO { } } - private static JPanel createDialogContent() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip")), BorderLayout.WEST); - UILabel hyperLinkLabel = new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip_HyperLink_Text")); - hyperLinkLabel.addMouseListener(new MouseClickListener() { - @Override - public void mouseClicked(MouseEvent e) { - BrowseUtils.browser(WEBSOCKET_HELP_DOC); - } - }); - hyperLinkLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); - hyperLinkLabel.setForeground(Color.BLUE); - hyperLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - jPanel.add(hyperLinkLabel, BorderLayout.CENTER); - return jPanel; - } - - private static void showRPCDisconnectDialog() { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - FineJOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), - UIManager.getString("OptionPane.messageDialogTitle"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - EnvChangeEntrance.getInstance().chooseEnv(); - } - }); - } - - private static boolean checkRPCConnect() { - CloseableHttpClient httpclient = HttpClients.createDefault(); - WorkspaceConnectionInfo info = getConnectionInfo(); - HttpGet httpGet = new HttpGet(StableUtils.pathJoin(info.getUrl(), WorkspaceConstants.CONTROLLER_PREFIX, WorkspaceConstants.VT)); - RequestConfig requestConfig = RequestConfig - .custom() - .setConnectTimeout(TIMEOUT) - .setConnectionRequestTimeout(TIMEOUT) - .build(); - httpGet.setConfig(requestConfig); - try { - CloseableHttpResponse response = httpclient.execute(httpGet); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - return false; - } - return true; - } - //配置变更监听器 private static final Emitter.Listener modifyConfig = new Emitter.Listener() { @Override @@ -387,4 +317,4 @@ public class DesignerSocketIO { }; } -} +} \ No newline at end of file From ea5a6fc9bb07069d0b0fb8683bc5d9d6ca0beff4 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 8 Nov 2021 14:46:51 +0800 Subject: [PATCH 064/152] =?UTF-8?q?CHART-21570=20=E9=80=82=E9=85=8D11.0=20?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84cpt?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=20=E4=B8=8D=E6=94=AF=E6=8C=81=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/gui/AdjustWorkBookDefaultStyleUtils.java | 11 +++++++++++ .../mainframe/cell/settingpane/style/StylePane.java | 6 +++++- .../java/com/fr/design/report/ReportStylePane.java | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index abae997e3..aa2178ece 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -43,4 +43,15 @@ public class AdjustWorkBookDefaultStyleUtils { return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; } + /** + * cpt模板是否支持跟随主题选项 + * 单元格样式 + * 悬浮元素样式 + * 纸张背景入口大屏模板屏蔽掉了 忽略 + * @return 大屏模板中cpt组件不支持 + */ + public static boolean supportTheme() { + return !DesignModeContext.isDuchampMode(); + } + } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java index bad6e6b6a..84c0c12b4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java @@ -13,6 +13,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -38,6 +39,7 @@ public class StylePane extends BasicPane implements UIObserver { public static final int DEFAULT_SELECTED_INDEX = 0; private final UIButtonGroup followingThemeButtonGroup; + private JPanel followingThemePane; private final CustomStylePane customStylePane; private final ThemedCellStyleListPane themedCellStyleListPane; private final CardLayout cardLayout; @@ -64,7 +66,7 @@ public class StylePane extends BasicPane implements UIObserver { private void initializePane() { setLayout(new BorderLayout(0, IntervalConstants.INTERVAL_L1)); - add(createFollowingThemePane(), BorderLayout.NORTH); + add(followingThemePane = createFollowingThemePane(), BorderLayout.NORTH); contentPane = createTabbedContentPane(); add(contentPane, BorderLayout.CENTER); } @@ -226,6 +228,8 @@ public class StylePane extends BasicPane implements UIObserver { setSelectedIndex(1); customStylePane.populateBean(style); } + //单元格配置界面是单例 所以直接在populate的时候把跟随主题的按钮组设置不可见 + followingThemePane.setVisible(AdjustWorkBookDefaultStyleUtils.supportTheme()); } private void fireStateChanged() { diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java index fc4b5a116..e16af5e3d 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java @@ -27,6 +27,7 @@ import com.fr.design.style.BorderUtils; import com.fr.design.style.FRFontPane; import com.fr.design.style.FormatPane; import com.fr.design.style.background.BackgroundPane; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.general.FRFont; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; @@ -66,6 +67,7 @@ public class ReportStylePane extends BasicPane { private final CellStylePreviewPane previewArea; private final UIButtonGroup followingThemeButtonGroup; + private JPanel followingThemePane; private final CustomFloatStyleSettingPane customStylePane; private final ThemedFloatStyleSettingPane themedFloatStyleSettingPane; private final CardLayout cardLayout; @@ -106,7 +108,7 @@ public class ReportStylePane extends BasicPane { add(createPreviewPane(), BorderLayout.NORTH); JPanel settingContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel followingThemePane = createFollowingThemePane(); + followingThemePane = createFollowingThemePane(); followingThemePane.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0)); settingContainer.add(followingThemePane, BorderLayout.NORTH); settingContainer.add(contentPane, BorderLayout.CENTER); @@ -319,6 +321,8 @@ public class ReportStylePane extends BasicPane { setSelectedIndex(1); customStylePane.populateBean(style); } + + followingThemePane.setVisible(AdjustWorkBookDefaultStyleUtils.supportTheme()); } public void updatePreviewArea() { From ee2191b929a59dc84908d821dca0a451c29344a1 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 8 Nov 2021 15:00:24 +0800 Subject: [PATCH 065/152] =?UTF-8?q?CHART-21570=20=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20cpt=E7=BB=84=E4=BB=B6=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=B9=9F=E4=B8=8D=E6=94=AF=E6=8C=81=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/mode/ChartEditContext.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java index 56345aeda..51fe2f816 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.chart.mode; import com.fr.common.annotations.Open; +import com.fr.design.base.mode.DesignModeContext; /** * @author shine @@ -27,9 +28,9 @@ public class ChartEditContext { /** * 是否支持 主题样式 设置 * - * @return duchamp大屏模板模式 不支持 + * @return duchamp大屏模板模式 不支持 图表组件&cpt组件中的图表 都不支持 */ public static boolean supportTheme() { - return !duchampMode(); + return !DesignModeContext.isDuchampMode(); } } From 23d23642c3f7c0f49fc901049e3ac45d0b21857e Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 8 Nov 2021 19:56:48 +0800 Subject: [PATCH 066/152] =?UTF-8?q?CHART-21570=20=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=9B=BE=E8=A1=A8=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/ChartTypePane.java | 10 ++++++++-- .../type/AbstractVanChartTypePane.java | 4 ++++ .../chart/map/designer/type/GisLayerPane.java | 19 +++++++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index d31cd3208..0337fff44 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -11,8 +11,10 @@ import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; @@ -23,10 +25,10 @@ import javax.swing.JSplitPane; import javax.swing.ListCellRenderer; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import java.awt.Color; import java.awt.Component; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent { private static final long serialVersionUID = -1175602484968520546L; @@ -153,6 +155,10 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven } } + if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { + ((VanChart) chart4Update).setThemeAutoCustom(); + } + update(chart4Update); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 9cf916554..04f48c732 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -24,6 +24,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.general.Background; import com.fr.js.NameJavaScriptGroup; import com.fr.log.FineLoggerFactory; @@ -152,6 +153,9 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane { refreshZoomLevel(); @@ -236,9 +237,19 @@ public class GisLayerPane extends JPanel implements UIObserver { } public void resetGisLayer(VanChartMapPlot mapPlot) { - GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer(); - mapPlot.setGisLayer(defaultGisLayer); - populate(defaultGisLayer); + + if (ChartEditContext.supportTheme()) { + GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer(); + mapPlot.setGisLayer(defaultGisLayer); + populate(defaultGisLayer); + } else { + GaoDeGisType gaoDeGisType = mapPlot.getDefaultGisLayerType(); + + mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); + mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName()); + mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType); + populate(mapPlot.getGisLayer()); + } } public void populate(GisLayer layer) { From 6c9a8425334a71b7e8ab88df6779aefd273a8a3d Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 8 Nov 2021 19:59:14 +0800 Subject: [PATCH 067/152] update --- .../src/main/java/com/fr/design/chart/ChartTypePane.java | 2 +- .../fr/van/chart/designer/type/AbstractVanChartTypePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 0337fff44..968117156 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -156,7 +156,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven } if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { - ((VanChart) chart4Update).setThemeAutoCustom(); + ((VanChart) chart4Update).setAutoThemeCustom(); } update(chart4Update); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 04f48c732..3456dd0be 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -154,7 +154,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane Date: Mon, 8 Nov 2021 20:00:13 +0800 Subject: [PATCH 068/152] =?UTF-8?q?=E6=97=A0=E4=BB=BB=E5=8A=A1=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/help/AboutPane.java | 3 +-- .../java/com/fr/design/actions/help/TutorialAction.java | 4 ++-- .../com/fr/design/data/datapane/connect/JDBCDefPane.java | 4 ++-- .../com/fr/design/mainframe/check/CheckFontInfoDialog.java | 5 ++--- designer-base/src/main/java/com/fr/env/HelpLink.java | 7 ++++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index eaff26ba5..615854088 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -14,7 +14,6 @@ import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; -import com.fr.i18n.UrlI18nManager; import com.fr.locale.InterProviderFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -83,7 +82,7 @@ public class AboutPane extends JPanel { addPhoneAndQQPane(contentPane); // 官网 - JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), UrlI18nManager.getInstance().getI18nUrl("website")); + JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); // 支持邮箱 String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 5a1439114..51a390c82 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -3,9 +3,9 @@ package com.fr.design.actions.help; import com.fr.design.i18n.Toolkit; import com.fr.design.login.AbstractDesignerSSO; import com.fr.design.menu.MenuKeySet; +import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; -import com.fr.i18n.UrlI18nManager; import com.fr.stable.CommonUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -28,7 +28,7 @@ public class TutorialAction extends AbstractDesignerSSO { @Override public String getJumpUrl() { - return UrlI18nManager.getInstance().getI18nUrl("help"); + return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com"); } // 生成帮助文档 sitecenter key, help.zh_CN.10 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 1f9b90dbb..0da46965b 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 @@ -16,8 +16,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.BrowseUtils; import com.fr.file.filter.ChooseFileFilter; +import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; -import com.fr.i18n.UrlI18nManager; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; @@ -159,7 +159,7 @@ public class JDBCDefPane extends JPanel { odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); odbcTipsLink.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { - String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help"); + String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); BrowseUtils.browser(url); } }); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java index a8c19c697..0671ed1b6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java @@ -7,8 +7,8 @@ import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.CloudCenter; import com.fr.general.IOUtils; -import com.fr.i18n.UrlI18nManager; import javax.swing.BorderFactory; import javax.swing.JDialog; @@ -49,8 +49,7 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener { JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"), Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"), - UrlI18nManager.getInstance().getI18nUrl("help.install.font") - ); + CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html")); linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink")); messagePanel.add(linkMessage); diff --git a/designer-base/src/main/java/com/fr/env/HelpLink.java b/designer-base/src/main/java/com/fr/env/HelpLink.java index 133a23490..c717ce6ea 100644 --- a/designer-base/src/main/java/com/fr/env/HelpLink.java +++ b/designer-base/src/main/java/com/fr/env/HelpLink.java @@ -1,7 +1,7 @@ package com.fr.env; - -import com.fr.i18n.UrlI18nManager; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.locale.InterProviderFactory; import com.fr.stable.StringUtils; import java.util.HashMap; @@ -18,7 +18,8 @@ public class HelpLink { public static String getLink(String solution) { Map map = new HashMap<>(); - String link = UrlI18nManager.getInstance().getI18nUrl("help.remote.design"); + LocaleMark linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class); + String link = linkMark.getValue(); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), StringUtils.EMPTY); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link); From bcbe3ea85658dd44f9768582befb1e61901e00e6 Mon Sep 17 00:00:00 2001 From: eason Date: Tue, 9 Nov 2021 10:09:29 +0800 Subject: [PATCH 069/152] =?UTF-8?q?CHART-21786:=E4=B8=8D=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A0=87=E8=AE=B0=E7=82=B9=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/marker/VanChartImageMarkerPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java index d28354bdb..3d6c85f4e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java @@ -31,8 +31,8 @@ public class VanChartImageMarkerPane extends BasicBeanPane { public VanChartImageMarkerPane() { imageBackgroundPane = new ImageBackgroundQuickPane(false); imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize())); - width = new UISpinnerWithPx(0, 100, 0.5, 30); - height = new UISpinnerWithPx(0, 100, 0.5, 30); + width = new UISpinnerWithPx(0, Integer.MAX_VALUE, 0.5, 30); + height = new UISpinnerWithPx(0, Integer.MAX_VALUE, 0.5, 30); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; From 3137f71571d4c9f58ffe2be3d8fb6a08a6ee2cd1 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Tue, 9 Nov 2021 10:15:35 +0800 Subject: [PATCH 070/152] =?UTF-8?q?REPORT-62133=20mac=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=89=E8=A3=85=E5=8C=85=E8=B5=B7=E4=B8=8D=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/DesignerEnvManager.java | 8 ++++++++ .../com/fr/design/login/DesignerLoginHelper.java | 2 +- .../login/config/DesignerLoginConfigManager.java | 14 ++++++++++++++ .../design/login/guide/DesignerGuideHelper.java | 16 +++++++++++----- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 9c23dcc51..b8d63ca7a 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -867,6 +867,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerLoginConfigManager.setPluginRemindOnFirstLaunch(pluginRemindOnFirstLaunch); } + public boolean isUseOldVersionLogin() { + return designerLoginConfigManager.isUseOldVersionLogin(); + } + + public void setUseOldVersionLogin(boolean useOldVersionLogin) { + designerLoginConfigManager.setUseOldVersionLogin(useOldVersionLogin); + } + /** * 内置服务器是否使用时启动 * diff --git a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java index 2d2dd935d..8976a0734 100644 --- a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java @@ -47,7 +47,7 @@ public class DesignerLoginHelper { } public static void showLoginDialog(DesignerLoginSource source, Map params, Window window) { - if (!SupportOSImpl.DESIGNER_LOGIN.support()) { + if (!SupportOSImpl.DESIGNER_LOGIN.support() || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) { WebViewDlgHelper.createLoginDialog(window); return; } diff --git a/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java b/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java index a0ab68109..b0fb0e292 100644 --- a/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java @@ -70,6 +70,10 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { * 插件管理第一次启动时的提醒 */ private boolean pluginRemindOnFirstLaunch = true; + /** + * 使用旧版登录 + */ + private boolean useOldVersionLogin = false; private DesignerLoginConfigManager() { @@ -98,6 +102,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { this.setLastLoginAccount(reader.getAttrAsString("lastLoginAccount", StringUtils.EMPTY)); this.setLoginRemindBeforeJumpBBS(reader.getAttrAsBoolean("loginRemindBeforeJumpBBS", true)); this.setPluginRemindOnFirstLaunch(reader.getAttrAsBoolean("pluginRemindOnFirstLaunch", true)); + this.setUseOldVersionLogin(reader.getAttrAsBoolean("useOldVersionLogin", false)); } } @@ -117,6 +122,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { writer.attr("lastLoginAccount", lastLoginAccount); writer.attr("loginRemindBeforeJumpBBS", loginRemindBeforeJumpBBS); writer.attr("pluginRemindOnFirstLaunch", pluginRemindOnFirstLaunch); + writer.attr("useOldVersionLogin", useOldVersionLogin); writer.end(); } @@ -223,4 +229,12 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { public void setPluginRemindOnFirstLaunch(boolean pluginRemindOnFirstLaunch) { this.pluginRemindOnFirstLaunch = pluginRemindOnFirstLaunch; } + + public boolean isUseOldVersionLogin() { + return useOldVersionLogin; + } + + public void setUseOldVersionLogin(boolean useOldVersionLogin) { + this.useOldVersionLogin = useOldVersionLogin; + } } diff --git a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java index b3513bb6d..3e4c0dae5 100644 --- a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java @@ -8,9 +8,7 @@ import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.update.push.DesignerPushUpdateManager; -import com.fr.general.CloudCenter; -import com.fr.general.CloudCenterConfig; -import com.fr.general.http.HttpToolbox; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import javax.swing.WindowConstants; @@ -39,7 +37,11 @@ public class DesignerGuideHelper { public static void prepareShowGuideDialog() { // 如果存在更新升级的弹窗,则不显示引导页面 - if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { + if (!DesignerLoginUtils.isOnline() + || !SupportOSImpl.DESIGNER_LOGIN.support() + || !FRContext.isChineseEnv() + || DesignerPushUpdateManager.getInstance().isShouldPopUp() + || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) { return; } if (isActivatedForOneWeek()) { @@ -52,7 +54,11 @@ public class DesignerGuideHelper { DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { @Override public void designerOpened() { - showGuideDialog(); + try { + showGuideDialog(); + } catch (Throwable t) { + FineLoggerFactory.getLogger().warn(t.getMessage(), t); + } } }); } From 6181bd0226c6e98efaa4cb0eecafa813c4247a75 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 9 Nov 2021 14:23:13 +0800 Subject: [PATCH 071/152] =?UTF-8?q?CHART-21805=20fix:cpt=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=9B=BE=E8=A1=A8=20=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E4=B8=AD=E6=9C=89=E7=9A=84=E5=B1=9E=E6=80=A7=20=E4=B8=8D?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=B1=9E=E6=80=A7=20=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=88=90=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/chart/ChartTypePane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 968117156..748a64069 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -156,6 +156,9 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven } if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { + //主题中有的属性 不跟随属性 全部设置成自定义 + ((VanChart) chart4Update).setThemeCustom(); + //主题中没有的 根据主题深浅色自动 的属性 全部设置成自定义 ((VanChart) chart4Update).setAutoThemeCustom(); } From 1c33d91f1a54a0174192db49b737eb463cdb032c Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 9 Nov 2021 16:51:57 +0800 Subject: [PATCH 072/152] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=BE=93=E5=85=A5=E6=8F=90=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=202.=E4=BC=98=E5=8C=96=E4=BA=86=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=EF=BC=9B=203.=E4=BC=98=E5=8C=96=E4=BA=86=E5=87=BA=E9=94=99?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BB=A5=E5=8F=8A=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=89=8D=E6=A3=80=E6=B5=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/dialog/BasicPane.java | 17 +- .../java/com/fr/design/dialog/UIDialog.java | 26 +- .../com/fr/design/formula/FormulaChecker.java | 78 +- .../com/fr/design/formula/FormulaPane.java | 341 +++-- .../FormulaPaneWhenReserveFormula.java | 9 +- .../FormulaExceptionTipsProcessor.java | 48 + .../function/FormulaCheckConstants.java | 31 + .../function/FormulaCheckWrongFunction.java | 74 + .../function/MismatchedCharFunction.java | 103 ++ .../function/MismatchedTokenFunction.java | 139 ++ .../function/NoViableAltForCharFunction.java | 43 + .../function/NoViableAltFunction.java | 40 + .../FormulaAutoCompletePopupWindow.java | 1003 +++++++++++++ .../gui/autocomplete/FormulaCompletion.java | 22 + .../FormulaPaneAutoCompletion.java | 1311 +++++++++++++++++ .../ParameterizedCompletionContext.java | 28 +- .../com/fr/design/images/m_file/formula.png | Bin 0 -> 279 bytes .../com/fr/design/images/m_file/param.png | Bin 0 -> 383 bytes 18 files changed, 3143 insertions(+), 170 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaCompletion.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaPaneAutoCompletion.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/formula.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/param.png diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index d3c592a4e..75626441b 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -8,9 +8,14 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; +import javax.swing.JPanel; import javax.swing.event.DocumentEvent; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Window; @Open public abstract class BasicPane extends JPanel { @@ -262,6 +267,10 @@ public abstract class BasicPane extends JPanel { public void checkValid() throws Exception { } + public boolean confirmContinueBeforeDoOK() { + return true; + } + public static class NamePane extends BasicPane { private UITextField nameTextField; private UILabel Name; @@ -390,6 +399,10 @@ public abstract class BasicPane extends JPanel { BasicPane.this.checkValid(); } + public boolean confirmContinueBeforeDoOK() { + return BasicPane.this.confirmContinueBeforeDoOK(); + } + } private class UnsizedDialog extends UIDialog { diff --git a/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java index c15812357..458daddab 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java @@ -33,6 +33,7 @@ public abstract class UIDialog extends JDialog { private BasicPane pane; private java.util.List listeners = new ArrayList(); private boolean isDoOKSucceed; + private boolean needExceptionCheck = true; public UIDialog(Frame parent) { @@ -151,6 +152,10 @@ public abstract class UIDialog extends JDialog { }); } + public void setNeedExceptionCheck(boolean needExceptionCheck) { + this.needExceptionCheck = needExceptionCheck; + } + /** * 添加监听器 @@ -172,14 +177,21 @@ public abstract class UIDialog extends JDialog { * 确定操作 */ public void doOK() { + //由于checkValid不可以加入自定义的弹窗以及操作,添加一个接口 + if (!confirmContinueBeforeDoOK()) { + return; + } + try { checkValid(); } catch (Exception exp) { - FineJOptionPane.showMessageDialog( - this, - exp.getMessage(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.WARNING_MESSAGE); + if (needExceptionCheck) { + FineJOptionPane.showMessageDialog( + this, + exp.getMessage(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.WARNING_MESSAGE); + } return; } @@ -253,6 +265,10 @@ public abstract class UIDialog extends JDialog { */ public abstract void checkValid() throws Exception; + public boolean confirmContinueBeforeDoOK() { + return true; + } + public void setButtonEnabled(boolean b) { this.okButton.setEnabled(b); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index 59446169d..1682ba307 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -1,91 +1,43 @@ package com.fr.design.formula; +import com.fr.design.formula.exception.FormulaExceptionTipsProcessor; import com.fr.design.i18n.Toolkit; -import com.fr.log.FineLoggerFactory; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; import com.fr.script.checker.FunctionCheckerDispatcher; -import com.fr.script.checker.exception.ConditionCheckWrongException; -import com.fr.script.checker.exception.FunctionCheckWrongException; -import com.fr.script.rules.FunctionParameterType; -import com.fr.script.rules.FunctionRule; -import com.fr.stable.StringUtils; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; import com.fr.stable.script.Expression; import com.fr.stable.script.Node; +import com.fr.third.antlr.TokenStreamRecognitionException; import java.io.StringReader; -import java.util.List; /** * @author Hoky * @date 2021/9/28 */ public class FormulaChecker { - private static final String VALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula"); - private static final String INVALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"); - public static final String COLON = ":"; + public static final String VALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula"); + public static final String INVALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"); + private static FormulaExceptionTipsProcessor processor = FormulaExceptionTipsProcessor.getProcessor(); - public static String check(String formulaText) throws FormulaCheckerException { + public static FormulaCheckResult check(String formulaText) { + //过滤一些空格等符号 StringReader in = new StringReader(formulaText); - FRLexer lexer = new FRLexer(in); FRParser parser = new FRParser(lexer); try { Expression expression = parser.parse(); Node node = expression.getConditionalExpression(); - boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(node); - if (valid) { - return VALID_FORMULA; - } else { - throw new FormulaCheckerException(INVALID_FORMULA); - } - } catch (ConditionCheckWrongException cce) { - String functionName = cce.getFunctionName(); - throw new FormulaCheckerException(functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Condition_Tips") + COLON); - } catch (FunctionCheckWrongException ce) { - List rules = ce.getRules(); - String functionName = ce.getFunctionName(); - StringBuilder errorMsg = new StringBuilder(functionName + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Error_Tips") + COLON); - for (int i = 0; i < rules.size(); i++) { - errorMsg.append("("); - if (rules.get(i).getParameterList().isEmpty()) { - errorMsg.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_No_Param")); - } - for (FunctionParameterType functionParameterType : rules.get(i).getParameterList()) { - errorMsg.append(getTypeString(functionParameterType)).append(","); - } - if (",".equals(errorMsg.charAt(errorMsg.length() - 1) + "")) { - errorMsg.deleteCharAt(errorMsg.length() - 1); - } - errorMsg.append(")"); - if (i != rules.size() - 1) { - errorMsg.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Or")); - } - } - throw new FormulaCheckerException(errorMsg.toString()); + boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node); + return new FormulaCheckResult(valid, valid ? VALID_FORMULA : INVALID_FORMULA, FormulaCoordinates.INVALID); } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - throw new FormulaCheckerException(INVALID_FORMULA); - // alex:继续往下面走,expression为null时告知不合法公式 - } - } - - private static String getTypeString(FunctionParameterType type) { - switch (type) { - case NUMBER: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Number"); - case STRING: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_String"); - case ANY: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Any"); - case DATE: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Date"); - case BOOLEAN: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Boolean"); - case ARRAY: - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Array"); + if (e instanceof TokenStreamRecognitionException) { + return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog); + } + return processor.getExceptionTips(e); } - return StringUtils.EMPTY; } } 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 6012bba19..9fa1af23e 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 @@ -16,7 +16,13 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.autocomplete.CompletionCellRenderer; +import com.fr.design.gui.autocomplete.CompletionProvider; +import com.fr.design.gui.autocomplete.DefaultCompletionProvider; +import com.fr.design.gui.autocomplete.FormulaCompletion; +import com.fr.design.gui.autocomplete.FormulaPaneAutoCompletion; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.QuickList; @@ -43,6 +49,7 @@ import com.fr.parser.SheetIntervalLiteral; import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.script.Calculator; import com.fr.script.ScriptConstants; +import com.fr.script.checker.result.FormulaCheckResult; import com.fr.stable.EncodeConstants; import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; @@ -65,6 +72,7 @@ import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; @@ -82,6 +90,8 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; @@ -112,17 +122,27 @@ import java.util.Set; * @since 2012-3-29下午1:50:53 */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - - public static final String VALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula"); - public static final String INVALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"); + private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"); public static final int DEFUAL_FOMULA_LENGTH = 103; public static final String ELLIPSIS = "..."; + public static final int KEY_CODE_A = 64; + public static final int KEY_CODE_Z = 91; + public static final String CHECK_RESULT = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"); + public static final String CONTINUE = Toolkit.i18nText("Fine-Design_Basic_Formula_Continue"); + public static final String CAL_RESULT = Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result"); + public static final String NEWLINE = "\n"; + public static final String ERROR_POSITION = Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position"); + public static final String FORMULA_ICON = "/com/fr/design/images/m_file/formula.png"; + public static final String PARAM_ICON = "/com/fr/design/images/m_file/param.png"; + public static final int KEY_CODE_$ = 515; private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; private RSyntaxTextArea formulaTextArea; private UITextField keyWordTextField = new UITextField(18); private int currentPosition = 0; private int beginPosition = 0; private int insertPosition = 0; + protected static UICheckBox autoCompletionCheck; + protected static UICheckBox checkBeforeColse; private JList tipsList; protected DefaultListModel listModel = new DefaultListModel(); private int ifHasBeenWriten = 0; @@ -131,6 +151,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private DefaultListModel functionNameModel; private JList functionNameList; private UITableEditorPane editor4CalPane; + private FormulaPaneAutoCompletion autoCompletion; + private static DefaultCompletionProvider COMPLETION_PROVIDER = null; + private static final Map PARAM_PREFIX_MAP = new HashMap<>(); public FormulaPane() { initComponents(); @@ -139,6 +162,21 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initFormulaTextAreaKeyListener() { formulaTextArea.addKeyListener(this); formulaTextArea.addKeyListener(new KeyAdapter() { + //用来判断一下是不是组合键 + + @Override + public void keyTyped(KeyEvent e) { + if (inKeyCodeRange(e) && autoCompletionCheck.isSelected()) { + autoCompletion.doCompletion(); + } + } + + private boolean inKeyCodeRange(KeyEvent e) { + //|| e.getExtendedKeyCode() == + return (e.getExtendedKeyCode() > KEY_CODE_A && e.getExtendedKeyCode() < KEY_CODE_Z); + } + + @Override public void keyReleased(KeyEvent e) { formulaTextArea.setForeground(Color.black); String text = formulaTextArea.getText(); @@ -150,6 +188,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { insertPosition = 0; formulaTextArea.setText(text); } + if (e.getExtendedKeyCode() == KEY_CODE_$) { + autoCompletion.doCompletion(); + } } }); } @@ -174,7 +215,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { beginPosition = getBeginPosition(); insertPosition = beginPosition; firstStepToFindTips(beginPosition); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } } } }); @@ -204,7 +247,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (e.getKeyCode() == KeyEvent.VK_ENTER) { String toFind = keyWordTextField.getText(); search(toFind, false); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } e.consume(); } } @@ -213,28 +258,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initTipsPane() { // tipsPane - JPanel tipsPane = new JPanel(new BorderLayout(4, 4)); - this.add(tipsPane, BorderLayout.EAST); - JPanel searchPane = new JPanel(new BorderLayout(4, 4)); + JPanel searchPane = new JPanel(new BorderLayout(4, 1)); + this.add(searchPane, BorderLayout.NORTH); searchPane.add(keyWordTextField, BorderLayout.CENTER); UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search")); + UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":" + + " "); + formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); searchPane.add(searchButton, BorderLayout.EAST); - tipsPane.add(searchPane, BorderLayout.NORTH); + searchPane.add(formulaLabel, BorderLayout.WEST); initKeyWordTextFieldKeyListener(); tipsList = new JList(listModel); tipsList.addMouseListener(new DoubleClick()); - UIScrollPane tipsScrollPane = new UIScrollPane(tipsList); - tipsScrollPane.setPreferredSize(new Dimension(170, 75)); - tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); - tipsPane.add(tipsScrollPane, BorderLayout.CENTER); - searchButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String toFind = keyWordTextField.getText(); - search(toFind, false); - formulaTextArea.requestFocusInWindow(); - fixFunctionNameList(); + searchButton.addActionListener(e -> { + String toFind = keyWordTextField.getText(); + search(toFind, false); + popTips(); + formulaTextArea.requestFocusInWindow(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); } }); } @@ -254,18 +297,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initTextPane() { // text - JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); - JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":" - + " "); - formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); initFormulaTextArea(); UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); formulaTextAreaScrollPane.setBorder(null); - textPane.add(formulaLabel, BorderLayout.NORTH); textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); @@ -275,19 +313,105 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkValidButton.addActionListener(checkValidActionListener); calButton.addActionListener(calculateActionListener); + //靠左流式布局 JPanel checkBoxPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkBoxPane.setPreferredSize(new Dimension(450, 30)); checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); - checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); - checkBoxandbuttonPane.add(calButton, BorderLayout.EAST); + //靠右流式布局 + JPanel buttonPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + buttonPane.add(checkValidButton, BorderLayout.EAST); + buttonPane.add(calButton, BorderLayout.EAST); + checkBoxandbuttonPane.add(buttonPane, BorderLayout.EAST); + if (autoCompletionCheck == null) { + autoCompletionCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_AutoCompletion")); + autoCompletionCheck.setSelected(true); + } + if (checkBeforeColse == null) { + checkBeforeColse = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Before_Closed")); + checkBeforeColse.setSelected(true); + } + checkBoxPane.add(autoCompletionCheck, BorderLayout.WEST); + checkBoxPane.add(checkBeforeColse, BorderLayout.WEST); extendCheckBoxPane(checkBoxPane); ParameterTableModel model = new ParameterTableModel(0); editor4CalPane = new UITableEditorPane<>(model); + formulaTextArea.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + // 获得焦点时 安装 + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); + } + } + + @Override + public void focusLost(FocusEvent e) { + // 失去焦点时 卸载 + uninstallAutoCompletion(); + } + }); + } + + private CompletionProvider createCompletionProvider() { + if (COMPLETION_PROVIDER == null) { + COMPLETION_PROVIDER = new DefaultCompletionProvider(); + NameAndDescription[] nameAndDescriptions = FunctionConstants.ALL.getDescriptions(); + for (NameAndDescription nameAndDescription : nameAndDescriptions) { + COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, nameAndDescription.getName(), BaseUtils.readIcon(FORMULA_ICON))); + } + + VariableResolver variableResolver = VariableResolver.DEFAULT; + List allParameters = new ArrayList<>(); + allParameters.addAll(Arrays.asList(variableResolver.resolveCurReportVariables())); + allParameters.addAll(Arrays.asList(variableResolver.resolveColumnNames())); + allParameters.addAll(Arrays.asList(variableResolver.resolveGlobalParameterVariables())); + allParameters.addAll(Arrays.asList(variableResolver.resolveReportParameterVariables())); + allParameters.addAll(Arrays.asList(variableResolver.resolveTableDataParameterVariables())); + + //先把参数前缀拿出来 + for (String parameter : allParameters) { + String paramWithoutPre; + if (parameter.startsWith("$$")) { + paramWithoutPre = parameter.substring(2); + PARAM_PREFIX_MAP.put(paramWithoutPre, "$$"); + } else if (parameter.startsWith("$")) { + paramWithoutPre = parameter.substring(1); + PARAM_PREFIX_MAP.put(paramWithoutPre, "$"); + } else { + paramWithoutPre = parameter; + PARAM_PREFIX_MAP.put(paramWithoutPre, StringUtils.EMPTY); + } + COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); + } + COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, "$$$", BaseUtils.readIcon(PARAM_ICON))); + + return COMPLETION_PROVIDER; + } + return COMPLETION_PROVIDER; + } + + public static boolean containsParam(String param) { + return PARAM_PREFIX_MAP.containsKey(param); + } + + public static String getParamPrefix(String param) { + return PARAM_PREFIX_MAP.getOrDefault(param, StringUtils.EMPTY); + } + + private void uninstallAutoCompletion() { + if (autoCompletion != null) { + autoCompletion.uninstall(); + autoCompletion = null; + } } protected void extendCheckBoxPane(JPanel checkBoxPane) { + // do nothing } @@ -341,7 +465,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void singleClickActuator(String currentLineContent) { refreshDescriptionTextArea(currentLineContent); formulaTextArea.requestFocusInWindow(); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } } private void doubleClickActuator(String currentLineContent) { @@ -405,43 +531,41 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { beginPosition = getBeginPosition(); insertPosition = beginPosition; firstStepToFindTips(beginPosition); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } ifHasBeenWriten = 1; } } } - private void fixFunctionNameList() { - if (tipsList.getSelectedValue() != null) { - int signOfContinue = 1; - int indexOfFunction = 0; - for (int i = 0; i < functionTypeListModel.size(); i++) { - int signOfType = 0; - FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); - NameAndDescription[] nads = functionType.getDescriptions(); - if (signOfContinue == 1) { - functionNameModel.removeAllElements(); - String functionName = ((String) tipsList.getSelectedValue()); - for (int k = 0; k < nads.length; k++) { - functionNameModel.addElement(nads[k]); - if (functionName.equals(nads[k].getName()))//若相等,找出显示的函数的index,setSelectedIndex() - { - signOfType = 1; - signOfContinue = 0; - indexOfFunction = k; - } + private void fixFunctionNameList(String functionName) { + int signOfContinue = 1; + int indexOfFunction = 0; + for (int i = 0; i < functionTypeListModel.size(); i++) { + int signOfType = 0; + FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); + NameAndDescription[] nads = functionType.getDescriptions(); + if (signOfContinue == 1) { + functionNameModel.removeAllElements(); + for (int k = 0; k < nads.length; k++) { + functionNameModel.addElement(nads[k]); + if (functionName.equals(nads[k].getName()))//若相等,找出显示的函数的index,setSelectedIndex() + { + signOfType = 1; + signOfContinue = 0; + indexOfFunction = k; } + } - if (signOfType == 1) { - functionTypeList.setSelectedIndex(i); - signOfType = 0; - } + if (signOfType == 1) { + functionTypeList.setSelectedIndex(i); + signOfType = 0; } } - functionNameList.setSelectedIndex(indexOfFunction); - functionNameList.ensureIndexIsVisible(indexOfFunction); } - + functionNameList.setSelectedIndex(indexOfFunction); + functionNameList.ensureIndexIsVisible(indexOfFunction); } private int getBeginPosition() { @@ -492,9 +616,17 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // do nothing } + private void popTips() { + JPopupMenu popupMenu = new JPopupMenu(); + JScrollPane tipsScrollPane = new JScrollPane(tipsList); + popupMenu.add(tipsScrollPane); + tipsScrollPane.setPreferredSize(new Dimension(240, 146)); + tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + popupMenu.show(keyWordTextField, 0, 23); + } + protected void search(String keyWord, boolean findDescription) { listModel.removeAllElements(); - keyWord = removeAllSpace(keyWord); if (keyWord.length() != 0) { NameAndDescription[] descriptions = FunctionConstants.ALL.getDescriptions(); @@ -610,7 +742,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { beginPosition = getBeginPosition(); insertPosition = beginPosition; firstStepToFindTips(beginPosition); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } ifHasBeenWriten = 1; } else { this.formulaTextArea.setText(content); @@ -618,7 +752,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { beginPosition = getBeginPosition(); insertPosition = beginPosition; firstStepToFindTips(beginPosition); - fixFunctionNameList(); + if (tipsList.getSelectedValue() != null) { + fixFunctionNameList(tipsList.getSelectedValue().toString()); + } ifHasBeenWriten = 1; } } @@ -650,17 +786,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public void actionPerformed(ActionEvent evt) { // Execute Formula default cell element. String formulaText = formulaTextArea.getText().trim(); - String formulaValidMessage; - try { - formulaValidMessage = FormulaChecker.check(formulaText); - showMessageDialog(formulaValidMessage + "."); - } catch (FormulaCheckerException e) { - formulaValidMessage = e.getMessage(); - showMessageDialog(formulaValidMessage + ".", false); - } + FormulaCheckResult checkResult = FormulaChecker.check(formulaText); + confirmCheckResult(checkResult); } }; + private final ActionListener calculateActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -671,20 +802,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return; } - String formulaValidMessage; - boolean formulaValid; - try { - formulaValidMessage = FormulaChecker.check(formulaText); - formulaValid = true; - } catch (FormulaCheckerException formulaCheckerException) { - formulaValidMessage = formulaCheckerException.getMessage(); - formulaValid = false; - } String messageTips; - if (ComparatorUtils.equals(formulaValidMessage, INVALID_FORMULA)) { - messageTips = INVALID_FORMULA; - } else { - messageTips = ComparatorUtils.equals(formulaValidMessage, VALID_FORMULA) ? "" : formulaValidMessage + "\n"; + FormulaCheckResult checkResult = FormulaChecker.check(formulaText); + if (checkResult.isValid()) { + messageTips = checkResult.getTips() + NEWLINE; Map paramsMap = setParamsIfExist(formulaText); Calculator calculator = Calculator.createCalculator(); ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap); @@ -704,19 +825,42 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String objectToString = EssentialUtils.objectToString(value); String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; - messageTips = messageTips + - Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; + messageTips = messageTips + CAL_RESULT + ":" + result; FineLoggerFactory.getLogger().info("value:{}", value); } catch (UtilEvalError utilEvalError) { - FineLoggerFactory.getLogger().error("", utilEvalError); + FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError); } + } else { + messageTips = checkResult.getTips(); + } + if (checkResult.isValid()) { + showMessageDialog(messageTips, checkResult.isValid()); + } else { + confirmCheckResult(checkResult); } - showMessageDialog(messageTips, formulaValid); } }; - private void showMessageDialog(String message) { - showMessageDialog(message, true); + private boolean confirmCheckResult(FormulaCheckResult checkResult) { + if (checkResult.isValid()) { + showMessageDialog(checkResult.getTips(), checkResult.isValid()); + } else { + int confirmDialog = FineJOptionPane.showConfirmDialog( + FormulaPane.this, + checkResult.getTips() + ", " + ERROR_POSITION + ":" + (checkResult.getFormulaCoordinates().getColumns()) + ".", + CONFIRM_DIALOG_TITLE, + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE, + null, + new String[]{CHECK_RESULT, CONTINUE}, + CHECK_RESULT); + if (confirmDialog == 0) { + formulaTextArea.setCaretPosition(checkResult.getFormulaCoordinates().getColumns()); + formulaTextArea.requestFocus(); + return false; + } + } + return true; } private void showMessageDialog(String message, boolean formulaValid) { @@ -750,6 +894,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return null; } + @Override + public boolean confirmContinueBeforeDoOK() { + if (checkBeforeColse.isSelected()) { + String formula = formulaTextArea.getText().trim(); + FormulaCheckResult checkResult = FormulaChecker.check(formula); + if (!checkResult.isValid()) { + return confirmCheckResult(checkResult); + } + } + return true; + } + private Map setParamsIfExist(String formulaText) { Map parameterMap = new HashMap<>(); try { @@ -990,7 +1146,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initDescriptionTextArea() { // Description - descriptionTextArea = new UITextArea(16, 27); + descriptionTextArea = new UITextArea(); + descriptionTextArea.setPreferredSize(new Dimension(350, 200)); UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea); desScrollPane.setBorder(null); @@ -1191,6 +1348,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } }; + public void refreshText(String line) { + refreshDescriptionTextArea(line); + } + public void populate(VariableResolver variableResolver) { // varibale tree. DefaultTreeModel variableModel = (DefaultTreeModel) variablesTree.getModel(); @@ -1326,12 +1487,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { buffer.append(name.toUpperCase()); buffer.append("\""); buffer.append("|"); - buffer.append("\n"); + buffer.append(NEWLINE); buffer.append("\""); buffer.append(name.toLowerCase()); buffer.append("\""); buffer.append("|"); - buffer.append("\n"); + buffer.append(NEWLINE); } FineLoggerFactory.getLogger().debug(buffer.toString()); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index e08f7e3b4..ab49b605d 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -3,11 +3,10 @@ package com.fr.design.formula; import com.fr.base.BaseFormula; import com.fr.design.gui.icheckbox.UICheckBox; - -import javax.swing.*; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; /** * @author richie @@ -41,8 +40,8 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { reserveCheckBox4Write = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Save_Formula")); reserveCheckBox4Write.setSelected(false); - checkBoxPane.add(reserveCheckBox4Result, BorderLayout.CENTER); - checkBoxPane.add(reserveCheckBox4Write, BorderLayout.SOUTH); + checkBoxPane.add(reserveCheckBox4Result, BorderLayout.WEST); + checkBoxPane.add(reserveCheckBox4Write, BorderLayout.WEST); } @Override diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java new file mode 100644 index 000000000..44f3d59b4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java @@ -0,0 +1,48 @@ +package com.fr.design.formula.exception; + +import com.fr.design.formula.FormulaChecker; +import com.fr.design.formula.exception.function.FormulaCheckWrongFunction; +import com.fr.design.formula.exception.function.MismatchedCharFunction; +import com.fr.design.formula.exception.function.MismatchedTokenFunction; +import com.fr.design.formula.exception.function.NoViableAltForCharFunction; +import com.fr.design.formula.exception.function.NoViableAltFunction; +import com.fr.script.checker.exception.FunctionCheckWrongException; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.third.antlr.MismatchedCharException; +import com.fr.third.antlr.MismatchedTokenException; +import com.fr.third.antlr.NoViableAltException; +import com.fr.third.antlr.NoViableAltForCharException; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/26 + */ +public class FormulaExceptionTipsProcessor { + private static final Map> EXCEPTION_TIPS = new ConcurrentHashMap<>(); + + private static final FormulaExceptionTipsProcessor PROCESSOR = new FormulaExceptionTipsProcessor(); + + static { + EXCEPTION_TIPS.put(FunctionCheckWrongException.class, FormulaCheckWrongFunction.getFunction()); + EXCEPTION_TIPS.put(MismatchedCharException.class, MismatchedCharFunction.getFunction()); + EXCEPTION_TIPS.put(MismatchedTokenException.class, MismatchedTokenFunction.getFunction()); + EXCEPTION_TIPS.put(NoViableAltException.class, NoViableAltFunction.getFunction()); + EXCEPTION_TIPS.put(NoViableAltForCharException.class, NoViableAltForCharFunction.getFunction()); + + } + + public FormulaCheckResult getExceptionTips(Exception e) { + return EXCEPTION_TIPS.getOrDefault(e.getClass(), + e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID)) + .apply(e); + } + + public static FormulaExceptionTipsProcessor getProcessor() { + return PROCESSOR; + } +} diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java new file mode 100644 index 000000000..6e3af75c5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java @@ -0,0 +1,31 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.i18n.Toolkit; + +/** + * @author Hoky + * @date 2021/10/28 + */ +public class FormulaCheckConstants { + public final static String EXPECTING = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": "; + public final static String FOUND = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"); + public final static String EXPECTING_ANYTHING = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything"); + public final static String GOT_IT_ANYWAY = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_GotItAnyway"); + public final static String TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Token"); + public final static String IN_RANGE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_In_Range"); + public final static String CHECK_NOT = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Not"); + public final static String ONE_OF = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ONE_OF"); + public final static String UNEXPECTED_TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_Token"); + public final static String UNEXPECTED_CHAR = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_Char"); + public final static String UNEXPECTED_END_OF_SUBTREE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_End_Of_Subtree"); + public final static String UNEXPECTED_AST_NODE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_AST_Node"); + public final static String MISMATCHED_TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Token"); + public final static String MISMATCHED_CHAR = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Char"); + public final static String MISMATCHED_EOF = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF"); + public static final String COLON = ":"; + public static final String LEFT = "("; + public static final String COMMON = ","; + public static final String RIGHT = ")"; + public static final String BLANK = " "; + public static final String SINGLE_QUOTES = "'"; +} diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java new file mode 100644 index 000000000..274868989 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java @@ -0,0 +1,74 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.i18n.Toolkit; +import com.fr.script.checker.exception.FunctionCheckWrongException; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.script.rules.FunctionParameterType; +import com.fr.script.rules.FunctionRule; +import com.fr.stable.StringUtils; + +import java.util.List; +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/26 + */ +public class FormulaCheckWrongFunction implements Function { + private final static FormulaCheckWrongFunction FUNCTION = new FormulaCheckWrongFunction(); + + @Override + public FormulaCheckResult apply(Exception e) { + if (e instanceof FunctionCheckWrongException) { + FunctionCheckWrongException ce = (FunctionCheckWrongException) e; + List rules = ce.getRules(); + String functionName = ce.getFunctionName(); + StringBuilder errorMsg = new StringBuilder(functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Error_Tips") + FormulaCheckConstants.COLON); + for (int i = 0; i < rules.size(); i++) { + errorMsg.append(FormulaCheckConstants.LEFT); + if (rules.get(i).getParameterList().isEmpty()) { + errorMsg.append(Toolkit.i18nText("Fine-Design_Basic_Formula_No_Param")); + } + for (FunctionParameterType functionParameterType : rules.get(i).getParameterList()) { + errorMsg.append(getTypeString(functionParameterType)).append(FormulaCheckConstants.COMMON); + } + if (FormulaCheckConstants.COMMON.equals(errorMsg.charAt(errorMsg.length() - 1) + StringUtils.EMPTY)) { + errorMsg.deleteCharAt(errorMsg.length() - 1); + } + errorMsg.append(FormulaCheckConstants.RIGHT); + if (i != rules.size() - 1) { + errorMsg.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Or")); + } + } + return new FormulaCheckResult(false, errorMsg.toString(), new FormulaCoordinates(1, indexPosition(ce.getFormulaText(), ce.getNode().toString()))); + } + return new FormulaCheckResult(false, StringUtils.EMPTY, new FormulaCoordinates(-1, -1)); + } + + private static String getTypeString(FunctionParameterType type) { + switch (type) { + case NUMBER: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Number"); + case STRING: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_String"); + case ANY: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Any"); + case DATE: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Date"); + case BOOLEAN: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Boolean"); + case ARRAY: + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ParamType_Array"); + } + return StringUtils.EMPTY; + } + + public static Function getFunction() { + return FUNCTION; + } + + private int indexPosition(String formulaText, String invalidFormula) { + return formulaText.indexOf(invalidFormula); + } +} diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java new file mode 100644 index 000000000..e63353a08 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java @@ -0,0 +1,103 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.formula.FormulaChecker; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.third.antlr.MismatchedCharException; + +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/28 + */ +public class MismatchedCharFunction implements Function { + private final static MismatchedCharFunction FUNCTION = new MismatchedCharFunction(); + + @Override + public FormulaCheckResult apply(Exception e) { + if (e instanceof MismatchedCharException) { + MismatchedCharException charException = (MismatchedCharException) e; + FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1); + return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates); + } + return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID); + } + + public static Function getFunction() { + return FUNCTION; + } + + private String getMessage(MismatchedCharException charException) { + StringBuffer sb = new StringBuffer(); + switch (charException.mismatchType) { + case 1: + sb.append(FormulaCheckConstants.EXPECTING); + appendCharName(sb, charException.expecting); + sb.append(FormulaCheckConstants.COMMON) + .append(FormulaCheckConstants.BLANK) + .append(FormulaCheckConstants.FOUND); + appendCharName(sb, charException.foundChar); + break; + case 2: + sb.append(FormulaCheckConstants.EXPECTING_ANYTHING) + .append(FormulaCheckConstants.BLANK) + .append(FormulaCheckConstants.SINGLE_QUOTES); + appendCharName(sb, charException.expecting); + sb.append("';").append(FormulaCheckConstants.GOT_IT_ANYWAY); + break; + case 3: + case 4: + sb.append(FormulaCheckConstants.EXPECTING).append(FormulaCheckConstants.TOKEN); + if (charException.mismatchType == 4) { + sb.append(FormulaCheckConstants.CHECK_NOT); + } + + sb.append(FormulaCheckConstants.IN_RANGE).append(": "); + appendCharName(sb, charException.expecting); + sb.append(".."); + appendCharName(sb, charException.upper); + sb.append(", ").append(FormulaCheckConstants.FOUND); + appendCharName(sb, charException.foundChar); + break; + case 5: + case 6: + sb.append(FormulaCheckConstants.EXPECTING) + .append(charException.mismatchType == 6 ? FormulaCheckConstants.CHECK_NOT : FormulaCheckConstants.BLANK) + .append(FormulaCheckConstants.ONE_OF).append(" ("); + int[] elems = charException.set.toArray(); + + for (int i = 0; i < elems.length; ++i) { + appendCharName(sb, elems[i]); + } + + sb.append("), ").append(FormulaCheckConstants.FOUND); + appendCharName(sb, charException.foundChar); + break; + default: + sb.append(FormulaCheckConstants.MISMATCHED_CHAR); + } + + return sb.toString(); + } + + private void appendCharName(StringBuffer sb, int c) { + switch (c) { + case 9: + sb.append("'\\t'"); + break; + case 10: + sb.append("'\\n'"); + break; + case 13: + sb.append("'\\r'"); + break; + case 65535: + sb.append(FormulaCheckConstants.MISMATCHED_EOF); + break; + default: + sb.append((char) c); + } + + } +} 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 new file mode 100644 index 000000000..eb825e3b2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java @@ -0,0 +1,139 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.formula.FormulaChecker; +import com.fr.log.FineLoggerFactory; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.stable.StringUtils; +import com.fr.third.antlr.MismatchedTokenException; + +import java.lang.reflect.Field; +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/28 + */ +public class MismatchedTokenFunction implements Function { + private final static MismatchedTokenFunction FUNCTION = new MismatchedTokenFunction(); + public static final String NULL_STRING = "null"; + + @Override + public FormulaCheckResult apply(Exception e) { + if (e instanceof MismatchedTokenException) { + MismatchedTokenException charException = (MismatchedTokenException) e; + FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1); + return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates); + } + return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID); + } + + public static Function getFunction() { + return FUNCTION; + } + + public String getMessage(MismatchedTokenException exception) { + StringBuilder sb = new StringBuilder(); + Object fieldValue = getFieldValue(exception, "tokenText"); + String tokenText = fieldValue == null ? NULL_STRING : fieldValue.toString(); + switch (exception.mismatchType) { + case 1: + sb.append(FormulaCheckConstants.EXPECTING) + .append(tokenName(exception.expecting, exception)) + .append(", ") + .append(FormulaCheckConstants.FOUND) + .append(FormulaCheckConstants.BLANK + FormulaCheckConstants.SINGLE_QUOTES) + .append(tokenText).append("'"); + break; + case 2: + sb.append(FormulaCheckConstants.EXPECTING_ANYTHING) + .append(tokenName(exception.expecting, exception)) + .append("; ") + .append(FormulaCheckConstants.GOT_IT_ANYWAY); + break; + case 3: + sb.append(FormulaCheckConstants.EXPECTING) + .append(FormulaCheckConstants.TOKEN) + .append(FormulaCheckConstants.IN_RANGE) + .append(": ") + .append(tokenName(exception.expecting, exception)) + .append("..") + .append(tokenName(exception.upper, exception)) + .append(", ").append(FormulaCheckConstants.FOUND) + .append("'").append(tokenText).append("'"); + break; + case 4: + sb.append(FormulaCheckConstants.EXPECTING) + .append(FormulaCheckConstants.TOKEN) + .append(FormulaCheckConstants.CHECK_NOT) + .append(FormulaCheckConstants.IN_RANGE) + .append(": ") + .append(tokenName(exception.expecting, exception)) + .append("..") + .append(tokenName(exception.upper, exception)) + .append(","). + append(FormulaCheckConstants.FOUND) + .append(" '") + .append(tokenText) + .append("'"); + break; + case 5: + case 6: + sb.append(FormulaCheckConstants.EXPECTING) + .append(exception.mismatchType == 6 ? FormulaCheckConstants.CHECK_NOT : FormulaCheckConstants.BLANK) + .append(FormulaCheckConstants.ONE_OF).append("("); + int[] elms = exception.set.toArray(); + + for (int i = 0; i < elms.length; ++i) { + sb.append(' '); + sb.append(tokenName(elms[i], exception)); + } + + sb.append("),") + .append(FormulaCheckConstants.FOUND) + .append("'") + .append(tokenText) + .append("'"); + break; + default: + sb.append(FormulaCheckConstants.MISMATCHED_TOKEN); + } + + return sb.toString(); + } + + private String tokenName(int tokenType, MismatchedTokenException exception) { + if (tokenType == 0) { + return ""; + } else { + String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); + return tokenType >= 0 && tokenType < tokenNames.length ? translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; + } + } + + private String translateToken(String token) { + switch (token) { + case ("RPAREN"): + return ")"; + case ("LPAREN"): + return "("; + case ("COMMA"): + return ","; + case ("COLON"): + return ":"; + default: + return token; + } + } + + private Object getFieldValue(Object object, String fieldName) { + try { + Field field = object.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + return field.get(object); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + return StringUtils.EMPTY; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java new file mode 100644 index 000000000..dda2577c7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java @@ -0,0 +1,43 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.formula.FormulaChecker; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.third.antlr.NoViableAltForCharException; + +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/28 + */ +public class NoViableAltForCharFunction implements Function { + private final static NoViableAltForCharFunction FUNCTION = new NoViableAltForCharFunction(); + + @Override + public FormulaCheckResult apply(Exception e) { + if (e instanceof NoViableAltForCharException) { + NoViableAltForCharException charException = (NoViableAltForCharException) e; + FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1); + return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates); + } + return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID); + } + + public static Function getFunction() { + return FUNCTION; + } + + public String getMessage(NoViableAltForCharException exception) { + String mesg = FormulaCheckConstants.UNEXPECTED_CHAR + ": "; + if (exception.foundChar >= ' ' && exception.foundChar <= '~') { + mesg = mesg + '\''; + mesg = mesg + exception.foundChar; + mesg = mesg + '\''; + } else { + mesg = mesg + exception.foundChar + "(0x" + Integer.toHexString(exception.foundChar).toUpperCase() + ")"; + } + + return mesg; + } +} diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java new file mode 100644 index 000000000..aa7c7d3ec --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java @@ -0,0 +1,40 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.formula.FormulaChecker; +import com.fr.script.checker.result.FormulaCheckResult; +import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.third.antlr.NoViableAltException; +import com.fr.third.antlr.TreeParser; + +import java.util.function.Function; + +/** + * @author Hoky + * @date 2021/10/28 + */ +public class NoViableAltFunction implements Function { + private final static NoViableAltFunction FUNCTION = new NoViableAltFunction(); + + @Override + public FormulaCheckResult apply(Exception e) { + if (e instanceof NoViableAltException) { + NoViableAltException altException = (NoViableAltException) e; + FormulaCoordinates formulaCoordinates = new FormulaCoordinates(altException.line, altException.column - 1); + return new FormulaCheckResult(false, getMessage(altException), formulaCoordinates); + } + return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID); + } + + public static Function getFunction() { + return FUNCTION; + } + + public String getMessage(NoViableAltException exception) { + if (exception.token != null) { + return FormulaCheckConstants.UNEXPECTED_TOKEN + ": " + exception.token.getText(); + } else { + return exception.node == TreeParser.ASTNULL ? FormulaCheckConstants.UNEXPECTED_END_OF_SUBTREE : + FormulaCheckConstants.UNEXPECTED_AST_NODE + ": " + exception.node.toString(); + } + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java new file mode 100644 index 000000000..e704a6bdd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java @@ -0,0 +1,1003 @@ +/* + * 12/21/2008 + * + * AutoCompletePopupWindow.java - A window containing a list of auto-complete + * choices. + * + * This library is distributed under a modified BSD license. See the included + * RSyntaxTextArea.License.txt file for details. + */ +package com.fr.design.gui.autocomplete; + +import com.fr.design.formula.FormulaPane; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator; +import com.fr.log.FineLoggerFactory; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JWindow; +import javax.swing.KeyStroke; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.plaf.ListUI; +import javax.swing.text.Caret; +import javax.swing.text.JTextComponent; +import java.awt.BorderLayout; +import java.awt.ComponentOrientation; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.List; + + +/** + * The actual popup window of choices. When visible, this window intercepts + * certain keystrokes in the parent text component and uses them to navigate + * the completion choices instead. If Enter or Escape is pressed, the window + * hides itself and notifies the {@link AutoCompletion} to insert the selected + * text. + * + * @author Robert Futrell + * @version 1.0 + */ +class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, + ListSelectionListener, MouseListener { + + private final static int DIS = 5; + /** + * The parent AutoCompletion instance. + */ + private FormulaPaneAutoCompletion ac; + + /** + * The list of completion choices. + */ + private JList list; + + /** + * The contents of {@link #list()}. + */ + private CompletionListModel model; + + /** + * A hack to work around the fact that we clear our completion model (and + * our selection) when hiding the completion window. This allows us to + * still know what the user selected after the popup is hidden. + */ + private Completion lastSelection; + + /** + * Optional popup window containing a description of the currently + * selected completion. + */ + private AutoCompleteDescWindow descWindow; + + /** + * The preferred size of the optional description window. This field + * only exists because the user may (and usually will) set the size of + * the description window before it exists (it must be parented to a + * Window). + */ + private Dimension preferredDescWindowSize; + + private FormulaPane.VariableTreeAndDescriptionArea component; + + /** + * Whether the completion window and the optional description window + * should be displayed above the current caret position (as opposed to + * underneath it, which is preferred unless there is not enough space). + */ + private boolean aboveCaret; + + private int lastLine; + + private KeyActionPair escapeKap; + private KeyActionPair upKap; + private KeyActionPair downKap; + private KeyActionPair leftKap; + private KeyActionPair rightKap; + private KeyActionPair enterKap; + private KeyActionPair tabKap; + private KeyActionPair homeKap; + private KeyActionPair endKap; + private KeyActionPair pageUpKap; + private KeyActionPair pageDownKap; + private KeyActionPair ctrlCKap; + + private KeyActionPair oldEscape, oldUp, oldDown, oldLeft, oldRight, + oldEnter, oldTab, oldHome, oldEnd, oldPageUp, oldPageDown, + oldCtrlC; + + /** + * The space between the caret and the completion popup. + */ + private static final int VERTICAL_SPACE = 1; + + /** + * The class name of the Substance List UI. + */ + private static final String SUBSTANCE_LIST_UI = + "org.pushingpixels.substance.internal.ui.SubstanceListUI"; + + + /** + * Constructor. + * + * @param parent The parent window (hosting the text component). + * @param ac The auto-completion instance. + */ + public FormulaAutoCompletePopupWindow(Window parent, final FormulaPaneAutoCompletion ac) { + + super(parent); + ComponentOrientation o = ac.getTextComponentOrientation(); + + this.ac = ac; + model = new CompletionListModel(); + list = new PopupList(model); + + list.setCellRenderer(new DelegatingCellRenderer()); + list.addListSelectionListener(this); + list.addMouseListener(this); + + JPanel contentPane = new JPanel(new BorderLayout()); + JScrollPane sp = new JScrollPane(list, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + + // In 1.4, JScrollPane.setCorner() has a bug where it won't accept + // JScrollPane.LOWER_TRAILING_CORNER, even though that constant is + // defined. So we have to put the logic added in 1.5 to handle it + // here. + JPanel corner = new SizeGrip(); + //sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, corner); + boolean isLeftToRight = o.isLeftToRight(); + String str = isLeftToRight ? JScrollPane.LOWER_RIGHT_CORNER : + JScrollPane.LOWER_LEFT_CORNER; + sp.setCorner(str, corner); + + contentPane.add(sp); + setContentPane(contentPane); + applyComponentOrientation(o); + + // Give apps a chance to decorate us with drop shadows, etc. + if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) { + PopupWindowDecorator decorator = PopupWindowDecorator.get(); + if (decorator != null) { + decorator.decorate(this); + } + } + + pack(); + + setFocusableWindowState(false); + + lastLine = -1; + + } + + + public void caretUpdate(CaretEvent e) { + if (isVisible()) { // Should always be true + int line = ac.getLineOfCaret(); + if (line != lastLine) { + lastLine = -1; + setVisible(false); + } else { + doAutocomplete(); + } + } else if (AutoCompletion.isDebug()) { + Thread.dumpStack(); + } + } + + + /** + * Creates the description window. + * + * @return The description window. + */ + private AutoCompleteDescWindow createDescriptionWindow() { + AutoCompleteDescWindow dw = new AutoCompleteDescWindow(this, ac); + dw.applyComponentOrientation(ac.getTextComponentOrientation()); + Dimension size = preferredDescWindowSize; + if (size == null) { + size = getSize(); + } + dw.setSize(size); + return dw; + } + + + /** + * Creates the mappings from keys to Actions we'll be putting into the + * text component's ActionMap and InputMap. + */ + private void createKeyActionPairs() { + + // Actions we'll install. + EnterAction enterAction = new EnterAction(); + escapeKap = new KeyActionPair("Escape", new EscapeAction()); + upKap = new KeyActionPair("Up", new UpAction()); + downKap = new KeyActionPair("Down", new DownAction()); + leftKap = new KeyActionPair("Left", new LeftAction()); + rightKap = new KeyActionPair("Right", new RightAction()); + enterKap = new KeyActionPair("Enter", enterAction); + tabKap = new KeyActionPair("Tab", enterAction); + homeKap = new KeyActionPair("Home", new HomeAction()); + endKap = new KeyActionPair("End", new EndAction()); + pageUpKap = new KeyActionPair("PageUp", new PageUpAction()); + pageDownKap = new KeyActionPair("PageDown", new PageDownAction()); + ctrlCKap = new KeyActionPair("CtrlC", new CopyAction()); + + // Buffers for the actions we replace. + oldEscape = new KeyActionPair(); + oldUp = new KeyActionPair(); + oldDown = new KeyActionPair(); + oldLeft = new KeyActionPair(); + oldRight = new KeyActionPair(); + oldEnter = new KeyActionPair(); + oldTab = new KeyActionPair(); + oldHome = new KeyActionPair(); + oldEnd = new KeyActionPair(); + oldPageUp = new KeyActionPair(); + oldPageDown = new KeyActionPair(); + oldCtrlC = new KeyActionPair(); + + } + + + protected void doAutocomplete() { + lastLine = ac.refreshPopupWindow(); + } + + + /** + * Returns the copy keystroke to use for this platform. + * + * @return The copy keystroke. + */ + private static final KeyStroke getCopyKeyStroke() { + int key = KeyEvent.VK_C; + int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + return KeyStroke.getKeyStroke(key, mask); + } + + + /** + * Returns the default list cell renderer used when a completion provider + * does not supply its own. + * + * @return The default list cell renderer. + * @see #setListCellRenderer(ListCellRenderer) + */ + public ListCellRenderer getListCellRenderer() { + DelegatingCellRenderer dcr = (DelegatingCellRenderer) list. + getCellRenderer(); + return dcr.getFallbackCellRenderer(); + } + + + /** + * Returns the selected value, or null if nothing is selected. + * + * @return The selected value. + */ + public Completion getSelection() { + return isShowing() ? (Completion) list.getSelectedValue() : lastSelection; + } + + + /** + * Inserts the currently selected completion. + * + * @see #getSelection() + */ + private void insertSelectedCompletion() { + Completion comp = getSelection(); + ac.insertCompletion(comp); + } + + public void installComp(FormulaPane.VariableTreeAndDescriptionArea component) { + this.component = component; + } + + private void refreshInstallComp() { + component.refreshText(getSelection().getReplacementText()); + } + + + /** + * Registers keyboard actions to listen for in the text component and + * intercept. + * + * @see #uninstallKeyBindings() + */ + private void installKeyBindings() { + + if (AutoCompletion.isDebug()) { + FineLoggerFactory.getLogger().debug("PopupWindow: Installing keybindings"); + } + + if (escapeKap == null) { // Lazily create actions. + createKeyActionPairs(); + } + + JTextComponent comp = ac.getTextComponent(); + InputMap im = comp.getInputMap(); + ActionMap am = comp.getActionMap(); + + replaceAction(im, am, KeyEvent.VK_ESCAPE, escapeKap, oldEscape); + if (AutoCompletion.isDebug() && oldEscape.action == escapeKap.action) { + Thread.dumpStack(); + } + replaceAction(im, am, KeyEvent.VK_UP, upKap, oldUp); + replaceAction(im, am, KeyEvent.VK_LEFT, leftKap, oldLeft); + replaceAction(im, am, KeyEvent.VK_DOWN, downKap, oldDown); + replaceAction(im, am, KeyEvent.VK_RIGHT, rightKap, oldRight); + replaceAction(im, am, KeyEvent.VK_ENTER, enterKap, oldEnter); + replaceAction(im, am, KeyEvent.VK_TAB, tabKap, oldTab); + replaceAction(im, am, KeyEvent.VK_HOME, homeKap, oldHome); + replaceAction(im, am, KeyEvent.VK_END, endKap, oldEnd); + replaceAction(im, am, KeyEvent.VK_PAGE_UP, pageUpKap, oldPageUp); + replaceAction(im, am, KeyEvent.VK_PAGE_DOWN, pageDownKap, oldPageDown); + + // Make Ctrl+C copy from description window. This isn't done + // automagically because the desc. window is not focusable, and copying + // from text components can only be done from focused components. + KeyStroke ks = getCopyKeyStroke(); + oldCtrlC.key = im.get(ks); + im.put(ks, ctrlCKap.key); + oldCtrlC.action = am.get(ctrlCKap.key); + am.put(ctrlCKap.key, ctrlCKap.action); + + comp.addCaretListener(this); + + } + + + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + insertSelectedCompletion(); + refreshInstallComp(); + } else if (e.getClickCount() == 1) { + refreshInstallComp(); + } + } + + + public void mouseEntered(MouseEvent e) { + } + + + public void mouseExited(MouseEvent e) { + } + + + public void mousePressed(MouseEvent e) { + } + + + public void mouseReleased(MouseEvent e) { + } + + + /** + * Positions the description window relative to the completion choices + * window. We assume there is room on one side of the other for this + * entire window to fit. + */ + private void positionDescWindow() { + + boolean showDescWindow = descWindow != null && ac.isShowDescWindow(); + if (!showDescWindow) { + return; + } + + // Don't use getLocationOnScreen() as this throws an exception if + // window isn't visible yet, but getLocation() doesn't, and is in + // screen coordinates! + Point p = getLocation(); + Rectangle screenBounds = Util.getScreenBoundsForPoint(p.x, p.y); + //Dimension screenSize = getToolkit().getScreenSize(); + //int totalH = Math.max(getHeight(), descWindow.getHeight()); + + // Try to position to the right first (LTR) + int x; + if (ac.getTextComponentOrientation().isLeftToRight()) { + x = getX() + getWidth() + DIS; + if (x + descWindow.getWidth() > screenBounds.x + screenBounds.width) { // doesn't fit + x = getX() - DIS - descWindow.getWidth(); + } + } else { // RTL + x = getX() - DIS - descWindow.getWidth(); + if (x < screenBounds.x) { // Doesn't fit + x = getX() + getWidth() + DIS; + } + } + + int y = getY(); + if (aboveCaret) { + y = y + getHeight() - descWindow.getHeight(); + } + + if (x != descWindow.getX() || y != descWindow.getY()) { + descWindow.setLocation(x, y); + } + + } + + + /** + * "Puts back" the original key/Action pair for a keystroke. This is used + * when this popup is hidden. + * + * @param im The input map. + * @param am The action map. + * @param key The keystroke whose key/Action pair to change. + * @param kap The (original) key/Action pair. + * @see #replaceAction(InputMap, ActionMap, int, KeyActionPair, KeyActionPair) + */ + private void putBackAction(InputMap im, ActionMap am, int key, + KeyActionPair kap) { + KeyStroke ks = KeyStroke.getKeyStroke(key, 0); + am.put(im.get(ks), kap.action); // Original action for the "new" key + im.put(ks, kap.key); // Original key for the keystroke. + } + + + /** + * Replaces a key/Action pair in an InputMap and ActionMap with a new + * pair. + * + * @param im The input map. + * @param am The action map. + * @param key The keystroke whose information to replace. + * @param kap The new key/Action pair for key. + * @param old A buffer in which to place the old key/Action pair. + * @see #putBackAction(InputMap, ActionMap, int, KeyActionPair) + */ + private void replaceAction(InputMap im, ActionMap am, int key, + KeyActionPair kap, KeyActionPair old) { + KeyStroke ks = KeyStroke.getKeyStroke(key, 0); + old.key = im.get(ks); + im.put(ks, kap.key); + old.action = am.get(kap.key); + am.put(kap.key, kap.action); + } + + + /** + * Selects the first item in the completion list. + * + * @see #selectLastItem() + */ + private void selectFirstItem() { + if (model.getSize() > 0) { + list.setSelectedIndex(0); + list.ensureIndexIsVisible(0); + } + } + + + /** + * Selects the last item in the completion list. + * + * @see #selectFirstItem() + */ + private void selectLastItem() { + int index = model.getSize() - 1; + if (index > -1) { + list.setSelectedIndex(index); + list.ensureIndexIsVisible(index); + } + } + + + /** + * Selects the next item in the completion list. + * + * @see #selectPreviousItem() + */ + private void selectNextItem() { + int index = list.getSelectedIndex(); + if (index > -1) { + index = (index + 1) % model.getSize(); + list.setSelectedIndex(index); + list.ensureIndexIsVisible(index); + } + } + + + /** + * Selects the completion item one "page down" from the currently selected + * one. + * + * @see #selectPageUpItem() + */ + private void selectPageDownItem() { + int visibleRowCount = list.getVisibleRowCount(); + int i = Math.min(list.getModel().getSize() - 1, + list.getSelectedIndex() + visibleRowCount); + list.setSelectedIndex(i); + list.ensureIndexIsVisible(i); + } + + + /** + * Selects the completion item one "page up" from the currently selected + * one. + * + * @see #selectPageDownItem() + */ + private void selectPageUpItem() { + int visibleRowCount = list.getVisibleRowCount(); + int i = Math.max(0, list.getSelectedIndex() - visibleRowCount); + list.setSelectedIndex(i); + list.ensureIndexIsVisible(i); + } + + + /** + * Selects the previous item in the completion list. + * + * @see #selectNextItem() + */ + private void selectPreviousItem() { + int index = list.getSelectedIndex(); + switch (index) { + case 0: + index = list.getModel().getSize() - 1; + break; + case -1: // Check for an empty list (would be an error) + index = list.getModel().getSize() - 1; + if (index == -1) { + return; + } + break; + default: + index = index - 1; + break; + } + list.setSelectedIndex(index); + list.ensureIndexIsVisible(index); + } + + + /** + * Sets the completions to display in the choices list. The first + * completion is selected. + * + * @param completions The completions to display. + */ + public void setCompletions(List completions) { + model.setContents(completions); + selectFirstItem(); + } + + + /** + * Sets the size of the description window. + * + * @param size The new size. This cannot be null. + */ + public void setDescriptionWindowSize(Dimension size) { + if (descWindow != null) { + descWindow.setSize(size); + } else { + preferredDescWindowSize = size; + } + } + + + /** + * Sets the default list cell renderer to use when a completion provider + * does not supply its own. + * + * @param renderer The renderer to use. If this is null, + * a default renderer is used. + * @see #getListCellRenderer() + */ + public void setListCellRenderer(ListCellRenderer renderer) { + DelegatingCellRenderer dcr = (DelegatingCellRenderer) list. + getCellRenderer(); + dcr.setFallbackCellRenderer(renderer); + } + + + /** + * Sets the location of this window to be "good" relative to the specified + * rectangle. That rectangle should be the location of the text + * component's caret, in screen coordinates. + * + * @param r The text component's caret position, in screen coordinates. + */ + public void setLocationRelativeTo(Rectangle r) { + + // Multi-monitor support - make sure the completion window (and + // description window, if applicable) both fit in the same window in + // a multi-monitor environment. To do this, we decide which monitor + // the rectangle "r" is in, and use that one (just pick top-left corner + // as the defining point). + Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y); + //Dimension screenSize = getToolkit().getScreenSize(); + + boolean showDescWindow = descWindow != null && ac.isShowDescWindow(); + int totalH = getHeight(); + if (showDescWindow) { + totalH = Math.max(totalH, descWindow.getHeight()); + } + + // Try putting our stuff "below" the caret first. We assume that the + // entire height of our stuff fits on the screen one way or the other. + aboveCaret = false; + int y = r.y + r.height + VERTICAL_SPACE; + if (y + totalH > screenBounds.height) { + y = r.y - VERTICAL_SPACE - getHeight(); + aboveCaret = true; + } + + // Get x-coordinate of completions. Try to align left edge with the + // caret first. + int x = r.x; + if (!ac.getTextComponentOrientation().isLeftToRight()) { + x -= getWidth(); // RTL => align right edge + } + if (x < screenBounds.x) { + x = screenBounds.x; + } else if (x + getWidth() > screenBounds.x + screenBounds.width) { // completions don't fit + x = screenBounds.x + screenBounds.width - getWidth(); + } + + setLocation(x, y); + + // Position the description window, if necessary. + if (showDescWindow) { + positionDescWindow(); + } + + } + + + /** + * Toggles the visibility of this popup window. + * + * @param visible Whether this window should be visible. + */ + @Override + public void setVisible(boolean visible) { + + if (visible != isVisible()) { + + if (visible) { + installKeyBindings(); + lastLine = ac.getLineOfCaret(); + selectFirstItem(); + if (descWindow == null && ac.isShowDescWindow()) { + descWindow = createDescriptionWindow(); + positionDescWindow(); + } + // descWindow needs a kick-start the first time it's displayed. + // Also, the newly-selected item in the choices list is + // probably different from the previous one anyway. + if (descWindow != null) { + Completion c = (Completion) list.getSelectedValue(); + if (c != null) { + descWindow.setDescriptionFor(c); + } + } + } else { + uninstallKeyBindings(); + } + + super.setVisible(visible); + + // Some languages, such as Java, can use quite a lot of memory + // when displaying hundreds of completion choices. We pro-actively + // clear our list model here to make them available for GC. + // Otherwise, they stick around, and consider the following: a + // user starts code-completion for Java 5 SDK classes, then hides + // the dialog, then changes the "class path" to use a Java 6 SDK + // instead. On pressing Ctrl+space, a new array of Completions is + // created. If this window holds on to the previous Completions, + // you're getting roughly 2x the necessary Completions in memory + // until the Completions are actually passed to this window. + if (!visible) { // Do after super.setVisible(false) + lastSelection = (Completion) list.getSelectedValue(); + model.clear(); + } + + // Must set descWindow's visibility one way or the other each time, + // because of the way child JWindows' visibility is handled - in + // some ways it's dependent on the parent, in other ways it's not. + if (descWindow != null) { + descWindow.setVisible(visible && ac.isShowDescWindow()); + } + + } + + } + + + /** + * Stops intercepting certain keystrokes from the text component. + * + * @see #installKeyBindings() + */ + private void uninstallKeyBindings() { + + if (AutoCompletion.isDebug()) { + FineLoggerFactory.getLogger().debug("PopupWindow: Removing keybindings"); + } + + JTextComponent comp = ac.getTextComponent(); + InputMap im = comp.getInputMap(); + ActionMap am = comp.getActionMap(); + + putBackAction(im, am, KeyEvent.VK_ESCAPE, oldEscape); + putBackAction(im, am, KeyEvent.VK_UP, oldUp); + putBackAction(im, am, KeyEvent.VK_DOWN, oldDown); + putBackAction(im, am, KeyEvent.VK_LEFT, oldLeft); + putBackAction(im, am, KeyEvent.VK_RIGHT, oldRight); + putBackAction(im, am, KeyEvent.VK_ENTER, oldEnter); + putBackAction(im, am, KeyEvent.VK_TAB, oldTab); + putBackAction(im, am, KeyEvent.VK_HOME, oldHome); + putBackAction(im, am, KeyEvent.VK_END, oldEnd); + putBackAction(im, am, KeyEvent.VK_PAGE_UP, oldPageUp); + putBackAction(im, am, KeyEvent.VK_PAGE_DOWN, oldPageDown); + + // Ctrl+C + KeyStroke ks = getCopyKeyStroke(); + am.put(im.get(ks), oldCtrlC.action); // Original action + im.put(ks, oldCtrlC.key); // Original key + + comp.removeCaretListener(this); + + } + + + /** + * Updates the LookAndFeel of this window and the description + * window. + */ + public void updateUI() { + SwingUtilities.updateComponentTreeUI(this); + if (descWindow != null) { + descWindow.updateUI(); + } + } + + + /** + * Called when a new item is selected in the popup list. + * + * @param e The event. + */ + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + Object value = list.getSelectedValue(); + if (value != null && descWindow != null) { + descWindow.setDescriptionFor((Completion) value); + positionDescWindow(); + } + } + } + + + class CopyAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + boolean doNormalCopy = false; + if (descWindow != null && descWindow.isVisible()) { + doNormalCopy = !descWindow.copy(); + } + if (doNormalCopy) { + ac.getTextComponent().copy(); + } + } + + } + + + class DownAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectNextItem(); + } + } + + } + + + class EndAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectLastItem(); + } + } + + } + + + class EnterAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + insertSelectedCompletion(); + refreshInstallComp(); + } + } + + } + + + class EscapeAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + setVisible(false); + } + } + + } + + + class HomeAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectFirstItem(); + } + } + + } + + + /** + * A mapping from a key (an Object) to an Action. + */ + private static class KeyActionPair { + + public Object key; + public Action action; + + public KeyActionPair() { + } + + public KeyActionPair(Object key, Action a) { + this.key = key; + this.action = a; + } + + } + + + class LeftAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + JTextComponent comp = ac.getTextComponent(); + Caret c = comp.getCaret(); + int dot = c.getDot(); + if (dot > 0) { + c.setDot(--dot); + // Ensure moving left hasn't moved us up a line, thus + // hiding the popup window. + if (comp.isVisible()) { + if (lastLine != -1) { + doAutocomplete(); + } + } + } + } + } + + } + + + class PageDownAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectPageDownItem(); + } + } + + } + + + class PageUpAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectPageUpItem(); + } + } + + } + + + /** + * The actual list of completion choices in this popup window. + */ + private class PopupList extends JList { + + public PopupList(CompletionListModel model) { + super(model); + } + + @Override + public void setUI(ListUI ui) { + if (Util.getUseSubstanceRenderers() && + SUBSTANCE_LIST_UI.equals(ui.getClass().getName())) { + // Substance requires its special ListUI be installed for + // its renderers to actually render (!), but long completion + // lists (e.g. PHPCompletionProvider in RSTALanguageSupport) + // will simply populate too slowly on initial display (when + // calculating preferred size of all items), so in this case + // we give a prototype cell value. + CompletionProvider p = ac.getCompletionProvider(); + BasicCompletion bc = new BasicCompletion(p, "Hello world"); + setPrototypeCellValue(bc); + } else { + // Our custom UI that is faster for long HTML completion lists. + ui = new FastListUI(); + setPrototypeCellValue(null); + } + super.setUI(ui); + } + + } + + + class RightAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + JTextComponent comp = ac.getTextComponent(); + Caret c = comp.getCaret(); + int dot = c.getDot(); + if (dot < comp.getDocument().getLength()) { + c.setDot(++dot); + // Ensure moving right hasn't moved us up a line, thus + // hiding the popup window. + if (comp.isVisible()) { + if (lastLine != -1) { + doAutocomplete(); + } + } + } + } + } + + } + + + class UpAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isVisible()) { + selectPreviousItem(); + } + } + + } + + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaCompletion.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaCompletion.java new file mode 100644 index 000000000..3b344dc35 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaCompletion.java @@ -0,0 +1,22 @@ +package com.fr.design.gui.autocomplete; + +import javax.swing.Icon; + +/** + * @author Hoky + * @date 2021/11/5 + */ +public class FormulaCompletion extends BasicCompletion { + private Icon icon; + + public FormulaCompletion(CompletionProvider provider, String replacementText, Icon icon) { + super(provider, replacementText); + this.icon = icon; + } + + @Override + public Icon getIcon() { + return icon; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaPaneAutoCompletion.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaPaneAutoCompletion.java new file mode 100644 index 000000000..8168c767d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaPaneAutoCompletion.java @@ -0,0 +1,1311 @@ +package com.fr.design.gui.autocomplete; + +import com.fr.design.formula.FormulaPane; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; +import javax.swing.Timer; +import javax.swing.UIManager; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.BadLocationException; +import javax.swing.text.Caret; +import javax.swing.text.Document; +import javax.swing.text.Element; +import javax.swing.text.JTextComponent; +import java.awt.ComponentOrientation; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; + +/** + * @author Hoky + * @date 2021/11/2 + * @description 重写一个支持刷新公式树组件的AutoCompletion + */ +public class FormulaPaneAutoCompletion extends AutoCompletion { + private FormulaPane.VariableTreeAndDescriptionArea area; + + /** + * The text component we're providing completion for. + */ + private JTextComponent textComponent; + + /** + * The parent window of {@link #textComponent}. + */ + private Window parentWindow; + + /** + * The popup window containing completion choices. + */ + private FormulaAutoCompletePopupWindow popupWindow; + + /** + * The preferred size of the completion choices window. This field exists + * because the user will likely set the preferred size of the window + * before it is actually created. + */ + private Dimension preferredChoicesWindowSize; + + /** + * The preferred size of the optional description window. This field + * only exists because the user may (and usually will) set the size of + * the description window before it exists (it must be parented to a + * Window). + */ + private Dimension preferredDescWindowSize; + + /** + * Manages any parameterized completions that are inserted. + */ + private ParameterizedCompletionContext pcc; + + /** + * Provides the completion options relevant to the current caret position. + */ + private CompletionProvider provider; + + /** + * The renderer to use for the completion choices. If this is + * null, then a default renderer is used. + */ + private ListCellRenderer renderer; + + /** + * The handler to use when an external URL is clicked in the help + * documentation. + */ + private ExternalURLHandler externalURLHandler; + + /** + * An optional redirector that converts URL's to some other location before + * being handed over to externalURLHandler. + */ + private static LinkRedirector linkRedirector; + + /** + * Whether the description window should be displayed along with the + * completion choice window. + */ + private boolean showDescWindow; + + /** + * Whether auto-complete is enabled. + */ + private boolean autoCompleteEnabled; + + /** + * Whether the auto-activation of auto-complete (after a delay, after the + * user types an appropriate character) is enabled. + */ + private boolean autoActivationEnabled; + + /** + * Whether or not, when there is only a single auto-complete option + * that matches the text at the current text position, that text should + * be auto-inserted, instead of the completion window displaying. + */ + private boolean autoCompleteSingleChoices; + + /** + * Whether parameter assistance is enabled. + */ + private boolean parameterAssistanceEnabled; + + /** + * A renderer used for {@link Completion}s in the optional parameter + * choices popup window (displayed when a {@link ParameterizedCompletion} + * is code-completed). If this isn't set, a default renderer is used. + */ + private ListCellRenderer paramChoicesRenderer; + + /** + * The keystroke that triggers the completion window. + */ + private KeyStroke trigger; + + /** + * The previous key in the text component's InputMap for the + * trigger key. + */ + private Object oldTriggerKey; + + /** + * The action previously assigned to {@link #trigger}, so we can reset it + * if the user disables auto-completion. + */ + private Action oldTriggerAction; + + /** + * The previous key in the text component's InputMap for the + * parameter completion trigger key. + */ + private Object oldParenKey; + + /** + * The action previously assigned to the parameter completion key, so we + * can reset it when we uninstall. + */ + private Action oldParenAction; + + /** + * Listens for events in the parent window that affect the visibility of + * the popup windows. + */ + private ParentWindowListener parentWindowListener; + + /** + * Listens for events from the text component that affect the visibility + * of the popup windows. + */ + private TextComponentListener textComponentListener; + + /** + * Listens for events in the text component that cause the popup windows + * to automatically activate. + */ + private AutoActivationListener autoActivationListener; + + /** + * Listens for LAF changes so the auto-complete windows automatically + * update themselves accordingly. + */ + private LookAndFeelChangeListener lafListener; + + /** + * The key used in the input map for the AutoComplete action. + */ + private static final String PARAM_TRIGGER_KEY = "AutoComplete"; + + /** + * Key used in the input map for the parameter completion action. + */ + private static final String PARAM_COMPLETE_KEY = "AutoCompletion.FunctionStart"; + + /** + * Stores how to render auto-completion-specific highlights in text + * components. + */ + private static final AutoCompletionStyleContext STYLE_CONTEXT = + new AutoCompletionStyleContext(); + + /** + * Whether debug messages should be printed to stdout as AutoCompletion + * runs. + */ + private static final boolean DEBUG = initDebug(); + + + /** + * Constructor. + * + * @param provider The completion provider. This cannot be + * null. + */ + public FormulaPaneAutoCompletion(CompletionProvider provider) { + super(provider); + setChoicesWindowSize(350, 200); + setDescriptionWindowSize(350, 250); + + setCompletionProvider(provider); + setTriggerKey(getDefaultTriggerKey()); + setAutoCompleteEnabled(true); + setAutoCompleteSingleChoices(true); + setAutoActivationEnabled(false); + setShowDescWindow(false); + parentWindowListener = new ParentWindowListener(); + textComponentListener = new TextComponentListener(); + autoActivationListener = new AutoActivationListener(); + lafListener = new LookAndFeelChangeListener(); + } + + + /** + * Displays the popup window. Hosting applications can call this method + * to programmatically begin an auto-completion operation. + */ + public void doCompletion() { + refreshPopupWindow(); + } + + + /** + * Returns the delay between when the user types a character and when the + * code completion popup should automatically appear (if applicable). + * + * @return The delay, in milliseconds. + * @see #setAutoActivationDelay(int) + */ + public int getAutoActivationDelay() { + return autoActivationListener.timer.getDelay(); + } + + + /** + * Returns whether, if a single auto-complete choice is available, it + * should be automatically inserted, without displaying the popup menu. + * + * @return Whether to auto-complete single choices. + * @see #setAutoCompleteSingleChoices(boolean) + */ + public boolean isAutoCompleteSingleChoices() { + return autoCompleteSingleChoices; + } + + + /** + * Returns the completion provider. + * + * @return The completion provider. + */ + public CompletionProvider getCompletionProvider() { + return provider; + } + + + /** + * Returns whether debug is enabled for AutoCompletion. + * + * @return Whether debug is enabled. + */ + static boolean isDebug() { + return DEBUG; + } + + + /** + * Returns the default auto-complete "trigger key" for this OS. For + * Windows, for example, it is Ctrl+Space. + * + * @return The default auto-complete trigger key. + */ + public static KeyStroke getDefaultTriggerKey() { + // Default to CTRL, even on Mac, since Ctrl+Space activates Spotlight + return KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, DEFAULT_MODIFIER); + } + + + /** + * Returns the handler to use when an external URL is clicked in the + * description window. + * + * @return The handler. + * @see #setExternalURLHandler(ExternalURLHandler) + * @see #getLinkRedirector() + */ + public ExternalURLHandler getExternalURLHandler() { + return externalURLHandler; + } + + + int getLineOfCaret() { + Document doc = textComponent.getDocument(); + Element root = doc.getDefaultRootElement(); + return root.getElementIndex(textComponent.getCaretPosition()); + } + + + /** + * Returns the link redirector, if any. + * + * @return The link redirector, or null if none. + * @see #setLinkRedirector(LinkRedirector) + */ + public static LinkRedirector getLinkRedirector() { + return linkRedirector; + } + + + /** + * Returns the default list cell renderer used when a completion provider + * does not supply its own. + * + * @return The default list cell renderer. + * @see #setListCellRenderer(ListCellRenderer) + */ + public ListCellRenderer getListCellRenderer() { + return renderer; + } + + + /** + * Returns the renderer to use for {@link Completion}s in the optional + * parameter choices popup window (displayed when a + * {@link ParameterizedCompletion} is code-completed). If this returns + * null, a default renderer is used. + * + * @return The renderer to use. + * @see #setParamChoicesRenderer(ListCellRenderer) + * @see #isParameterAssistanceEnabled() + */ + public ListCellRenderer getParamChoicesRenderer() { + return paramChoicesRenderer; + } + + + /** + * Returns the text to replace with in the document. This is a + * "last-chance" hook for subclasses to make special modifications to the + * completion text inserted. The default implementation simply returns + * c.getReplacementText(). You usually will not need to modify + * this method. + * + * @param c The completion being inserted. + * @param doc The document being modified. + * @param start The start of the text being replaced. + * @param len The length of the text being replaced. + * @return The text to replace with. + */ + protected String getReplacementText(Completion c, Document doc, int start, + int len) { + return c.getReplacementText(); + } + + + /** + * Returns whether the "description window" should be shown alongside + * the completion window. + * + * @return Whether the description window should be shown. + * @see #setShowDescWindow(boolean) + */ + public boolean isShowDescWindow() { + return showDescWindow; + } + + + /** + * Returns the style context describing how auto-completion related + * highlights in the editor are rendered. + * + * @return The style context. + */ + public static AutoCompletionStyleContext getStyleContext() { + return STYLE_CONTEXT; + } + + + /** + * Returns the text component for which auto-completion is enabled. + * + * @return The text component, or null if this + * {@link AutoCompletion} is not installed on any text component. + * @see #install(JTextComponent) + */ + public JTextComponent getTextComponent() { + return textComponent; + } + + + /** + * Returns the orientation of the text component we're installed to. + * + * @return The orientation of the text component, or null if + * we are not installed on one. + */ + ComponentOrientation getTextComponentOrientation() { + return textComponent == null ? null : + textComponent.getComponentOrientation(); + } + + + /** + * Returns the "trigger key" used for auto-complete. + * + * @return The trigger key. + * @see #setTriggerKey(KeyStroke) + */ + public KeyStroke getTriggerKey() { + return trigger; + } + + + /** + * Hides any child windows being displayed by the auto-completion system. + * + * @return Whether any windows were visible. + */ + public boolean hideChildWindows() { + //return hidePopupWindow() || hideToolTipWindow(); + boolean res = hidePopupWindow(); + res |= hideParameterCompletionPopups(); + return res; + } + + + /** + * Hides and disposes of any parameter completion-related popups. + * + * @return Whether any such windows were visible (and thus hidden). + */ + private boolean hideParameterCompletionPopups() { + if (pcc != null) { + pcc.deactivate(); + pcc = null; + return true; + } + return false; + } + + + /** + * Hides the popup window, if it is visible. + * + * @return Whether the popup window was visible. + */ + private boolean hidePopupWindow() { + if (popupWindow != null) { + if (popupWindow.isVisible()) { + popupWindow.setVisible(false); + return true; + } + } + return false; + } + + + /** + * Determines whether debug should be enabled for the AutoCompletion + * library. This method checks a system property, but takes care of + * {@link SecurityException}s in case we're in an applet or WebStart. + * + * @return Whether debug should be enabled. + */ + private static boolean initDebug() { + boolean debug = false; + try { + debug = Boolean.getBoolean("AutoCompletion.debug"); + } catch (SecurityException se) { // We're in an applet or WebStart. + debug = false; + } + return debug; + } + + + /** + * Installs this auto-completion on a text component. If this + * {@link AutoCompletion} is already installed on another text component, + * it is uninstalled first. + * + * @param c The text component. + * @see #uninstall() + */ + public void install(JTextComponent c) { + + if (textComponent != null) { + uninstall(); + } + + this.textComponent = c; + installTriggerKey(getTriggerKey()); + + // Install the function completion key, if there is one. + // NOTE: We cannot do this if the start char is ' ' (e.g. just a space + // between the function name and parameters) because it overrides + // RSTA's special space action. It seems KeyStorke.getKeyStroke(' ') + // hoses ctrl+space, shift+space, etc., even though I think it + // shouldn't... + char start = provider.getParameterListStart(); + if (start != 0 && start != ' ') { + InputMap im = c.getInputMap(); + ActionMap am = c.getActionMap(); + KeyStroke ks = KeyStroke.getKeyStroke(start); + oldParenKey = im.get(ks); + im.put(ks, PARAM_COMPLETE_KEY); + oldParenAction = am.get(PARAM_COMPLETE_KEY); + am.put(PARAM_COMPLETE_KEY, + new ParameterizedCompletionStartAction(start)); + } + + textComponentListener.addTo(this.textComponent); + // In case textComponent is already in a window... + textComponentListener.hierarchyChanged(null); + + if (isAutoActivationEnabled()) { + autoActivationListener.addTo(this.textComponent); + } + + UIManager.addPropertyChangeListener(lafListener); + updateUI(); // In case there have been changes since we uninstalled + + } + + + /** + * Installs a "trigger key" action onto the current text component. + * + * @param ks The keystroke that should trigger the action. + */ + private void installTriggerKey(KeyStroke ks) { + InputMap im = textComponent.getInputMap(); + oldTriggerKey = im.get(ks); + im.put(ks, PARAM_TRIGGER_KEY); + ActionMap am = textComponent.getActionMap(); + oldTriggerAction = am.get(PARAM_TRIGGER_KEY); + am.put(PARAM_TRIGGER_KEY, new AutoCompleteAction()); + } + + + /** + * Returns whether auto-activation is enabled (that is, whether the + * completion popup will automatically appear after a delay when the user + * types an appropriate character). Note that this parameter will be + * ignored if auto-completion is disabled. + * + * @return Whether auto-activation is enabled. + * @see #setAutoActivationEnabled(boolean) + * @see #getAutoActivationDelay() + * @see #isAutoCompleteEnabled() + */ + public boolean isAutoActivationEnabled() { + return autoActivationEnabled; + } + + + /** + * Returns whether auto-completion is enabled. + * + * @return Whether auto-completion is enabled. + * @see #setAutoCompleteEnabled(boolean) + */ + public boolean isAutoCompleteEnabled() { + return autoCompleteEnabled; + } + + + /** + * Returns whether parameter assistance is enabled. + * + * @return Whether parameter assistance is enabled. + * @see #setParameterAssistanceEnabled(boolean) + */ + public boolean isParameterAssistanceEnabled() { + return parameterAssistanceEnabled; + } + + + /** + * Returns whether the completion popup window is visible. + * + * @return Whether the completion popup window is visible. + */ + public boolean isPopupVisible() { + return popupWindow != null && popupWindow.isVisible(); + } + + private boolean needSetPopupWindow(int count, int textLen) { + return (count == 1 && (isPopupVisible() || textLen == 0)) + || (count == 1 && !isAutoCompleteSingleChoices()) + || count > 1; + } + + private FormulaAutoCompletePopupWindow createAutoCompletePopupWindow() { + FormulaAutoCompletePopupWindow popupWindow = new FormulaAutoCompletePopupWindow(parentWindow, this); + // Completion is usually done for code, which is always done + // LTR, so make completion stuff RTL only if text component is + // also RTL. + popupWindow.applyComponentOrientation( + getTextComponentOrientation()); + if (renderer != null) { + popupWindow.setListCellRenderer(renderer); + } + if (preferredChoicesWindowSize != null) { + popupWindow.setSize(preferredChoicesWindowSize); + } + if (preferredDescWindowSize != null) { + popupWindow.setDescriptionWindowSize( + preferredDescWindowSize); + } + return popupWindow; + } + + /** + * Sets the delay between when the user types a character and when the + * code completion popup should automatically appear (if applicable). + * + * @param ms The delay, in milliseconds. This should be greater than zero. + * @see #getAutoActivationDelay() + */ + public void setAutoActivationDelay(int ms) { + ms = Math.max(0, ms); + autoActivationListener.timer.stop(); + autoActivationListener.timer.setInitialDelay(ms); + } + + + /** + * Toggles whether auto-activation is enabled. Note that auto-activation + * also depends on auto-completion itself being enabled. + * + * @param enabled Whether auto-activation is enabled. + * @see #isAutoActivationEnabled() + * @see #setAutoActivationDelay(int) + */ + public void setAutoActivationEnabled(boolean enabled) { + if (enabled != autoActivationEnabled) { + autoActivationEnabled = enabled; + if (textComponent != null) { + if (autoActivationEnabled) { + autoActivationListener.addTo(textComponent); + } else { + autoActivationListener.removeFrom(textComponent); + } + } + } + } + + + /** + * Sets whether auto-completion is enabled. + * + * @param enabled Whether auto-completion is enabled. + * @see #isAutoCompleteEnabled() + */ + public void setAutoCompleteEnabled(boolean enabled) { + if (enabled != autoCompleteEnabled) { + autoCompleteEnabled = enabled; + hidePopupWindow(); + } + } + + + /** + * Sets whether, if a single auto-complete choice is available, it should + * be automatically inserted, without displaying the popup menu. + * + * @param autoComplete Whether to auto-complete single choices. + * @see #isAutoCompleteSingleChoices() + */ + public void setAutoCompleteSingleChoices(boolean autoComplete) { + autoCompleteSingleChoices = autoComplete; + } + + + /** + * Sets the completion provider being used. + * + * @param provider The new completion provider. This cannot be + * null. + * @throws IllegalArgumentException If provider is + * null. + */ + public void setCompletionProvider(CompletionProvider provider) { + if (provider == null) { + throw new IllegalArgumentException("provider cannot be null"); + } + this.provider = provider; + hidePopupWindow(); // In case new choices should be displayed. + } + + + /** + * Sets the size of the completion choices window. + * + * @param w The new width. + * @param h The new height. + * @see #setDescriptionWindowSize(int, int) + */ + public void setChoicesWindowSize(int w, int h) { + preferredChoicesWindowSize = new Dimension(w, h); + if (popupWindow != null) { + popupWindow.setSize(preferredChoicesWindowSize); + } + } + + + /** + * Sets the size of the description window. + * + * @param w The new width. + * @param h The new height. + * @see #setChoicesWindowSize(int, int) + */ + public void setDescriptionWindowSize(int w, int h) { + preferredDescWindowSize = new Dimension(w, h); + if (popupWindow != null) { + popupWindow.setDescriptionWindowSize(preferredDescWindowSize); + } + } + + + /** + * Sets the handler to use when an external URL is clicked in the + * description window. This handler can perform some action, such as + * open the URL in a web browser. The default implementation will open + * the URL in a browser, but only if running in Java 6. If you want + * browser support for Java 5 and below, or otherwise want to respond to + * hyperlink clicks, you will have to install your own handler to do so. + * + * @param handler The new handler. + * @see #getExternalURLHandler() + */ + public void setExternalURLHandler(ExternalURLHandler handler) { + this.externalURLHandler = handler; + } + + + /** + * Sets the redirector for external URL's found in code completion + * documentation. When a non-local link in completion popups is clicked, + * this redirector is given the chance to modify the URL fetched and + * displayed. + * + * @param redirector The link redirector, or null for + * none. + * @see #getLinkRedirector() + */ + public static void setLinkRedirector(LinkRedirector redirector) { + linkRedirector = redirector; + } + + + /** + * Sets the default list cell renderer to use when a completion provider + * does not supply its own. + * + * @param renderer The renderer to use. If this is null, + * a default renderer is used. + * @see #getListCellRenderer() + */ + public void setListCellRenderer(ListCellRenderer renderer) { + this.renderer = renderer; + if (popupWindow != null) { + popupWindow.setListCellRenderer(renderer); + hidePopupWindow(); + } + } + + + /** + * Sets the renderer to use for {@link Completion}s in the optional + * parameter choices popup window (displayed when a + * {@link ParameterizedCompletion} is code-completed). If this isn't set, + * a default renderer is used. + * + * @param r The renderer to use. + * @see #getParamChoicesRenderer() + * @see #setParameterAssistanceEnabled(boolean) + */ + public void setParamChoicesRenderer(ListCellRenderer r) { + paramChoicesRenderer = r; + } + + + /** + * Sets whether parameter assistance is enabled. If parameter assistance + * is enabled, and a "parameterized" completion (such as a function or + * method) is inserted, the user will get "assistance" in inserting the + * parameters in the form of a popup window with documentation and easy + * tabbing through the arguments (as seen in Eclipse and NetBeans). + * + * @param enabled Whether parameter assistance should be enabled. + * @see #isParameterAssistanceEnabled() + */ + public void setParameterAssistanceEnabled(boolean enabled) { + parameterAssistanceEnabled = enabled; + } + + + /** + * Sets whether the "description window" should be shown beside the + * completion window. + * + * @param show Whether to show the description window. + * @see #isShowDescWindow() + */ + public void setShowDescWindow(boolean show) { + hidePopupWindow(); // Needed to force it to take effect + showDescWindow = show; + } + + + /** + * Sets the keystroke that should be used to trigger the auto-complete + * popup window. + * + * @param ks The keystroke. + * @throws IllegalArgumentException If ks is null. + * @see #getTriggerKey() + */ + public void setTriggerKey(KeyStroke ks) { + if (ks == null) { + throw new IllegalArgumentException("trigger key cannot be null"); + } + if (!ks.equals(trigger)) { + if (textComponent != null) { + // Put old trigger action back. + uninstallTriggerKey(); + // Grab current action for new trigger and replace it. + installTriggerKey(ks); + } + trigger = ks; + } + } + + + /** + * Uninstalls this auto-completion from its text component. If it is not + * installed on any text component, nothing happens. + * + * @see #install(JTextComponent) + */ + public void uninstall() { + + if (textComponent != null) { + + hidePopupWindow(); // Unregisters listeners, actions, etc. + + uninstallTriggerKey(); + + // Uninstall the function completion key. + char start = provider.getParameterListStart(); + if (start != 0) { + KeyStroke ks = KeyStroke.getKeyStroke(start); + InputMap im = textComponent.getInputMap(); + im.put(ks, oldParenKey); + ActionMap am = textComponent.getActionMap(); + am.put(PARAM_COMPLETE_KEY, oldParenAction); + } + + textComponentListener.removeFrom(textComponent); + if (parentWindow != null) { + parentWindowListener.removeFrom(parentWindow); + } + + if (isAutoActivationEnabled()) { + autoActivationListener.removeFrom(textComponent); + } + + UIManager.removePropertyChangeListener(lafListener); + + textComponent = null; + popupWindow = null; + + } + + } + + + /** + * Replaces the "trigger key" action with the one that was there + * before auto-completion was installed. + */ + private void uninstallTriggerKey() { + InputMap im = textComponent.getInputMap(); + im.put(trigger, oldTriggerKey); + ActionMap am = textComponent.getActionMap(); + am.put(PARAM_TRIGGER_KEY, oldTriggerAction); + } + + + /** + * Updates the LookAndFeel of the popup window. Applications can call + * this method as appropriate if they support changing the LookAndFeel + * at runtime. + */ + private void updateUI() { + if (popupWindow != null) { + popupWindow.updateUI(); + } + if (pcc != null) { + pcc.updateUI(); + } + // Will practically always be a JComponent (a JLabel) + if (paramChoicesRenderer instanceof JComponent) { + ((JComponent) paramChoicesRenderer).updateUI(); + } + } + + + /** + * Listens for events in the text component to auto-activate the code + * completion popup. + */ + private class AutoActivationListener extends FocusAdapter + implements DocumentListener, CaretListener, ActionListener { + + private Timer timer; + private boolean justInserted; + + public AutoActivationListener() { + timer = new Timer(200, this); + timer.setRepeats(false); + } + + public void actionPerformed(ActionEvent e) { + doCompletion(); + } + + public void addTo(JTextComponent tc) { + tc.addFocusListener(this); + tc.getDocument().addDocumentListener(this); + tc.addCaretListener(this); + } + + public void caretUpdate(CaretEvent e) { + if (justInserted) { + justInserted = false; + } else { + timer.stop(); + } + } + + public void changedUpdate(DocumentEvent e) { + // Ignore + } + + @Override + public void focusLost(FocusEvent e) { + timer.stop(); + //hideChildWindows(); Other listener will do this + } + + public void insertUpdate(DocumentEvent e) { + justInserted = false; + if (isAutoCompleteEnabled() && isAutoActivationEnabled() && + e.getLength() == 1) { + if (provider.isAutoActivateOkay(textComponent)) { + timer.restart(); + justInserted = true; + } else { + timer.stop(); + } + } else { + timer.stop(); + } + } + + public void removeFrom(JTextComponent tc) { + tc.removeFocusListener(this); + tc.getDocument().removeDocumentListener(this); + tc.removeCaretListener(this); + timer.stop(); + justInserted = false; + } + + public void removeUpdate(DocumentEvent e) { + timer.stop(); + } + + } + + + /** + * The Action that displays the popup window if + * auto-completion is enabled. + */ + private class AutoCompleteAction extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (isAutoCompleteEnabled()) { + refreshPopupWindow(); + } else if (oldTriggerAction != null) { + oldTriggerAction.actionPerformed(e); + } + } + + } + + + /** + * Listens for LookAndFeel changes and updates the various popup windows + * involved in auto-completion accordingly. + */ + private class LookAndFeelChangeListener implements PropertyChangeListener { + + public void propertyChange(PropertyChangeEvent e) { + String name = e.getPropertyName(); + if ("lookAndFeel".equals(name)) { + updateUI(); + } + } + + } + + + /** + * Action that starts a parameterized completion, e.g. after '(' is + * typed. + */ + private class ParameterizedCompletionStartAction extends AbstractAction { + + private String start; + + public ParameterizedCompletionStartAction(char ch) { + this.start = Character.toString(ch); + } + + public void actionPerformed(ActionEvent e) { + + // Prevents keystrokes from messing up + boolean wasVisible = hidePopupWindow(); + + // Only proceed if they were selecting a completion + if (!wasVisible || !isParameterAssistanceEnabled()) { + textComponent.replaceSelection(start); + return; + } + + Completion c = popupWindow.getSelection(); + if (c instanceof ParameterizedCompletion) { // Should always be true + // Fixes capitalization of the entered text. + insertCompletion(c, true); + } + + } + + } + + + /** + * Listens for events in the parent window of the text component with + * auto-completion enabled. + */ + private class ParentWindowListener extends ComponentAdapter + implements WindowFocusListener { + + public void addTo(Window w) { + w.addComponentListener(this); + w.addWindowFocusListener(this); + } + + @Override + public void componentHidden(ComponentEvent e) { + hideChildWindows(); + } + + @Override + public void componentMoved(ComponentEvent e) { + hideChildWindows(); + } + + @Override + public void componentResized(ComponentEvent e) { + hideChildWindows(); + } + + public void removeFrom(Window w) { + w.removeComponentListener(this); + w.removeWindowFocusListener(this); + } + + public void windowGainedFocus(WindowEvent e) { + } + + public void windowLostFocus(WindowEvent e) { + hideChildWindows(); + } + + } + + + /** + * Listens for events from the text component we're installed on. + */ + private class TextComponentListener extends FocusAdapter + implements HierarchyListener { + + void addTo(JTextComponent tc) { + tc.addFocusListener(this); + tc.addHierarchyListener(this); + } + + /** + * Hide the auto-completion windows when the text component loses + * focus. + */ + @Override + public void focusLost(FocusEvent e) { + hideChildWindows(); + } + + /** + * Called when the component hierarchy for our text component changes. + * When the text component is added to a new {@link Window}, this + * method registers listeners on that Window. + * + * @param e The event. + */ + public void hierarchyChanged(HierarchyEvent e) { + + // NOTE: e many be null as we call this method at other times. + //System.out.println("Hierarchy changed! " + e); + + Window oldParentWindow = parentWindow; + parentWindow = SwingUtilities.getWindowAncestor(textComponent); + if (parentWindow != oldParentWindow) { + if (oldParentWindow != null) { + parentWindowListener.removeFrom(oldParentWindow); + } + if (parentWindow != null) { + parentWindowListener.addTo(parentWindow); + } + } + + } + + public void removeFrom(JTextComponent tc) { + tc.removeFocusListener(this); + tc.removeHierarchyListener(this); + } + + } + + public void installVariableTree(FormulaPane.VariableTreeAndDescriptionArea jComp) { + area = jComp; + } + + /** + * Inserts a completion. Any time a code completion event occurs, the + * actual text insertion happens through this method. + * + * @param c A completion to insert. This cannot be null. + * @param typedParamListStartChar Whether the parameterized completion + * start character was typed (typically '('). + */ + protected void insertCompletion(Completion c, + boolean typedParamListStartChar) { + + JTextComponent textComp = getTextComponent(); + String alreadyEntered = c.getAlreadyEntered(textComp); + hidePopupWindow(); + Caret caret = textComp.getCaret(); + + int dot = caret.getDot(); + int len = alreadyEntered.length(); + int start = dot - len; + String replacement = getReplacementText(c, textComp.getDocument(), + start, len); + + caret.setDot(start); + caret.moveDot(dot); + if (FormulaPane.containsParam(replacement)) { + textComp.replaceSelection(FormulaPane.getParamPrefix(replacement) + replacement); + int caretPosition = textComp.getCaretPosition(); + textComp.setCaretPosition(caretPosition); + } else { + textComp.replaceSelection(replacement + "()"); + int caretPosition = textComp.getCaretPosition(); + textComp.setCaretPosition(caretPosition - 1); + } + + + if (isParameterAssistanceEnabled() && + (c instanceof ParameterizedCompletion)) { + ParameterizedCompletion pc = (ParameterizedCompletion) c; + startParameterizedCompletionAssistance(pc, typedParamListStartChar); + } + + } + + /** + * Displays a "tool tip" detailing the inputs to the function just entered. + * + * @param pc The completion. + * @param typedParamListStartChar Whether the parameterized completion list + * starting character was typed. + */ + private void startParameterizedCompletionAssistance( + ParameterizedCompletion pc, boolean typedParamListStartChar) { + + // Get rid of the previous tool tip window, if there is one. + hideParameterCompletionPopups(); + + // Don't bother with a tool tip if there are no parameters, but if + // they typed e.g. the opening '(', make them overtype the ')'. + if (pc.getParamCount() == 0 && !(pc instanceof TemplateCompletion)) { + CompletionProvider p = pc.getProvider(); + char end = p.getParameterListEnd(); // Might be '\0' + String text = end == '\0' ? "" : Character.toString(end); + if (typedParamListStartChar) { + String template = "${}" + text + "${cursor}"; + textComponent.replaceSelection(Character.toString(p.getParameterListStart())); + TemplateCompletion tc = new TemplateCompletion(p, null, null, template); + pc = tc; + } else { + text = p.getParameterListStart() + text; + textComponent.replaceSelection(text); + return; + } + } + + pcc = new ParameterizedCompletionContext(parentWindow, this, pc); + pcc.activate(); + + } + + protected int refreshPopupWindow() { + // A return value of null => don't suggest completions + String text = provider.getAlreadyEnteredText(textComponent); + if (text == null && !isPopupVisible()) { + return getLineOfCaret(); + } + // If the popup is currently visible, and they type a space (or any + // character that resets the completion list to "all completions"), + // the popup window should be hidden instead of being reset to show + // everything. + int textLen = text == null ? 0 : text.length(); + if (textLen == 0 && isPopupVisible()) { + hidePopupWindow(); + return getLineOfCaret(); + } + final List completions = provider.getCompletions(textComponent); + int count = completions.size(); + if (needSetPopupWindow(count, textLen)) { + if (popupWindow == null) { + popupWindow = createAutoCompletePopupWindow(); + } + popupWindow.installComp(area); + popupWindow.setCompletions(completions); + if (!popupWindow.isVisible()) { + Rectangle r = null; + try { + r = textComponent.modelToView(textComponent.getCaretPosition()); + } catch (BadLocationException ble) { + return -1; + } + Point p = new Point(r.x, r.y); + SwingUtilities.convertPointToScreen(p, textComponent); + r.x = p.x; + r.y = p.y; + popupWindow.setLocationRelativeTo(r); + popupWindow.setVisible(true); + } + } else if (count == 1) { // !isPopupVisible && autoCompleteSingleChoices + SwingUtilities.invokeLater(new Runnable() { + public void run() { + insertCompletion(completions.get(0)); + } + }); + } else { + hidePopupWindow(); + } + return getLineOfCaret(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java index 78d5e74a4..238fa496b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java @@ -16,16 +16,34 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter; import com.fr.log.FineLoggerFactory; -import javax.swing.*; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.text.*; +import javax.swing.text.AbstractDocument; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultEditorKit; +import javax.swing.text.Document; +import javax.swing.text.Highlighter; import javax.swing.text.Highlighter.Highlight; import javax.swing.text.Highlighter.HighlightPainter; -import java.awt.*; -import java.awt.event.*; +import javax.swing.text.JTextComponent; +import javax.swing.text.Position; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; @@ -41,7 +59,7 @@ import java.util.List; * @author Robert Futrell * @version 1.0 */ -class ParameterizedCompletionContext { +public class ParameterizedCompletionContext { /** * The parent window. diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/formula.png b/designer-base/src/main/resources/com/fr/design/images/m_file/formula.png new file mode 100644 index 0000000000000000000000000000000000000000..7e495da1b29cd915984ef9552ac59c6e96a33e4c GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uuz(rC1}QWNE&K$e8a-VcLo5W3 zPIBZrpuod&RsZJy{SNn2ZXP#=DbWrCZGA_SQwTc=PEfg`vOf8_lM0XfRk)z4*}Q$iB}p~g=t literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/param.png b/designer-base/src/main/resources/com/fr/design/images/m_file/param.png new file mode 100644 index 0000000000000000000000000000000000000000..011c395813e8b95877b1d42af583f73059cdd3bb GIT binary patch literal 383 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uuz(rC1}QWNE&K$eUV6GXhFAzD zCoB*!X!;^8J^PRP@j08*&o_LXoXT(}NUbQx?b_j{GmRS)mofj`FDW50pXp^~`nfq- zi76>ZK4|%gZ`iacM=ynK zuGct{ADc2P<9NaQ_y2!Md4(SwV%H29JpcdvtbYH`vN Bg)RU9 literal 0 HcmV?d00001 From bcb8ad4693592b83bb56a33d91160ee3d5f68048 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 9 Nov 2021 16:57:55 +0800 Subject: [PATCH 073/152] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B=E9=94=AE=E5=85=A5=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 4 ---- 1 file changed, 4 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 9fa1af23e..3d1e921d0 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 @@ -172,7 +172,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private boolean inKeyCodeRange(KeyEvent e) { - //|| e.getExtendedKeyCode() == return (e.getExtendedKeyCode() > KEY_CODE_A && e.getExtendedKeyCode() < KEY_CODE_Z); } @@ -188,9 +187,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { insertPosition = 0; formulaTextArea.setText(text); } - if (e.getExtendedKeyCode() == KEY_CODE_$) { - autoCompletion.doCompletion(); - } } }); } From 105d7308ecbd76798bdaf4c5de8f67b6ff39b55f Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Wed, 10 Nov 2021 09:03:16 +0800 Subject: [PATCH 074/152] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E5=9B=BD=E9=99=85=E5=8C=96=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 32 +++++++--------- .../function/FormulaCheckConstants.java | 17 --------- .../function/MismatchedCharFunction.java | 29 ++++++++------- .../function/MismatchedTokenFunction.java | 37 ++++++++++--------- .../function/NoViableAltForCharFunction.java | 3 +- .../function/NoViableAltFunction.java | 7 ++-- 6 files changed, 53 insertions(+), 72 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 3d1e921d0..6c0ddcab1 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 @@ -122,19 +122,13 @@ import java.util.Set; * @since 2012-3-29下午1:50:53 */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"); public static final int DEFUAL_FOMULA_LENGTH = 103; public static final String ELLIPSIS = "..."; public static final int KEY_CODE_A = 64; public static final int KEY_CODE_Z = 91; - public static final String CHECK_RESULT = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"); - public static final String CONTINUE = Toolkit.i18nText("Fine-Design_Basic_Formula_Continue"); - public static final String CAL_RESULT = Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result"); public static final String NEWLINE = "\n"; - public static final String ERROR_POSITION = Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position"); public static final String FORMULA_ICON = "/com/fr/design/images/m_file/formula.png"; public static final String PARAM_ICON = "/com/fr/design/images/m_file/param.png"; - public static final int KEY_CODE_$ = 515; private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; private RSyntaxTextArea formulaTextArea; private UITextField keyWordTextField = new UITextField(18); @@ -152,7 +146,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JList functionNameList; private UITableEditorPane editor4CalPane; private FormulaPaneAutoCompletion autoCompletion; - private static DefaultCompletionProvider COMPLETION_PROVIDER = null; + private DefaultCompletionProvider completionProvider; private static final Map PARAM_PREFIX_MAP = new HashMap<>(); public FormulaPane() { @@ -353,11 +347,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private CompletionProvider createCompletionProvider() { - if (COMPLETION_PROVIDER == null) { - COMPLETION_PROVIDER = new DefaultCompletionProvider(); + if (completionProvider == null) { + completionProvider = new DefaultCompletionProvider(); NameAndDescription[] nameAndDescriptions = FunctionConstants.ALL.getDescriptions(); for (NameAndDescription nameAndDescription : nameAndDescriptions) { - COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, nameAndDescription.getName(), BaseUtils.readIcon(FORMULA_ICON))); + completionProvider.addCompletion(new FormulaCompletion(completionProvider, nameAndDescription.getName(), BaseUtils.readIcon(FORMULA_ICON))); } VariableResolver variableResolver = VariableResolver.DEFAULT; @@ -381,13 +375,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { paramWithoutPre = parameter; PARAM_PREFIX_MAP.put(paramWithoutPre, StringUtils.EMPTY); } - COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); + completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); } - COMPLETION_PROVIDER.addCompletion(new FormulaCompletion(COMPLETION_PROVIDER, "$$$", BaseUtils.readIcon(PARAM_ICON))); + completionProvider.addCompletion(new FormulaCompletion(completionProvider, "$$$", BaseUtils.readIcon(PARAM_ICON))); - return COMPLETION_PROVIDER; + return completionProvider; } - return COMPLETION_PROVIDER; + return completionProvider; } public static boolean containsParam(String param) { @@ -821,7 +815,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String objectToString = EssentialUtils.objectToString(value); String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; - messageTips = messageTips + CAL_RESULT + ":" + result; + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; FineLoggerFactory.getLogger().info("value:{}", value); } catch (UtilEvalError utilEvalError) { FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError); @@ -843,13 +837,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } else { int confirmDialog = FineJOptionPane.showConfirmDialog( FormulaPane.this, - checkResult.getTips() + ", " + ERROR_POSITION + ":" + (checkResult.getFormulaCoordinates().getColumns()) + ".", - CONFIRM_DIALOG_TITLE, + checkResult.getTips() + ", " + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + ":" + (checkResult.getFormulaCoordinates().getColumns()) + ".", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, - new String[]{CHECK_RESULT, CONTINUE}, - CHECK_RESULT); + new String[]{Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"), Toolkit.i18nText("Fine-Design_Basic_Formula_Continue")}, + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result")); if (confirmDialog == 0) { formulaTextArea.setCaretPosition(checkResult.getFormulaCoordinates().getColumns()); formulaTextArea.requestFocus(); diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java index 6e3af75c5..20ad72156 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckConstants.java @@ -1,27 +1,10 @@ package com.fr.design.formula.exception.function; -import com.fr.design.i18n.Toolkit; - /** * @author Hoky * @date 2021/10/28 */ public class FormulaCheckConstants { - public final static String EXPECTING = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": "; - public final static String FOUND = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"); - public final static String EXPECTING_ANYTHING = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything"); - public final static String GOT_IT_ANYWAY = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_GotItAnyway"); - public final static String TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Token"); - public final static String IN_RANGE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_In_Range"); - public final static String CHECK_NOT = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Not"); - public final static String ONE_OF = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_ONE_OF"); - public final static String UNEXPECTED_TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_Token"); - public final static String UNEXPECTED_CHAR = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_Char"); - public final static String UNEXPECTED_END_OF_SUBTREE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_End_Of_Subtree"); - public final static String UNEXPECTED_AST_NODE = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Unexpected_AST_Node"); - public final static String MISMATCHED_TOKEN = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Token"); - public final static String MISMATCHED_CHAR = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Char"); - public final static String MISMATCHED_EOF = Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF"); public static final String COLON = ":"; public static final String LEFT = "("; public static final String COMMON = ","; diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java index e63353a08..ca6df0852 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java @@ -1,6 +1,7 @@ package com.fr.design.formula.exception.function; import com.fr.design.formula.FormulaChecker; +import com.fr.design.i18n.Toolkit; import com.fr.script.checker.result.FormulaCheckResult; import com.fr.script.checker.result.FormulaCoordinates; import com.fr.third.antlr.MismatchedCharException; @@ -32,50 +33,50 @@ public class MismatchedCharFunction implements Function= ' ' && exception.foundChar <= '~') { mesg = mesg + '\''; mesg = mesg + exception.foundChar; diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java index aa7c7d3ec..e6bfbd5df 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java @@ -1,6 +1,7 @@ package com.fr.design.formula.exception.function; import com.fr.design.formula.FormulaChecker; +import com.fr.design.i18n.Toolkit; import com.fr.script.checker.result.FormulaCheckResult; import com.fr.script.checker.result.FormulaCoordinates; import com.fr.third.antlr.NoViableAltException; @@ -31,10 +32,10 @@ public class NoViableAltFunction implements Function Date: Wed, 10 Nov 2021 10:42:51 +0800 Subject: [PATCH 075/152] =?UTF-8?q?REPORT-53615=20=20=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/JDBCDefPane.java | 266 ++++++++++++++---- 1 file changed, 215 insertions(+), 51 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 0da46965b..25ecfcb34 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 @@ -1,10 +1,13 @@ package com.fr.design.data.datapane.connect; import com.fr.base.GraphHelper; +import com.fr.data.driver.DriverLoader; +import com.fr.data.driver.config.DriverLoaderConfig; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; @@ -21,6 +24,8 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; +import com.fr.third.guava.collect.HashBiMap; +import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.JFileChooser; @@ -28,6 +33,8 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.plaf.ComboBoxUI; +import javax.swing.plaf.basic.ComboPopup; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -45,6 +52,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -101,8 +109,60 @@ public class JDBCDefPane extends JPanel { private JDBCDatabaseConnection jdbcDatabase; private boolean needRefresh = true; + private UIComboBox driverManageBox; + private ActionLabel driverManageLabel; + private UIComboBox driverLoaderBox; + ActionListener driverManageListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boolean selectSelfDefine = isSelfDefine(); + driverManageLabel.setVisible(selectSelfDefine); + driverLoaderBox.setVisible(selectSelfDefine); + driverComboBox.setVisible(!selectSelfDefine); + // 选中自定义的话,将odbc的屏蔽,选中默认的话,重新触发一次driverComboBox的事件 + if (selectSelfDefine) { + odbcTipsLink.setVisible(false); + } else { + driverComboBox.setSelectedItem(driverComboBox.getSelectedItem()); + } + } + }; + ActionListener dbtypeActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + + urlTextField.setText(StringUtils.EMPTY); + driverComboBox.removeAllItems(); + driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); + if (driverLoaderBox.getItemCount() > 0) { + driverLoaderBox.setSelectedIndex(0); + } + if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { + driverComboBox.setSelectedItem(StringUtils.EMPTY); + return; + } + + DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); + for (int i = 0, len = dus.length; i < len; i++) { + driverComboBox.addItem(dus[i].getDriver()); + if (i == 0) { + driverComboBox.setSelectedItem(dus[i].getDriver()); + urlTextField.setText(dus[i].getURL()); + } + } + // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 + if (needRefresh) { + jdbcDatabase.setDatabase(StringUtils.EMPTY); + } + changePane(dbtypeComboBox.getSelectedItem()); + JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase); + DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase); + } + }; + private HashBiMap nameAndRepresent; public JDBCDefPane() { + initMap(); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); @@ -115,7 +175,15 @@ public class JDBCDefPane extends JPanel { } dbtypeComboBox.addActionListener(dbtypeActionListener); dbtypeComboBox.setMaximumRowCount(10); - + driverLoaderBox = new SpecialUIComboBox(); + refreshDriverLoader(); + driverLoaderBox.setPreferredSize(new Dimension(200, driverLoaderBox.getPreferredSize().height)); + driverLoaderBox.setEditable(false); + driverManageBox = new UIComboBox(); + refreshDriverManage(true); + driverManageBox.setEditable(false); + driverManageBox.addActionListener(driverManageListener); + driverLoaderBox.setVisible(isSelfDefine()); driverComboBox = new UIComboBox(); driverComboBox.setEditable(true); driverComboBox.addActionListener(driverListener); @@ -163,9 +231,33 @@ public class JDBCDefPane extends JPanel { BrowseUtils.browser(url); } }); + driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")) { + @Override + public void paintComponent(Graphics _gfx) { + super.paintComponent(_gfx); + _gfx.setColor(Color.blue); + _gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1); + } + }; + driverManageLabel.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")), driverManageLabel.getPreferredSize().height)); + driverManageLabel.setVisible(isSelfDefine()); + driverManageLabel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help"); + BrowseUtils.browser(url); + } + }); + + odbcTipsPane.add(driverManageLabel); + odbcTipsPane.add(odbcTipsLink); JPanel driverComboBoxAndTips = new JPanel(new BorderLayout()); - driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST); + JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 0); + normalFlowInnerContainer_s_pane.add(driverManageBox); + normalFlowInnerContainer_s_pane.add(driverComboBox); + normalFlowInnerContainer_s_pane.add(driverLoaderBox); + driverComboBoxAndTips.add(normalFlowInnerContainer_s_pane, BorderLayout.WEST); driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); @@ -225,7 +317,71 @@ public class JDBCDefPane extends JPanel { innerthis.add(centerPanel); } + private void refreshDriverLoader() { + Set representSet = nameAndRepresent.values(); + driverLoaderBox.clearBoxItems(); + for (String represent : representSet) { + driverLoaderBox.addItem(represent); + } + } + + private String getRepresent(String driverClass, String driverName) { + return driverClass + "(" + driverName + ")"; + } + + private boolean isSelfDefine() { + return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"), driverManageBox.getSelectedItem()); + } + + private void refreshDriverManage(boolean addSelfDefine) { + driverManageBox.clearBoxItems(); + driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); + if (addSelfDefine) { + driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define")); + } + } + + private void initMap() { + Map driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders(); + nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); + } + + private HashBiMap getDriverLoaderAndRepresent(Map driverLoaders) { + HashBiMap driverHashBiMap = HashBiMap.create(); + if (WorkContext.getCurrent().isWarDeploy()) { + return driverHashBiMap; + } + // name 是唯一的,name+driver自然也是唯一的 + for (DriverLoader driverLoader : driverLoaders.values()) { + driverHashBiMap.put(driverLoader.getName(), getRepresent(driverLoader.getDriverClass(), driverLoader.getName())); + } + return driverHashBiMap; + } + + + protected JDBCDatabaseConnection getJDBCDatabase() { + return this.jdbcDatabase; + } + + private void changePane(Object dbType) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f, 22}; + if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { + if (this.centerPanel.getComponentCount() != partComponents.length * 2) { + centerPanel.removeAll(); + TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel); + } + } else if (this.centerPanel.getComponentCount() != allComponents.length * 2) { + centerPanel.removeAll(); + TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel); + } + } + public void populate(JDBCDatabaseConnection jdbcDatabase) { + // 单例对象,重新打开的时候并不会新建,但是由于driverloaderbox里面需要是动态内容,因此需要进行刷新动作 + initMap(); + refreshDriverLoader(); needRefresh = false; if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); @@ -255,7 +411,24 @@ public class JDBCDefPane extends JPanel { this.dbtypeComboBox.setSelectedItem(OTHER_DB); } } - this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); + // jdbcDatabase.getDriverSource() 只会是空或者是有值,但是为了保险起见,还是应该做个处理 + String driverSource = jdbcDatabase.getDriverSource(); + if (driverSource == null) { + driverSource = StringUtils.EMPTY; + } + if (driverSource.isEmpty()) { + refreshDriverManage(!nameAndRepresent.isEmpty()); + this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); + this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); + } else { + refreshDriverManage(true); + this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define")); + String represent = getRepresent(jdbcDatabase.getDriver(), jdbcDatabase.getDriverSource()); + if (!nameAndRepresent.containsValue(represent)) { + this.driverLoaderBox.addItem(represent); + } + this.driverLoaderBox.setSelectedItem(represent); + } this.urlTextField.setText(jdbcDatabase.getURL()); this.userNameTextField.setText(jdbcDatabase.getUser()); this.passwordTextField.setText(jdbcDatabase.getPassword()); @@ -268,31 +441,10 @@ public class JDBCDefPane extends JPanel { needRefresh = false; } - protected JDBCDatabaseConnection getJDBCDatabase() { - return this.jdbcDatabase; - } - - private void changePane(Object dbType) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f, 22}; - if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { - if (this.centerPanel.getComponentCount() != partComponents.length * 2) { - centerPanel.removeAll(); - TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel); - } - } else if (this.centerPanel.getComponentCount() != allComponents.length * 2) { - centerPanel.removeAll(); - TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel); - } - } - public JDBCDatabaseConnection update() { if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); } - Object driveItem = this.driverComboBox.getSelectedItem(); - jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); @@ -304,36 +456,30 @@ public class JDBCDefPane extends JPanel { jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); } - return jdbcDatabase; - } - - ActionListener dbtypeActionListener = new ActionListener() { - public void actionPerformed(ActionEvent evt) { - - urlTextField.setText(StringUtils.EMPTY); - driverComboBox.removeAllItems(); - if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { - driverComboBox.setSelectedItem(StringUtils.EMPTY); - return; - } - - DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); - for (int i = 0, len = dus.length; i < len; i++) { - driverComboBox.addItem(dus[i].getDriver()); - if (i == 0) { - driverComboBox.setSelectedItem(dus[i].getDriver()); - urlTextField.setText(dus[i].getURL()); + String driverLoader = (String) this.driverLoaderBox.getSelectedItem(); + if (driverLoader == null) { + driverLoader = StringUtils.EMPTY; + } + if (isSelfDefine()) { + String[] split = driverLoader.split("\\("); + if (split.length > 1) { + String name = split[1]; + if (name.length() > 0) { + jdbcDatabase.setDriverSource(name.substring(0, name.length() - 1)); + } else { + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } + } else { + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 - if (needRefresh) { - jdbcDatabase.setDatabase(StringUtils.EMPTY); - } - changePane(dbtypeComboBox.getSelectedItem()); - JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase); - DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase); + jdbcDatabase.setDriver(split[0]); + } else { + Object driveItem = this.driverComboBox.getSelectedItem(); + jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - }; + return jdbcDatabase; + } ActionListener driverListener = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -579,4 +725,22 @@ public class JDBCDefPane extends JPanel { private String driver; private String url; } + + private static class SpecialUIComboBox extends UIComboBox { + + @Override + public ComboBoxUI getUIComboBoxUI() { + return new SpecialUIComboBoxUI(); + } + } + + private static class SpecialUIComboBoxUI extends UIComboBoxUI { + + @Override + public ComboPopup createPopup() { + return createHorizontalNeverUIComboPopUp(); + } + + } + } From e832cc91c0793dd7c35b31b3e8108a6b32d02b3b Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 10 Nov 2021 12:32:31 +0800 Subject: [PATCH 076/152] =?UTF-8?q?REPORT-61422=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91cpt=E4=B8=BB=E9=A2=98=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E9=A2=84=E8=A7=88=E5=9B=BE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BE=85=E5=8A=A9=E6=96=87=E6=9C=AC=E7=9A=84=E5=9B=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/preview/ReportThemePreviewPane.java | 2 +- .../ecpreview/AbstractECPreviewPane.java | 4 ++++ .../preview/ecpreview/ECPreviewPane.java | 24 ++++++++++++++----- .../ecpreview/ECReportPreviewPane.java | 13 ++++++++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java index 4ceec636d..2033e7072 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java @@ -41,7 +41,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane headerCellList = new ArrayList<>(); private final List contentCellList = new ArrayList<>(); private final List highLightCellList = new ArrayList<>(); + private final List assistCellList = new ArrayList<>(); private static final int COL_COUNT = 5; private static final int CONTENT_ROW_COUNT = 2; public ECPreviewPane() { - this.setPreferredSize(new Dimension(517, 147)); + this.setPreferredSize(new Dimension(517, 158)); this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel titlePane = new UINoOpaquePanel(new GridLayout()); - this.add(titlePane, BorderLayout.NORTH); + JPanel extCenterPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); + this.add(extCenterPane, BorderLayout.CENTER); + extCenterPane.add(titlePane, BorderLayout.NORTH); for (int i = 0; i < COL_COUNT; i++) { PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); cell.setPreferredSize(new Dimension(103, 36)); @@ -40,22 +43,29 @@ public class ECPreviewPane extends AbstractECPreviewPane { headerCellList.add(cell); } JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0)); - this.add(contentPane, BorderLayout.CENTER); + extCenterPane.add(contentPane, BorderLayout.CENTER); for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) { PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); - cell.setPreferredSize(new Dimension(103, 33)); + cell.setPreferredSize(new Dimension(103, 30)); contentPane.add(cell); contentCellList.add(cell); } JPanel endPane = new UINoOpaquePanel(new GridLayout()); - this.add(endPane, BorderLayout.SOUTH); + extCenterPane.add(endPane, BorderLayout.SOUTH); for (int i = 0; i < COL_COUNT; i++) { PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); - cell.setPreferredSize(new Dimension(103, 33)); + cell.setPreferredSize(new Dimension(103, 30)); endPane.add(cell); highLightCellList.add(cell); } + + JPanel extSouthPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); + PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text")); + assistCell.setPreferredSize(new Dimension(123, 30)); + assistCellList.add(assistCell); + extSouthPane.add(assistCell); + this.add(extSouthPane, BorderLayout.SOUTH); } @Override @@ -64,6 +74,8 @@ public class ECPreviewPane extends AbstractECPreviewPane { refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(assistCellList, getAssistMsgStyle(cellStyleConfig)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java index 885f480b7..432c8b49c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java @@ -27,6 +27,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview private final List titleCellList = new ArrayList<>(); private final List contentCellList = new ArrayList<>(); private final List highLightCellList = new ArrayList<>(); + private final List assistCellList = new ArrayList<>(); private static final int CONTENT_ROW_COUNT = 3; private static final int COL_COUNT = 5; @@ -54,8 +55,10 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel northPane = createNorthPane(); JPanel centerPane = createCenterPane(); + JPanel southPane = createSouthPane(); this.add(northPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); } private JPanel createNorthPane() { @@ -126,6 +129,15 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview return centerPane; } + private JPanel createSouthPane(){ + JPanel southPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); + PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text")); + assistCell.setPreferredSize(new Dimension(123, 30)); + assistCellList.add(assistCell); + southPane.add(assistCell, BorderLayout.CENTER); + return southPane; + } + @Override public void refresh(TemplateTheme theme) { ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); @@ -134,6 +146,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(titleCellList, getSmallTitleStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(assistCellList, getAssistMsgStyle(cellStyleConfig)); } } } From ad9a3fa276c4a02a7c0dc2aa8c0b76a2a9931c0c Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 10 Nov 2021 14:53:42 +0800 Subject: [PATCH 077/152] =?UTF-8?q?REPORT-62142=20=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=9C=A8json=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=A6=81=E7=94=A8=E5=90=AF=E7=94=A8=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE=E9=9B=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 47 +++++++++---------- .../main/java/com/fr/file/StashedFILE.java | 18 ++++++- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 52fb1bcfa..667592552 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -12,7 +12,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; -import com.fr.design.module.DesignModuleFactory; import com.fr.design.ui.util.UIUtil; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -361,22 +360,30 @@ public class HistoryTemplateListCache implements CallbackEvent { int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); - FILE file = template.getEditingFILE(); - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - target.export(outputStream); - stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray())); - } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FILE file = templateToStashFile(template); + if (file != null) { + stashFILEMap.put(i, file); } } FineLoggerFactory.getLogger().info("Env Change Template Stashed."); } + private FILE templateToStashFile(JTemplate template) { + FILE file = template.getEditingFILE(); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + target.export(outputStream); + return new StashedFILE(file, outputStream.toByteArray(), template.suffix()); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + private boolean checkStash() { try { return stashWorker.get(); @@ -458,18 +465,10 @@ public class HistoryTemplateListCache implements CallbackEvent { FILE file = template.getEditingFILE(); boolean needReload = context == null || needReloadTemplate(context, template); if (needReload) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); - target.export(outputStream); - FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); - template.refreshResource(stashedFile); - } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FILE stashFile = templateToStashFile(template); + if (stashFile != null) { + FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); + template.refreshResource(stashFile); } } } diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java index 454433874..860515fba 100644 --- a/designer-base/src/main/java/com/fr/file/StashedFILE.java +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -1,5 +1,9 @@ package com.fr.file; +import com.fr.base.io.XMLEncryptUtils; +import com.fr.io.EncryptUtils; +import com.fr.io.FineEncryptUtils; +import com.fr.stable.StringUtils; import javax.swing.Icon; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -11,10 +15,16 @@ public class StashedFILE extends AbstractFILE { private FILE file; private byte[] content; + private String suffix; public StashedFILE(FILE file, byte[] content) { + this(file, content, null); + } + + public StashedFILE(FILE file, byte[] content, String suffix) { this.file = file; this.content = content; + this.suffix = suffix; } @Override @@ -54,7 +64,13 @@ public class StashedFILE extends AbstractFILE { @Override public InputStream asInputStream() throws Exception { - return new ByteArrayInputStream(content); + ByteArrayInputStream in = new ByteArrayInputStream(content); + return needDecode() ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in; + } + + private boolean needDecode() { + // 仅有cpt支持模板加密 + return StringUtils.isNotEmpty(suffix) && suffix.endsWith(".cpt"); } @Override From 545ab8b4b50ae42d10558b02bf6c2230e493aded Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 10 Nov 2021 15:03:02 +0800 Subject: [PATCH 078/152] =?UTF-8?q?REPORT-62142=20fix=20=E8=A7=A3=E5=AF=86?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=20=E5=85=B3=E6=B3=A8=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E4=B8=A4=E7=A7=8D=E6=A8=A1=E6=9D=BF=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/file/StashedFILE.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java index 860515fba..48f00f95b 100644 --- a/designer-base/src/main/java/com/fr/file/StashedFILE.java +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -69,8 +69,7 @@ public class StashedFILE extends AbstractFILE { } private boolean needDecode() { - // 仅有cpt支持模板加密 - return StringUtils.isNotEmpty(suffix) && suffix.endsWith(".cpt"); + return StringUtils.isNotEmpty(suffix) && (suffix.endsWith(".cpt") || suffix.endsWith(".frm")); } @Override From 90817ad82450de63f5a54fa96fa581b40c213b4a Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 10 Nov 2021 15:47:20 +0800 Subject: [PATCH 079/152] =?UTF-8?q?REPORT-62437=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=9B=86=E5=AF=BC=E5=87=BAexcel?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=90=8E=EF=BC=8C=E8=BF=9C=E7=A8=8B=E5=92=8C?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E4=BA=92=E7=9B=B8=E5=88=87=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 1ccc07303..d8bc7fb48 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 @@ -406,8 +406,11 @@ public abstract class JTemplate> } private void setTargetByFile(FILE file) { - this.template = JTemplateFactory.asIOFile(file, this.suffix()); - setTarget(this.template); + T newTemplate = JTemplateFactory.asIOFile(file, this.suffix()); + if (newTemplate != null) { + this.template = newTemplate; + setTarget(this.template); + } } private void addCenterPane() { From 9d43ffdb5e70d057d70cd9a5b3fb9ffb896f9f3d Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 11 Nov 2021 10:34:12 +0800 Subject: [PATCH 080/152] =?UTF-8?q?REPORT-62433=2011.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E5=8D=95=E5=85=83=E6=A0=BC=E6=A0=B7=E5=BC=8F-?= =?UTF-8?q?=E6=9C=89=E9=83=A8=E5=88=86=E6=A0=B7=E5=BC=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E4=BD=93=E5=86=85=E5=AE=B9=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 问题颜色亮度计算错误 【改动思路】 同上 --- .../fr/design/cell/CellStylePreviewPane.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index 355dca62d..12f5a5228 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -51,14 +51,7 @@ public class CellStylePreviewPane extends JPanel { } private void paintTransparentBackground(Graphics2D g2d, Style style) { - Color fontColor = style.getFRFont().getForeground(); - float g = fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F * fontColor.getBlue() * 0.114F; - float alpha = 1.0F; - if (g < 50) { - alpha = 0.2F; - } else if (g < 160){ - alpha = 0.5F; - } + float alpha = computeTransparentBackgroundAlpha(style); float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth; float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight; @@ -76,6 +69,23 @@ public class CellStylePreviewPane extends JPanel { g2d.setComposite(oldComposite); } + private float computeTextColorBrightness(Style style) { + Color fontColor = style.getFRFont().getForeground(); + return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F; + } + + private float computeTransparentBackgroundAlpha(Style style) { + float textBrightness = computeTextColorBrightness(style); + + float alpha = 1.0F; + if (textBrightness < 50) { + alpha = 0.2F; + } else if (textBrightness < 160){ + alpha = 0.5F; + } + return alpha; + } + private void paintCellStyle(Graphics2D g2d, Style style) { int resolution = ScreenResolution.getScreenResolution(); From c5feb03896cc37cb41758a3461e8aacb1b6f6176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 11 Nov 2021 10:34:45 +0800 Subject: [PATCH 081/152] =?UTF-8?q?REPORT-60748=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E5=B1=9E=E6=80=A7-=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetBoundsPaneFactory.java | 6 +++--- .../design/designer/creator/XChartEditor.java | 15 ++++++++++++--- .../fr/design/designer/creator/XCreator.java | 12 ++++++++++-- .../designer/creator/XCreatorUtils.java | 19 +++++++++++++++++++ .../design/designer/creator/XElementCase.java | 5 +++++ .../designer/creator/XLayoutContainer.java | 5 +++++ .../widget/ui/FormSingleWidgetCardPane.java | 13 +++---------- .../component/WidgetAbsoluteBoundPane.java | 2 +- .../designer/component/WidgetBoundPane.java | 15 ++++++++++++++- 9 files changed, 72 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index ae3dfc255..2b2dcc532 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -46,12 +46,12 @@ public class WidgetBoundsPaneFactory { private static final int RIGHT_PANE_WIDTH = 145; - public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked) { + public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) { JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; @@ -65,7 +65,7 @@ public class WidgetBoundsPaneFactory { } public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { - return createBoundsPane(width, height, null); + return createBoundsPane(width, height, null, NameAttribute.DEFAULT); } public static JPanel createRightPane(Component com1, Component com2) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index 1ab6d1a31..b808a935d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -20,7 +20,6 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.module.DesignModuleFactory; import com.fr.form.ui.BaseChartEditor; -import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.core.PropertyChangeAdapter; @@ -29,9 +28,15 @@ import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.awt.*; -import java.beans.IntrospectionException; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; import java.awt.event.MouseEvent; +import java.beans.IntrospectionException; /** * form中的图表按钮弹出的控件, 创建初始化图表内容. @@ -367,4 +372,8 @@ public class XChartEditor extends XBorderStyleWidgetCreator { return false; } + @Override + public boolean isComponent() { + return true; + } } 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 1c45fc2b6..14fc9ea24 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 @@ -9,8 +9,8 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; -import com.fr.design.designer.creator.operate.XCreatorBaseOperate; import com.fr.design.designer.creator.operate.DefaultXCreatorBaseOperate; +import com.fr.design.designer.creator.operate.XCreatorBaseOperate; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; import com.fr.design.designer.treeview.XCreatorTreeCellRender; import com.fr.design.designer.ui.PopupDialogContext; @@ -36,7 +36,6 @@ import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import java.awt.event.MouseListener; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; @@ -50,6 +49,7 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.List; @@ -935,4 +935,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return new DefaultXCreatorBaseOperate(); } + /** + * 是否是组件(控件还是组件) + * @return 是否是组件 + */ + public boolean isComponent() { + return false; + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 30f9ab307..deaa22967 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -427,4 +427,23 @@ public class XCreatorUtils { } return null; } + + /** + * 把控件例如textEditor外层的容器剥掉 + * @param xCreator 控件 + * @return 内层控件 + */ + public static XCreator getXCreatorInnerWidget(XCreator xCreator) { + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + return (XCreator) xCreator.getComponent(0); + } + } + + if (xCreator.acceptType(XWTitleLayout.class)) { + return (XCreator) xCreator.getComponent(0); + } + + return xCreator; + } } \ No newline at end of file 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 42a14aee3..bdaf40d22 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 @@ -366,4 +366,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public void releaseResources() { imageLable.setIcon(null); } + + @Override + public boolean isComponent() { + return true; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index 801f18969..01d09fe4c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -612,4 +612,9 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme public void replaceXcreator(XCreator newCreator, XCreator oldCreator){ } + + @Override + public boolean isComponent() { + return true; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 9f0c44ded..6fed5262f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -10,8 +10,6 @@ import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.designer.creator.XWScaleLayout; -import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.foldablepane.UIExpandablePane; @@ -113,7 +111,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { } private void initComponents() { - XCreator innerCreator = getXCreatorDedicated(); + XCreator innerCreator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); content.add(attriCardPane, BorderLayout.CENTER); @@ -166,7 +164,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { private void initDefinePane() { currentEditorDefinePane = null; - XCreator creator = getXCreatorDedicated(); + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() { @Override public void did(DataCreatorUI ui, String cardName) { @@ -190,11 +188,6 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { currentEditorDefinePane = definePane; } - private XCreator getXCreatorDedicated() { - boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class); - return dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator; - } - @Override public String title4PopupWindow() { return "Widget"; @@ -283,7 +276,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { } public void fireValueChanged() { - XCreator creator = getXCreatorDedicated(); + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); creator.firePropertyChange(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index e8aeb994d..f6d52a2d6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -35,7 +35,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); - this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, getNameAttribute())); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index a462a8aed..aee83889e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -89,7 +89,20 @@ public class WidgetBoundPane extends BasicPane { ratioLockedButton.setLockEnabled(false); } - this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton)); + this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton, getNameAttribute())); + } + + protected WidgetBoundsPaneFactory.NameAttribute getNameAttribute() { + WidgetBoundsPaneFactory.NameAttribute nameAttribute = WidgetBoundsPaneFactory.NameAttribute.DEFAULT; + if (!isComponent()) { + nameAttribute = WidgetBoundsPaneFactory.NameAttribute.WIDGET; + } + return nameAttribute; + } + + protected boolean isComponent() { + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.creator); + return creator.isComponent(); } From efc33deea7a5cce5fb58abe8beb6d46ce69ccc9b Mon Sep 17 00:00:00 2001 From: Lanlan Date: Tue, 9 Nov 2021 10:15:35 +0800 Subject: [PATCH 082/152] =?UTF-8?q?REPORT-62133=20mac=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=89=E8=A3=85=E5=8C=85=E8=B5=B7=E4=B8=8D=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/DesignerEnvManager.java | 8 ++++++++ .../com/fr/design/login/DesignerLoginHelper.java | 2 +- .../login/config/DesignerLoginConfigManager.java | 14 ++++++++++++++ .../design/login/guide/DesignerGuideHelper.java | 16 +++++++++++----- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 9c23dcc51..b8d63ca7a 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -867,6 +867,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerLoginConfigManager.setPluginRemindOnFirstLaunch(pluginRemindOnFirstLaunch); } + public boolean isUseOldVersionLogin() { + return designerLoginConfigManager.isUseOldVersionLogin(); + } + + public void setUseOldVersionLogin(boolean useOldVersionLogin) { + designerLoginConfigManager.setUseOldVersionLogin(useOldVersionLogin); + } + /** * 内置服务器是否使用时启动 * diff --git a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java index 2d2dd935d..8976a0734 100644 --- a/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java @@ -47,7 +47,7 @@ public class DesignerLoginHelper { } public static void showLoginDialog(DesignerLoginSource source, Map params, Window window) { - if (!SupportOSImpl.DESIGNER_LOGIN.support()) { + if (!SupportOSImpl.DESIGNER_LOGIN.support() || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) { WebViewDlgHelper.createLoginDialog(window); return; } diff --git a/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java b/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java index a0ab68109..b0fb0e292 100644 --- a/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java @@ -70,6 +70,10 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { * 插件管理第一次启动时的提醒 */ private boolean pluginRemindOnFirstLaunch = true; + /** + * 使用旧版登录 + */ + private boolean useOldVersionLogin = false; private DesignerLoginConfigManager() { @@ -98,6 +102,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { this.setLastLoginAccount(reader.getAttrAsString("lastLoginAccount", StringUtils.EMPTY)); this.setLoginRemindBeforeJumpBBS(reader.getAttrAsBoolean("loginRemindBeforeJumpBBS", true)); this.setPluginRemindOnFirstLaunch(reader.getAttrAsBoolean("pluginRemindOnFirstLaunch", true)); + this.setUseOldVersionLogin(reader.getAttrAsBoolean("useOldVersionLogin", false)); } } @@ -117,6 +122,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { writer.attr("lastLoginAccount", lastLoginAccount); writer.attr("loginRemindBeforeJumpBBS", loginRemindBeforeJumpBBS); writer.attr("pluginRemindOnFirstLaunch", pluginRemindOnFirstLaunch); + writer.attr("useOldVersionLogin", useOldVersionLogin); writer.end(); } @@ -223,4 +229,12 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { public void setPluginRemindOnFirstLaunch(boolean pluginRemindOnFirstLaunch) { this.pluginRemindOnFirstLaunch = pluginRemindOnFirstLaunch; } + + public boolean isUseOldVersionLogin() { + return useOldVersionLogin; + } + + public void setUseOldVersionLogin(boolean useOldVersionLogin) { + this.useOldVersionLogin = useOldVersionLogin; + } } diff --git a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java index b3513bb6d..3e4c0dae5 100644 --- a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java @@ -8,9 +8,7 @@ import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.update.push.DesignerPushUpdateManager; -import com.fr.general.CloudCenter; -import com.fr.general.CloudCenterConfig; -import com.fr.general.http.HttpToolbox; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import javax.swing.WindowConstants; @@ -39,7 +37,11 @@ public class DesignerGuideHelper { public static void prepareShowGuideDialog() { // 如果存在更新升级的弹窗,则不显示引导页面 - if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { + if (!DesignerLoginUtils.isOnline() + || !SupportOSImpl.DESIGNER_LOGIN.support() + || !FRContext.isChineseEnv() + || DesignerPushUpdateManager.getInstance().isShouldPopUp() + || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) { return; } if (isActivatedForOneWeek()) { @@ -52,7 +54,11 @@ public class DesignerGuideHelper { DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { @Override public void designerOpened() { - showGuideDialog(); + try { + showGuideDialog(); + } catch (Throwable t) { + FineLoggerFactory.getLogger().warn(t.getMessage(), t); + } } }); } From 0dd0eef5b546137bdf46cf8648fd254da46bef9e Mon Sep 17 00:00:00 2001 From: Lanlan Date: Thu, 11 Nov 2021 14:29:27 +0800 Subject: [PATCH 083/152] =?UTF-8?q?REPORT-61844=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A811.0=E3=80=91=E9=AB=98=E5=88=86=E5=B1=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9dpi=EF=BC=8C=E5=88=87=E6=8D=A2=E5=B8=86?= =?UTF-8?q?=E8=BD=AF=E8=B4=A6=E5=8F=B7=EF=BC=8C=E5=BC=B9=E7=AA=97=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=87=AA=E9=80=82=E5=BA=94=EF=BC=8C=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B8=B2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/PreferencePane.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 2e32eb88c..303d9fd81 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 @@ -167,6 +167,7 @@ public class PreferencePane extends BasicPane { private UICheckBox oracleSpace; private UISpinner cachingTemplateSpinner; private UICheckBox useOptimizedUPMCheckbox; + private UICheckBox useNewVersionLoginCheckbox; private UICheckBox useUniverseDBMCheckbox; private UICheckBox joinProductImproveCheckBox; private UICheckBox autoPushUpdateCheckBox; @@ -233,6 +234,13 @@ public class PreferencePane extends BasicPane { advancePane.add(upmSelectorPane); } + if (SupportOSImpl.DESIGNER_LOGIN.support()) { + JPanel loginSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Login_Manager")); + useNewVersionLoginCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Login_Manager")); + loginSelectorPane.add(useNewVersionLoginCheckbox); + advancePane.add(loginSelectorPane); + } + JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager")); useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); //dbmSelectorPane.add(useUniverseDBMCheckbox); @@ -726,6 +734,10 @@ public class PreferencePane extends BasicPane { useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); } + if (useNewVersionLoginCheckbox != null) { + useNewVersionLoginCheckbox.setSelected(!DesignerEnvManager.getEnvManager().isUseOldVersionLogin()); + } + useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); @@ -820,6 +832,10 @@ public class PreferencePane extends BasicPane { designerEnvManager.setAutoPushUpdateEnabled(this.autoPushUpdateCheckBox.isSelected()); } + if (useNewVersionLoginCheckbox != null) { + designerEnvManager.setUseOldVersionLogin(!this.useNewVersionLoginCheckbox.isSelected()); + } + designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); From e86dd190a6158cdf9ea8471e8e387ad3f58ff4aa Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 11 Nov 2021 14:46:58 +0800 Subject: [PATCH 084/152] =?UTF-8?q?REPORT-60789=E3=80=90=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E9=A2=84=E8=A7=88=E6=94=AF=E6=8C=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=B8=83=E5=B1=80=E3=80=91=E6=96=B0=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94-=E6=9C=AC=E5=9C=B0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=BF=9B=E5=85=A5=E5=BC=80=E5=8F=91=E8=80=85?= =?UTF-8?q?=E8=B0=83=E8=AF=95=EF=BC=8C=E8=B7=AF=E5=BE=84=E5=A4=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=B7=B2=E9=94=81=E5=AE=9A=E4=BD=86=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=B8=8A=E6=B2=A1=E6=9C=89=E9=94=81=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=EF=BC=8C=E8=BF=9C=E7=A8=8B=E4=B8=8B=E6=98=AF=E6=9C=89?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/filetree/FileTreeIcon.java | 11 +++-- .../com/fr/design/icon/LocalFileIcon.java | 42 ++++++++++++++++++ .../java/com/fr/design/icon/LockIcon.java | 5 ++- .../com/fr/design/images/gui/file_lock.png | Bin 0 -> 225 bytes 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/gui/file_lock.png diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index e0515fe81..b2956b70f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -2,6 +2,7 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.icon.LocalFileIcon; import com.fr.design.icon.LockIcon; import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.file.filetree.FileNode; @@ -19,6 +20,8 @@ public class FileTreeIcon { private FileTreeIcon() { } + public static final String FILE_LOCKED_ICON_PATH = "/com/fr/design/images/gui/file_lock.png"; + public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); public static final Icon FOLDER_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png"); @@ -153,7 +156,7 @@ public class FileTreeIcon { if (node.isDirectory()) { return FileTreeIcon.FOLDER_IMAGE_ICON; } - return getLocalFileIcon(path); + return getLocalFileIcon(path, isShowLock); } } if (node.isDirectory()) { @@ -163,12 +166,12 @@ public class FileTreeIcon { } } - private static Icon getLocalFileIcon(String path) { - Icon icon = getExtraIcon(path, false); + private static Icon getLocalFileIcon(String path, boolean isShowLock) { + Icon icon = getExtraIcon(path, isShowLock); if (icon != null) { return icon; } - return FileSystemView.getFileSystemView().getSystemIcon(new File(path)); + return new LocalFileIcon(FileSystemView.getFileSystemView().getSystemIcon(new File(path)), isShowLock); } private static Icon getRemoteFileIcon(FileNode node, boolean isShowLock) { diff --git a/designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java b/designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java new file mode 100644 index 000000000..e80af21c6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java @@ -0,0 +1,42 @@ +package com.fr.design.icon; + +import com.fr.base.BaseUtils; +import com.fr.design.gui.itree.filetree.FileTreeIcon; + +import javax.swing.Icon; +import java.awt.Component; +import java.awt.Graphics; + +/** + * Created by kerry on 2021/11/11 + */ +public class LocalFileIcon implements Icon { + private static final Icon FILE_LOCKED_ICON = BaseUtils.readIcon(FileTreeIcon.FILE_LOCKED_ICON_PATH); + private static final int OFFSET_X = 9; + private static final int OFFSET_Y = 8; + private final Icon mainIcon; + private final boolean showLock; + + public LocalFileIcon(Icon mainIcon, boolean showLock) { + this.mainIcon = mainIcon; + this.showLock = showLock; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + mainIcon.paintIcon(c, g, x, y); + if (showLock) { + FILE_LOCKED_ICON.paintIcon(c, g, OFFSET_X, OFFSET_Y); + } + } + + @Override + public int getIconWidth() { + return mainIcon.getIconWidth(); + } + + @Override + public int getIconHeight() { + return mainIcon.getIconHeight(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/icon/LockIcon.java b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java index 7ebffbdb7..e7c400020 100644 --- a/designer-base/src/main/java/com/fr/design/icon/LockIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java @@ -1,6 +1,7 @@ package com.fr.design.icon; import com.fr.base.BaseUtils; +import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.log.FineLoggerFactory; import javax.swing.GrayFilter; @@ -12,7 +13,7 @@ import java.awt.MediaTracker; import java.awt.image.ImageObserver; public class LockIcon extends ImageIcon { - private final static Image lockImage = BaseUtils.readImage("/com/fr/design/images/gui/locked.gif"); + private final static Image lockImage = BaseUtils.readImage(FileTreeIcon.FILE_LOCKED_ICON_PATH); private Image mainImage = null; @@ -107,4 +108,4 @@ public class LockIcon extends ImageIcon { { loadImage(lockImage); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/file_lock.png b/designer-base/src/main/resources/com/fr/design/images/gui/file_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..a0b08e6e27b150fb4c8ebbb3624d9a6abf6b2a13 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)H!3HEvS)PI@#^NA%Cx&(BWL^R}E~ycoX}-P; zS|C*njP02WEFdL7ECs|249p7{8JK}IBS>rk6I_;k0W+M<0a6&u=FtwMyggkULpWrU zfBgTypGzQ_flVQSQBdJSM4aHEhDi!nc?@*>pNJ%!`EOvR?7 Date: Thu, 11 Nov 2021 16:53:13 +0800 Subject: [PATCH 085/152] =?UTF-8?q?CHART-21665=20design=20fix:=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E5=88=BB=E5=BA=A6=E9=85=8D=E8=89=B2=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/series/UIColorPickerPane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index 6529efce0..8a0c2c5cb 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -29,8 +29,6 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -42,6 +40,8 @@ import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; public class UIColorPickerPane extends BasicPane implements UIObserver { private static final int MARGIN_TOP = 7; @@ -691,14 +691,18 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { fillStyleCombox.setSelectObject(mainColor); designTypeButtonGroup.setSelectedIndex(hotAreaColor.getUseType()); - double value = (double) hotAreaColor.getAreaNumber(); + int value = hotAreaColor.getAreaNumber(); UIColorPickerPane.this.add(textGroup); UIColorPickerPane.this.add(colorGroup); Color[] colors = hotAreaColor.initColor(); BaseFormula[] values = hotAreaColor.initValues(); + if (value != colors.length && hotAreaColor.getUseType() == MapHotAreaColor.CUSTOM) { + colors = getColorArray(mainColor, value); + values = getValueArray(value); + } refreshGroupPane(colors, values); this.initContainerLister(); - regionNumPane.populateBean(value); + regionNumPane.populateBean((double) value); refreshPane(); } From 4fef352bb37e7a3e5685bbe7e6ddc3716373f0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 11 Nov 2021 19:10:51 +0800 Subject: [PATCH 086/152] =?UTF-8?q?REPORT-57521=20feature=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A2=AB=E5=9B=9E=E9=80=80=E4=BA=86=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=BF=98=E5=8E=9F-=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E6=97=B6websocket=E6=96=AD=E5=BC=80=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toast/DesignerToastMsgUtil.java | 14 +- .../mainframe/toast/ToastMsgDialog.java | 7 +- .../mainframe/socketio/DesignerSocketIO.java | 139 +++++++++++++----- 3 files changed, 123 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java index d7e83dc2e..fc326c60e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java @@ -31,6 +31,13 @@ public class DesignerToastMsgUtil { } + public static ToastMsgDialog createPromptDialog(String text) { + return createDialog(PROMPT_ICON, toastPane(text), DesignerContext.getDesignerFrame()); + } + + public static ToastMsgDialog createPromptDialog(JPanel contentPane) { + return createDialog(PROMPT_ICON, contentPane, DesignerContext.getDesignerFrame()); + } public static void toastPrompt(JPanel contendPane) { toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame()); @@ -69,6 +76,11 @@ public class DesignerToastMsgUtil { } private static void toastPane(Icon icon, JPanel contendPane, Window parent) { + ToastMsgDialog dialog = createDialog(icon, contendPane, parent); + dialog.setVisible(true); + } + + private static ToastMsgDialog createDialog(Icon icon, JPanel contendPane, Window parent) { JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel uiLabel = new UILabel(icon); uiLabel.setVerticalAlignment(SwingConstants.TOP); @@ -83,7 +95,7 @@ public class DesignerToastMsgUtil { } else { dialog = new ToastMsgDialog((Frame) parent, pane); } - dialog.setVisible(true); + return dialog; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java index c3f9b096d..b4c6dc1b5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java @@ -24,6 +24,7 @@ public class ToastMsgDialog extends UIDialog { private ScheduledExecutorService TIMER; private int hide_height = 0; private JPanel contentPane; + private boolean show = false; public ToastMsgDialog(Frame parent, JPanel panel) { super(parent); @@ -65,6 +66,7 @@ public class ToastMsgDialog extends UIDialog { public void display(JPanel outerJPanel) { + show = true; outerJPanel.setLocation(0, -hide_height); ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService(); TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() { @@ -98,6 +100,7 @@ public class ToastMsgDialog extends UIDialog { TIP_TOOL_TIMER.shutdown(); ToastMsgDialog.this.setVisible(false); ToastMsgDialog.this.dispose(); + ToastMsgDialog.this.show = false; } outerJPanel.setLocation(point.x, point.y - 5); Dimension dimension = ToastMsgDialog.this.getSize(); @@ -159,5 +162,7 @@ public class ToastMsgDialog extends UIDialog { super.dispose(); } - + public boolean isShow() { + return show; + } } \ No newline at end of file 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 e1d4e5e37..c32e6673a 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 @@ -7,20 +7,33 @@ import com.fr.design.EnvChangeEntrance; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfoContext; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogger; +import com.fr.design.mainframe.share.ui.base.MouseClickListener; +import com.fr.design.mainframe.toast.DesignerToastMsgUtil; +import com.fr.design.mainframe.toast.ToastMsgDialog; import com.fr.design.ui.util.UIUtil; +import com.fr.design.utils.BrowseUtils; import com.fr.event.EventDispatcher; +import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; +import com.fr.third.org.apache.http.client.config.RequestConfig; +import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; +import com.fr.third.org.apache.http.client.methods.HttpGet; import com.fr.third.org.apache.http.conn.ssl.NoopHostnameVerifier; import com.fr.third.org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import com.fr.third.org.apache.http.impl.client.CloseableHttpClient; +import com.fr.third.org.apache.http.impl.client.HttpClients; import com.fr.third.org.apache.http.ssl.SSLContexts; import com.fr.web.WebSocketConfig; import com.fr.web.socketio.WebSocketProtocol; @@ -29,22 +42,27 @@ import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; +import javax.net.ssl.SSLContext; +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.event.MouseEvent; import java.io.File; import java.io.FileInputStream; -import java.security.KeyStore; -import java.util.Arrays; -import javax.net.ssl.SSLContext; -import javax.swing.*; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.security.KeyStore; +import java.util.Arrays; import java.util.Timer; -import java.util.TimerTask; public class DesignerSocketIO { @@ -54,18 +72,21 @@ public class DesignerSocketIO { Disconnecting } + private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("websocketConnect", "https://help.fanruan.com/finereport/doc-view-2512.html"); private static final String HTTPS = "https"; private static final String HTTP = "http"; private static Socket socket = null; private static Status status = Status.Disconnected; private static Timer disConnectHintTimer = null; private static long disConnectHintTimerDelay = 3000; + private static final int TIMEOUT = 5000; //维护一个当前工作环境的uri列表 private static String[] uri; //维护一个关于uri列表的计数器 private static int count; // 当前webSocket选择的协议 private static String currentProtocol; + private static ToastMsgDialog dialog = null; public static void close() { @@ -115,7 +136,6 @@ public class DesignerSocketIO { private static IO.Options createOptions() { IO.Options options = new IO.Options(); - options.path = WebSocketConfig.getInstance().getSocketContext(); try { if (ComparatorUtils.equals(currentProtocol, HTTPS)) { options.sslContext = getSSLContext(); @@ -186,6 +206,7 @@ public class DesignerSocketIO { private static final Emitter.Listener failRetry = new Emitter.Listener() { @Override public void call(Object... args) { + showSocketDisconnectToast(); printLog(args, PrintEventLogImpl.WARN, "failed args: {}"); status = Status.Disconnecting; socket.close(); @@ -224,41 +245,38 @@ public class DesignerSocketIO { @Override public void call(Object... objects) { FineLoggerFactory.getLogger().info("start disConnectHintTimer"); - disConnectHintTimer = new Timer(); - disConnectHintTimer.schedule(new TimerTask() { - @Override - public void run() { - try { - /* - * todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, - * socket 只用推日志和通知配置变更 - */ - printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}"); - if (status != Status.Disconnecting) { - showConnectionLostDialog(); - } - status = Status.Disconnected; - } finally { - disConnectHintTimer.cancel(); - disConnectHintTimer = null; - } - } - }, disConnectHintTimerDelay); + /* + * todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, + * socket 只用推日志和通知配置变更 + */ + printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}"); + if (status != Status.Disconnecting) { + dealWithSocketDisconnect(); + } + status = Status.Disconnected; } }; - private static void showConnectionLostDialog() { + private static void dealWithSocketDisconnect() { + if (checkRPCConnect()) { + showSocketDisconnectToast(); + } else { + showRPCDisconnectDialog(); + } + } + + private static void showSocketDisconnectToast() { try { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - FineJOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), - UIManager.getString("OptionPane.messageDialogTitle"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - EnvChangeEntrance.getInstance().chooseEnv(); + if (dialog == null) { + dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent()); + } + + if (!dialog.isShow()) { + dialog.setVisible(true); + } } }); } catch (Exception e) { @@ -266,6 +284,57 @@ public class DesignerSocketIO { } } + private static JPanel createDialogContent() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip")), BorderLayout.WEST); + UILabel hyperLinkLabel = new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip_HyperLink_Text")); + hyperLinkLabel.addMouseListener(new MouseClickListener() { + @Override + public void mouseClicked(MouseEvent e) { + BrowseUtils.browser(WEBSOCKET_HELP_DOC); + } + }); + hyperLinkLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); + hyperLinkLabel.setForeground(Color.BLUE); + hyperLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + jPanel.add(hyperLinkLabel, BorderLayout.CENTER); + return jPanel; + } + + private static void showRPCDisconnectDialog() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + FineJOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), + UIManager.getString("OptionPane.messageDialogTitle"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); + EnvChangeEntrance.getInstance().chooseEnv(); + } + }); + } + + private static boolean checkRPCConnect() { + CloseableHttpClient httpclient = HttpClients.createDefault(); + WorkspaceConnectionInfo info = getConnectionInfo(); + HttpGet httpGet = new HttpGet(StableUtils.pathJoin(info.getUrl(), WorkspaceConstants.CONTROLLER_PREFIX, WorkspaceConstants.VT)); + RequestConfig requestConfig = RequestConfig + .custom() + .setConnectTimeout(TIMEOUT) + .setConnectionRequestTimeout(TIMEOUT) + .build(); + httpGet.setConfig(requestConfig); + try { + CloseableHttpResponse response = httpclient.execute(httpGet); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + return false; + } + return true; + } + //配置变更监听器 private static final Emitter.Listener modifyConfig = new Emitter.Listener() { @Override From f7fcf6110cffdd5631b3b7289b9e88358a66141a Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 12 Nov 2021 10:00:09 +0800 Subject: [PATCH 087/152] =?UTF-8?q?REPORT-62433=2011.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E5=8D=95=E5=85=83=E6=A0=BC=E6=A0=B7=E5=BC=8F-?= =?UTF-8?q?=E6=9C=89=E9=83=A8=E5=88=86=E6=A0=B7=E5=BC=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E4=BD=93=E5=86=85=E5=AE=B9=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 补充下绘制时的反锯齿 【改动思路】 同上 --- .../main/java/com/fr/design/cell/CellStylePreviewPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index 12f5a5228..cb6cfc8d5 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -12,6 +12,7 @@ import java.awt.Composite; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.image.BufferedImage; /** @@ -44,10 +45,14 @@ public class CellStylePreviewPane extends JPanel { public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g.clearRect(0, 0, getWidth(), getHeight()); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); paintTransparentBackground(g2d, style); - paintCellStyle(g2d, style); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } private void paintTransparentBackground(Graphics2D g2d, Style style) { From 0d0f152fd32a68fa95e6e08136a019e1b59aebaf Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 12 Nov 2021 10:14:03 +0800 Subject: [PATCH 088/152] =?UTF-8?q?REPORT-62539=20=20=E4=B8=8D=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E4=BA=8B=E4=BB=B6=E4=BA=86=EF=BC=8C=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=94=B9=E5=8F=AF=E8=A7=81=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 3 +-- 1 file changed, 1 insertion(+), 2 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 25ecfcb34..f5d69a02d 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 @@ -119,11 +119,10 @@ public class JDBCDefPane extends JPanel { driverManageLabel.setVisible(selectSelfDefine); driverLoaderBox.setVisible(selectSelfDefine); driverComboBox.setVisible(!selectSelfDefine); - // 选中自定义的话,将odbc的屏蔽,选中默认的话,重新触发一次driverComboBox的事件 if (selectSelfDefine) { odbcTipsLink.setVisible(false); } else { - driverComboBox.setSelectedItem(driverComboBox.getSelectedItem()); + odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); } } }; From a682e7d9a0907020f4b6e291c77b6fa6865fd901 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 12 Nov 2021 10:59:11 +0800 Subject: [PATCH 089/152] =?UTF-8?q?REPORT-62543=20=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 未使用搜索结果重新渲染组件列表页 【改动思路】 同上 --- .../share/ui/online/AbstractOnlineWidgetShowPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java index 62000b2d8..1e5899f46 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java @@ -130,11 +130,11 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { this.mainCardLayout.show(mainCenterPane, MAIN_FILTER_TAB_PANE); return; } - List widgets = new ArrayList<>(); + List searchedWidgetList = new ArrayList<>(); if (StringUtils.isNotEmpty(text)) { for (OnlineShareWidget provider : sharableWidgetProviders) { if (provider.getName().toLowerCase().contains(text)) { - widgets.add(provider); + searchedWidgetList.add(provider); } } } @@ -142,7 +142,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { if (searchResultShowPane != null) { mainCenterPane.remove(searchResultShowPane); } - searchResultShowPane = manualCreateOnlineWidgetSelectPane(sharableWidgetProviders); + searchResultShowPane = manualCreateOnlineWidgetSelectPane(searchedWidgetList.toArray(new OnlineShareWidget[]{})); this.mainCenterPane.add(searchResultShowPane, SEARCH_RESULT_PANE); this.mainCardLayout.show(mainCenterPane, SEARCH_RESULT_PANE); this.validate(); From 78aab5a8781ff246e38bbdb9f3e6d7c4b31fc10f Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 12 Nov 2021 14:33:20 +0800 Subject: [PATCH 090/152] =?UTF-8?q?REPORT-62400=20&&=20REPORT-62399=20&&?= =?UTF-8?q?=20REPORT-62547=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E6=8B=96=E6=8B=BD=E5=8A=A8=E6=95=88=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E6=97=B6=EF=BC=8C=E9=A2=84=E8=A7=88=E5=9B=BE=E4=B8=8D?= =?UTF-8?q?=E6=B6=88=E5=A4=B1=EF=BC=9B=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E7=9A=84=E5=90=8C?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E9=BC=A0=E6=A0=87=E6=82=AC=E6=B5=AE=E5=9C=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=8A=EF=BC=8C=E8=BD=AE=E6=92=AD=E5=9B=BE?= =?UTF-8?q?=E4=B8=8D=E6=B6=88=E5=A4=B1=EF=BC=8C=E4=B8=8E=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=9B=BE=E5=90=8C=E6=97=B6=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=EF=BC=9B=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=BD=AE=E6=92=AD=E7=9A=84=E5=9B=BE=E7=89=87=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E5=A4=A7=E5=B0=8F=EF=BC=8C=E5=AF=BC=E8=87=B4=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=9B=BE=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../embed/OnlineEmbedFilterSelectPane.java | 4 +++- .../share/ui/online/embed/PreviewDialog.java | 18 ++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index b7f62e564..0d3a757f3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -95,7 +95,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane this.doLayout(); this.validate(); this.repaint(); - previewDialog.setImage(getPreviewImage(shareWidget)); + previewDialog.setImage(getPreviewImage(shareWidget), widgetPane.getLocationOnScreen()); //展示弹出框 service.schedule(new Runnable() { @Override @@ -114,6 +114,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane if (!CarouselStateManger.getInstance().isSuspend()) { showCurrentLoadBlock(integer, widgetPane); } else { + previewDialog.setVisible(false); pollingCarouselState(integer, widgetPane); } } @@ -130,6 +131,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane return; } if (!CarouselStateManger.getInstance().isSuspend()) { + previewDialog.setVisible(true); showCurrentLoadBlock(integer, widgetPane); service.shutdown(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java index 086f4d2bd..3ef29c8cb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java @@ -6,35 +6,33 @@ import com.fr.design.mainframe.EastRegionContainerPane; import javax.swing.ImageIcon; import javax.swing.JDialog; +import java.awt.Dimension; import java.awt.Image; +import java.awt.Point; /** * Created by kerry on 2021/10/22 */ public class PreviewDialog extends JDialog { + private static final int OFFSET_Y = 9; public PreviewDialog() { super(DesignerContext.getDesignerFrame()); setUndecorated(true); - setSize(300, 300); - adjustLocation(); this.setVisible(false); } - public void setImage(Image image) { + public void setImage(Image image, Point point) { this.getContentPane().removeAll(); this.getContentPane().add(new UILabel(new ImageIcon(image))); + int width = image.getWidth(null); + this.setSize(width, image.getHeight(null)); + this.setLocation(point.x - width, point.y + OFFSET_Y); this.doLayout(); + this.validate(); this.repaint(); } - public void adjustLocation() { - - this.setLocation( - EastRegionContainerPane.getInstance().getX() - 300, - 20 - ); - } } From 90505e143d01bd40b02d58c16eb960a087b48365 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 12 Nov 2021 14:54:57 +0800 Subject: [PATCH 091/152] =?UTF-8?q?REPORT-62088=20=E6=9D=A5=E5=9B=9E?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=A4=E4=B8=AA=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=8F=8A=E5=85=B6=E7=9A=84=E6=8E=92=E5=BA=8F=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E5=87=A0=E5=8D=81=E6=AC=A1=E5=90=8E=EF=BC=8C=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/ibutton/UIButtonGroup.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index 624e2e8ee..5ca303fd5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -379,7 +379,10 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { * @param l */ public void removeChangeListener(ChangeListener l) { - this.listenerList.remove(ChangeListener.class, l); + for (int i = 0; i < labelButtonList.size(); i++) { + labelButtonList.get(i).removeChangeListener(l); + listenerList.remove(ChangeListener.class, l); + } } From aee7de437134a246ad3d31e4fc0dab0ccbde53e6 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Mon, 15 Nov 2021 10:15:54 +0800 Subject: [PATCH 092/152] =?UTF-8?q?REPORT-62539=20=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=B8=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/JDBCDefPane.java | 6 +----- 1 file changed, 1 insertion(+), 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 f5d69a02d..fcb0896ee 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 @@ -119,11 +119,7 @@ public class JDBCDefPane extends JPanel { driverManageLabel.setVisible(selectSelfDefine); driverLoaderBox.setVisible(selectSelfDefine); driverComboBox.setVisible(!selectSelfDefine); - if (selectSelfDefine) { - odbcTipsLink.setVisible(false); - } else { - odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); - } + odbcTipsLink.setVisible(driverComboBox.isVisible() && ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); } }; ActionListener dbtypeActionListener = new ActionListener() { From e1748fda1b5ab98f888de565f3e6ba1552e620f1 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 15 Nov 2021 10:18:03 +0800 Subject: [PATCH 093/152] =?UTF-8?q?REPORT-62573=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=BA=94=E5=BD=93?= =?UTF-8?q?=E4=BB=85=E6=9C=89=E5=8F=AF=E6=9B=B4=E6=96=B0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=BB=84=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 重新实现组件分组面板可展开的逻辑 【改动思路】 同上 --- .../share/ui/block/LocalWidgetBlock.java | 2 +- .../mainframe/share/ui/local/GroupPane.java | 22 +++++++++++++------ .../share/ui/local/LocalWidgetRepoPane.java | 8 +++---- .../ui/local/LocalWidgetRepoUpdater.java | 8 +++++-- .../mainframe/share/ui/local/ManagePane.java | 2 +- 5 files changed, 27 insertions(+), 15 deletions(-) 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 6839ee41f..e08c317d8 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 @@ -275,7 +275,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock if (getUpdater().isUpdating()) { paintLoadingIndicator(g2d, getUpdater().getProcessValue()); - } else if (LocalWidgetRepoUpdater.getInstance().checkUpdate(getWidget()) != null) { + } else if (LocalWidgetRepoUpdater.getInstance().checkUpdatable(getWidget())) { paintUpdatableMarker(g2d); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java index 905e9d87b..0a4aacfc9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java @@ -53,10 +53,6 @@ public class GroupPane extends JPanel { private SharableWidgetProvider[] elCaseBindInfoList; private SortType sortType = WidgetSortType.INSTALL_TIME; - private GroupPane(Group group) { - this(group, DEFAULT_HEIGHT, group.isDefaultExpend()); - } - private GroupPane(Group group, boolean expendStatus) { this(group, DEFAULT_HEIGHT, expendStatus); } @@ -90,7 +86,9 @@ public class GroupPane extends JPanel { //按照筛选条件进行过滤 elCaseBindInfoList = LocalWidgetFilter.getInstance().filter(elCaseBindInfoList); - boolean needExpendGroup = expendStatus || (isFiltering() && elCaseBindInfoList.length > 0); + boolean needExpendGroup = expendStatus + || (isFiltering() && elCaseBindInfoList.length > 0) + || hasUpdatableWidget(); if (elCaseBindInfoList.length == 0 && isFiltering()) { this.setVisible(false); } @@ -107,6 +105,16 @@ public class GroupPane extends JPanel { expendGroup(needExpendGroup); } + private boolean hasUpdatableWidget() { + for (SharableWidgetProvider provider: elCaseBindInfoList) { + boolean updatable = LocalWidgetRepoUpdater.getInstance().checkUpdatable(provider); + if (updatable) { + return true; + } + } + return false; + } + public LocalWidgetSelectPane getWidgetListPane() { return contentPanel; } @@ -375,7 +383,7 @@ public class GroupPane extends JPanel { DEFAULT { @Override public GroupPane creteGroupPane(Group group) { - return new GroupPane(group); + return new GroupPane(group, group.isDefaultExpend()); } }, EXPANDED { @@ -384,7 +392,7 @@ public class GroupPane extends JPanel { return new GroupPane(group, true); } }, - CLOSURE { + COLLAPSED { @Override public GroupPane creteGroupPane(Group group) { return new GroupPane(group, false); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 522574ce0..d2ad2d6f5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -390,7 +390,7 @@ public class LocalWidgetRepoPane extends BasicPane { List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); updateTipPane.setVisible(updatableWidgetProviders.size() > 0); if (updatableWidgetProviders.size() > 0) { - refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED); + refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); } } } @@ -413,7 +413,7 @@ public class LocalWidgetRepoPane extends BasicPane { toolbarPane.reset(); managePane.switchPanel(false); switchPane(LocalPaneStatus.NORMAL); - refreshAllGroupPane(GroupPane.GroupCreateStrategy.EXPANDED); + refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); List blockList = getUpdatableBlocks(); if (blockList.size() == 0) { @@ -428,7 +428,7 @@ public class LocalWidgetRepoPane extends BasicPane { LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); for (LocalWidgetBlock block: blockList) { - OnlineShareWidget remoteLatestWidget = updater.checkUpdate(block.getWidget()); + OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(block.getWidget()); block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() { @Override public void onUpdated(boolean success, String group, String id) { @@ -505,7 +505,7 @@ public class LocalWidgetRepoPane extends BasicPane { LocalWidgetBlock widgetBlock = (LocalWidgetBlock) component; SharableWidgetProvider localProvider = widgetBlock.getWidget(); - OnlineShareWidget remoteLatestWidget = updater.checkUpdate(localProvider); + OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(localProvider); if (remoteLatestWidget != null) { blockList.add(widgetBlock); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java index 03eb751f2..4cf949fad 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoUpdater.java @@ -55,7 +55,11 @@ public class LocalWidgetRepoUpdater { remoteLatestWidgetsBackup.clear(); } - public OnlineShareWidget checkUpdate(SharableWidgetProvider provider) { + public boolean checkUpdatable(SharableWidgetProvider provider) { + return findLatestRemoteWidget(provider) != null; + } + + public OnlineShareWidget findLatestRemoteWidget(SharableWidgetProvider provider) { OnlineShareWidget remoteLatestWidget = remoteLatestWidgetsBackup.get(provider.getId()); if (remoteLatestWidget != null && StringUtils.isNotEmpty(remoteLatestWidget.getVersion())) { Version remoteLatestVersion = Version.create(remoteLatestWidget.getVersion()); @@ -76,7 +80,7 @@ public class LocalWidgetRepoUpdater { for (Group group: groups) { SharableWidgetProvider[] widgetProviders = group.getAllBindInfoList(); for (SharableWidgetProvider widgetProvider: widgetProviders) { - if (checkUpdate(widgetProvider) != null) { + if (checkUpdatable(widgetProvider)) { updatableProviders.add(widgetProvider); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java index 67e2efe3f..387c1a135 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ManagePane.java @@ -135,7 +135,7 @@ class ManagePane extends JPanel implements ShareUIAspect { String userInput = getFileName().replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY); //新建分组,刷新显示 if (DefaultShareGroupManager.getInstance().createGroup(userInput)) { - LocalWidgetRepoPane.getInstance().refreshAllGroupPane(GroupPane.GroupCreateStrategy.CLOSURE); + LocalWidgetRepoPane.getInstance().refreshAllGroupPane(GroupPane.GroupCreateStrategy.COLLAPSED); } else { ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Make_Failure")); } From e7355039d81200f49accf92ff31aea7749ff7d07 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 15 Nov 2021 16:22:05 +0800 Subject: [PATCH 094/152] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/DesignerCloudURLManager.java | 4 +-- .../mainframe/share/ComponentShareUtil.java | 2 +- .../mainframe/FormWidgetDetailPane.java | 33 ++++++++++++------- .../share/ui/block/PreviewWidgetBlock.java | 3 +- .../embed/OnlineEmbedFilterSelectPane.java | 20 +++++++---- 5 files changed, 39 insertions(+), 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java index c6e5e18cf..240733a72 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java @@ -63,7 +63,7 @@ public class DesignerCloudURLManager implements XMLable { executorService.submit(() -> { updateURLXMLFile(key, latestUrl); }); - return url; + return latestUrl; } //本地缓存不为空时,直接返回对应 url,同时异步更新 executorService.submit(() -> { @@ -74,7 +74,7 @@ public class DesignerCloudURLManager implements XMLable { } private synchronized void updateURLXMLFile(String key, String url) { - if (!urlMap.containsKey(key) || !url.equals(urlMap.get(key))) { + if (StringUtils.isNotEmpty(url) && (!urlMap.containsKey(key) || !url.equals(urlMap.get(key)))) { urlMap.put(key, url); saveURLXMLFile(); } 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 db53be726..dbf983993 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 @@ -66,7 +66,7 @@ public class ComponentShareUtil { * @return boolean */ public static boolean needShowFirstDragAnimate() { - return ComponentReuseNotificationInfo.getInstance().isFirstDrag() && !hasTouched(); + return ComponentReuseNotificationInfo.getInstance().isFirstDrag(); } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 5bf6a9385..205316cd1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -13,7 +13,6 @@ import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; - import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; @@ -33,13 +32,15 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView{ +public class FormWidgetDetailPane extends FormDockView { private static final int ONLINE_TAB = 1; private JPanel centerPane; private UIHeadGroup headGroup; private List paneList; private CardLayout cardLayout; + //用来标记当前组件库界面是否处于已触达状态 + private boolean hasTouched = false; private boolean isEmptyPane = false; @@ -50,7 +51,7 @@ public class FormWidgetDetailPane extends FormDockView{ return HOLDER.singleton; } - private FormWidgetDetailPane(){ + private FormWidgetDetailPane() { setLayout(FRGUIPaneFactory.createBorderLayout()); } @@ -77,7 +78,7 @@ public class FormWidgetDetailPane extends FormDockView{ /** * 初始化 */ - public void refreshDockingView(){ + public void refreshDockingView() { if (isEmptyPane) { return; } @@ -87,18 +88,18 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - + hasTouched = ComponentShareUtil.hasTouched(); initPaneList(); this.setBorder(null); cardLayout = new CardLayout(); centerPane = new JPanel(cardLayout); String[] paneNames = new String[paneList.size()]; for (int i = 0; i < paneList.size(); i++) { - String title = paneList.get(i).getTitle(); + String title = paneList.get(i).getTitle(); paneNames[i] = title; centerPane.add(paneList.get(i), title); } - headGroup = new UIHeadGroup(paneNames) { + headGroup = new UIHeadGroup(paneNames) { protected void tabChanged(int newSelectedIndex) { //初始化还未展示的时候不需要收集其 marketClick if (this.isShowing() && newSelectedIndex == 1) { @@ -106,20 +107,28 @@ public class FormWidgetDetailPane extends FormDockView{ } cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); } - }; + }; headGroup.setSelectedIndex(ComponentShareUtil.needSwitch2OnlineTab() ? ONLINE_TAB : 0); this.add(headGroup, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } + /** + * 判断是否可触达 + * + * @return boolean + */ + public boolean hasTouched() { + return hasTouched; + } + - public void resetEmptyPane(){ + public void resetEmptyPane() { this.isEmptyPane = false; } - /** * 清除数据 */ @@ -129,7 +138,7 @@ public class FormWidgetDetailPane extends FormDockView{ this.add(psp, BorderLayout.CENTER); } - public void switch2Empty(){ + public void switch2Empty() { isEmptyPane = true; this.removeAll(); JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); @@ -162,7 +171,7 @@ public class FormWidgetDetailPane extends FormDockView{ } - public void enterWidgetLib() { + public void enterWidgetLib() { ComponentReuseNotifyUtil.enterWidgetLibExtraAction(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB); } 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 949719b85..425e3e1ca 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 @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.collect.ComponentCollector; @@ -147,7 +148,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe @Override public void mouseEntered(MouseEvent e) { hover = true; - if (ComponentShareUtil.needShowFirstDragAnimate() && checkWidget()) { + if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { schedule(ANIMATE_START_TIME); awtEventListener = event -> { if (!this.isShowing()) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 0d3a757f3..6ef729ce3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -46,13 +46,18 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane awtEventListener = event -> { if (event instanceof MouseEvent) { if (((MouseEvent) event).getClickCount() > 0) { - Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); - Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); - Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); - if (CarouselStateManger.getInstance().running() && - !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { - CarouselStateManger.getInstance().stop(); + try { + Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); + Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); + Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); + if (CarouselStateManger.getInstance().running() && + !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { + CarouselStateManger.getInstance().stop(); + } + } catch (Exception e) { + //忽略 } + } } @@ -82,9 +87,10 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane public void animate() throws InterruptedException { CarouselStateManger.getInstance().countDownLatchAwait(); - AtomicInteger integer = new AtomicInteger(showWidgets.length-1); + AtomicInteger integer = new AtomicInteger(showWidgets.length - 1); showCurrentLoadBlock(integer, widgetPane); this.repaint(); + CarouselStateManger.getInstance().start(); previewDialog.setVisible(true); } From fd7a89abd349ebb97eae2bd0067f4a5c5f82b883 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 15 Nov 2021 17:38:37 +0800 Subject: [PATCH 095/152] REPORT-62623 && REPORT-62399 && REPORT-62547 && REPORT-62626 && REPORT-62400 && REPORT-62542 && REPORT-62544 --- .../share/ui/online/CarouselStateManger.java | 12 ---- .../embed/OnlineEmbedFilterSelectPane.java | 57 +++++++++++++------ 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java index a0265d536..078fe4110 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/CarouselStateManger.java @@ -4,14 +4,11 @@ package com.fr.design.mainframe.share.ui.online; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import java.util.concurrent.CountDownLatch; - /** * Created by kerry on 2021/10/22 */ public class CarouselStateManger { - private static final String START_CAROUSEL ="START_CAROUSEL"; public static final String RIGHT_CLICK ="RIGHT_CLICK"; public static final String DOWNLOAD_COMPONENT ="DOWNLOAD_COMPONENT"; public static final String FIRST_DRAG_ANIMATE ="FIRST_DRAG_ANIMATE"; @@ -19,7 +16,6 @@ public class CarouselStateManger { private CarouseState state; - private final CountDownLatch countDownLatch = new CountDownLatch(1); private String suspendEvent; @@ -36,14 +32,6 @@ public class CarouselStateManger { } - public void countDown() { - countDownLatch.countDown(); - } - - public void countDownLatchAwait() throws InterruptedException { - countDownLatch.await(); - } - public void start() { this.state = CarouseState.RUNNING; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 6ef729ce3..120a396b6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -7,11 +7,9 @@ import com.fr.design.mainframe.share.ui.online.CarouselStateManger; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; -import com.fr.form.share.constants.ShareComponentConstants; -import com.fr.log.FineLoggerFactory; +import com.fr.form.share.exception.NetWorkFailedException; +import com.fr.general.http.HttpClient; import com.fr.module.ModuleContext; -import com.fr.stable.EncodeConstants; -import com.fr.third.springframework.web.util.UriUtils; import javax.imageio.ImageIO; import javax.swing.JPanel; @@ -24,7 +22,8 @@ import java.awt.Rectangle; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; import java.io.IOException; -import java.net.URL; +import java.net.HttpURLConnection; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -34,10 +33,12 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane { private static final String CAROUSEL_PREVIEW = "carousel_preview"; + private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000; private OnlineShareWidget[] showWidgets; private PreviewDialog previewDialog; private JPanel widgetPane; + private final CountDownLatch countDownLatch = new CountDownLatch(1); private final AWTEventListener awtEventListener; @@ -82,11 +83,11 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane protected void fireAfterDataLoad() { super.fireAfterDataLoad(); - CarouselStateManger.getInstance().countDown(); + countDownLatch.countDown(); } public void animate() throws InterruptedException { - CarouselStateManger.getInstance().countDownLatchAwait(); + countDownLatch.await(); AtomicInteger integer = new AtomicInteger(showWidgets.length - 1); showCurrentLoadBlock(integer, widgetPane); this.repaint(); @@ -94,6 +95,22 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane previewDialog.setVisible(true); } + private Image getPreviewImage(String url) throws NetWorkFailedException { + HttpClient httpClient = new HttpClient(url); + httpClient.setTimeout(CAROUSE_IMAGE_LOAD_TIMEOUT); + httpClient.asGet(); + int responseCode = httpClient.getResponseCode(); + if (responseCode != HttpURLConnection.HTTP_OK) { + throw new NetWorkFailedException(); + } + try { + return ImageIO.read(httpClient.getResponseStream()); + } catch (IOException e) { + throw new NetWorkFailedException(); + } + + } + private void showCurrentLoadBlock(AtomicInteger integer, JPanel widgetPane) { ScheduledExecutorService service = createToastScheduleExecutorService(); OnlineShareWidget shareWidget = showWidgets[integer.get()]; @@ -101,7 +118,13 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane this.doLayout(); this.validate(); this.repaint(); - previewDialog.setImage(getPreviewImage(shareWidget), widgetPane.getLocationOnScreen()); + try { + previewDialog.setImage(getPreviewImage(shareWidget.getPicPath()), widgetPane.getLocationOnScreen()); + } catch (NetWorkFailedException e) { + this.stopCarouse(integer, false); + this.switchPane(PaneStatue.DISCONNECTED); + return; + } //展示弹出框 service.schedule(new Runnable() { @Override @@ -146,11 +169,18 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } private void stopCarouse(AtomicInteger integer) { + this.stopCarouse(integer, true); + } + + private void stopCarouse(AtomicInteger integer, boolean showExtra) { previewDialog.setVisible(false); - loadRestShowWidgets(integer.get() - 1); + if (showExtra) { + loadRestShowWidgets(integer.get() - 1); + } java.awt.Toolkit.getDefaultToolkit().removeAWTEventListener(awtEventListener); } + private void loadRestShowWidgets(int startIndex) { for (int i = startIndex; i >= 0; i--) { OnlineShareWidget shareWidget = showWidgets[i]; @@ -161,15 +191,6 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane this.repaint(); } - public Image getPreviewImage(OnlineShareWidget widget) { - try { - return ImageIO.read(new URL(UriUtils.encodePath(widget.getPicPath(), EncodeConstants.ENCODING_UTF_8))); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return ShareComponentConstants.DEFAULT_COVER; - } - } - private ScheduledExecutorService createToastScheduleExecutorService() { return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW)); } From e49f8cd9c970b44326be9e498f6c79cae3894c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 15 Nov 2021 18:40:51 +0800 Subject: [PATCH 096/152] =?UTF-8?q?REPORT-62275=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8B=96=E5=85=A5=E5=A4=B1=E8=B4=A5-=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/beans/LayoutAdapter.java | 3 +++ .../adapters/layout/AbstractLayoutAdapter.java | 3 +++ .../adapters/layout/FRFitLayoutAdapter.java | 8 +++++++- .../adapters/layout/FRNoFixLayoutAdapter.java | 7 +++++++ .../designer/beans/models/AddingModel.java | 8 ++++++++ .../designer/beans/models/SelectionModel.java | 6 +++++- .../design/mainframe/FormCreatorDropTarget.java | 17 +++++++++++++++++ .../com/fr/design/mainframe/FormDesigner.java | 1 + 8 files changed, 51 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 438699b86..7686709a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -3,6 +3,7 @@ package com.fr.design.designer.beans; import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.adapters.layout.DefaultDesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; @@ -141,4 +142,6 @@ public interface LayoutAdapter { }; + void updateAddingModel(AddingModel model); + } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index 98b6c8855..a2e9b71ff 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -4,6 +4,7 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.NullPainter; import com.fr.design.designer.creator.XCreator; @@ -210,5 +211,7 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { selectionModel.setSelectedCreator(container); } + public void updateAddingModel(AddingModel model) { + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index d17e9689e..747479cbb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -8,6 +8,7 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -1243,5 +1244,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { frLayoutState.dragOver(xCreator, selectionModel,x,y); - }; + } + + @Override + public void updateAddingModel(AddingModel model) { + frLayoutState.updateAddingModel(model); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index aaeedfc8d..b278e0ffe 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -1,5 +1,6 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.AbstractPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -144,6 +145,12 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { @Override public void dragStart(XCreator xCreator, SelectionModel selectionModel) { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); + selectionModel.fireCreatorDeleted(); selectionModel.setSelectedCreator(container); } + + @Override + public void updateAddingModel(AddingModel model) { + model.setNeedUndoWhenAddingFailed(true); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 1926b57b1..c9a9eb330 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean needUndoWhenAddingFailed = false; public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -141,4 +142,11 @@ public class AddingModel { return added; } + public boolean isNeedUndoWhenAddingFailed() { + return needUndoWhenAddingFailed; + } + + public void setNeedUndoWhenAddingFailed(boolean needUndoWhenAddingFailed) { + this.needUndoWhenAddingFailed = needUndoWhenAddingFailed; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 963f60e6c..28456f799 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -25,7 +25,6 @@ import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; @@ -585,4 +584,9 @@ public class SelectionModel { selection.setSelectedCreators(rebuildSelection); fireCreatorSelected(); } + + public void fireCreatorDeleted() { + designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), + DesignerEvent.CREATOR_DELETED); + } } 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 82befa273..2b9a4f6be 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 @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -25,6 +26,7 @@ import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mod.bean.ChangeItem; import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; import com.fr.form.share.SharableWidgetProvider; @@ -152,6 +154,9 @@ public class FormCreatorDropTarget extends DropTarget { if (creator != null) { creator.setSelected(false); } + if (designer.getAddingModel().isNeedUndoWhenAddingFailed()) { + undoWhenDropFail(); + } } // 取消提示 designer.setPainter(null); @@ -159,6 +164,18 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } + private void undoWhenDropFail() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null && jt.getUndoManager().canUndo()) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + jt.undo(); + } + }); + } + } + private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); 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 3eb40b6a2..9cf220ff8 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 @@ -1210,6 +1210,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection setTransferHandler(handler); handler.exportAsDrag(this, lastPressEvent, TransferHandler.COPY); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); + parent.getLayoutAdapter().updateAddingModel(addingModel); parent.getLayoutAdapter().dragStart(xCreator, selectionModel); this.setDropTarget(new FormCreatorDropTarget(this)); // 触发状态添加模式事件 From 39703b20da47fb1ae4bb0d5506a2496e3710e22c Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 16 Nov 2021 11:57:12 +0800 Subject: [PATCH 097/152] =?UTF-8?q?CHART-21951=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=9B=BE=E8=A1=A8=E6=8F=92=E4=BB=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=A4=8D=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/share/effect/EffectItemGroup.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java b/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java index c04932d0d..8f629d640 100644 --- a/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java +++ b/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java @@ -109,16 +109,7 @@ public class EffectItemGroup { Object value = cellElement.getValue(); if (value instanceof ChartCollection) { ChartCollection chartCollection = (ChartCollection) value; - for (int index = 0; index < chartCollection.getChartCount(); index++) { - Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); - Plot plot = chart.getPlot(); - if (plot == null) { - continue; - } - SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), cellSourceNode); - initChartPlot(plot, chartSourceNode, false); - } - + initChartEditorByChartCollection(chartCollection, cellSourceNode); } } @@ -127,16 +118,23 @@ public class EffectItemGroup { private void initChartEditor() { ChartEditor editor = (ChartEditor) this.widget; ChartCollection chartCollection = (ChartCollection) editor.getChartCollection(); + initChartEditorByChartCollection(chartCollection, null); + + } + + private void initChartEditorByChartCollection(ChartCollection chartCollection, SourceNode sourceNode) { for (int index = 0; index < chartCollection.getChartCount(); index++) { - Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); - Plot plot = chart.getPlot(); - if (plot == null) { - continue; + ChartProvider chartProvider = chartCollection.getChart(index, ChartProvider.class); + if (chartProvider instanceof Chart) { + Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); + Plot plot = chart.getPlot(); + if (plot == null) { + continue; + } + SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), sourceNode); + initChartPlot(plot, plotSourceNode, false); } - SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), null); - initChartPlot(plot, plotSourceNode, false); } - } private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) { From 3c184dd951271f4cfee172e1d4100a47a16b3fd1 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 09:48:02 +0800 Subject: [PATCH 098/152] =?UTF-8?q?REPORT-62647=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=88=90=E5=8A=9F=E5=90=8E=E5=8F=AF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=A0=87=E5=BF=97=E5=BA=94=E8=AF=A5=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 更新成功后没有替换视图块中的组件数据,导致组件 数据模型中的版本还是低版本,所以会继续绘制可 更新标志。 【改动思路】 更新成功后,依照id取出最新的数据并赋值重绘 --- .../share/ui/block/LocalWidgetUpdater.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java index 083df1b4e..65e5fcc94 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -5,12 +5,16 @@ 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.ui.local.LocalWidgetRepoUpdater; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.ui.util.UIUtil; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.Group; +import com.fr.form.share.GroupManege; +import com.fr.form.share.SharableWidgetProvider; +import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -106,6 +110,9 @@ public class LocalWidgetUpdater implements Process { } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } + if (success) { + resetWidgetOfBlock(); + } if (updateListener != null) { updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId()); } @@ -115,6 +122,21 @@ public class LocalWidgetUpdater implements Process { worker.execute(); } + private void resetWidgetOfBlock() { + GroupManege groupManege = DefaultShareGroupManager.getInstance(); + Group group = groupManege.getGroup(getGroup().getGroupName()); + if (group != null) { + String id = widgetBlock.getWidgetUuid(); + if (StringUtils.isNotEmpty(id)) { + SharableWidgetProvider localLatestWidget = group.getElCaseBindInfoById(widgetBlock.getWidgetUuid()); + if (localLatestWidget instanceof DefaultSharableWidget) { + widgetBlock.widget = (DefaultSharableWidget) localLatestWidget; + repaintBlockAndOverlay(); + } + } + } + } + public void cancelUpdate() { if (worker.isDone() || worker.isCancelled()) { return; @@ -126,7 +148,10 @@ public class LocalWidgetUpdater implements Process { @Override public void process(Double processValue) { this.processValue = processValue; + repaintBlockAndOverlay(); + } + private void repaintBlockAndOverlay() { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { From 0a1394d78940c0e1a6b7a6fbeba76a061bf2166f Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 09:58:43 +0800 Subject: [PATCH 099/152] =?UTF-8?q?REPORT-62652=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E4=B8=8D=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E5=BC=B9=E7=AA=97=E5=9B=BE=E6=A0=87=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=98=AF=E7=BA=A2=E8=89=B2=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 替换不兼容提示弹窗图标 【改动思路】 同上 --- .../design/mainframe/share/ui/block/LocalWidgetBlock.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 e08c317d8..4846468d6 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 @@ -38,8 +38,10 @@ import org.jetbrains.annotations.Nullable; import javax.swing.Action; import javax.swing.Icon; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.UIManager; import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; @@ -224,7 +226,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock } if (!widget.isCompatibleWithCurrentEnv()) { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip") + Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") ); return; } From 0099f1f88ee8dce45562abdb4ead0cd102c53ec9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 11:19:03 +0800 Subject: [PATCH 100/152] =?UTF-8?q?REPORT-62576=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=8F=96=E6=B6=88=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 未处理取消异常 【改动思路】 try-catch块中使用Exception匹配所有异常 --- .../share/ui/block/LocalWidgetUpdater.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java index 65e5fcc94..68a3123f7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -5,7 +5,6 @@ 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.ui.local.LocalWidgetRepoUpdater; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; @@ -24,7 +23,6 @@ import java.awt.Component; import java.awt.Container; import java.io.File; import java.io.IOException; -import java.util.concurrent.ExecutionException; /** * @author Starryi @@ -107,7 +105,7 @@ public class LocalWidgetUpdater implements Process { boolean success = false; try { success = get(); - } catch (InterruptedException | ExecutionException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success) { @@ -138,10 +136,11 @@ public class LocalWidgetUpdater implements Process { } public void cancelUpdate() { - if (worker.isDone() || worker.isCancelled()) { - return; + if (worker != null && !worker.isDone()) { + worker.cancel(true); + worker = null; } - worker.cancel(true); + process(-1.0); } @@ -152,7 +151,7 @@ public class LocalWidgetUpdater implements Process { } private void repaintBlockAndOverlay() { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock); From d5d81f8f7c087b169fc847f56d971dfb525eef79 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 11:29:30 +0800 Subject: [PATCH 101/152] =?UTF-8?q?REPORT-62677=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E5=9C=A8=E7=BA=BF=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 有个同时进行的任务在优化这部分代码,导致新修改的在线组件数据请求 路径在合并时丢失了,需要补充一下 【改动思路】 try-catch块中使用Exception匹配所有异常 --- .../com/fr/design/mainframe/share/util/OnlineShopUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 67326c853..c8c7b54ea 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 @@ -46,7 +46,7 @@ public class OnlineShopUtils { } private static String getWidgetReusePath() { - return getReuInfoPath(); + return StableUtils.pathJoin(getReuInfoPath(), "all/detail/"); } private static String getPackageChildrenPath() { From d2c39de9d3229333e467f81c844a3b4886a89eef Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 16 Nov 2021 13:44:24 +0800 Subject: [PATCH 102/152] =?UTF-8?q?CHART-21951=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=9B=BE=E8=A1=A8=E6=8F=92=E4=BB=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=A4=8D=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/share/effect/EffectItemGroup.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java b/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java index c04932d0d..622f5cc99 100644 --- a/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java +++ b/designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java @@ -109,15 +109,7 @@ public class EffectItemGroup { Object value = cellElement.getValue(); if (value instanceof ChartCollection) { ChartCollection chartCollection = (ChartCollection) value; - for (int index = 0; index < chartCollection.getChartCount(); index++) { - Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); - Plot plot = chart.getPlot(); - if (plot == null) { - continue; - } - SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), cellSourceNode); - initChartPlot(plot, chartSourceNode, false); - } + initChartEditorByChartCollection(chartCollection, cellSourceNode); } } @@ -127,16 +119,23 @@ public class EffectItemGroup { private void initChartEditor() { ChartEditor editor = (ChartEditor) this.widget; ChartCollection chartCollection = (ChartCollection) editor.getChartCollection(); + initChartEditorByChartCollection(chartCollection, null); + + } + + private void initChartEditorByChartCollection(ChartCollection chartCollection, SourceNode sourceNode) { for (int index = 0; index < chartCollection.getChartCount(); index++) { - Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); - Plot plot = chart.getPlot(); - if (plot == null) { - continue; + ChartProvider chartProvider = chartCollection.getChart(index, ChartProvider.class); + if (chartProvider instanceof Chart) { + Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); + Plot plot = chart.getPlot(); + if (plot == null) { + continue; + } + SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), sourceNode); + initChartPlot(plot, plotSourceNode, false); } - SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), null); - initChartPlot(plot, plotSourceNode, false); } - } private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) { From 1b42276edf338ca8c89b4b66b77c97e54dc1b519 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 12:02:26 +0800 Subject: [PATCH 103/152] =?UTF-8?q?REPORT-62653=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E2=80=9C=E7=89=88=E6=9C=AC=E4=B8=8D=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E2=80=9D=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E4=B8=8D=E6=98=8E?= =?UTF-8?q?=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改提示文字背景及字体 【改动思路】 同上 --- .../mainframe/share/ui/block/LocalWidgetBlock.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 4846468d6..72eb35d00 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 @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.design.base.mode.DesignModeContext; @@ -59,6 +60,7 @@ import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.util.UUID; @@ -298,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock double canvasH = coverDim.getHeight(); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); - GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); - Font tipFont = FRFont.getInstance().deriveFont(8F); + Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F); FontRenderContext frc = g2d.getFontRenderContext(); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); - Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); - double tipTextHeight = dim.getHeight(); + LineMetrics metrics = tipFont.getLineMetrics(tipText, frc); + double tipTextHeight = metrics.getHeight(); g2d.setColor(Color.WHITE); g2d.setFont(tipFont); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); From 0dbfac7719f17f4637d9f31eddfec88d8cf45e2d Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 16 Nov 2021 17:15:24 +0800 Subject: [PATCH 104/152] =?UTF-8?q?REPORT-62398=20=20&&=20REPORT-62397?= =?UTF-8?q?=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=8E=A8=E8=8D=90=E7=BB=84=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8;?= =?UTF-8?q?=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E9=9D=A2=E6=9D=BF=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8A=E4=B8=8B=E6=BB=91=E5=8A=A8=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/share/ui/block/OnlineWidgetBlock.java | 7 ++++--- .../share/ui/online/AbstractOnlineWidgetSelectPane.java | 4 ++-- .../mainframe/share/ui/online/OnlineWidgetRepoPane.java | 6 ++++++ .../mainframe/share/ui/online/OnlineWidgetTabPane.java | 7 +++++++ .../design/mainframe/share/ui/online/embed/EmbedPane.java | 2 +- .../share/ui/online/embed/OnlineEmbedFilterShowPane.java | 6 ++++++ 6 files changed, 26 insertions(+), 6 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 9f5873771..cd4163b4b 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 @@ -357,6 +357,9 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { if (isUnusable) { paintUnusableMask((Graphics2D) g); } + if (this.parentPane != null) { + this.parentPane.refreshShowPaneUI(); + } } protected void paintUnusableMask(Graphics2D g2d) { @@ -393,14 +396,12 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { g2d.setColor(oldColor); g2d.setFont(oldFont); + } @Override public void repaint() { super.repaint(); - if (this.parentPane != null) { - this.parentPane.refreshUI(); - } } class WidgetDownloadProcess implements com.fr.design.extra.Process { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java index 4221e4b96..53239700d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java @@ -242,7 +242,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele return this.getParent(); } - public void refreshUI() { - OnlineWidgetRepoPane.getInstance().repaint(); + public void refreshShowPaneUI() { + OnlineWidgetRepoPane.getInstance().refreshShowPaneUI(); } } 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 fcc59771e..b9e430fe4 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 @@ -228,6 +228,12 @@ public class OnlineWidgetRepoPane extends BasicPane { } } + public void refreshShowPaneUI(){ + if (componentTabPane != null) { + this.componentTabPane.refreshShowPaneUI(); + } + } + public void completeEmbedFilter(){ if (componentTabPane != null) { 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 96c3e2825..b48b74e67 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 @@ -87,6 +87,13 @@ public class OnlineWidgetTabPane extends JPanel { this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); } + public void refreshShowPaneUI(){ + if (embedFilterShowPane != null) { + this.embedFilterShowPane.refreshUI(); + } + } + + public void removeTabChangeListener(TabChangeListener listener) { tabChangeListeners.remove(listener); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index 04680753b..bf535b367 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -86,7 +86,7 @@ public class EmbedPane extends JPanel { protected void paintBorder(Graphics g, UIButton b) { Color oldColor = g.getColor(); g.setColor(SEARCH_BUTTON_COLOR); - g.drawRoundRect(0, 0, b.getWidth(), b.getHeight(), 2, 2); + g.drawRoundRect(0, 0, b.getWidth() - 4, b.getHeight() - 4, 2, 2); g.setColor(oldColor); } }); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java index 11e39c923..9141bf98a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java @@ -36,6 +36,12 @@ public class OnlineEmbedFilterShowPane extends JPanel { selectPane.animate(); } + public void refreshUI(){ + if (embedPane != null) { + this.repaint(); + } + } + public void completeEmbedFilter(){ if (embedPane!= null && embedPane.isShowing()){ this.remove(embedPane); From 3430b56fae9b86e58e059a4d2ec87c7af6f86a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 16 Nov 2021 21:43:44 +0800 Subject: [PATCH 105/152] =?UTF-8?q?REPORT-60748=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E5=B1=9E=E6=80=A7-=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetBoundsPaneFactory.java | 6 +++--- .../design/designer/creator/XChartEditor.java | 5 +++++ .../fr/design/designer/creator/XCreator.java | 8 ++++++++ .../designer/creator/XCreatorUtils.java | 19 +++++++++++++++++++ .../design/designer/creator/XElementCase.java | 5 +++++ .../designer/creator/XLayoutContainer.java | 5 +++++ .../widget/ui/FormSingleWidgetCardPane.java | 11 +++-------- .../component/WidgetAbsoluteBoundPane.java | 2 +- .../designer/component/WidgetBoundPane.java | 15 ++++++++++++++- 9 files changed, 63 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index 99b1ddaa0..2b2dcc532 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -46,12 +46,12 @@ public class WidgetBoundsPaneFactory { private static final int RIGHT_PANE_WIDTH = 145; - public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked) { + public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) { JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Form_Widget_Size")), + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; @@ -65,7 +65,7 @@ public class WidgetBoundsPaneFactory { } public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { - return createBoundsPane(width, height, null); + return createBoundsPane(width, height, null, NameAttribute.DEFAULT); } public static JPanel createRightPane(Component com1, Component com2) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index 3d1550af6..b70754c11 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -363,4 +363,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator { return false; } + @Override + public boolean isComponent() { + return true; + } + } 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 87a1926cb..1fafe839c 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 @@ -894,4 +894,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } return ((XCreator) this.getParent()).getLevel() + 1; } + + /** + * 是否是组件(控件还是组件) + * @return 是否是组件 + */ + public boolean isComponent() { + return false; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 945d3bfdd..2f797efa4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -356,4 +356,23 @@ public class XCreatorUtils { } return null; } + + /** + * 把控件例如textEditor外层的容器剥掉 + * @param xCreator 控件 + * @return 内层控件 + */ + public static XCreator getXCreatorInnerWidget(XCreator xCreator) { + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + return (XCreator) xCreator.getComponent(0); + } + } + + if (xCreator.acceptType(XWTitleLayout.class)) { + return (XCreator) xCreator.getComponent(0); + } + + return xCreator; + } } \ No newline at end of file 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 cf8b7a766..f1a4f1716 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 @@ -365,4 +365,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public void releaseResources() { imageLable.setIcon(null); } + + @Override + public boolean isComponent() { + return true; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index f1d4c4f6d..92c5dd654 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -586,4 +586,9 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme public void setDragInAble(boolean dragInAble) { this.dragInAble = dragInAble; } + + @Override + public boolean isComponent() { + return true; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 9f0c44ded..1fd1a3527 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -113,7 +113,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { } private void initComponents() { - XCreator innerCreator = getXCreatorDedicated(); + XCreator innerCreator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); content.add(attriCardPane, BorderLayout.CENTER); @@ -166,7 +166,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { private void initDefinePane() { currentEditorDefinePane = null; - XCreator creator = getXCreatorDedicated(); + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() { @Override public void did(DataCreatorUI ui, String cardName) { @@ -190,11 +190,6 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { currentEditorDefinePane = definePane; } - private XCreator getXCreatorDedicated() { - boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class); - return dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator; - } - @Override public String title4PopupWindow() { return "Widget"; @@ -283,7 +278,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { } public void fireValueChanged() { - XCreator creator = getXCreatorDedicated(); + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator); creator.firePropertyChange(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index e8aeb994d..f6d52a2d6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -35,7 +35,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); - this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, getNameAttribute())); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index a462a8aed..aee83889e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -89,7 +89,20 @@ public class WidgetBoundPane extends BasicPane { ratioLockedButton.setLockEnabled(false); } - this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton)); + this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton, getNameAttribute())); + } + + protected WidgetBoundsPaneFactory.NameAttribute getNameAttribute() { + WidgetBoundsPaneFactory.NameAttribute nameAttribute = WidgetBoundsPaneFactory.NameAttribute.DEFAULT; + if (!isComponent()) { + nameAttribute = WidgetBoundsPaneFactory.NameAttribute.WIDGET; + } + return nameAttribute; + } + + protected boolean isComponent() { + XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.creator); + return creator.isComponent(); } From a51db423435c9d8ad5daa6f3fac3e5c6e007e786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 17 Nov 2021 11:03:43 +0800 Subject: [PATCH 106/152] REPORT-61827 --- .../com/fr/design/mainframe/DesignerTransferHandler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index 38e6f47a4..013d7c2f1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -1,12 +1,11 @@ package com.fr.design.mainframe; -import java.awt.datatransfer.Transferable; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.beans.models.AddingModel; import javax.swing.JComponent; import javax.swing.TransferHandler; - -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.beans.models.AddingModel; +import java.awt.datatransfer.Transferable; public class DesignerTransferHandler extends TransferHandler { @@ -20,7 +19,7 @@ public class DesignerTransferHandler extends TransferHandler { } protected void exportDone(JComponent source, Transferable data, int action) { - if (!addingModel.isCreatorAdded()) { + if (!addingModel.isCreatorAdded() && !addingModel.isNeedUndoWhenAddingFailed()) { designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); } } From f515d766e467e6ad28abe313cf03a041b9bdf80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 17 Nov 2021 15:38:24 +0800 Subject: [PATCH 107/152] =?UTF-8?q?REPORT-62596=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1websocket=E6=96=AD=E5=BC=80=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96-=E8=BF=9C=E7=A8=8B=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8B=E5=90=AF=E5=8A=A8=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=B6=E5=87=BA=E7=8E=B0toast=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c32e6673a..f3df35fb8 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 @@ -128,6 +128,7 @@ public class DesignerSocketIO { } else { //表示所有的uri都连接不成功 FineLoggerFactory.getLogger().warn("All uris failed to connect"); + showSocketDisconnectToast(); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -206,7 +207,6 @@ public class DesignerSocketIO { private static final Emitter.Listener failRetry = new Emitter.Listener() { @Override public void call(Object... args) { - showSocketDisconnectToast(); printLog(args, PrintEventLogImpl.WARN, "failed args: {}"); status = Status.Disconnecting; socket.close(); From a992039144f20522d64e707de1da6ec46e4bed2c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 17 Nov 2021 17:20:27 +0800 Subject: [PATCH 108/152] =?UTF-8?q?REPORT-62554=20=E5=86=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=A8=A1=E6=9D=BF=E4=BC=9A?= =?UTF-8?q?=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/app/FormApp.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 286890303..29f56d143 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -73,15 +73,13 @@ class FormApp extends AbstractAppProvider { @Override public JTemplate call() throws Exception { OpenResult result = worker.getResult(); - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); + return getJForm(result.getBaseBook(), tplFile, result.getRef()); } }); worker.start(tplFile.getPath()); OpenResult result = worker.getResult(); if (result != null) { - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); + return getJForm(result.getBaseBook(), tplFile, result.getRef()); } return emptyForm; } else { @@ -90,6 +88,16 @@ class FormApp extends AbstractAppProvider { } } + @Nullable + private JForm getJForm(Form form, FILE file, Parameter[] parameters) { + try { + return new JForm(form, file, parameters); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + return null; + } + } + @Nullable private Form getForm(FILE tplFile) { ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN); From 64287df3fdb6b19a78b1669125ea4c559c196bf3 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 18 Nov 2021 14:09:56 +0800 Subject: [PATCH 109/152] =?UTF-8?q?REPORT-60154=E3=80=90=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E4=BA=8E=E8=BF=AD=E4=BB=A3=E4=BB=BB=E5=8A=A1=E3=80=91=E3=80=90?= =?UTF-8?q?V3.1.0=E3=80=91=E3=80=90=E6=97=A0=E9=9C=80=E9=80=82=E9=85=8D?= =?UTF-8?q?=E3=80=91=E5=A4=8D=E7=94=A8=E7=BB=84=E4=BB=B6=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E4=BA=8C=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reuse/ComponentReuseNotificationInfo.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java index 46ccef099..ea8722f1b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java @@ -9,6 +9,7 @@ import com.fr.stable.xml.XMLableReader; */ public class ComponentReuseNotificationInfo implements XMLable { public static final String XML_TAG = "ComponentReuseNotificationInfo"; + private static final int INVALID_NUM = -1; private static final ComponentReuseNotificationInfo INSTANCE = new ComponentReuseNotificationInfo(); @@ -86,6 +87,19 @@ public class ComponentReuseNotificationInfo implements XMLable { this.historyCreatedReuses = historyCreatedReuses; } + //兼容老版本云端埋点的记录 + public long getLastNotifyTime() { + return INVALID_NUM; + } + + public int getNotifiedNumber() { + return INVALID_NUM; + } + + public long getLastGuidePopUpTime() { + return INVALID_NUM; + } + @Override public void readXML(XMLableReader reader) { this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false)); From f81fc8d004823e8b5d264284306fb02402fc916c Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 18 Nov 2021 15:44:57 +0800 Subject: [PATCH 110/152] =?UTF-8?q?REPORT-62780=E3=80=90=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E3=80=91=E3=80=90=E6=8E=A5=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E6=94=B6=E8=B5=B7=E7=AD=9B=E9=80=89=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E5=BC=80=E5=A7=8B=E8=BD=AE=E6=92=AD=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC=E4=BC=9A?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=BD=91=E7=BB=9C=E8=BF=9E=E6=8E=A5=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E8=BD=AE=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/online/embed/OnlineEmbedFilterSelectPane.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 120a396b6..3f4cea2a0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -7,9 +7,13 @@ import com.fr.design.mainframe.share.ui.online.CarouselStateManger; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.constants.ShareComponentConstants; import com.fr.form.share.exception.NetWorkFailedException; import com.fr.general.http.HttpClient; +import com.fr.log.FineLoggerFactory; import com.fr.module.ModuleContext; +import com.fr.stable.EncodeConstants; +import com.fr.third.springframework.web.util.UriUtils; import javax.imageio.ImageIO; import javax.swing.JPanel; @@ -22,6 +26,7 @@ import java.awt.Rectangle; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; @@ -96,6 +101,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } private Image getPreviewImage(String url) throws NetWorkFailedException { + try { + url = UriUtils.encodePath(url, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return ShareComponentConstants.DEFAULT_COVER; + } HttpClient httpClient = new HttpClient(url); httpClient.setTimeout(CAROUSE_IMAGE_LOAD_TIMEOUT); httpClient.asGet(); From 15341520dd5dc7688629ec3dbf603b9404d55fca Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 18 Nov 2021 17:33:05 +0800 Subject: [PATCH 111/152] =?UTF-8?q?CHART-21785=20cpt=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=83=8C=E6=99=AF=E5=92=8C=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=A2=9C=E8=89=B2=E8=83=8C=E6=99=AF=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/gui/AdjustWorkBookDefaultStyleUtils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index abae997e3..760fc3c80 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -18,6 +18,16 @@ public class AdjustWorkBookDefaultStyleUtils { private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); + private static Color currentStoryBack = null; + + public static void setCurrentStoryBack(Color color) { + currentStoryBack = color; + } + + private static Color getCurrentStoryBack() { + return currentStoryBack == null ? TEMPLATE_BACKGROUND : currentStoryBack; + } + public static void adjustCellElement(CellElement cellElement) { if (DesignModeContext.isDuchampMode()) { Style style = cellElement.getStyle(); @@ -33,14 +43,14 @@ public class AdjustWorkBookDefaultStyleUtils { public static void adjustFloatElement(FloatElement floatElement) { if (DesignModeContext.isDuchampMode()) { Style style = floatElement.getStyle(); - style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); + style = style.deriveBackground(ColorBackground.getInstance(getCurrentStoryBack())); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); floatElement.setStyle(style); } } public static Color adjustBack(Color color) { - return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; + return DesignModeContext.isDuchampMode() ? getCurrentStoryBack() : color; } } From 0ae062a012093257e24ac28e39dce5d965c7a9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 18 Nov 2021 17:46:59 +0800 Subject: [PATCH 112/152] REPORT-62275 --- .../designer/beans/adapters/layout/FRNoFixLayoutAdapter.java | 1 - .../com/fr/design/designer/beans/models/SelectionModel.java | 5 ----- .../java/com/fr/design/mainframe/FormCreatorDropTarget.java | 5 +++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index b278e0ffe..3f0c61e63 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -145,7 +145,6 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { @Override public void dragStart(XCreator xCreator, SelectionModel selectionModel) { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); - selectionModel.fireCreatorDeleted(); selectionModel.setSelectedCreator(container); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 28456f799..31bb62531 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -584,9 +584,4 @@ public class SelectionModel { selection.setSelectedCreators(rebuildSelection); fireCreatorSelected(); } - - public void fireCreatorDeleted() { - designer.getEditListenerTable().fireCreatorModified(selection.getSelectedCreator(), - DesignerEvent.CREATOR_DELETED); - } } 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 2b9a4f6be..6a0ad0952 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 @@ -166,11 +166,12 @@ public class FormCreatorDropTarget extends DropTarget { private void undoWhenDropFail() { JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { + if (jt != null) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - jt.undo(); + FormUndoState current = (FormUndoState) jt.getUndoState(); + current.applyState(); } }); } From 7c550df360fd5f57cb17114ee416ef21f792cae3 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 18 Nov 2021 17:47:31 +0800 Subject: [PATCH 113/152] =?UTF-8?q?REPORT-62809=20&&=20REPORT-62814=20&&?= =?UTF-8?q?=20REPORT-62815=20&&=20REPORT-62816=20&&=20REPORT-62817=201.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B8=83=E5=B1=80=E4=B8=8E=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaChecker.java | 7 +++- .../com/fr/design/formula/FormulaPane.java | 36 ++++++++++++------- .../function/NoViableAltForCharFunction.java | 2 +- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index 1682ba307..1d1097db4 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -7,6 +7,7 @@ import com.fr.parser.FRParser; import com.fr.script.checker.FunctionCheckerDispatcher; import com.fr.script.checker.result.FormulaCheckResult; import com.fr.script.checker.result.FormulaCoordinates; +import com.fr.stable.StringUtils; import com.fr.stable.script.Expression; import com.fr.stable.script.Node; import com.fr.third.antlr.TokenStreamRecognitionException; @@ -23,6 +24,9 @@ public class FormulaChecker { private static FormulaExceptionTipsProcessor processor = FormulaExceptionTipsProcessor.getProcessor(); public static FormulaCheckResult check(String formulaText) { + if (StringUtils.isEmpty(formulaText) || formulaText.equals(Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Tips"))) { + return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID); + } //过滤一些空格等符号 StringReader in = new StringReader(formulaText); FRLexer lexer = new FRLexer(in); @@ -32,7 +36,8 @@ public class FormulaChecker { Expression expression = parser.parse(); Node node = expression.getConditionalExpression(); boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node); - return new FormulaCheckResult(valid, valid ? VALID_FORMULA : INVALID_FORMULA, FormulaCoordinates.INVALID); + return new FormulaCheckResult(valid, valid ? Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : + Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID); } catch (Exception e) { if (e instanceof TokenStreamRecognitionException) { return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog); 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 6c0ddcab1..be73609c8 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 @@ -88,6 +88,7 @@ import java.awt.BorderLayout; import java.awt.Color; 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.FocusEvent; @@ -124,8 +125,8 @@ import java.util.Set; public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static final int DEFUAL_FOMULA_LENGTH = 103; public static final String ELLIPSIS = "..."; - public static final int KEY_CODE_A = 64; - public static final int KEY_CODE_Z = 91; + public static final char KEY_CODE_A = 'A'; + public static final char KEY_CODE_Z = 'z'; public static final String NEWLINE = "\n"; public static final String FORMULA_ICON = "/com/fr/design/images/m_file/formula.png"; public static final String PARAM_ICON = "/com/fr/design/images/m_file/param.png"; @@ -166,7 +167,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private boolean inKeyCodeRange(KeyEvent e) { - return (e.getExtendedKeyCode() > KEY_CODE_A && e.getExtendedKeyCode() < KEY_CODE_Z); + return (e.getKeyChar() >= KEY_CODE_A && e.getKeyChar() <= KEY_CODE_Z); } @Override @@ -248,16 +249,25 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initTipsPane() { // tipsPane + JPanel containerSPane = new JPanel(new BorderLayout(4, 1)); + JPanel labelPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0), true); + JPanel searchPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0), true); + containerSPane.setPreferredSize(new Dimension(892, 23)); + this.add(containerSPane, BorderLayout.NORTH); - JPanel searchPane = new JPanel(new BorderLayout(4, 1)); - this.add(searchPane, BorderLayout.NORTH); - searchPane.add(keyWordTextField, BorderLayout.CENTER); UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search")); - UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":" - + " "); + UILabel formulaLabel = new UILabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":"); formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + + labelPane.add(formulaLabel, BorderLayout.WEST); + keyWordTextField.setPreferredSize(new Dimension(240, 23)); + searchPane.add(keyWordTextField, BorderLayout.EAST); searchPane.add(searchButton, BorderLayout.EAST); - searchPane.add(formulaLabel, BorderLayout.WEST); + + containerSPane.add(labelPane, BorderLayout.WEST); + containerSPane.add(searchPane, BorderLayout.EAST); + initKeyWordTextFieldKeyListener(); tipsList = new JList(listModel); tipsList.addMouseListener(new DoubleClick()); @@ -835,10 +845,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (checkResult.isValid()) { showMessageDialog(checkResult.getTips(), checkResult.isValid()); } else { + String position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + (checkResult.getFormulaCoordinates().getColumns()) + + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " "; int confirmDialog = FineJOptionPane.showConfirmDialog( FormulaPane.this, - checkResult.getTips() + ", " + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + ":" + (checkResult.getFormulaCoordinates().getColumns()) + ".", - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), + position + checkResult.getTips(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, @@ -1265,7 +1277,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { }; basicPane.setLayout(FRGUIPaneFactory.createBorderLayout()); UITextArea desArea = new UITextArea(); -// desArea。setEnabled(false); desArea.setText(this.getTextAreaText()); basicPane.add(new UIScrollPane(desArea), BorderLayout.CENTER); BasicDialog dialog = basicPane.showWindow(DesignerContext.getDesignerFrame()); @@ -1339,6 +1350,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { }; public void refreshText(String line) { + fixFunctionNameList(line); refreshDescriptionTextArea(line); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java index 7671c3a6e..0cb4058a7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java @@ -36,7 +36,7 @@ public class NoViableAltForCharFunction implements Function Date: Thu, 18 Nov 2021 20:09:58 +0800 Subject: [PATCH 114/152] =?UTF-8?q?REPORT-62680=20=E6=8F=92=E4=BB=B6-?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=87=8C=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E6=8F=90=E7=A4=BA=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C?= =?UTF-8?q?=E6=B2=A1=E9=80=82=E9=85=8D=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=911.=20=E9=80=82=E9=85=8D=E4=B8=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA=EF=BC=9B2.=20=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E6=8A=8Aforbid-reminder=E6=94=BE=E5=88=B0PluginView?= =?UTF-8?q?=E9=87=8C=E8=BF=98=E6=98=AF=E4=B8=8D=E5=90=88=E9=80=82=EF=BC=8C?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E9=80=9A=E8=BF=87xml=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F=20=E3=80=90review=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index d7260f84e..7f68cd8bf 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -25,6 +25,7 @@ import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; +import com.fr.plugin.xml.PluginElementName; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -91,15 +92,31 @@ public class PluginOperateUtils { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { - PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); - PluginContext plugin = PluginManager.getContext(pluginMarker); - boolean active = plugin.isActive(); - PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); - if (active) { - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); - } else { - PluginManager.getController().enable(pluginMarker, modifyStatusCallback); - } + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginContext plugin = PluginManager.getContext(pluginMarker); + boolean active = plugin.isActive(); + PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); + if (active) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + PluginManager.getController().enable(pluginMarker, modifyStatusCallback); + } + } + }); } public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { From 60edfb2cbdaa50ba950ed4d1a54982de15cd9cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 18 Nov 2021 20:35:43 +0800 Subject: [PATCH 115/152] REPORT-62275&REPORT-61827 --- .../com/fr/design/mainframe/JTemplate.java | 17 +++++++++++++---- .../design/designer/beans/LayoutAdapter.java | 4 ---- .../adapters/layout/AbstractLayoutAdapter.java | 7 +------ .../adapters/layout/FRBorderLayoutAdapter.java | 1 - .../layout/FRCardMainBorderLayoutAdapter.java | 14 ++------------ .../adapters/layout/FRFitLayoutAdapter.java | 6 ------ .../adapters/layout/FRNoFixLayoutAdapter.java | 6 ------ .../designer/beans/models/AddingModel.java | 9 --------- .../mainframe/DesignerTransferHandler.java | 13 ++++++++++--- .../mainframe/FormCreatorDropTarget.java | 18 ------------------ .../com/fr/design/mainframe/FormDesigner.java | 1 - 11 files changed, 26 insertions(+), 70 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 c9b223c52..3bbaf2706 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 @@ -7,11 +7,11 @@ import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateThemeAttrMark; +import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeCompatible; +import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.ThemedTemplate; import com.fr.base.vcs.DesignerMode; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; import com.fr.decision.config.FSConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; @@ -70,14 +70,13 @@ import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.nx.app.designer.utils.CptAndCptxCompatibilityUtil; import com.fr.nx.app.designer.utils.CptCompileUtil; import com.fr.nx.cptx.entry.metadata.CptxMetadata; import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.nx.app.designer.toolbar.CompileAction; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; @@ -642,6 +641,16 @@ public abstract class JTemplate> fireSuperTargetModified(); } + public void undoToCurrent() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + BaseUndoState current = JTemplate.this.getUndoState(); + current.applyState(); + } + }); + } + /** * 模板更新 */ diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 7686709a3..3c0c2bd5f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -3,7 +3,6 @@ package com.fr.design.designer.beans; import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.adapters.layout.DefaultDesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; @@ -141,7 +140,4 @@ public interface LayoutAdapter { default void dragOver(XCreator xCreator, SelectionModel selectionModel, int x, int y) { }; - - void updateAddingModel(AddingModel model); - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index a2e9b71ff..7d287e5a5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -4,7 +4,6 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.NullPainter; import com.fr.design.designer.creator.XCreator; @@ -14,7 +13,7 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; -import java.awt.*; +import java.awt.LayoutManager; public abstract class AbstractLayoutAdapter implements LayoutAdapter { @@ -210,8 +209,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.setSelectedCreator(container); } - - public void updateAddingModel(AddingModel model) { - - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java index cbb8f018f..6a9eadf83 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java @@ -184,5 +184,4 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { return new FRBorderLayoutConstraints(container, creator); } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index dd9e03c8d..00c0d7751 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -7,7 +7,6 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -65,17 +64,8 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { - // 自适应布局平分高度导致变矮的场景,优先做撤销 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - jt.undo(); - } - }); - } else if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); + if (jt != null) { + jt.undoToCurrent(); } return true; } else { diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 747479cbb..9871d1b32 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -8,7 +8,6 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -1245,9 +1244,4 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { frLayoutState.dragOver(xCreator, selectionModel,x,y); } - - @Override - public void updateAddingModel(AddingModel model) { - frLayoutState.updateAddingModel(model); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index 3f0c61e63..aaeedfc8d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java @@ -1,6 +1,5 @@ package com.fr.design.designer.beans.adapters.layout; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.painters.AbstractPainter; import com.fr.design.designer.beans.painters.FRFitLayoutPainter; @@ -147,9 +146,4 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.setSelectedCreator(container); } - - @Override - public void updateAddingModel(AddingModel model) { - model.setNeedUndoWhenAddingFailed(true); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index c9a9eb330..b94b21d94 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,7 +24,6 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; - private boolean needUndoWhenAddingFailed = false; public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -141,12 +140,4 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } - - public boolean isNeedUndoWhenAddingFailed() { - return needUndoWhenAddingFailed; - } - - public void setNeedUndoWhenAddingFailed(boolean needUndoWhenAddingFailed) { - this.needUndoWhenAddingFailed = needUndoWhenAddingFailed; - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index 013d7c2f1..e5b11dd9a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.models.AddingModel; +import com.fr.design.file.HistoryTemplateListPane; import javax.swing.JComponent; import javax.swing.TransferHandler; @@ -19,8 +19,15 @@ public class DesignerTransferHandler extends TransferHandler { } protected void exportDone(JComponent source, Transferable data, int action) { - if (!addingModel.isCreatorAdded() && !addingModel.isNeedUndoWhenAddingFailed()) { - designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); + if (!addingModel.isCreatorAdded()) { + undoWhenAddingFailed(); + } + } + + private void undoWhenAddingFailed() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null) { + jt.undoToCurrent(); } } } \ No newline at end of file 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 6a0ad0952..82befa273 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 @@ -18,7 +18,6 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -26,7 +25,6 @@ import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mod.bean.ChangeItem; import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; -import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; import com.fr.form.share.SharableWidgetProvider; @@ -154,9 +152,6 @@ public class FormCreatorDropTarget extends DropTarget { if (creator != null) { creator.setSelected(false); } - if (designer.getAddingModel().isNeedUndoWhenAddingFailed()) { - undoWhenDropFail(); - } } // 取消提示 designer.setPainter(null); @@ -164,19 +159,6 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } - private void undoWhenDropFail() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null) { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - FormUndoState current = (FormUndoState) jt.getUndoState(); - current.applyState(); - } - }); - } - } - private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); 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 9cf220ff8..3eb40b6a2 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 @@ -1210,7 +1210,6 @@ public class FormDesigner extends TargetComponent implements TreeSelection setTransferHandler(handler); handler.exportAsDrag(this, lastPressEvent, TransferHandler.COPY); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); - parent.getLayoutAdapter().updateAddingModel(addingModel); parent.getLayoutAdapter().dragStart(xCreator, selectionModel); this.setDropTarget(new FormCreatorDropTarget(this)); // 触发状态添加模式事件 From ed0a2090dfec25615df88d308d72eeb91870f694 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 09:49:03 +0800 Subject: [PATCH 116/152] =?UTF-8?q?REPORT-62896=20=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=BC=95=E5=AF=BC=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=80=A7=E9=80=80=E5=87=BA=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormWidgetDetailPane.java | 6 ++--- .../theme/DownloadComponentPackageGuide.java | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 7b4e3c2e0..eb7e9e583 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -140,11 +140,11 @@ public class FormWidgetDetailPane extends FormDockView{ } public void switch2Local() { - cardLayout.show(centerPane, paneList.get(0).getTitle()); + headGroup.setSelectedIndex(0); } - public void swich2Online() { - cardLayout.show(centerPane, paneList.get(1).getTitle()); + public void switch2Online() { + headGroup.setSelectedIndex(ONLINE_TAB); } private UILabel tipLabel(String text) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 5d878a3c2..5215f232b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -29,6 +29,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip; import com.fr.design.mainframe.share.ui.block.OnlineWidgetPackageBlock; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetTabPane; +import com.fr.design.mainframe.share.ui.online.widgetpackage.OnlineWidgetPackagesShowPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.utils.ShareUtils; @@ -102,22 +103,23 @@ public class DownloadComponentPackageGuide { EastRegionContainerPane.getInstance().showContainer(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance(); - onlineWidgetRepoPane.setContent(); - OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); - UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); - JPanel centerPane = (JPanel) tabPane.getComponent(1); - if (centerPane.getComponentCount() > 0) { + Component onlineWidgetPackagesShowPane = ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetPackagesShowPane.class); + if (onlineWidgetPackagesShowPane != null) { GuideManager.getInstance().getCurrentGuide().start(); } else { + onlineWidgetRepoPane.setContent(); + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); + JPanel centerPane = (JPanel) tabPane.getComponent(1); centerPane.addContainerListener(new ContainerAdapter() { @Override public void componentAdded(ContainerEvent e) { - GuideManager.getInstance().getCurrentGuide().start(); + if (e.getChild() instanceof OnlineWidgetPackagesShowPane) { + GuideManager.getInstance().getCurrentGuide().start(); + } } }); } - tabGroup.setSelectedIndex(1); - tabGroup.tabChanged(1); + switch2OnlinePackageBlock(); } else { GuideCreateUtils.showNoNetworkAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); @@ -168,7 +170,7 @@ public class DownloadComponentPackageGuide { @Override public boolean onComplete() { - FormWidgetDetailPane.getInstance().swich2Online(); + FormWidgetDetailPane.getInstance().switch2Online(); return true; } }); @@ -298,4 +300,11 @@ public class DownloadComponentPackageGuide { themeConfirmDialog.dispose(); } } + + private static void switch2OnlinePackageBlock() { + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(OnlineWidgetRepoPane.getInstance(), OnlineWidgetTabPane.class); + UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); + tabGroup.setSelectedIndex(1); + tabGroup.tabChanged(1); + } } From dbb9bb6ce7083fb2b0cebbaee3206db3238ff75f Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 09:53:52 +0800 Subject: [PATCH 117/152] =?UTF-8?q?REPORT-62896=20=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index eb7e9e583..7e8cd6710 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -31,6 +31,7 @@ import java.util.List; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ + private static final int LOCAL_TAB = 0; private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -104,7 +105,7 @@ public class FormWidgetDetailPane extends FormDockView{ cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); } }; - headGroup.setSelectedIndex(ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib() ? 0 : ONLINE_TAB); + headGroup.setSelectedIndex(ComponentReuseNotificationInfo.getInstance().isClickedWidgetLib() ? LOCAL_TAB : ONLINE_TAB); this.add(headGroup, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } @@ -140,7 +141,7 @@ public class FormWidgetDetailPane extends FormDockView{ } public void switch2Local() { - headGroup.setSelectedIndex(0); + headGroup.setSelectedIndex(LOCAL_TAB); } public void switch2Online() { From 3e6b0f874e3928d485c059ac61b8010a2fb30a99 Mon Sep 17 00:00:00 2001 From: yvan Date: Fri, 19 Nov 2021 09:57:10 +0800 Subject: [PATCH 118/152] =?UTF-8?q?REPORT-62680=20=E6=8F=92=E4=BB=B6-?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=87=8C=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E6=8F=90=E7=A4=BA=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index 7f68cd8bf..7dd2097dc 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -26,6 +26,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; import com.fr.plugin.xml.PluginElementName; +import com.fr.plugin.xml.PluginXmlElement; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -101,15 +102,21 @@ public class PluginOperateUtils { boolean active = plugin.isActive(); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); if (active) { - // 禁用前提示 - int rv = FineJOptionPane.showConfirmDialog( - null, - plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.WARNING_MESSAGE - ); - if (rv == JOptionPane.OK_OPTION) { + PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); + if (forbidReminder != null && forbidReminder.getContent() != null) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + forbidReminder.getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + // 正常禁用 PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); } } else { From 1b52c54a85171a2e46e2170096c9f66264023d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 14:35:48 +0800 Subject: [PATCH 119/152] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JTemplate.java | 10 ++++++++++ .../layout/FRCardMainBorderLayoutAdapter.java | 13 ++----------- 2 files changed, 12 insertions(+), 11 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 d8bc7fb48..f1f72b48c 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 @@ -581,6 +581,16 @@ public abstract class JTemplate> fireSuperTargetModified(); } + public void undoToCurrent() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + BaseUndoState current = JTemplate.this.getUndoState(); + current.applyState(); + } + }); + } + /** * 模板更新 */ diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index dd9e03c8d..7e30b9840 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -65,17 +65,8 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { - // 自适应布局平分高度导致变矮的场景,优先做撤销 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - jt.undo(); - } - }); - } else if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); + if (jt != null) { + jt.undoToCurrent(); } return true; } else { From ccaa4cf79a164a7bc61facc7d9ef7cbf96b3856b Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 19 Nov 2021 14:51:37 +0800 Subject: [PATCH 120/152] =?UTF-8?q?CHART-22020=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E3=80=91=E5=A4=A7=E5=B1=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8-=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8-=E6=8F=92=E4=BB=B6=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8Creportlets?= =?UTF-8?q?=E6=A0=B9=E7=9B=AE=E5=BD=95=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BA=86?= =?UTF-8?q?FVS=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=8F=AA=E6=9C=89=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=9A=84=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=89=8D=E8=83=BD=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/DesignerFrameFileDealerPane.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 2925e03a8..a33aa91d5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -34,6 +34,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.Event; @@ -101,6 +102,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); } }); + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + DesignerFrameFileDealerPane.getInstance().refresh(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + }); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, App.MARK_STRING); + } + }); } private List otherToolbarStateChangeListeners = new ArrayList<>(); From 07d4884230cb93d9572837a2bb6624e4ffae2072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 16:06:23 +0800 Subject: [PATCH 121/152] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRCardMainBorderLayoutAdapter.java | 7 +++++++ .../com/fr/design/designer/beans/models/AddingModel.java | 9 +++++++++ .../com/fr/design/mainframe/FormCreatorDropTarget.java | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 00c0d7751..13910f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,12 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -67,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (jt != null) { jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index b94b21d94..ba0cf5dd0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -140,4 +141,12 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } + + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } 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 82befa273..2fb7ba0e4 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 @@ -144,7 +144,9 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } } else { Toolkit.getDefaultToolkit().beep(); // 拖入失败 取消选中 From ac23b37e17998cc7fbc280c2294c87c65ba75220 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 19 Nov 2021 16:08:19 +0800 Subject: [PATCH 122/152] =?UTF-8?q?REPORT-62972=20=E3=80=90=E6=8E=A5?= =?UTF-8?q?=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=B7=9F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E7=9A=84=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 本地组件可更新提示初始时应该不可见 【改动思路】 同上 --- .../fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index d2ad2d6f5..fd050513b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -92,6 +92,7 @@ public class LocalWidgetRepoPane extends BasicPane { container.setLayout(new BorderLayout()); updateTipPane = createUpdateTipPane(); + updateTipPane.setVisible(false); container.add(updateTipPane, BorderLayout.NORTH); updateProgressPane = createUpdateMaskPane(); From eb4fbebd72f7fef3db22c6bb388fae730e19ba70 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 19 Nov 2021 16:20:25 +0800 Subject: [PATCH 123/152] REPORT-62926 && REPORT-62920 && REPORT-62967 && REPORT-62964 --- .../share/ui/block/PreviewWidgetBlock.java | 2 +- .../online/OnlineWidgetPopupPreviewPane.java | 34 +------------ .../share/ui/online/PreviewImagePane.java | 41 +++++++++++++++ .../share/ui/online/embed/EmbedPane.java | 50 ++++++++++++++++--- .../embed/OnlineEmbedFilterShowPane.java | 2 +- .../share/ui/online/embed/PreviewDialog.java | 15 +++--- 6 files changed, 95 insertions(+), 49 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java 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 425e3e1ca..e77ea8112 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 @@ -237,7 +237,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe lastStallTime = System.currentTimeMillis(); Dimension dimension = getCoverDimension(); Rectangle containerRec = new Rectangle(0, 0, dimension.width, dimension.height); - if (!isRightClickPopupMenuVisible()) { + if (!isRightClickPopupMenuVisible() && !FirstDragAnimateStateManager.getInstance().animating()) { if (containerRec.contains(e.getX(), e.getY())) { this.showPreviewPane(); } else { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java index ab1793519..d7311db3e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java @@ -23,11 +23,8 @@ import javax.swing.plaf.basic.BasicLabelUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.Toolkit; /** * @author Starryi @@ -35,7 +32,7 @@ import java.awt.Toolkit; * Created by Starryi on 2021/9/14 */ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane { - private static final int POPUP_WIDTH = 412; + public static final int POPUP_WIDTH = 412; private static final int POPUP_TOP_HEIGHT = 28; private static final int POPUP_BOTTOM_HEIGHT = 54; @@ -221,33 +218,4 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane compatibleEnVersionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version") + ": " + compatibleEnVersion); } - - private static class PreviewImagePane extends JPanel { - private static final Image DEFAULT_IMAGE = IOUtils.readImage("com/fr/base/images/share/component_error.png"); - private static final int PREVIEW_IMAGE_WIDTH = POPUP_WIDTH - 20; - private static final int STANDARD_DPI = 128; - - private Image previewImage; - - public void setPreviewImage(Image previewImage) { - this.previewImage = previewImage; - if (this.previewImage == null) { - this.previewImage = DEFAULT_IMAGE; - } - - int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); - int imageWidth = this.previewImage.getWidth(null); - int imageHeight = this.previewImage.getHeight(null); - - double imageAspectRatio = (double) imageWidth / imageHeight; - int width = (PREVIEW_IMAGE_WIDTH * dpi) / STANDARD_DPI; - int height = (int) (width / imageAspectRatio); - setPreferredSize(new Dimension(width, height)); - } - - @Override - public void paint(Graphics g) { - g.drawImage(this.previewImage, 0, 0, getWidth(), getHeight(), null); - } - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java new file mode 100644 index 000000000..bedcb4e2f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java @@ -0,0 +1,41 @@ +package com.fr.design.mainframe.share.ui.online; + +import com.fr.general.IOUtils; + +import javax.swing.JPanel; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; + +/** + * Created by kerry on 2021/11/19 + */ +public class PreviewImagePane extends JPanel { + private static final Image DEFAULT_IMAGE = IOUtils.readImage("com/fr/base/images/share/component_error.png"); + private static final int PREVIEW_IMAGE_WIDTH = OnlineWidgetPopupPreviewPane.POPUP_WIDTH - 20; + private static final int STANDARD_DPI = 128; + + private Image previewImage; + + public void setPreviewImage(Image previewImage) { + this.previewImage = previewImage; + if (this.previewImage == null) { + this.previewImage = DEFAULT_IMAGE; + } + + int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); + int imageWidth = this.previewImage.getWidth(null); + int imageHeight = this.previewImage.getHeight(null); + + double imageAspectRatio = (double) imageWidth / imageHeight; + int width = (PREVIEW_IMAGE_WIDTH * dpi) / STANDARD_DPI; + int height = (int) (width / imageAspectRatio); + setPreferredSize(new Dimension(width, height)); + } + + @Override + public void paint(Graphics g) { + g.drawImage(this.previewImage, 0, 0, getWidth(), getHeight(), null); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index bf535b367..c725e7bd2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; import com.fr.design.mainframe.share.util.OnlineShopUtils; @@ -21,6 +22,7 @@ import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; @@ -54,7 +56,6 @@ public class EmbedPane extends JPanel { private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); jPanel.setBackground(Color.WHITE); - jPanel.setPreferredSize(new Dimension(200, 200)); jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { @@ -65,9 +66,9 @@ public class EmbedPane extends JPanel { }; UIButton searchBtn = initSearchBtn(filterConfigPane, showPane); filterConfigPane.setBorder(null); - UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip")); - tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - jPanel.add(tipLabel, BorderLayout.NORTH); + JPanel tipPane = getFilterTipPane(); + tipPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + jPanel.add(tipPane, BorderLayout.NORTH); jPanel.add(filterConfigPane, BorderLayout.CENTER); JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); southPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); @@ -79,6 +80,43 @@ public class EmbedPane extends JPanel { return jPanel; } + private JPanel getFilterTipPane() { + String remark = Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip"); + UILabel label = new UILabel(); + label.setSize(new Dimension(212, 30)); + + //用THML标签进行拼接,以实现自动换行 + StringBuilder builder = new StringBuilder(""); + char[] chars = remark.toCharArray(); + //获取字体计算大小 + FontMetrics fontMetrics = label.getFontMetrics(label.getFont()); + int start = 0; + int len = 0; + while (start + len < remark.length()) { + while (true) { + len++; + if (start + len > remark.length()) + break; + if (fontMetrics.charsWidth(chars, start, len) + > label.getWidth()) { + break; + } + } + builder.append(chars, start, len - 1).append("
"); + start = start + len - 1; + len = 0; + } + //拼接剩余部分 + builder.append(chars, start, remark.length() - start); + builder.append(""); + + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + label.setText(builder.toString()); + jPanel.add(label); + + return jPanel; + } + private UIButton initSearchBtn(FilterConfigPane filterConfigPane, OnlineEmbedFilterShowPane showPane) { UIButton searchBtn = new UIButton(Toolkit.i18nText("Fine-Design_Share_Online_Query_Recommend_Component")); searchBtn.setUI(new UIButtonUI() { @@ -86,7 +124,7 @@ public class EmbedPane extends JPanel { protected void paintBorder(Graphics g, UIButton b) { Color oldColor = g.getColor(); g.setColor(SEARCH_BUTTON_COLOR); - g.drawRoundRect(0, 0, b.getWidth() - 4, b.getHeight() - 4, 2, 2); + g.drawRoundRect(2, 2, b.getWidth() - 4, b.getHeight() - 4, 2, 2); g.setColor(oldColor); } }); @@ -96,7 +134,7 @@ public class EmbedPane extends JPanel { public void actionPerformed(ActionEvent e) { String filterStr = filterConfigPane.assembleFilter(); if (StringUtils.isEmpty(filterStr)) { - FineJOptionPane.showMessageDialog(EmbedPane.this, + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Warning_Tip"), Toolkit.i18nText("Fine-Design_Basic_Message"), WARNING_MESSAGE, UIManager.getIcon("OptionPane.warningIcon")); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java index 9141bf98a..62adbb76e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java @@ -21,7 +21,7 @@ public class OnlineEmbedFilterShowPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); embedPane = new EmbedPane(this); embedPane.setLocation(10, 0); - embedPane.setSize(228, 273); + embedPane.setSize(228, embedPane.getPreferredSize().height); this.add(embedPane); this.onlineWidgetShowPane = onlineWidgetShowPane; this.add(onlineWidgetShowPane, BorderLayout.CENTER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java index 3ef29c8cb..2edd7d094 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.share.ui.online.embed; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.share.ui.online.PreviewImagePane; -import javax.swing.ImageIcon; import javax.swing.JDialog; import java.awt.Dimension; import java.awt.Image; @@ -25,12 +23,13 @@ public class PreviewDialog extends JDialog { public void setImage(Image image, Point point) { this.getContentPane().removeAll(); - this.getContentPane().add(new UILabel(new ImageIcon(image))); - int width = image.getWidth(null); - this.setSize(width, image.getHeight(null)); - this.setLocation(point.x - width, point.y + OFFSET_Y); + PreviewImagePane previewImagePane = new PreviewImagePane(); + previewImagePane.setPreviewImage(image); + Dimension dimension = previewImagePane.getPreferredSize(); + this.getContentPane().add(previewImagePane); + setSize(new Dimension(dimension.width, dimension.height)); + this.setLocation(point.x - dimension.width, point.y + OFFSET_Y); this.doLayout(); - this.validate(); this.repaint(); } From e125cbe2d900fd50011d85ee4101ac5655a2a733 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 16:56:35 +0800 Subject: [PATCH 124/152] =?UTF-8?q?REPORT-62974=20=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E4=B8=8E=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E6=96=87=E5=AD=97=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guide/creator/layout/UseLayoutAndComponentGuide.java | 2 +- .../guide/creator/theme/DownloadComponentPackageGuide.java | 2 +- .../design/mainframe/guide/creator/theme/ThemeToggleGuide.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index 78e75d8f2..b4f5647c6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -191,7 +191,7 @@ public class UseLayoutAndComponentGuide { Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON); if (component != null) { scene.addClickTarget(component, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Report_OK")), GuideTip.Direction.TOP); } return super.prepared(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 5215f232b..2825189aa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -272,7 +272,7 @@ public class DownloadComponentPackageGuide { public boolean prepared() { Component target = ComponentUtils.findComponentByClass(themeConfirmDialog.getContentPane(), UIButton.class); scene.addClickTarget(target, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.BOTTOM); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm", Toolkit.i18nText("Fine-Design_Basic_Confirm")), GuideTip.Direction.BOTTOM); return super.prepared(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 3ab6234a3..61dffc156 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -173,7 +173,7 @@ public class ThemeToggleGuide { @Override public boolean prepared() { scene.addClickTarget(ComponentUtils.findComponentByName(themeDialog, TemplateThemeGridPagesPane.COMPLETE_BUTTON), ClickScene.ClickType.LEFT, true); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Complete"), BubbleTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close")), BubbleTip.Direction.TOP); return true; } From 19b7fcb536e8ef99218cca5827601eeb6c8ea46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 17:24:37 +0800 Subject: [PATCH 125/152] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRCardMainBorderLayoutAdapter.java | 8 +++++++- .../designer/beans/models/AddingModel.java | 9 +++++++++ .../design/mainframe/FormCreatorDropTarget.java | 16 +++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 7e30b9840..13910f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,13 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -68,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (jt != null) { jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index c0b6cd400..edc5ca998 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -142,4 +143,12 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } + + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } 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 7a6a73f4b..a2c1ba66c 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 @@ -27,19 +27,16 @@ import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; -import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; +import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import java.util.Collections; -import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.List; -import java.util.Map; +import javax.swing.SwingUtilities; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -49,7 +46,10 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; -import javax.swing.SwingUtilities; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 添加模式下鼠标事件处理器。 @@ -141,7 +141,9 @@ public class FormCreatorDropTarget extends DropTarget { } designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep(); From dc1f4cd0ff03280707233c9f763825f8a3e12ad6 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 19 Nov 2021 17:37:17 +0800 Subject: [PATCH 126/152] =?UTF-8?q?REPORT-62970=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E7=AD=9B=E9=80=89=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BA=A4=E4=BA=92=E7=9C=8B?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/share/ui/online/embed/EmbedPane.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index c725e7bd2..825eb22a5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -19,11 +19,13 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.UIManager; +import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; @@ -43,7 +45,9 @@ public class EmbedPane extends JPanel { private static final String EMBED_PANE_TIMER = "EMBED_PANE_TIMER"; private static final Color BORDER_COLOR = Color.decode("#D9DADD"); private static final Color SEARCH_BUTTON_COLOR = Color.decode("#419BF9"); + private static final float DELTA_ALPHA = 0.13F; private Image image; + private float alpha = 1.0F; public EmbedPane(OnlineEmbedFilterShowPane showPane) { this.addMouseListener(new MouseAdapter() { @@ -172,6 +176,7 @@ public class EmbedPane extends JPanel { Dimension newDimension = new Dimension(dimension.width - 25, dimension.height - 30); EmbedPane.this.setSize(newDimension); EmbedPane.this.setLocation(point.x + 25, 0); + alpha -= DELTA_ALPHA; }); }, 0, 60, TimeUnit.MILLISECONDS); @@ -179,6 +184,8 @@ public class EmbedPane extends JPanel { @Override public void paint(Graphics g) { + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); + ((Graphics2D) g).setComposite(composite); super.paint(g); if (image != null) { g.drawImage(image, 0, 0, EmbedPane.this.getWidth(), EmbedPane.this.getHeight(), null); From f4ce22e862bc2dc0fe091337187d8782919057fb Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 19 Nov 2021 17:34:02 +0800 Subject: [PATCH 127/152] =?UTF-8?q?REPORT-62984=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=A7=A6=E6=91=B8=E6=9D=BF=E9=97=AE=E9=A2=98-?= =?UTF-8?q?=E5=8F=8C=E6=8C=87=E5=90=91=E5=8F=B3=E6=BB=91=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=95=8C=E9=9D=A2=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E5=90=91=E5=8F=B3=E4=B8=8B=E6=BB=91=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修复REPORT-55989时实现了新的支持双向触摸滚动的MouseWheelListener, 但未删除旧的触摸板滚动处理逻辑,导致旧的纵向滚动逻辑也一起生效了 【改动思路】 删除旧的纵向滚动处理逻辑 --- .../src/main/java/com/fr/grid/GridMouseAdapter.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 11b6ae22b..c2c186114 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -879,12 +879,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param e */ public void mouseWheelMoved(MouseWheelEvent e) { - if (!InputEventBaseOnOS.isControlDown(e)) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane.isHorizontalScrollBarVisible()) { - reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); - } - } + } /** From 427fb1aa96942d417238b8cb65ee794cab6e4f1e Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 19 Nov 2021 18:50:58 +0800 Subject: [PATCH 128/152] =?UTF-8?q?REPORT-62398=20=E3=80=90=E6=8E=A5?= =?UTF-8?q?=E8=A7=A6=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=AD=98=E5=9C=A8=E6=97=B6=EF=BC=8C=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=BB=91=E5=8A=A8=E9=BC=A0=E6=A0=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/online/AbstractOnlineWidgetShowPane.java | 14 ++++++++++---- .../mainframe/share/ui/online/embed/EmbedPane.java | 4 ++-- .../ui/online/embed/OnlineEmbedFilterShowPane.java | 11 ++++++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java index 1e5899f46..ef61c1e94 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java @@ -43,6 +43,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { protected FilterPane filterPane; private JPanel centerPane; private SortTabPane sortTabPane; + private JPanel toolBarPane; private final JPanel loadingPane = new LoadingPane(); @@ -77,10 +78,10 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { FlexSearchFieldPane flexSearchPane = new FlexSearchFieldPane(filterPane); initSearchTextFieldPaneListener(flexSearchPane); - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPane.add(flexSearchPane, BorderLayout.CENTER); - northPane.add(sortTabPane, BorderLayout.SOUTH); - initNorthPane(jPanel, northPane); + toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + toolBarPane.add(flexSearchPane, BorderLayout.CENTER); + toolBarPane.add(sortTabPane, BorderLayout.SOUTH); + initNorthPane(jPanel, toolBarPane); this.searchResultShowPane = initSearchResultShowPane(sharableWidgetProviders); mainCardLayout = new CardLayout(); @@ -93,10 +94,15 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { return jPanel; } + protected void initNorthPane(JPanel jPanel, JPanel northPane) { jPanel.add(northPane, BorderLayout.NORTH); } + public void setToolBarPaneVisible(boolean flag){ + this.toolBarPane.setVisible(flag); + } + protected AbstractOnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { return new OnlineWidgetSelectPane(sharableWidgetProviders, filterPane, 50); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index 825eb22a5..c9562b1da 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -60,7 +60,7 @@ public class EmbedPane extends JPanel { private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); jPanel.setBackground(Color.WHITE); - jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { @Override @@ -184,7 +184,7 @@ public class EmbedPane extends JPanel { @Override public void paint(Graphics g) { - AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, Math.max(0, alpha)); ((Graphics2D) g).setComposite(composite); super.paint(g); if (image != null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java index 62adbb76e..640d84d73 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java @@ -22,13 +22,22 @@ public class OnlineEmbedFilterShowPane extends JPanel { embedPane = new EmbedPane(this); embedPane.setLocation(10, 0); embedPane.setSize(228, embedPane.getPreferredSize().height); - this.add(embedPane); + this.add(embedPane, BorderLayout.NORTH); this.onlineWidgetShowPane = onlineWidgetShowPane; + this.onlineWidgetShowPane.setToolBarPaneVisible(false); this.add(onlineWidgetShowPane, BorderLayout.CENTER); } public void filterStateChanged(String filterStr) { + this.removeAll(); + this.add(embedPane); + this.add(onlineWidgetShowPane, BorderLayout.CENTER); + this.validate(); + this.doLayout(); + this.repaint(); + onlineWidgetShowPane.setToolBarPaneVisible(true); selectPane = onlineWidgetShowPane.animate(filterStr); + } public void animate(List selectedFilters) throws InterruptedException { From 15f0d94c21e9ab285530b6f098c101cea760cf26 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 19 Nov 2021 20:09:08 +0800 Subject: [PATCH 129/152] =?UTF-8?q?REPORT-62961=2011=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B2=A1=E6=9C=89=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/DesignerEnvManager.java | 11 +++++++++++ .../fr/design/mainframe/ComponentReuseNotifyUtil.java | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index ca85a6517..9d84e25ba 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -19,6 +19,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.login.DesignerLoginType; import com.fr.design.login.config.DesignerLoginConfigManager; +import com.fr.design.mainframe.ComponentReuseNotifyUtil; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; @@ -415,6 +416,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void compatibilityPrevVersion(File prevEnvFile) { try { XMLTools.readFileXML(designerEnvManager, prevEnvFile); + clearOldVersionDesignerEnvProperties(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -424,6 +426,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerEnvManager.saveXMLFile(); } + private void clearOldVersionDesignerEnvProperties() { + SnapChatConfig snapChatConfig = designerEnvManager.getSnapChatConfig(); + snapChatConfig.resetRead(ComponentReuseNotifyUtil.COMPONENT_SNAP_CHAT_KEY); + } + public static void setEnvFile(File envFile) { DesignerEnvManager.envFile = envFile; } @@ -2332,4 +2339,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { DesignerExiter.getInstance().execute(); } } + + public SnapChatConfig getSnapChatConfig() { + return snapChatConfig; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java index 2175804dc..2dc77bb62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java @@ -12,7 +12,7 @@ import com.fr.design.notification.SnapChatKey; * Created by kerry on 5/8/21 */ public class ComponentReuseNotifyUtil { - private static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components"; + public static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components"; private ComponentReuseNotifyUtil() { From d8140ae8c2e0c14f292ca860ecb88b8e53f37d21 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 22 Nov 2021 11:58:43 +0800 Subject: [PATCH 130/152] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=BA=9B=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/formula/FormulaChecker.java | 4 ++-- .../java/com/fr/design/formula/FormulaPane.java | 13 ++++++------- .../exception/FormulaExceptionTipsProcessor.java | 2 +- .../function/FormulaCheckWrongFunction.java | 8 ++++++-- .../exception/function/MismatchedCharFunction.java | 4 ++-- .../exception/function/MismatchedTokenFunction.java | 4 ++-- .../function/NoViableAltForCharFunction.java | 4 ++-- .../exception/function/NoViableAltFunction.java | 4 ++-- .../FormulaAutoCompletePopupWindow.java | 2 +- 9 files changed, 24 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index 1d1097db4..f91322f68 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -25,7 +25,7 @@ public class FormulaChecker { public static FormulaCheckResult check(String formulaText) { if (StringUtils.isEmpty(formulaText) || formulaText.equals(Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Tips"))) { - return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID); + return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID, true); } //过滤一些空格等符号 StringReader in = new StringReader(formulaText); @@ -37,7 +37,7 @@ public class FormulaChecker { Node node = expression.getConditionalExpression(); boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node); return new FormulaCheckResult(valid, valid ? Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : - Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID); + Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID, true); } catch (Exception e) { if (e instanceof TokenStreamRecognitionException) { return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog); 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 be73609c8..b11644e68 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 @@ -387,7 +387,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); } - completionProvider.addCompletion(new FormulaCompletion(completionProvider, "$$$", BaseUtils.readIcon(PARAM_ICON))); return completionProvider; } @@ -787,7 +786,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // Execute Formula default cell element. String formulaText = formulaTextArea.getText().trim(); FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - confirmCheckResult(checkResult); + confirmCheckResult(checkResult, checkResult.getTips()); } }; @@ -804,7 +803,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String messageTips; FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - if (checkResult.isValid()) { + if (checkResult.grammarValid()) { messageTips = checkResult.getTips() + NEWLINE; Map paramsMap = setParamsIfExist(formulaText); Calculator calculator = Calculator.createCalculator(); @@ -836,12 +835,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (checkResult.isValid()) { showMessageDialog(messageTips, checkResult.isValid()); } else { - confirmCheckResult(checkResult); + confirmCheckResult(checkResult, messageTips); } } }; - private boolean confirmCheckResult(FormulaCheckResult checkResult) { + private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { if (checkResult.isValid()) { showMessageDialog(checkResult.getTips(), checkResult.isValid()); } else { @@ -849,7 +848,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " "; int confirmDialog = FineJOptionPane.showConfirmDialog( FormulaPane.this, - position + checkResult.getTips(), + position + messageTips, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, @@ -902,7 +901,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String formula = formulaTextArea.getText().trim(); FormulaCheckResult checkResult = FormulaChecker.check(formula); if (!checkResult.isValid()) { - return confirmCheckResult(checkResult); + return confirmCheckResult(checkResult, checkResult.getTips()); } } return true; diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java index 44f3d59b4..53fa9aaf8 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java @@ -38,7 +38,7 @@ public class FormulaExceptionTipsProcessor { public FormulaCheckResult getExceptionTips(Exception e) { return EXCEPTION_TIPS.getOrDefault(e.getClass(), - e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID)) + e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false)) .apply(e); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java index 274868989..ce2b7cb52 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java @@ -41,9 +41,9 @@ public class FormulaCheckWrongFunction implements Function getFunction() { 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 a1e7aeec9..e573e5693 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 @@ -24,9 +24,9 @@ public class MismatchedTokenFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java index 0cb4058a7..1f0bdf873 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java @@ -20,9 +20,9 @@ public class NoViableAltForCharFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java index e6bfbd5df..85cc0ecc6 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java @@ -21,9 +21,9 @@ public class NoViableAltFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java index e704a6bdd..0efd20076 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java @@ -371,7 +371,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { + if (e.getClickCount() == 2 && e.getButton() == 1) { insertSelectedCompletion(); refreshInstallComp(); } else if (e.getClickCount() == 1) { From 786914be821bdb414bbf8040c6fb6d154fa16e5b Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 22 Nov 2021 15:59:22 +0800 Subject: [PATCH 131/152] =?UTF-8?q?REPORT-62964=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=A7=86=E8=A7=89=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/share/ui/online/embed/EmbedPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index c9562b1da..e275a1cda 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -87,7 +87,7 @@ public class EmbedPane extends JPanel { private JPanel getFilterTipPane() { String remark = Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip"); UILabel label = new UILabel(); - label.setSize(new Dimension(212, 30)); + label.setSize(new Dimension(229, 30)); //用THML标签进行拼接,以实现自动换行 StringBuilder builder = new StringBuilder(""); From 68a18ce3a2aafa0896875c6420284c0d2b4fa6c0 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 22 Nov 2021 17:33:49 +0800 Subject: [PATCH 132/152] =?UTF-8?q?REPORT-62808=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=96=EF=BC=8C=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E6=A1=86=E5=86=85=E9=80=89=E6=8B=A9=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=87=BD=E6=95=B0=E5=90=8D=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=B7=B3=E8=BD=AC=201.=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8D=95=E5=87=BB=E5=AE=9E=E7=8E=B0=E5=81=B6=E7=84=B6=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84bug=EF=BC=9B=202.=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E9=94=AE=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84bug?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormulaAutoCompletePopupWindow.java | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java index 0efd20076..760af0ad5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java @@ -152,7 +152,32 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, list.setCellRenderer(new DelegatingCellRenderer()); list.addListSelectionListener(this); - list.addMouseListener(this); + list.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + }); JPanel contentPane = new JPanel(new BorderLayout()); JScrollPane sp = new JScrollPane(list, @@ -373,9 +398,6 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && e.getButton() == 1) { insertSelectedCompletion(); - refreshInstallComp(); - } else if (e.getClickCount() == 1) { - refreshInstallComp(); } } @@ -389,6 +411,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void mousePressed(MouseEvent e) { + refreshInstallComp(); } @@ -818,6 +841,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void actionPerformed(ActionEvent e) { if (isVisible()) { selectNextItem(); + refreshInstallComp(); } } @@ -994,6 +1018,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void actionPerformed(ActionEvent e) { if (isVisible()) { selectPreviousItem(); + refreshInstallComp(); } } From b5945c31493d6d654b0eb2f33ad850be92d76f90 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 22 Nov 2021 17:35:36 +0800 Subject: [PATCH 133/152] =?UTF-8?q?REPORT-62808=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=96=EF=BC=8C=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E6=A1=86=E5=86=85=E9=80=89=E6=8B=A9=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=87=BD=E6=95=B0=E5=90=8D=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=B7=B3=E8=BD=AC=201.=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8D=95=E5=87=BB=E5=AE=9E=E7=8E=B0=E5=81=B6=E7=84=B6=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84bug=EF=BC=9B=202.=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E9=94=AE=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84bug?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormulaAutoCompletePopupWindow.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java index 760af0ad5..0e1c7c6ac 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java @@ -152,32 +152,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, list.setCellRenderer(new DelegatingCellRenderer()); list.addListSelectionListener(this); - list.addMouseListener(new MouseListener() { - @Override - public void mouseClicked(MouseEvent e) { - - } - - @Override - public void mousePressed(MouseEvent e) { - - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - }); + list.addMouseListener(this); JPanel contentPane = new JPanel(new BorderLayout()); JScrollPane sp = new JScrollPane(list, From 5ca264ee8b2e59360b66273e301977bde00cd49e Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 22 Nov 2021 15:28:16 +0800 Subject: [PATCH 134/152] =?UTF-8?q?REPORT-62477=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-10=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=BB=84=E4=BB=B6=E9=A2=84=E6=9C=9F=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E7=9C=8B=E5=88=B011=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 10.0设计器代码不做改动,因此需要修改商城相关接口,修改后原商城的 filter接口将不再返回设计器版本过滤条件,因此11.0的设计器需使用 新的接口以获取包含设计器版本的过滤条件 【改动思路】 11.0设计器上使用新接口获取过滤条件 --- .../com/fr/design/mainframe/share/util/OnlineShopUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c8c7b54ea..c42f06946 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 @@ -54,7 +54,7 @@ public class OnlineShopUtils { } private static String getWidgetFilterPath() { - return StableUtils.pathJoin(getReuInfoPath(), "filter"); + return StableUtils.pathJoin(getReuInfoPath(), "/all/filter/"); } private static String getGetCompositeSortParaPath() { From f356dee37578b8ffbe1838429656d8b6a005cd29 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 23 Nov 2021 11:32:58 +0800 Subject: [PATCH 135/152] =?UTF-8?q?REPORT-63102=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=96=EF=BC=8C=E5=A4=9A?= =?UTF-8?q?=E8=A1=8C=E5=87=BD=E6=95=B0=E9=94=99=E8=AF=AF=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E5=BC=82=E5=B8=B8=201.=E5=AE=9A=E5=88=B6=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=B2=A1=E6=9C=89newline=E7=9A=84frformulalexer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FRFormulaLexer.java | 1689 +++++++++++++++++ .../com/fr/design/formula/FormulaChecker.java | 4 +- 2 files changed, 1691 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java b/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java new file mode 100644 index 000000000..23c15d98a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java @@ -0,0 +1,1689 @@ +package com.fr.design.formula; + +import com.fr.parser.FRParserTokenTypes; +import com.fr.third.antlr.ByteBuffer; +import com.fr.third.antlr.CharBuffer; +import com.fr.third.antlr.CharStreamException; +import com.fr.third.antlr.CharStreamIOException; +import com.fr.third.antlr.InputBuffer; +import com.fr.third.antlr.LexerSharedInputState; +import com.fr.third.antlr.NoViableAltForCharException; +import com.fr.third.antlr.RecognitionException; +import com.fr.third.antlr.Token; +import com.fr.third.antlr.TokenStream; +import com.fr.third.antlr.TokenStreamException; +import com.fr.third.antlr.TokenStreamIOException; +import com.fr.third.antlr.TokenStreamRecognitionException; +import com.fr.third.antlr.collections.impl.BitSet; + +import java.io.InputStream; +import java.io.Reader; +import java.util.Hashtable; + +/** + * @author Hoky + * @date 2021/11/22 + */ + +public class FRFormulaLexer extends com.fr.third.antlr.CharScanner implements FRParserTokenTypes, TokenStream { + public FRFormulaLexer(InputStream in) { + this(new ByteBuffer(in)); + } + + public FRFormulaLexer(Reader in) { + this(new CharBuffer(in)); + } + + public FRFormulaLexer(InputBuffer ib) { + this(new LexerSharedInputState(ib)); + } + + public FRFormulaLexer(LexerSharedInputState state) { + super(state); + caseSensitiveLiterals = true; + setCaseSensitive(true); + literals = new Hashtable(); + } + + public Token nextToken() throws TokenStreamException { + Token theRetToken = null; + tryAgain: + for (; ; ) { + Token _token = null; + int _ttype = Token.INVALID_TYPE; + resetText(); + try { // for char stream error handling + try { // for lexical error handling + switch (LA(1)) { + case '?': { + mQUESTION(true); + theRetToken = _returnToken; + break; + } + case '(': { + mLPAREN(true); + theRetToken = _returnToken; + break; + } + case ')': { + mRPAREN(true); + theRetToken = _returnToken; + break; + } + case '[': { + mLBRACK(true); + theRetToken = _returnToken; + break; + } + case ']': { + mRBRACK(true); + theRetToken = _returnToken; + break; + } + case '{': { + mLCURLY(true); + theRetToken = _returnToken; + break; + } + case '}': { + mRCURLY(true); + theRetToken = _returnToken; + break; + } + case ',': { + mCOMMA(true); + theRetToken = _returnToken; + break; + } + case '/': { + mDIV(true); + theRetToken = _returnToken; + break; + } + case '+': { + mPLUS(true); + theRetToken = _returnToken; + break; + } + case '-': { + mMINUS(true); + theRetToken = _returnToken; + break; + } + case '*': { + mSTAR(true); + theRetToken = _returnToken; + break; + } + case '%': { + mMOD(true); + theRetToken = _returnToken; + break; + } + case '^': { + mPOWER(true); + theRetToken = _returnToken; + break; + } + case ';': { + mSEMI(true); + theRetToken = _returnToken; + break; + } + case '#': { + mSHARP(true); + theRetToken = _returnToken; + break; + } + case '@': { + mAT(true); + theRetToken = _returnToken; + break; + } + case '~': { + mWAVE(true); + theRetToken = _returnToken; + break; + } + case '`': { + mALLL2(true); + theRetToken = _returnToken; + break; + } + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + mINT_NUM(true); + theRetToken = _returnToken; + break; + } + case '"': { + mSTRING_LITERAL_DSQ(true); + theRetToken = _returnToken; + break; + } + case '\'': { + mSTRING_LITERAL_SSQ(true); + theRetToken = _returnToken; + break; + } + case '\t': + case '\n': + case '\u000c': + case '\r': + case ' ': { + mWS(true); + theRetToken = _returnToken; + break; + } + default: + if ((LA(1) == ':') && (LA(2) == ':')) { + mDCOLON(true); + theRetToken = _returnToken; + } else if ((LA(1) == '=') && (LA(2) == '=')) { + mEQUAL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (LA(2) == '=')) { + mNOT_EQUAL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (LA(2) == '>')) { + mNOT_EQUAL2(true); + theRetToken = _returnToken; + } else if ((LA(1) == '>') && (LA(2) == '=')) { + mGE(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (LA(2) == '=')) { + mLE(true); + theRetToken = _returnToken; + } else if ((LA(1) == '|') && (LA(2) == '|')) { + mLOR(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (LA(2) == '&')) { + mLAND(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (LA(2) == '0')) { + mALLL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (_tokenSet_0.member(LA(2)))) { + mCR_ADRESS(true); + theRetToken = _returnToken; + } else if ((LA(1) == ':') && (true)) { + mCOLON(true); + theRetToken = _returnToken; + } else if ((LA(1) == '=') && (true)) { + mEQUAL2(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (true)) { + mLNOT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '>') && (true)) { + mGT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (true)) { + mLT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '|') && (true)) { + mBOR(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (true)) { + mBAND(true); + theRetToken = _returnToken; + } else if ((_tokenSet_1.member(LA(1)))) { + mIDENT(true); + theRetToken = _returnToken; + } else { + if (LA(1) == EOF_CHAR) { + uponEOF(); + _returnToken = makeToken(Token.EOF_TYPE); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if (_returnToken == null) continue tryAgain; // found SKIP token + _ttype = _returnToken.getType(); + _ttype = testLiteralsTable(_ttype); + _returnToken.setType(_ttype); + return _returnToken; + } catch (RecognitionException e) { + throw new TokenStreamRecognitionException(e); + } + } catch (CharStreamException cse) { + if (cse instanceof CharStreamIOException) { + throw new TokenStreamIOException(((CharStreamIOException) cse).io); + } else { + throw new TokenStreamException(cse.getMessage()); + } + } + } + } + + public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = QUESTION; + int _saveIndex; + + match('?'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LPAREN; + int _saveIndex; + + match('('); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RPAREN; + int _saveIndex; + + match(')'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LBRACK; + int _saveIndex; + + match('['); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RBRACK; + int _saveIndex; + + match(']'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LCURLY; + int _saveIndex; + + match('{'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RCURLY; + int _saveIndex; + + match('}'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = COLON; + int _saveIndex; + + match(':'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mDCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DCOLON; + int _saveIndex; + + match("::"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = COMMA; + int _saveIndex; + + match(','); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = EQUAL; + int _saveIndex; + + match("=="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mEQUAL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = EQUAL2; + int _saveIndex; + + match('='); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LNOT; + int _saveIndex; + + match('!'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mNOT_EQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = NOT_EQUAL; + int _saveIndex; + + match("!="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mNOT_EQUAL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = NOT_EQUAL2; + int _saveIndex; + + match("<>"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mDIV(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DIV; + int _saveIndex; + + match('/'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = PLUS; + int _saveIndex; + + match('+'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = MINUS; + int _saveIndex; + + match('-'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STAR; + int _saveIndex; + + match('*'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mMOD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = MOD; + int _saveIndex; + + match('%'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mPOWER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = POWER; + int _saveIndex; + + match('^'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = GE; + int _saveIndex; + + match(">="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = GT; + int _saveIndex; + + match('>'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LE; + int _saveIndex; + + match("<="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LT; + int _saveIndex; + + match('<'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mBOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = BOR; + int _saveIndex; + + match('|'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mBAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = BAND; + int _saveIndex; + + match('&'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LOR; + int _saveIndex; + + match("||"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LAND; + int _saveIndex; + + match("&&"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = SEMI; + int _saveIndex; + + match(';'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = SHARP; + int _saveIndex; + + match('#'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = AT; + int _saveIndex; + + match('@'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mWAVE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = WAVE; + int _saveIndex; + + match('~'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mALLL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ALLL; + int _saveIndex; + + match('!'); + match('0'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mALLL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ALLL2; + int _saveIndex; + + match('`'); + match('0'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = IDENT; + int _saveIndex; + + mChar(false); + { + _loop109: + do { + if ((_tokenSet_1.member(LA(1)))) { + mChar(false); + } else if (((LA(1) >= '0' && LA(1) <= '9'))) { + { + mDIGIT(false); + } + } else { + break _loop109; + } + + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + /** + * 'a'..'z', '_', 'A'..'Z' and others without number + */ + protected final void mChar(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = Char; + int _saveIndex; + + switch (LA(1)) { + case '$': { + match('\u0024'); + break; + } + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': { + matchRange('\u0041', '\u005a'); + break; + } + case '_': { + match('\u005f'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': { + matchRange('\u0061', '\u007a'); + break; + } + case '\u00c0': + case '\u00c1': + case '\u00c2': + case '\u00c3': + case '\u00c4': + case '\u00c5': + case '\u00c6': + case '\u00c7': + case '\u00c8': + case '\u00c9': + case '\u00ca': + case '\u00cb': + case '\u00cc': + case '\u00cd': + case '\u00ce': + case '\u00cf': + case '\u00d0': + case '\u00d1': + case '\u00d2': + case '\u00d3': + case '\u00d4': + case '\u00d5': + case '\u00d6': { + matchRange('\u00c0', '\u00d6'); + break; + } + case '\u00d8': + case '\u00d9': + case '\u00da': + case '\u00db': + case '\u00dc': + case '\u00dd': + case '\u00de': + case '\u00df': + case '\u00e0': + case '\u00e1': + case '\u00e2': + case '\u00e3': + case '\u00e4': + case '\u00e5': + case '\u00e6': + case '\u00e7': + case '\u00e8': + case '\u00e9': + case '\u00ea': + case '\u00eb': + case '\u00ec': + case '\u00ed': + case '\u00ee': + case '\u00ef': + case '\u00f0': + case '\u00f1': + case '\u00f2': + case '\u00f3': + case '\u00f4': + case '\u00f5': + case '\u00f6': { + matchRange('\u00d8', '\u00f6'); + break; + } + case '\u00f8': + case '\u00f9': + case '\u00fa': + case '\u00fb': + case '\u00fc': + case '\u00fd': + case '\u00fe': + case '\u00ff': { + matchRange('\u00f8', '\u00ff'); + break; + } + default: + if (((LA(1) >= '\u0100' && LA(1) <= '\u1fff'))) { + matchRange('\u0100', '\u1fff'); + } else if (((LA(1) >= '\u3040' && LA(1) <= '\u318f'))) { + matchRange('\u3040', '\u318f'); + } else if (((LA(1) >= '\u3300' && LA(1) <= '\u337f'))) { + matchRange('\u3300', '\u337f'); + } else if (((LA(1) >= '\u3400' && LA(1) <= '\u3d2d'))) { + matchRange('\u3400', '\u3d2d'); + } else if (((LA(1) >= '\u4e00' && LA(1) <= '\u9fff'))) { + matchRange('\u4e00', '\u9fff'); + } else if (((LA(1) >= '\uf900' && LA(1) <= '\ufaff'))) { + matchRange('\uf900', '\ufaff'); + } else if (((LA(1) >= '\uac00' && LA(1) <= '\ud7af'))) { + matchRange('\uac00', '\ud7af'); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DIGIT; + int _saveIndex; + + matchRange('0', '9'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCR_ADRESS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = CR_ADRESS; + int _saveIndex; + + mBAND(false); + { + int _cnt112 = 0; + _loop112: + do { + if ((_tokenSet_0.member(LA(1)))) { + mLETTER(false); + } else { + if (_cnt112 >= 1) { + break _loop112; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt112++; + } while (true); + } + { + int _cnt114 = 0; + _loop114: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt114 >= 1) { + break _loop114; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt114++; + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LETTER; + int _saveIndex; + + switch (LA(1)) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': { + matchRange('A', 'Z'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': { + matchRange('a', 'z'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mINT_NUM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = INT_NUM; + int _saveIndex; + + switch (LA(1)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + { + int _cnt117 = 0; + _loop117: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt117 >= 1) { + break _loop117; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt117++; + } while (true); + } + { + if ((LA(1) == '.')) { + match('.'); + { + _loop120: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + break _loop120; + } + + } while (true); + } + _ttype = FLOT_NUM; + } else { + } + + } + { + if ((LA(1) == 'E' || LA(1) == 'e')) { + mExponent(false); + _ttype = FLOT_NUM; + } else { + } + + } + + //System.out.println("number like 1.2e+12"); + + break; + } + case '.': { + match('.'); + _ttype = DOT; + { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + { + int _cnt124 = 0; + _loop124: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt124 >= 1) { + break _loop124; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt124++; + } while (true); + } + { + if ((LA(1) == 'E' || LA(1) == 'e')) { + mExponent(false); + } else { + } + + } + _ttype = FLOT_NUM; + } else { + } + + } + + //System.out.println("number like .3e-2"); + + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mExponent(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = Exponent; + int _saveIndex; + + { + switch (LA(1)) { + case 'e': { + match('e'); + break; + } + case 'E': { + match('E'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + switch (LA(1)) { + case '+': { + match('+'); + break; + } + case '-': { + match('-'); + break; + } + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + int _cnt144 = 0; + _loop144: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt144 >= 1) { + break _loop144; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt144++; + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTRING_LITERAL_DSQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STRING_LITERAL_DSQ; + int _saveIndex; + + match('"'); + { + _loop128: + do { + if ((LA(1) == '\\')) { + mESC(false); + } else if ((_tokenSet_2.member(LA(1)))) { + matchNot('"'); + } else { + break _loop128; + } + + } while (true); + } + match('"'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ESC; + int _saveIndex; + + match('\\'); + { + switch (LA(1)) { + case 'n': { + match('n'); + break; + } + case 'r': { + match('r'); + break; + } + case 't': { + match('t'); + break; + } + case 'b': { + match('b'); + break; + } + case 'f': { + match('f'); + break; + } + case '"': { + match('"'); + break; + } + case '\'': { + match('\''); + break; + } + case '\\': { + match('\\'); + break; + } + case 'u': { + { + int _cnt136 = 0; + _loop136: + do { + if ((LA(1) == 'u')) { + match('u'); + } else { + if (_cnt136 >= 1) { + break _loop136; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt136++; + } while (true); + } + mXDIGIT(false); + mXDIGIT(false); + mXDIGIT(false); + mXDIGIT(false); + break; + } + case '0': + case '1': + case '2': + case '3': { + matchRange('0', '3'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + case '4': + case '5': + case '6': + case '7': { + matchRange('4', '7'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTRING_LITERAL_SSQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STRING_LITERAL_SSQ; + int _saveIndex; + + match('\''); + { + _loop131: + do { + if ((LA(1) == '\\')) { + mESC(false); + } else if ((_tokenSet_3.member(LA(1)))) { + matchNot('\''); + } else { + break _loop131; + } + + } while (true); + } + match('\''); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = XDIGIT; + int _saveIndex; + + switch (LA(1)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + matchRange('0', '9'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': { + matchRange('a', 'f'); + break; + } + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': { + matchRange('A', 'F'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = WS; + int _saveIndex; + + { + int _cnt151 = 0; + _loop151: + do { + switch (LA(1)) { + case ' ': { + match(' '); + break; + } + case '\t': { + match('\t'); + break; + } + case '\u000c': { + match('\f'); + break; + } + case '\n': + case '\r': { + { + if ((LA(1) == '\r') && (LA(2) == '\n')) { + match("\r\n"); + } else if ((LA(1) == '\r') && (true)) { + match('\r'); + } else if ((LA(1) == '\n')) { + match('\n'); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + //new line 不生效情况居多,此line对于公式语法的检测没有什么作用,还不如直接用column定位,表示第xx个字符 + //newline(); + break; + } + default: { + if (_cnt151 >= 1) { + break _loop151; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + _cnt151++; + } while (true); + } + _ttype = Token.SKIP; + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + + private static final long[] mk_tokenSet_0() { + long[] data = new long[1025]; + data[1] = 576460743847706622L; + return data; + } + + public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); + + private static final long[] mk_tokenSet_1() { + long[] data = new long[3988]; + data[0] = 68719476736L; + data[1] = 576460745995190270L; + data[3] = -36028797027352577L; + for (int i = 4; i <= 127; i++) { + data[i] = -1L; + } + for (int i = 193; i <= 197; i++) { + data[i] = -1L; + } + data[198] = 65535L; + for (int i = 204; i <= 205; i++) { + data[i] = -1L; + } + for (int i = 208; i <= 243; i++) { + data[i] = -1L; + } + data[244] = 70368744177663L; + for (int i = 312; i <= 639; i++) { + data[i] = -1L; + } + for (int i = 688; i <= 861; i++) { + data[i] = -1L; + } + data[862] = 281474976710655L; + for (int i = 996; i <= 1003; i++) { + data[i] = -1L; + } + return data; + } + + public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); + + private static final long[] mk_tokenSet_2() { + long[] data = new long[2048]; + data[0] = -17179869192L; + data[1] = -268435457L; + for (int i = 2; i <= 1022; i++) { + data[i] = -1L; + } + data[1023] = 9223372036854775807L; + return data; + } + + public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); + + private static final long[] mk_tokenSet_3() { + long[] data = new long[2048]; + data[0] = -549755813896L; + data[1] = -268435457L; + for (int i = 2; i <= 1022; i++) { + data[i] = -1L; + } + data[1023] = 9223372036854775807L; + return data; + } + + public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); + +} + diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index f91322f68..302be0b08 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -2,7 +2,6 @@ package com.fr.design.formula; import com.fr.design.formula.exception.FormulaExceptionTipsProcessor; import com.fr.design.i18n.Toolkit; -import com.fr.parser.FRLexer; import com.fr.parser.FRParser; import com.fr.script.checker.FunctionCheckerDispatcher; import com.fr.script.checker.result.FormulaCheckResult; @@ -29,7 +28,8 @@ public class FormulaChecker { } //过滤一些空格等符号 StringReader in = new StringReader(formulaText); - FRLexer lexer = new FRLexer(in); + //此lexer为公式校验定制 + FRFormulaLexer lexer = new FRFormulaLexer(in); FRParser parser = new FRParser(lexer); try { From 88cfa15c8411a1b4c5a2ad0f5d42c5b398d7c494 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 23 Nov 2021 15:59:50 +0800 Subject: [PATCH 136/152] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 整理下目前组件生成面板中必填项的校验规则 2. 将组件类型设置渐入到必填项的校验规则中 【改动思路】 同上 --- .../share/ui/generate/ShareGeneratePane.java | 68 +++--------------- .../share/ui/generate/ShareMainPane.java | 69 +++++++++++++++++-- 2 files changed, 74 insertions(+), 63 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index f71a504c8..5969cb6c2 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -5,6 +5,8 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -33,15 +35,12 @@ import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.border.Border; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; @@ -113,57 +112,17 @@ public class ShareGeneratePane extends BasicPane { this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED)); this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED)); - simplePane.getNameField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - + simplePane.addRequiredSettingChangeListener(new ChangeListener() { @Override - public void removeUpdate(DocumentEvent e) { - validInput(); + public void fireChanged(ChangeEvent event) { + checkRequiredSettings(); } }); - simplePane.getDesignerVersionField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - + uploadPane.addRequiredSettingChangeListener(new ChangeListener() { @Override - public void removeUpdate(DocumentEvent e) { - validInput(); - } - }); - - uploadPane.getNameField().getDocument().addDocumentListener(new DocumentListener() { - - @Override - public void changedUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validInput(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - validInput(); + public void fireChanged(ChangeEvent event) { + checkRequiredSettings(); } }); @@ -176,14 +135,9 @@ public class ShareGeneratePane extends BasicPane { return pane; } - private void validInput() { - String name = getSelectMainPane().getNameField().getText().trim(); - boolean isValidName = StringUtils.isNotEmpty(name); - - boolean isValidDesignerVersion = getSelectMainPane().getDesignerVersionField().isValidVersion(); - - boolean isValidInput = isValidName && isValidDesignerVersion; - dialog.setButtonEnabled(isValidInput); + private void checkRequiredSettings() { + boolean isSettingsRequired = getSelectMainPane().checkRequiredSettings(); + dialog.setButtonEnabled(isSettingsRequired); } diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index b19dbd659..7bcad336f 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -5,6 +5,8 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; import com.fr.design.extra.LoginWebBridge; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -62,6 +64,8 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.border.MatteBorder; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; @@ -142,6 +146,9 @@ public class ShareMainPane extends JPanel { private List effectItemGroups; private final boolean needContentTip; + // 监听必填项 + private ChangeListener requiredSettingChangeListener; + public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List effectItemGroups, boolean needContentTip) { this.shareCover = shareCover; @@ -410,11 +417,31 @@ public class ShareMainPane extends JPanel { pane.add(parentClassify); pane.add(childClassify); + + UILabel validSymbol = new UILabel(" *"); + pane.add(validSymbol); return pane; } private JPanel createDesignerVersionFiledPane() { designerVersionField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT)); + designerVersionField.getDocument().addDocumentListener(new DocumentListener() { + + @Override + public void changedUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + + @Override + public void insertUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + + @Override + public void removeUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(designerVersionField)); + } + }); JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel validSymbol = new UILabel(" *"); symbolTextFiled.add(designerVersionField, BorderLayout.CENTER); @@ -546,6 +573,23 @@ public class ShareMainPane extends JPanel { nameField.setPlaceholder(Toolkit.i18nText("Fine-Design_Share_Name_Placeholder")); nameField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT)); nameField.setDocument(nameLimited); + nameField.getDocument().addDocumentListener(new DocumentListener() { + + @Override + public void changedUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + + @Override + public void insertUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + + @Override + public void removeUpdate(DocumentEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(nameField)); + } + }); JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel validSymbol = new UILabel(" *"); symbolTextFiled.add(nameField, BorderLayout.CENTER); @@ -672,16 +716,29 @@ public class ShareMainPane extends JPanel { return provider; } - public Group getSelectGroup() { - return (Group) localGroup.getSelectedItem(); + public boolean checkRequiredSettings() { + String name = nameField.getText().trim(); + boolean isNameRequired = StringUtils.isNotEmpty(name); + + boolean isDesignerVersionRequired = designerVersionField.isValidVersion(); + + boolean isClassifyRequired = parentClassify.getSelectedItem() != null && childClassify.getSelectedItem() != null; + + return isNameRequired && isDesignerVersionRequired && isClassifyRequired; + } + + public void addRequiredSettingChangeListener(ChangeListener changeListener) { + this.requiredSettingChangeListener = changeListener; } - public UITextField getNameField() { - return nameField; + private void notifyRequiredSettingChanged(ChangeEvent event) { + if (this.requiredSettingChangeListener != null) { + this.requiredSettingChangeListener.fireChanged(event); + } } - public VersionIntervalField getDesignerVersionField() { - return designerVersionField; + public Group getSelectGroup() { + return (Group) localGroup.getSelectedItem(); } private String classify(Object classify) { From fb67c0901c388166ee42b530c792ed3fb38ee769 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 23 Nov 2021 17:21:18 +0800 Subject: [PATCH 137/152] =?UTF-8?q?REPORT-63194=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E9=80=82=E9=85=8D?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=AD=97=E6=AE=B5=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E8=BE=93=E5=85=A5=E6=97=B6=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E6=B6=88=E5=A4=B1=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 合成文本,如中文等存在输入-删除-替换的机制,参考JTextComponent#replaceInputMethodText() 所以insertString中不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时 会导致原有字符被删除 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 7bcad336f..5639b5957 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -818,14 +818,17 @@ public class ShareMainPane extends JPanel { @Override public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException { if (str == null) { - return; + throw new BadLocationException(null, offset); } int count = str.length(); for (int i = 0; i < count; i++) { char c = str.charAt(i); if (allowCharAsString.indexOf(c) < 0) { java.awt.Toolkit.getDefaultToolkit().beep(); - return; + // REPORT-63194 + // 合成文本,如中文等存在输入-删除-替换的机制 JTextComponent#replaceInputMethodText() + // 所以这里不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时会导致原有字符被删除 + throw new BadLocationException(str, offset); } } super.insertString(offset, str, attrSet); From 1a8a38a8893a4c070afe9d1672c20950e1179e9a Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 24 Nov 2021 15:33:22 +0800 Subject: [PATCH 138/152] =?UTF-8?q?REPORT-63190=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E5=88=87=E6=8D=A2=E7=BB=84=E4=BB=B6=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E5=9B=9E=E6=9D=A5=E5=8F=91=E7=8E=B0=E6=98=BE?= =?UTF-8?q?=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 --- .../share/ui/block/AbstractOnlineWidgetBlock.java | 4 ++++ .../share/ui/block/OnlineWidgetPackageBlock.java | 3 +++ .../mainframe/share/ui/block/PreviewWidgetBlock.java | 7 ++++++- .../mainframe/share/ui/block/SimpleWidgetBlock.java | 5 +++++ .../ui/online/AbstractOnlineWidgetSelectPane.java | 2 +- .../ui/online/resource/OnlineResourceManager.java | 10 ++++++++-- .../share/ui/online/resource/ResourceLoader.java | 7 +++++++ 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 582f353ee..864e5cdda 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -95,6 +95,10 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock extends JPanel implements MouseListe @Override public void mouseEntered(MouseEvent e) { hover = true; - if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { + if (ComponentShareUtil.needShowFirstDragAnimate() && supportFirstDragAnimate() && + !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) { schedule(ANIMATE_START_TIME); awtEventListener = event -> { if (!this.isShowing()) { @@ -169,6 +170,10 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe } } + protected boolean supportFirstDragAnimate(){ + return true; + } + protected boolean checkWidget() { return true; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java index cf5e948de..a76220fd5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java @@ -14,4 +14,9 @@ public class SimpleWidgetBlock extends OnlineWidgetBlock { this.removeListener(); this.setFocusable(false); } + + protected boolean supportFirstDragAnimate(){ + return false; + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java index 53239700d..187bcca32 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java @@ -170,7 +170,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele if (!OnlineShopUtils.testConnection()) { return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED; } - OnlineResourceManager.getInstance().cancelLoad(); + OnlineResourceManager.getInstance().cancelLoad(this); contentPane.removeAll(); scrollPane = createScrollPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java index 4e10ff25b..b29ea11db 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.ui.online.resource; import javax.swing.SwingWorker; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; +import java.util.function.Predicate; /** * Created by kerry on 2020-12-10 @@ -25,11 +26,16 @@ public class OnlineResourceManager { private final BlockingQueue loaderBlockingQueue = new ArrayBlockingQueue(100); - public void cancelLoad() { + public void cancelLoad(Object key) { if (swingWorker != null) { swingWorker.cancel(true); } - this.loaderBlockingQueue.clear(); + loaderBlockingQueue.removeIf(new Predicate() { + @Override + public boolean test(ResourceLoader resourceLoader) { + return resourceLoader.checkValid(key); + } + }); } public void addLoader(ResourceLoader loader) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java index fee705f8a..7aacd2941 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java @@ -10,4 +10,11 @@ public interface ResourceLoader { */ void load(); + /** + * 检查resource是否属于某分类 + * @param key 分类标识 + * @return boolean + */ + boolean checkValid(Object key); + } From 23ece8197e7460b3d0b94a774b8f391bdfafdf02 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 24 Nov 2021 15:00:35 +0800 Subject: [PATCH 139/152] =?UTF-8?q?REPORT-63250=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E8=A7=86=E8=A7=89=E9=AA=8C=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改设计器组件商城面板上一些控件的展示效果 【改动思路】 同上 --- .../design/mainframe/share/ui/local/LocalWidgetRepoPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index fd050513b..0d0cff570 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -119,10 +119,12 @@ public class LocalWidgetRepoPane extends BasicPane { content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER); JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); + actionsPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -5)); actionsPane.setOpaque(false); actionsPane.setBackground(null); UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel")); + cancelUpgradeButton.setRoundBorder(true); cancelUpgradeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -132,6 +134,8 @@ public class LocalWidgetRepoPane extends BasicPane { UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All")); startUpgradeButton.setSelected(true); + startUpgradeButton.setRoundBorder(true); + startUpgradeButton.setBorderPainted(false); startUpgradeButton.setForeground(Color.WHITE); startUpgradeButton.addActionListener(new ActionListener() { @Override From 6aa636185daf0bf2a471b433891590b4195ff47b Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 24 Nov 2021 17:26:52 +0800 Subject: [PATCH 140/152] =?UTF-8?q?REPORT-62672=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E9=83=A8=E5=88=86=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=97=A0=E6=B3=95=E6=A8=A1=E6=8B=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/share/collect/ComponentCollector.java | 3 --- .../share/ui/online/embed/OnlineEmbedFilterSelectPane.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index db9fbe43b..d65f6af9a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -343,9 +343,6 @@ public class ComponentCollector implements XMLable { } public void clickComponentSetting() { - if (!ComponentShareUtil.needShowEmbedFilterPane()) { - return; - } boolean changed = false; int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; if (this.firstShowReact != firstShowReact) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 3f4cea2a0..be433aa56 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -40,6 +40,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane private static final String CAROUSEL_PREVIEW = "carousel_preview"; private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000; private OnlineShareWidget[] showWidgets; + private static final int NOT_CAROUSE_WIDGET_NUM = 30; private PreviewDialog previewDialog; private JPanel widgetPane; @@ -144,7 +145,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane stopCarouse(integer); return; } - if (integer.get() == 0) { + if (integer.get() == NOT_CAROUSE_WIDGET_NUM) { CarouselStateManger.getInstance().stop(); stopCarouse(integer); previewDialog.setVisible(false); From 0c77e8cdf3f2f8c0c9a84e7ad6ef2f409919e91c Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Wed, 24 Nov 2021 17:41:04 +0800 Subject: [PATCH 141/152] =?UTF-8?q?REPORT-63196=20&&=20REPORT-63186=201.?= =?UTF-8?q?=E5=9C=A8=E5=8F=8C=E5=87=BB=E4=B9=8B=E5=90=8E=E4=BD=BF=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E6=B6=88=E5=A4=B1=EF=BC=9B=202.=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E8=AE=A1=E7=AE=97=E5=9C=A8=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E6=97=B6=E5=80=99=E6=8F=90=E7=A4=BA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 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 b11644e68..dc1e03027 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 @@ -46,6 +46,7 @@ import com.fr.parser.BlockIntervalLiteral; import com.fr.parser.ColumnRowRangeInPage; import com.fr.parser.NumberLiteral; import com.fr.parser.SheetIntervalLiteral; +import com.fr.record.analyzer.EnableMetrics; import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.script.Calculator; import com.fr.script.ScriptConstants; @@ -54,7 +55,6 @@ import com.fr.stable.EncodeConstants; import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import com.fr.stable.UtilEvalError; import com.fr.stable.script.CRAddress; import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.Expression; @@ -122,6 +122,7 @@ import java.util.Set; * @editor zhou * @since 2012-3-29下午1:50:53 */ +@EnableMetrics public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static final int DEFUAL_FOMULA_LENGTH = 103; public static final String ELLIPSIS = "..."; @@ -139,6 +140,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected static UICheckBox autoCompletionCheck; protected static UICheckBox checkBeforeColse; private JList tipsList; + private JPopupMenu popupMenu; protected DefaultListModel listModel = new DefaultListModel(); private int ifHasBeenWriten = 0; private DefaultListModel functionTypeListModel = new DefaultListModel(); @@ -457,6 +459,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { doubleClickActuator(doublePressContent); } + if (popupMenu != null) { + popupMenu.setVisible(false); + } } } } @@ -616,7 +621,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void popTips() { - JPopupMenu popupMenu = new JPopupMenu(); + popupMenu = new JPopupMenu(); JScrollPane tipsScrollPane = new JScrollPane(tipsList); popupMenu.add(tipsScrollPane); tipsScrollPane.setPreferredSize(new Dimension(240, 146)); @@ -792,6 +797,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private final ActionListener calculateActionListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { String formulaText = formulaTextArea.getText().trim(); @@ -819,16 +825,20 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); + Object calResult; try { - Object value = calculator.evalValue(baseFormula); - String objectToString = EssentialUtils.objectToString(value); + calResult = calculator.evalValue(baseFormula); + String objectToString = EssentialUtils.objectToString(calResult); String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; - FineLoggerFactory.getLogger().info("value:{}", value); - } catch (UtilEvalError utilEvalError) { - FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError); + } catch (Exception ce) { + //模拟计算如果出现错误,则抛出错误 + calResult = ce.getMessage(); + FineLoggerFactory.getLogger().error(ce.getMessage(), ce); + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } + FineLoggerFactory.getLogger().info("value:{}", calResult); } else { messageTips = checkResult.getTips(); } From 568cf34dc65fa13e4efe4d2f2ab8c377732c7827 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 24 Nov 2021 18:37:02 +0800 Subject: [PATCH 142/152] =?UTF-8?q?REPORT-63305=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=8E=B7=E5=8F=96=E7=88=B6=E5=AE=B9=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=AF=B9=E6=8B=93=E5=B1=95=E7=9A=84=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E6=8F=92=E4=BB=B6=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 26 +++++++++++++++++++ .../widget/ui/FormSingleWidgetCardPane.java | 7 ++--- .../designer/component/WidgetBoundPane.java | 10 ++----- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 2f797efa4..6445e001b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -57,6 +57,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; @@ -68,6 +69,7 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; +import java.util.Set; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; @@ -375,4 +377,28 @@ public class XCreatorUtils { return xCreator; } + + public static boolean isExtraContainer(XCreator creator) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() + && ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget()) + && ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) { + return true; + } + } + return false; + } + + public static XLayoutContainer getParent(XCreator source) { + if (source.acceptType(XWCardTagLayout.class) ) { + return (XLayoutContainer)source.getParent(); + } + XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); + boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source); + if (accept) { + container = null; + } + return container; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 1fd1a3527..491b42b2b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -67,12 +67,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { initDefinePane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index aee83889e..f711eb157 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane { initBoundPane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - if(source.acceptType(XWCardTagLayout.class)){ - return (XLayoutContainer)source.getParent(); - } - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public void initBoundPane() { From 8de9339eceaf774fe0f497b6845a82daa8b98762 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 25 Nov 2021 11:37:08 +0800 Subject: [PATCH 143/152] =?UTF-8?q?CHART-22038=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=8C=E5=AE=89=E8=A3=85ECharts=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=9B=BE=E8=A1=A8=E5=9D=97=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=8C=BA=E5=9F=9F=E4=B8=8D=E6=98=BE=E7=A4=BAecharts?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/FormParaWidgetPane.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 09e02ac67..be752777b 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 @@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.chart.ChartXMLTag; import com.fr.design.gui.core.FormWidgetOption; @@ -19,6 +20,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.Widget; @@ -99,6 +101,15 @@ public class FormParaWidgetPane extends JPanel { synchronized (FormParaWidgetPane.class) { THIS = null; } + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null && !template.isJWorkBook()) { + DesignerContext.getDesignerFrame().resetToolkitByPlus(template); + } + } + }); } }, new PluginFilter() { From f8c570a3f1243f41c12236ebbbca8e4481b6ed74 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 25 Nov 2021 15:32:37 +0800 Subject: [PATCH 144/152] =?UTF-8?q?REPORT-62175=20&&=20REPORT-63204=201.?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E9=80=82=E9=85=8D=202.=E9=92=88=E5=AF=B9sum(?= =?UTF-8?q?1,)=E7=AD=89=E6=AD=A4=E7=B1=BB=E5=85=AC=E5=BC=8F=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=90=88=E6=B3=95=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 116 ++++++++++-------- 1 file changed, 62 insertions(+), 54 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 dc1e03027..189b9e042 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 @@ -341,13 +341,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void focusGained(FocusEvent e) { // 获得焦点时 安装 - if (autoCompletion == null && autoCompletionCheck.isSelected()) { - CompletionProvider provider = createCompletionProvider(); - autoCompletion = new FormulaPaneAutoCompletion(provider); - autoCompletion.setListCellRenderer(new CompletionCellRenderer()); - autoCompletion.install(formulaTextArea); - autoCompletion.installVariableTree(variableTreeAndDescriptionArea); - } + installAutoCompletion(); } @Override @@ -410,6 +404,16 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } + private void installAutoCompletion() { + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); + } + } + protected void extendCheckBoxPane(JPanel checkBoxPane) { @@ -795,58 +799,62 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } }; + private void calculateFormula() { + String formulaText = formulaTextArea.getText().trim(); + String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); + if (unSupportFormula != null) { + showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); + return; + } - private final ActionListener calculateActionListener = new ActionListener() { + String messageTips; + FormulaCheckResult checkResult = FormulaChecker.check(formulaText); + if (checkResult.grammarValid()) { + messageTips = checkResult.getTips() + NEWLINE; + Map paramsMap = setParamsIfExist(formulaText); + Calculator calculator = Calculator.createCalculator(); + ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap); + calculator.pushNameSpace(parameterMapNameSpace); + + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (currentEditingTemplate != null) { + IOFile file = (IOFile) currentEditingTemplate.getTarget(); + calculator.setAttribute(TableDataSource.KEY, file); + calculator.pushNameSpace(TableDataNameSpace.getInstance()); + calculator.pushNameSpace(SimpleCellValueNameSpace.getInstance()); + } - @Override - public void actionPerformed(ActionEvent e) { - String formulaText = formulaTextArea.getText().trim(); - String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); - if (unSupportFormula != null) { - showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); - return; + BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); + Object calResult; + try { + calResult = calculator.evalValue(baseFormula); + String objectToString = EssentialUtils.objectToString(calResult); + String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? + objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; + } catch (Exception ce) { + //模拟计算如果出现错误,则抛出错误 + calResult = ce.getMessage(); + FineLoggerFactory.getLogger().error(ce.getMessage(), ce); + messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } + FineLoggerFactory.getLogger().info("value:{}", calResult); + } else { + messageTips = checkResult.getTips(); + } + if (checkResult.isValid()) { + showMessageDialog(messageTips, checkResult.isValid()); + } else { + confirmCheckResult(checkResult, messageTips); + } + } - String messageTips; - FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - if (checkResult.grammarValid()) { - messageTips = checkResult.getTips() + NEWLINE; - Map paramsMap = setParamsIfExist(formulaText); - Calculator calculator = Calculator.createCalculator(); - ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap); - calculator.pushNameSpace(parameterMapNameSpace); - - JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (currentEditingTemplate != null) { - IOFile file = (IOFile) currentEditingTemplate.getTarget(); - calculator.setAttribute(TableDataSource.KEY, file); - calculator.pushNameSpace(TableDataNameSpace.getInstance()); - calculator.pushNameSpace(SimpleCellValueNameSpace.getInstance()); - } - BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText); - Object calResult; - try { - calResult = calculator.evalValue(baseFormula); - String objectToString = EssentialUtils.objectToString(calResult); - String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ? - objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString; - messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result; - } catch (Exception ce) { - //模拟计算如果出现错误,则抛出错误 - calResult = ce.getMessage(); - FineLoggerFactory.getLogger().error(ce.getMessage(), ce); - messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; - } - FineLoggerFactory.getLogger().info("value:{}", calResult); - } else { - messageTips = checkResult.getTips(); - } - if (checkResult.isValid()) { - showMessageDialog(messageTips, checkResult.isValid()); - } else { - confirmCheckResult(checkResult, messageTips); - } + private final ActionListener calculateActionListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + calculateFormula(); } }; From 76b1cc1e02ccf6e042d65b4872ddac265e1a1660 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 15:43:32 +0800 Subject: [PATCH 145/152] =?UTF-8?q?REPORT-63308=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E5=9C=A8=E7=BB=84=E4=BB=B6=E4=B8=8A=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/share/ui/block/AbstractOnlineWidgetBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 864e5cdda..5c1620ab4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -114,7 +114,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock Date: Thu, 25 Nov 2021 15:52:56 +0800 Subject: [PATCH 146/152] =?UTF-8?q?CHART-22060=20fix:fvs=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AA=E4=B8=8D=E6=98=AF=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E4=B8=BB=E9=A2=98default=20=E6=98=AFnormal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java index e6ea1e2e7..9f9a3f13c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java @@ -153,7 +153,7 @@ public class ColorSchemeComboBox extends UIComboBox { if (selectedIndex == itemCount - 2) { return SelectType.COMBINATION_COLOR; } - if (selectedIndex == 0) { + if (selectedIndex == 0 && ChartEditContext.supportTheme()) { return SelectType.DEFAULT; } return SelectType.NORMAL; From ddd7b9fb4aa88bd75cc4f35c737d894dc52d41e5 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 17:21:25 +0800 Subject: [PATCH 147/152] =?UTF-8?q?REPORT-62672=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E9=83=A8=E5=88=86=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=97=A0=E6=B3=95=E6=A8=A1=E6=8B=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/collect/ComponentCollector.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java index d65f6af9a..477673978 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java @@ -343,18 +343,12 @@ public class ComponentCollector implements XMLable { } public void clickComponentSetting() { - boolean changed = false; int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1; if (this.firstShowReact != firstShowReact) { - this.firstShowReact = firstShowReact; - changed = true; + collectFirstShowReact(firstShowReact); } if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) { - this.embededFilterReact = -1; - changed = true; - } - if (changed) { - saveInfo(); + collectEmbededFilterReact(-1); } } @@ -371,11 +365,16 @@ public class ComponentCollector implements XMLable { return; } if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) { - this.dynamicEffectReact = 1; - saveInfo(); + collectDynamicEffectReactFlag(1); } } + public void collectDynamicEffectReactFlag(int flag) { + this.dynamicEffectReact = flag; + saveInfo(); + } + + public void clearSortType() { sortType = JSONFactory.createJSON(JSON.ARRAY); } From 4818c71faef81099ff01127d0d9e788827a6ed84 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 25 Nov 2021 18:40:40 +0800 Subject: [PATCH 148/152] =?UTF-8?q?REPORT-63311=E3=80=90=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96=E3=80=91=E8=BD=AE=E6=92=AD=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E5=88=87=E6=8D=A2=E7=BB=84=E4=BB=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E8=BD=AE=E6=92=AD=E5=81=9C=E4=BD=8F?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/online/embed/OnlineEmbedFilterSelectPane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index be433aa56..def1056e9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -57,8 +57,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen(); Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize(); Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height); - if (CarouselStateManger.getInstance().running() && - !selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { + if (!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) { CarouselStateManger.getInstance().stop(); } } catch (Exception e) { @@ -173,6 +172,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } if (!CarouselStateManger.getInstance().isSuspend()) { previewDialog.setVisible(true); + //再做一次检查,避免因并发导致的previewDialog始终展示的问题 + if (CarouselStateManger.getInstance().stopped()) { + stopCarouse(integer); + service.shutdown(); + return; + } showCurrentLoadBlock(integer, widgetPane); service.shutdown(); } From cc7e2b8fdb49c324f0d06c1dfcadedc123fae67f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 26 Nov 2021 15:59:51 +0800 Subject: [PATCH 149/152] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 监听下必填项设置:组件分类 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 5639b5957..9ac98286e 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel { childClassify.clearBoxItems(); childClassify.refreshBoxItems(children); } + + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); + } + }); + + childClassify.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); } }); From 18d681ac3600342cdad48a788ea6a02e5c36aad9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 26 Nov 2021 15:59:51 +0800 Subject: [PATCH 150/152] =?UTF-8?q?REPORT-63192=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=AB=AF=E7=94=9F=E6=88=90=E7=BB=84=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 监听下必填项设置:组件分类 【改动思路】 同上 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 5639b5957..9ac98286e 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel { childClassify.clearBoxItems(); childClassify.refreshBoxItems(children); } + + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); + } + }); + + childClassify.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + notifyRequiredSettingChanged(new ChangeEvent(parentClassify)); } }); From 6f797af38e5dbc2aaf20b8d3e160258043cefdaf Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 14:54:37 +0800 Subject: [PATCH 151/152] =?UTF-8?q?REPORT-63524=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8-=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=AB=AF?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=8F=AF=E6=9B=B4=E6=96=B0=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=97=B6=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 将响应获取组件更新信息结果的动作抽离出来 【改动思路】 同上 --- .../share/ui/local/LocalWidgetRepoPane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 0d0cff570..169b4b5e7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -393,15 +393,19 @@ public class LocalWidgetRepoPane extends BasicPane { public void onFetchedAfter(boolean success, Map remoteLatestWidgets) { if (success) { List updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); - updateTipPane.setVisible(updatableWidgetProviders.size() > 0); - if (updatableWidgetProviders.size() > 0) { - refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); - } + onRemoteWidgetUpdatesChanged(updatableWidgetProviders.size() > 0); } } }); } + public void onRemoteWidgetUpdatesChanged(boolean hasUpdates) { + updateTipPane.setVisible(hasUpdates); + if (hasUpdates) { + refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT); + } + } + public void doQuitUpdateComponents() { LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); updater.clearUpdate(); From 5a407a44914a8fbfa88e9c27aab5629eb0c389cc Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 30 Nov 2021 18:10:15 +0800 Subject: [PATCH 152/152] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9F=8B=E7=82=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 16 ++-- .../function/MismatchedCharFunction.java | 9 -- .../function/MismatchedTokenFunction.java | 38 +------- .../function/TranslateTokenUtils.java | 96 +++++++++++++++++++ 4 files changed, 108 insertions(+), 51 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java 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 189b9e042..27018e6e0 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 @@ -341,7 +341,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void focusGained(FocusEvent e) { // 获得焦点时 安装 - installAutoCompletion(); + if (autoCompletion == null && autoCompletionCheck.isSelected()) { + installAutoCompletion(); + } } @Override @@ -405,13 +407,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void installAutoCompletion() { - if (autoCompletion == null && autoCompletionCheck.isSelected()) { - CompletionProvider provider = createCompletionProvider(); - autoCompletion = new FormulaPaneAutoCompletion(provider); - autoCompletion.setListCellRenderer(new CompletionCellRenderer()); - autoCompletion.install(formulaTextArea); - autoCompletion.installVariableTree(variableTreeAndDescriptionArea); - } + CompletionProvider provider = createCompletionProvider(); + autoCompletion = new FormulaPaneAutoCompletion(provider); + autoCompletion.setListCellRenderer(new CompletionCellRenderer()); + autoCompletion.install(formulaTextArea); + autoCompletion.installVariableTree(variableTreeAndDescriptionArea); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java index c25b34f67..69ea0c81a 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java @@ -35,10 +35,6 @@ public class MismatchedCharFunction implements Function"; } else { String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); - return tokenType >= 0 && tokenType < tokenNames.length ? translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; + return tokenType >= 0 && tokenType < tokenNames.length ? TranslateTokenUtils.translateToken(tokenNames[tokenType]) : "<" + tokenType + ">"; } } - private String translateToken(String token) { - switch (token) { - case ("RPAREN"): - return ")"; - case ("LPAREN"): - return "("; - case ("COMMA"): - return ","; - case ("COLON"): - return ":"; - default: - return token; - } - } private Object getFieldValue(Object object, String fieldName) { try { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java new file mode 100644 index 000000000..1df697d07 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java @@ -0,0 +1,96 @@ +package com.fr.design.formula.exception.function; + +import com.fr.design.i18n.Toolkit; + +/** + * @author Hoky + * @date 2021/11/30 + */ +public class TranslateTokenUtils { + public static String translateToken(String token) { + switch (token) { + case ("RPAREN"): + return ")"; + case ("LPAREN"): + return "("; + case ("COMMA"): + return ","; + case ("COLON"): + return ":"; + case ("EOF"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF"); + case ("DOT"): + return "."; + case ("FLOT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Float_Number"); + case ("LOR"): + return "||"; + case ("LAND"): + return "&&"; + case ("EQUAL"): + return "="; + case ("EQUAL2"): + return "="; + case ("NOT_EQUAL"): + return "!="; + case ("NOT_EQUAL2"): + return "!="; + case ("GE"): + return ">="; + case ("LE"): + return "<="; + case ("LT"): + return "<"; + case ("PLUS"): + return "+"; + case ("MINUS"): + return "-"; + case ("STAR"): + return "*"; + case ("DIV"): + return "/"; + case ("MOD"): + return "%"; + case ("POWER"): + return "^"; + case ("LNOT"): + return "!"; + case ("WAVE"): + return "~"; + case ("LBRACK"): + return "["; + case ("SEMI"): + return ";"; + case ("RBRACK"): + return "]"; + case ("LCURLY"): + return "{"; + case ("RCURLY"): + return "}"; + case ("DCOLON"): + return ";"; + case ("INT_NUM"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Integer"); + case ("CR_ADRESS"): + return "\n"; + case ("SHARP"): + return "#"; + case ("AT"): + return "@"; + case ("QUESTION"): + return "?"; + case ("BOR"): + return "||"; + case ("BAND"): + return "&&"; + case ("Char"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Character"); + case ("DIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Digital"); + case ("XDIGIT"): + return Toolkit.i18nText("Fine-Design_Basic_Formula_Hexadecimal_Digital"); + default: + return token; + } + } +}