From 553c1c827d044f884b55b67db78cfb025793b649 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 21 Dec 2020 09:56:30 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=AD=97=E6=AE=B5=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 44 +++++- .../richText/VanChartFieldAddPane.java | 124 +++++++++++++++ .../richText/VanChartFieldGroupPane.java | 115 ++++++++++++++ .../richText/VanChartFieldListener.java | 15 ++ .../VanChartRichEditorPane.java | 2 +- .../VanChartRichTextDialog.java} | 8 +- .../richText/VanChartRichTextPane.java | 144 ++++++++++++++++++ 7 files changed, 441 insertions(+), 11 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{ => richText}/VanChartRichEditorPane.java (99%) rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{VanChartRichEditorDialog.java => richText/VanChartRichTextDialog.java} (73%) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b5f03a728..b6e768e34 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -32,7 +33,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; +import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -45,6 +50,8 @@ 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.List; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -437,24 +444,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane pane = VanChartRichEditorPane.createRichEditorPane(richText); - BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane); + final ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - pane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); + BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); + + BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + + richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); dialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = pane.update(); + VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); String content = model.getContent(); updateLocalRichText(content, model.isAuto()); - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } public void doCancel() { - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } }); @@ -465,6 +475,28 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("分类"); + fieldNames.add("系列"); + fieldNames.add("值"); + fieldNames.add("百分比"); + + return fieldNames; + } + + private List getTableFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("字段A"); + fieldNames.add("字段B"); + fieldNames.add("字段C"); + fieldNames.add("字段D"); + + return fieldNames; + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java new file mode 100644 index 000000000..dd34a2a7f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java @@ -0,0 +1,124 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.base.BaseUtils; +import com.fr.data.util.function.DataFunction; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.Icon; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.Format; + +public class VanChartFieldAddPane extends JPanel { + + private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); + + private static final int W = 200; + private static final int H = 28; + + private UIToggleButton fieldButton; + private UIButton addButton; + + private Format format; + private DataFunction dataFunction; + + private String fieldName; + private boolean showSummary; + + public VanChartFieldAddPane(String fieldName, VanChartFieldListener listener) { + this(fieldName, false, listener); + } + + public VanChartFieldAddPane(String fieldName, boolean showSummary, VanChartFieldListener listener) { + this.fieldName = fieldName; + this.showSummary = showSummary; + + initComponents(fieldName, listener); + + this.setLayout(new BorderLayout()); + this.add(getContentPane(), BorderLayout.CENTER); + } + + public String getFieldName() { + return fieldName; + } + + public Format getFormat() { + return format; + } + + public void setFormat(Format format) { + this.format = format; + } + + public DataFunction getDataFunction() { + return dataFunction; + } + + public void setDataFunction(DataFunction dataFunction) { + this.dataFunction = dataFunction; + } + + public boolean isShowSummary() { + return showSummary; + } + + private void initComponents(String fieldName, VanChartFieldListener listener) { + fieldButton = new UIToggleButton(fieldName) { + + protected MouseListener getMouseListener() { + + return new MouseAdapter() { + public void mousePressed(MouseEvent e) { + setSelected(true); + + listener.refreshSelectedField(fieldName); + listener.setGlobalName(fieldName); + } + }; + } + }; + + addButton = new UIButton(ADD_ICON); + + addButton.addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + + listener.addSelectedField(fieldName); + } + }); + } + + private JPanel getContentPane() { + Component[][] components = new Component[][]{ + new Component[]{fieldButton, addButton} + }; + + double p = TableLayout.PREFERRED; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + + double[] rowSize = {p}; + double[] columnSize = {e, d}; + + JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); + content.setPreferredSize(new Dimension(W, H)); + + return content; + } + + public void setSelectedState(boolean selected) { + fieldButton.setSelected(selected); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java new file mode 100644 index 000000000..5e80aa78c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java @@ -0,0 +1,115 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldGroupPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private List defaultFieldNameList; + private List tableFieldNameList; + + private List defaultFieldPaneList = new ArrayList<>(); + private List tableFieldPaneList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { + this.defaultFieldNameList = defaultFieldNameList; + this.tableFieldNameList = tableFieldNameList; + + initFieldListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : defaultFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + defaultField.add(fieldAddPane); + defaultFieldPaneList.add(fieldAddPane); + } + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + private JPanel createTableFieldPane() { + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : tableFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + tableField.add(fieldAddPane); + tableFieldPaneList.add(fieldAddPane); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + private void initFieldListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public void refreshSelectedField(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + + for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName) { + System.out.println(fieldName); + } + + public void populateFieldFormatPane() { + + } + + public void updateFieldFormatPane() { + + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java new file mode 100644 index 000000000..738492d67 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -0,0 +1,15 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.event.GlobalNameListener; + +public interface VanChartFieldListener extends GlobalNameListener { + + public void refreshSelectedField(String fieldName); + + public void addSelectedField(String fieldName); + + public void populateFieldFormatPane(); + + public void updateFieldFormatPane(); + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java similarity index 99% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 6f308ad43..66453a157 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java similarity index 73% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index a13208df5..2cf7050dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; @@ -8,17 +8,17 @@ import com.fr.design.utils.gui.GUICoreUtils; import java.awt.Dimension; import java.awt.Frame; -public class VanChartRichEditorDialog extends BasicDialog { +public class VanChartRichTextDialog extends BasicDialog { public static final Dimension DEFAULT = new Dimension(960, 600); - public VanChartRichEditorDialog(Frame parent, BasicPane pane) { + public VanChartRichTextDialog(Frame parent, BasicPane pane) { super(parent, pane); this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); this.setBasicDialogSize(DEFAULT); GUICoreUtils.centerWindow(this); - this.setResizable(true); + this.setResizable(false); this.setModal(true); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java new file mode 100644 index 000000000..927fbdaae --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -0,0 +1,144 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.style.FormatPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.stable.StringUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +// 标签提示中的富文本面板,包含字段设置和富文本编辑器 +public class VanChartRichTextPane extends BasicBeanPane { + + private static final int FIELD_PANE_W = 470; + private static final int FIELD_PANE_H = 270; + + private static final int RICH_EDITOR_W = 940; + private static final int RICH_EDITOR_H = 260; + + private static final double P = TableLayout.PREFERRED; + private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + private JScrollPane fieldContentPane; + private JScrollPane fieldPropsPane; + + private FormatPane fieldFormatPane; + private JPanel fieldSummaryPane; + + private UIComboBox fieldSummaryBox; + + private VanChartStylePane parent; + + private List defaultFieldsFormat; + private List tableFieldsFormat; + + public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { + this.parent = parent; + + this.defaultFieldsFormat = defaultFieldsFormat; + this.tableFieldsFormat = tableFieldsFormat; + + initFieldContentPane(); + initFieldPropsPane(); + + this.setLayout(new BorderLayout()); + this.add(createFieldDetailPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + } + + private void initFieldContentPane() { + JPanel content = new JPanel(); + content.setLayout(new BorderLayout()); + content.add(createDefaultContentPane(), BorderLayout.NORTH); + content.add(createTableFieldsPane(), BorderLayout.CENTER); + + fieldContentPane = new JScrollPane(content); + fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldContentPane.setHorizontalScrollBar(null); + fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); + } + + private void initFieldPropsPane() { + fieldFormatPane = new FormatPaneWithOutFont() { + protected JPanel createContentPane(Component[][] components) { + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); + } + }; + + fieldSummaryBox = new CalculateComboBox(); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} + }; + + fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); + + JPanel props = new JPanel(); + props.setLayout(new BorderLayout()); + props.add(fieldFormatPane, BorderLayout.NORTH); + props.add(fieldSummaryPane, BorderLayout.CENTER); + props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + + fieldPropsPane = new JScrollPane(props); + fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + } + + private JPanel createDefaultContentPane() { + + return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); + } + + private JPanel createTableFieldsPane() { + return new JPanel(); + } + + private JPanel createFieldDetailPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + fieldPane.add(fieldContentPane); + fieldPane.add(fieldPropsPane); + + return fieldPane; + } + + private JPanel createRichEditorPane(JPanel richEditor) { + JPanel richEditorPane = new JPanel(); + + richEditorPane.setLayout(new BorderLayout()); + richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); + richEditorPane.add(richEditor, BorderLayout.CENTER); + + return richEditorPane; + } + + public void populateBean(AttrTooltipContent ob) { + + } + + public AttrTooltipContent updateBean() { + return null; + } + + protected String title4PopupWindow() { + return StringUtils.EMPTY; + } +} From b72b41e03472780d22bd3ba9da456dcca9efc8c8 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 24 Dec 2020 17:29:03 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=95=8C=E9=9D=A2=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 6 + .../component/VanChartTooltipContentPane.java | 91 +++--- .../richText/VanChartFieldAttrPane.java | 81 +++++ ...dAddPane.java => VanChartFieldButton.java} | 29 +- .../richText/VanChartFieldGroupPane.java | 115 ------- .../richText/VanChartFieldListPane.java | 294 ++++++++++++++++++ .../richText/VanChartFieldListener.java | 6 +- .../richText/VanChartRichEditorModel.java | 64 ++++ .../richText/VanChartRichEditorPane.java | 80 +---- .../richText/VanChartRichTextPane.java | 117 +++---- .../com/fr/design/editor/script/editor.js | 1 + 11 files changed, 563 insertions(+), 321 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/{VanChartFieldAddPane.java => VanChartFieldButton.java} (82%) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 0b33b7adf..ba68ab36f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -6,6 +6,7 @@ import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.border.UIRoundedBorder; @@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse globalNameListener = listener; } + public void registerChangeListener(UIObserverListener listener) { + typeComboBox.registerChangeListener(listener); + textField.registerChangeListener(listener); + } + @Override public boolean shouldResponseNameListener() { return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b6e768e34..9700e4faa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -33,11 +32,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; -import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -99,7 +98,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - - BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); - BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr(); + ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); + // 更新字段格式和汇总方式 + richTextPane.populateBean(this.richTextTooltipContent); + // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); - dialog.addDialogActionListener(new DialogActionAdapter() { + richTextDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); + + // 收集字段格式和汇总方式 + updateTooltipFormat(richTextTooltipContent, richTextPane.updateBean()); + VanChartRichEditorModel model = richEditorPane.update(); String content = model.getContent(); + // 收集编辑后的富文本内容 updateLocalRichText(content, model.isAuto()); SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); @@ -468,24 +467,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("分类"); - fieldNames.add("系列"); - fieldNames.add("值"); - fieldNames.add("百分比"); - - return fieldNames; - } - private List getTableFieldNames() { List fieldNames = new ArrayList<>(); @@ -745,8 +733,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane defaultFieldNameList; - private List tableFieldNameList; - - private List defaultFieldPaneList = new ArrayList<>(); - private List tableFieldPaneList = new ArrayList<>(); - - private VanChartFieldListener fieldListener; - - public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { - this.defaultFieldNameList = defaultFieldNameList; - this.tableFieldNameList = tableFieldNameList; - - initFieldListener(); - - this.setLayout(new BorderLayout()); - - this.add(createDefaultFieldPane(), BorderLayout.CENTER); - this.add(createTableFieldPane(), BorderLayout.SOUTH); - } - - private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); - - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : defaultFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - defaultField.add(fieldAddPane); - defaultFieldPaneList.add(fieldAddPane); - } - - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - - return defaultField; - } - - private JPanel createTableFieldPane() { - JPanel tableField = new JPanel(); - - tableField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : tableFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - tableField.add(fieldAddPane); - tableFieldPaneList.add(fieldAddPane); - } - - tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); - } - - private void initFieldListener() { - - fieldListener = new VanChartFieldListener() { - - private String fieldName; - - public void setGlobalName(String fieldName) { - this.fieldName = fieldName; - } - - public String getGlobalName() { - return this.fieldName; - } - - public void refreshSelectedField(String fieldName) { - if (ComparatorUtils.equals(fieldName, this.fieldName)) { - return; - } - - for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - - for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - } - - public void addSelectedField(String fieldName) { - System.out.println(fieldName); - } - - public void populateFieldFormatPane() { - - } - - public void updateFieldFormatPane() { - - } - }; - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java new file mode 100644 index 000000000..aa3dbd17b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -0,0 +1,294 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.design.event.UIObserverListener; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.Format; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldListPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private VanChartFieldButton categoryNameButton; + private VanChartFieldButton seriesNameButton; + private VanChartFieldButton valueButton; + private VanChartFieldButton percentButton; + + private VanChartFieldAttrPane fieldAttrPane; + private ModernUIPane richEditorPane; + private List tableFieldNameList; + private List tableFieldButtonList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditorPane) { + + this.tableFieldNameList = tableFieldNameList; + + this.fieldAttrPane = fieldAttrPane; + this.richEditorPane = richEditorPane; + + initFieldListListener(); + registerAttrListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + createDefaultButtonGroup(defaultField); + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + protected void createDefaultButtonGroup(JPanel field) { + categoryNameButton = createCategoryFieldButton(); + seriesNameButton = createSeriesFieldButton(); + valueButton = createValueFieldButton(); + percentButton = createPercentFieldButton(); + + field.add(categoryNameButton); + field.add(seriesNameButton); + field.add(valueButton); + field.add(percentButton); + } + + // 不同图表的name和id不一样 + protected VanChartFieldButton createCategoryFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); + String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createSeriesFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); + String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createValueFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); + String id = new AttrTooltipValueFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createPercentFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String id = new AttrTooltipPercentFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + private JPanel createTableFieldPane() { + if (tableFieldNameList == null || tableFieldNameList.isEmpty()) { + return new JPanel(); + } + + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String name : tableFieldNameList) { + VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + + tableField.add(fieldButton); + tableFieldButtonList.add(fieldButton); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + protected List getDefaultFieldButtonList() { + List defaultFieldButtonList = new ArrayList<>(); + + defaultFieldButtonList.add(categoryNameButton); + defaultFieldButtonList.add(seriesNameButton); + defaultFieldButtonList.add(valueButton); + defaultFieldButtonList.add(percentButton); + + return defaultFieldButtonList; + } + + private void initFieldListListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public VanChartFieldButton getSelectedField() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + return null; + } + + public void refreshSelectedPane(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName, String fieldId) { + VanChartRichEditorModel model = richEditorPane.update(); + String content = model.getContent() + getFieldRichText(fieldName, fieldId); + model.setContent(content); + VanChartRichEditorPane.createRichEditorPane(model); + } + + public void populateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + Format format = fieldButton.getFormat(); + AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + + fieldAttrPane.populate(format, dataFunction, showDataFunction); + } + + public void updateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); + } + }; + } + + private void registerAttrListener() { + + fieldAttrPane.registerFunctionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + fieldListener.updateFieldFormatPane(); + } + }); + + fieldAttrPane.registerChangeListener(new UIObserverListener() { + public void doChange() { + fieldListener.updateFieldFormatPane(); + } + }); + } + + private void checkFieldListSelected() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + if (defaultFieldButtonList != null && defaultFieldButtonList.size() > 0) { + String selected = defaultFieldButtonList.get(0).getFieldName(); + + fieldListener.refreshSelectedPane(selected); + fieldListener.setGlobalName(selected); + fieldListener.populateFieldFormatPane(); + } + } + + private String getFieldRichText(String fieldName, String fieldId) { + return "

" + fieldName + "

"; + } + + public void populate(AttrTooltipContent tooltipContent) { + populateDefaultField(tooltipContent); + populateTableField(tooltipContent); + + // 初次打开富文本界面选中第一个 + checkFieldListSelected(); + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); + seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); + valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); + percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + } + + public void populateTableField(AttrTooltipContent tooltipContent) { + + } + + public void update(AttrTooltipContent tooltipContent) { + updateDefaultField(tooltipContent); + updateTableField(tooltipContent); + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); + tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); + tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); + tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + } + + public void updateTableField(AttrTooltipContent tooltipContent) { + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java index 738492d67..62f096663 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -4,9 +4,11 @@ import com.fr.design.event.GlobalNameListener; public interface VanChartFieldListener extends GlobalNameListener { - public void refreshSelectedField(String fieldName); + public VanChartFieldButton getSelectedField(); - public void addSelectedField(String fieldName); + public void refreshSelectedPane(String fieldName); + + public void addSelectedField(String fieldName, String fieldId); public void populateFieldFormatPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java new file mode 100644 index 000000000..245eaa951 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.plugin.chart.type.TextAlign; +import com.fr.stable.StringUtils; + +public class VanChartRichEditorModel { + + private String content = StringUtils.EMPTY; + private boolean auto = true; + private String params = StringUtils.EMPTY; + private String initParams = StringUtils.EMPTY; + private String align = TextAlign.LEFT.getAlign(); + + public VanChartRichEditorModel() { + } + + public VanChartRichEditorModel(String content, boolean auto, String params, String initParams, String align) { + this.content = content; + this.auto = auto; + this.params = params; + this.initParams = initParams; + this.align = align; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public boolean isAuto() { + return auto; + } + + public void setAuto(boolean auto) { + this.auto = auto; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + public String getInitParams() { + return initParams; + } + + public void setInitParams(String initParams) { + this.initParams = initParams; + } + + public String getAlign() { + return align; + } + + public void setAlign(String align) { + this.align = align; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 66453a157..99afba30e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -25,7 +25,7 @@ public class VanChartRichEditorPane { private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; private static final String expression = "dispatch()"; - private static ModernUIPane richEditorPane; + private static ModernUIPane richEditorPane; private static Browser browser; public static void initRichEditorPane() { @@ -36,7 +36,7 @@ public class VanChartRichEditorPane { @Override public void run() { try { - richEditorPane = initPane(new RichEditorModel()); + richEditorPane = initPane(new VanChartRichEditorModel()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -47,9 +47,12 @@ public class VanChartRichEditorPane { } } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { - RichEditorModel model = getRichEditorModel(richEditor); + public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { + VanChartRichEditorModel model = getRichEditorModel(richEditor); + return createRichEditorPane(model); + } + public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); } else if (browser != null) { @@ -59,8 +62,8 @@ public class VanChartRichEditorPane { return richEditorPane; } - public static ModernUIPane initPane(RichEditorModel model) { - return new ModernUIPane.Builder() + public static ModernUIPane initPane(VanChartRichEditorModel model) { + return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { public void onScriptContextCreated(ScriptContextEvent event) { browser = event.getBrowser(); @@ -79,13 +82,13 @@ public class VanChartRichEditorPane { .namespace(namespace).build(); } - public static void updatePane(Browser browser, RichEditorModel model) { + public static void updatePane(Browser browser, VanChartRichEditorModel model) { JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); ns.asObject().setProperty(variable, model); browser.executeJavaScript("window." + namespace + "." + expression); } - public static RichEditorModel getRichEditorModel(AttrTooltipRichText richText) { + public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { Map paramsMap = richText.getParams(); StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY); @@ -115,7 +118,7 @@ public class VanChartRichEditorPane { align = content.contains(left) ? left : center; } - return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); + return new VanChartRichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); } public static String generateTransformI18nJS() { @@ -129,63 +132,4 @@ public class VanChartRichEditorPane { return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());"; } - - public static class RichEditorModel { - private String content = StringUtils.EMPTY; - private boolean auto = true; - private String params = StringUtils.EMPTY; - private String initParams = StringUtils.EMPTY; - private String align = TextAlign.LEFT.getAlign(); - - public RichEditorModel() { - } - - public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { - this.content = content; - this.auto = auto; - this.params = params; - this.initParams = initParams; - this.align = align; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public boolean isAuto() { - return auto; - } - - public void setAuto(boolean auto) { - this.auto = auto; - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public String getInitParams() { - return initParams; - } - - public void setInitParams(String initParams) { - this.initParams = initParams; - } - - public String getAlign() { - return align; - } - - public void setAlign(String align) { - this.align = align; - } - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 927fbdaae..e48050619 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -1,25 +1,16 @@ package com.fr.van.chart.designer.component.richText; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.style.FormatPane; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingConstants; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.util.List; @@ -32,110 +23,74 @@ public class VanChartRichTextPane extends BasicBeanPane { private static final int RICH_EDITOR_W = 940; private static final int RICH_EDITOR_H = 260; - private static final double P = TableLayout.PREFERRED; - private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - private JScrollPane fieldContentPane; - private JScrollPane fieldPropsPane; - - private FormatPane fieldFormatPane; - private JPanel fieldSummaryPane; - - private UIComboBox fieldSummaryBox; + private VanChartFieldListPane fieldListPane; + private VanChartFieldAttrPane fieldAttrPane; private VanChartStylePane parent; - private List defaultFieldsFormat; private List tableFieldsFormat; - public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { - this.parent = parent; + private ModernUIPane richEditor; - this.defaultFieldsFormat = defaultFieldsFormat; + public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { + this.parent = parent; this.tableFieldsFormat = tableFieldsFormat; + this.richEditor = richEditor; - initFieldContentPane(); - initFieldPropsPane(); + initFieldContent(); this.setLayout(new BorderLayout()); - this.add(createFieldDetailPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + this.add(createFieldContentPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(), BorderLayout.SOUTH); } - private void initFieldContentPane() { - JPanel content = new JPanel(); - content.setLayout(new BorderLayout()); - content.add(createDefaultContentPane(), BorderLayout.NORTH); - content.add(createTableFieldsPane(), BorderLayout.CENTER); - - fieldContentPane = new JScrollPane(content); - fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldContentPane.setHorizontalScrollBar(null); - fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - } - - private void initFieldPropsPane() { - fieldFormatPane = new FormatPaneWithOutFont() { - protected JPanel createContentPane(Component[][] components) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); - } - }; - - fieldSummaryBox = new CalculateComboBox(); - - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} - }; - - fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); - - JPanel props = new JPanel(); - props.setLayout(new BorderLayout()); - props.add(fieldFormatPane, BorderLayout.NORTH); - props.add(fieldSummaryPane, BorderLayout.CENTER); - props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); - - fieldPropsPane = new JScrollPane(props); - fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + private void initFieldContent() { + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); } - private JPanel createDefaultContentPane() { + private JPanel createFieldContentPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); - } + // 新增字段目录 + JPanel fieldListContent = new JPanel(); + fieldListContent.setLayout(new BorderLayout()); + fieldListContent.add(fieldListPane, BorderLayout.NORTH); - private JPanel createTableFieldsPane() { - return new JPanel(); - } + JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent); + fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldListScrollPane.setHorizontalScrollBar(null); + fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - private JPanel createFieldDetailPane() { - JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + // 字段格式和汇总 + JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane); + fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置")); - fieldPane.add(fieldContentPane); - fieldPane.add(fieldPropsPane); + fieldPane.add(fieldListScrollPane); + fieldPane.add(fieldAttrScrollPane); return fieldPane; } - private JPanel createRichEditorPane(JPanel richEditor) { + private JPanel createRichEditorPane() { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(richEditor, BorderLayout.CENTER); + richEditorPane.add(this.richEditor, BorderLayout.CENTER); return richEditorPane; } - public void populateBean(AttrTooltipContent ob) { - + public void populateBean(AttrTooltipContent tooltipContent) { + fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - return null; + AttrTooltipContent content = new AttrTooltipContent(); + fieldListPane.update(content); + return content; } protected String title4PopupWindow() { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js index f3e053679..a2b5dd6a7 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -50,6 +50,7 @@ }, items: [{ type: "bi.htape", + tgap: 5, items: [{ type: "bi.label", text: BI.i18nText("BI-Design_Font_Style") + ": ", From 5d34cb788006ea47ba43214b330608739a4aaedc Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 09:53:58 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldAttrPane.java | 20 +++-- .../richText/VanChartFieldListPane.java | 5 +- .../richText/VanChartRichEditorModel.java | 11 +++ .../richText/VanChartRichEditorPane.java | 74 +++++++++---------- .../com/fr/design/editor/rich_editor.html | 31 +++++++- 5 files changed, 86 insertions(+), 55 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index cc99a2ce1..89c3cd73e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -16,7 +16,6 @@ import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionListener; -import java.awt.event.MouseListener; import java.text.Format; public class VanChartFieldAttrPane extends JPanel { @@ -27,6 +26,15 @@ public class VanChartFieldAttrPane extends JPanel { private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { + initComponents(); + + this.setLayout(new BorderLayout()); + this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(fieldFunctionPane, BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + } + + private void initComponents() { double p = TableLayout.PREFERRED; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -35,10 +43,6 @@ public class VanChartFieldAttrPane extends JPanel { protected JPanel createContentPane(Component[][] components) { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } - - public void addActionListener(ActionListener listener) { - - } }; fieldDataFunction = new CalculateComboBox(); @@ -49,11 +53,6 @@ public class VanChartFieldAttrPane extends JPanel { }; fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - - this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); - this.add(fieldFunctionPane, BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } public void registerFunctionListener(ActionListener listener) { @@ -67,7 +66,6 @@ public class VanChartFieldAttrPane extends JPanel { public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { fieldFormatPane.populateBean(format); fieldDataFunction.populateBean(dataFunction); - fieldFunctionPane.setVisible(showDataFunction); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index aa3dbd17b..c4039c691 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -194,9 +194,8 @@ public class VanChartFieldListPane extends JPanel { public void addSelectedField(String fieldName, String fieldId) { VanChartRichEditorModel model = richEditorPane.update(); - String content = model.getContent() + getFieldRichText(fieldName, fieldId); - model.setContent(content); - VanChartRichEditorPane.createRichEditorPane(model); + model.setAddition(fieldName); + VanChartRichEditorPane.richEditorAddField(model); } public void populateFieldFormatPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java index 245eaa951..83df27c0f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -10,6 +10,7 @@ public class VanChartRichEditorModel { private String params = StringUtils.EMPTY; private String initParams = StringUtils.EMPTY; private String align = TextAlign.LEFT.getAlign(); + private String addition = StringUtils.EMPTY; public VanChartRichEditorModel() { } @@ -20,6 +21,7 @@ public class VanChartRichEditorModel { this.params = params; this.initParams = initParams; this.align = align; + this.addition = StringUtils.EMPTY; } public String getContent() { @@ -61,4 +63,13 @@ public class VanChartRichEditorModel { public void setAlign(String align) { this.align = align; } + + public String getAddition() { + return addition; + } + + public void setAddition(String addition) { + this.addition = addition; + } + } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 99afba30e..87710da55 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -1,10 +1,8 @@ package com.fr.van.chart.designer.component.richText; -import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.ui.ModernUIPane; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; @@ -15,38 +13,20 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.util.Locale; import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class VanChartRichEditorPane { - private static final String namespace = "Pool"; - private static final String variable = "data"; - private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; - private static final String expression = "dispatch()"; + private static final String NAME_SPACE = "Pool"; + private static final String VARIABLE = "data"; + + private static final String RICH_EDITOR_HTML = "/com/fr/design/editor/rich_editor.html"; + + private static final String REFRESH = "refresh()"; + private static final String ADD_FIELD = "addField()"; private static ModernUIPane richEditorPane; private static Browser browser; - public static void initRichEditorPane() { - ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor")); - - try { - singleThreadExecutor.submit(new Runnable() { - @Override - public void run() { - try { - richEditorPane = initPane(new VanChartRichEditorModel()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }); - } finally { - singleThreadExecutor.shutdown(); - } - } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); return createRichEditorPane(model); @@ -55,13 +35,25 @@ public class VanChartRichEditorPane { public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); - } else if (browser != null) { - updatePane(browser, model); + } else { + richEditorRefresh(model); } return richEditorPane; } + public static void richEditorRefresh(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + refresh(browser, model); + } + } + + public static void richEditorAddField(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + addField(browser, model); + } + } + public static ModernUIPane initPane(VanChartRichEditorModel model) { return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { @@ -74,18 +66,26 @@ public class VanChartRichEditorPane { browser.executeJavaScript(generateTransformI18nJS()); browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js")); - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); } }) - .withEMB(richEditorPath) - .namespace(namespace).build(); + .withEMB(RICH_EDITOR_HTML) + .namespace(NAME_SPACE).build(); + } + + public static void refresh(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, REFRESH); + } + + public static void addField(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, ADD_FIELD); } - public static void updatePane(Browser browser, VanChartRichEditorModel model) { - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); - browser.executeJavaScript("window." + namespace + "." + expression); + public static void stateChange(Browser browser, VanChartRichEditorModel model, String trigger) { + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); + browser.executeJavaScript("window." + NAME_SPACE + "." + trigger); } public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index e6c769f0a..f62d7dbb2 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -88,8 +88,7 @@ {type: "bi.rich_editor_color_chooser"}, {type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.design.chart.common.editor.insert_param"} + {type: "bi.rich_editor_align_right_button"} ] }, ref: function (_ref) { @@ -97,7 +96,7 @@ } }); - Pool.dispatch = function () { + Pool.refresh = function () { var content = Pool.data.getContent(); var isAuto = Pool.data.isAuto(); var params = Pool.data.getParams(); @@ -117,7 +116,31 @@ }); rich_editor.setFocus(); - } + }; + + Pool.addField = function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + + var content = Pool.data.getContent(); + var isAuto = Pool.data.isAuto(); + var params = Pool.data.getParams(); + var addition = Pool.data.getAddition(); + + if (addition) { + // todo 暂时先处理成在content后加一行 + content += '

' + editorService.getEditorParamImage(addition) + '

'; + } + + rich_editor.editor.bindToolbar(rich_editor.bar); + + rich_editor.setValue({ + content: content, + isAuto: isAuto, + dimensionIds: getDimensionIds(params) + }); + + rich_editor.setFocus(); + }; Pool.update = function () { var {content, isAuto} = rich_editor.getValue(); From 9760575f9fe1878be67abe2d0acc79c6c80e093a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 17:34:37 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 2 +- .../richText/VanChartFieldButton.java | 23 +++- .../richText/VanChartFieldListPane.java | 109 +++++++++--------- .../richText/VanChartRichTextPane.java | 26 +---- 4 files changed, 79 insertions(+), 81 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 9700e4faa..89a627518 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -439,7 +439,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); // 更新字段格式和汇总方式 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 9c0c20d11..a3ccc2a47 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -6,6 +6,8 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.Icon; @@ -28,19 +30,20 @@ public class VanChartFieldButton extends JPanel { private final String fieldName; private final String fieldId; + private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; private UIToggleButton fieldButton; private UIButton addButton; - private Format format; private DataFunction dataFunction; - public VanChartFieldButton(String fieldName, String fieldId, boolean showSummary, VanChartFieldListener listener) { + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; - this.fieldId = fieldId; + this.tooltipFormat = format; + this.showDataFunction = showDataFunction; - this.showDataFunction = showSummary; + this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); initComponents(fieldName, listener); @@ -52,12 +55,20 @@ public class VanChartFieldButton extends JPanel { return fieldName; } + public boolean isEnable() { + return this.tooltipFormat.isEnable(); + } + + public void setEnable(boolean enable) { + this.tooltipFormat.setEnable(enable); + } + public Format getFormat() { - return format; + return tooltipFormat.getFormat(); } public void setFormat(Format format) { - this.format = format; + this.tooltipFormat.setFormat(format); } public DataFunction getDataFunction() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index c4039c691..f7fb81d0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -7,6 +7,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; @@ -49,6 +50,8 @@ public class VanChartFieldListPane extends JPanel { this.richEditorPane = richEditorPane; initFieldListListener(); + initDefaultFieldButton(); + registerAttrListener(); this.setLayout(new BorderLayout()); @@ -58,58 +61,37 @@ public class VanChartFieldListPane extends JPanel { } private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); + JPanel fieldPane = new JPanel(); - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - createDefaultButtonGroup(defaultField); + fieldPane.setLayout(new GridLayout(0, 1, 1, 0)); - List defaultFieldButtonList = getDefaultFieldButtonList(); + addDefaultFieldButton(fieldPane); - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); + fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - return defaultField; + return fieldPane; } - protected void createDefaultButtonGroup(JPanel field) { - categoryNameButton = createCategoryFieldButton(); - seriesNameButton = createSeriesFieldButton(); - valueButton = createValueFieldButton(); - percentButton = createPercentFieldButton(); + protected void initDefaultFieldButton() { + categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); - field.add(categoryNameButton); - field.add(seriesNameButton); - field.add(valueButton); - field.add(percentButton); - } + seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); - // 不同图表的name和id不一样 - protected VanChartFieldButton createCategoryFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); - String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); - return new VanChartFieldButton(name, id, false, fieldListener); + percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); } - protected VanChartFieldButton createSeriesFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); - String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createValueFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); - String id = new AttrTooltipValueFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createPercentFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String id = new AttrTooltipPercentFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(categoryNameButton); + fieldPane.add(seriesNameButton); + fieldPane.add(valueButton); + fieldPane.add(percentButton); } private JPanel createTableFieldPane() { @@ -122,7 +104,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -133,6 +115,11 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } + // 生成新增字段对应的format + private AttrTooltipFormat getTableTooltipFormat(String fieldName) { + return new AttrTooltipCategoryFormat(); + } + protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -252,10 +239,6 @@ public class VanChartFieldListPane extends JPanel { } } - private String getFieldRichText(String fieldName, String fieldId) { - return "

" + fieldName + "

"; - } - public void populate(AttrTooltipContent tooltipContent) { populateDefaultField(tooltipContent); populateTableField(tooltipContent); @@ -265,10 +248,19 @@ public class VanChartFieldListPane extends JPanel { } public void populateDefaultField(AttrTooltipContent tooltipContent) { - categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); - seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); - valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); - percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); + } + + public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + button.setEnable(format.isEnable()); + button.setFormat(format.getFormat()); } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -281,13 +273,22 @@ public class VanChartFieldListPane extends JPanel { } public void updateDefaultField(AttrTooltipContent tooltipContent) { - tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); - tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); - tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); - tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); } public void updateTableField(AttrTooltipContent tooltipContent) { } + + public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + format.setEnable(button.isEnable()); + format.setFormat(button.getFormat()); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index e48050619..7ee3f3df6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -5,7 +5,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -26,27 +25,14 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - private VanChartStylePane parent; + public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - private List tableFieldsFormat; - - private ModernUIPane richEditor; - - public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { - this.parent = parent; - this.tableFieldsFormat = tableFieldsFormat; - this.richEditor = richEditor; - - initFieldContent(); + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(), BorderLayout.SOUTH); - } - - private void initFieldContent() { - fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } private JPanel createFieldContentPane() { @@ -73,12 +59,12 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - private JPanel createRichEditorPane() { + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(this.richEditor, BorderLayout.CENTER); + richEditorPane.add(richEditor, BorderLayout.CENTER); return richEditorPane; } From 04756947ee2cbdad4cf8daf7afd883f261e6d576 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 09:56:19 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 12 ++--- .../designer/style/VanChartStylePane.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 89a627518..b9472dd86 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -49,7 +49,6 @@ 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.List; /** @@ -475,14 +474,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("字段A"); - fieldNames.add("字段B"); - fieldNames.add("字段C"); - fieldNames.add("字段D"); + if (parent == null) { + return null; + } - return fieldNames; + return parent.getDataModelColumnNames(); } private JPanel createHtmlPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java index 32a4f8e54..f9d0720dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java @@ -1,9 +1,20 @@ package com.fr.van.chart.designer.style; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartdata.MoreNameCDDefinition; +import com.fr.chart.chartdata.OneValueCDDefinition; +import com.fr.data.TableDataSource; +import com.fr.data.impl.EmbeddedTableData; +import com.fr.design.DesignModelAdapter; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; @@ -75,4 +86,47 @@ public class VanChartStylePane extends ChartStylePane { protected void addVanChartTooltipPane(List paneList) { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } + + public List getDataModelColumnNames() { + Chart chart = getChart(); + + if (chart == null) { + return null; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return null; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + return null; + } + + try { + EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, + tableData, TableData.RESULT_NOT_NEED, false); + + return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } } \ No newline at end of file From f6c353ae7f023b19f0fa2661358a4d49dd2a5afa Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 11:22:22 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldButton.java | 3 +- .../richText/VanChartFieldListPane.java | 60 ++++++++++++++++--- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index a3ccc2a47..4e75b9feb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; +import com.fr.data.util.function.NoneFunction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; @@ -36,7 +37,7 @@ public class VanChartFieldButton extends JPanel { private UIToggleButton fieldButton; private UIButton addButton; - private DataFunction dataFunction; + private DataFunction dataFunction = new NoneFunction(); public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index f7fb81d0c..e88937a6a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -1,12 +1,17 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.DataFunction; import com.fr.design.event.UIObserverListener; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -23,6 +28,7 @@ import java.awt.event.ActionListener; import java.text.Format; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class VanChartFieldListPane extends JPanel { @@ -38,13 +44,14 @@ public class VanChartFieldListPane extends JPanel { private ModernUIPane richEditorPane; private List tableFieldNameList; private List tableFieldButtonList = new ArrayList<>(); + private TableFieldCollection tableFieldCollection = new TableFieldCollection(); private VanChartFieldListener fieldListener; public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList; + this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; @@ -104,7 +111,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, new AttrTooltipFieldFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -115,11 +122,6 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } - // 生成新增字段对应的format - private AttrTooltipFormat getTableTooltipFormat(String fieldName) { - return new AttrTooltipCategoryFormat(); - } - protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -180,6 +182,16 @@ public class VanChartFieldListPane extends JPanel { } public void addSelectedField(String fieldName, String fieldId) { + if (tableFieldNameList.contains(fieldName)) { + int index = tableFieldNameList.indexOf(fieldName); + + VanChartFieldButton fieldButton = tableFieldButtonList.get(index); + Format fieldFormat = fieldButton.getFormat(); + DataFunction dataFunction = fieldButton.getDataFunction(); + + tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + VanChartRichEditorModel model = richEditorPane.update(); model.setAddition(fieldName); VanChartRichEditorPane.richEditorAddField(model); @@ -264,7 +276,35 @@ public class VanChartFieldListPane extends JPanel { } public void populateTableField(AttrTooltipContent tooltipContent) { + TableFieldCollection fieldCollection = tooltipContent.getFieldCollection(); + if (fieldCollection == null) { + return; + } + + Map fieldDefinitionGroup = fieldCollection.getFieldNameFormulaMap(); + + if (fieldDefinitionGroup == null || fieldDefinitionGroup.isEmpty()) { + return; + } + + this.tableFieldCollection = new TableFieldCollection(); + + for (int i = 0, len = tableFieldNameList.size(); i < len; i++) { + String fieldName = tableFieldNameList.get(i); + VanChartFieldButton fieldButton = tableFieldButtonList.get(i); + TableFieldDefinition fieldDefinition = fieldDefinitionGroup.get(fieldName); + + if (fieldDefinitionGroup.containsKey(fieldName)) { + Format fieldFormat = fieldDefinition.getFormat(); + DataFunction dataFunction = fieldDefinition.getDataFunction(); + + fieldButton.setFormat(fieldFormat); + fieldButton.setDataFunction(dataFunction); + + this.tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + } } public void update(AttrTooltipContent tooltipContent) { @@ -280,7 +320,11 @@ public class VanChartFieldListPane extends JPanel { } public void updateTableField(AttrTooltipContent tooltipContent) { - + try { + tooltipContent.setFieldCollection(this.tableFieldCollection); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { From d798bd90480f43a88465b8795660cddf30c10a79 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 13:55:09 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AF=8C=E6=96=87=E6=9C=AC=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 13 +++++++++---- .../component/richText/VanChartFieldListPane.java | 15 +++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b9472dd86..ba6a55cb8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -15,6 +15,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -449,15 +450,19 @@ public class VanChartTooltipContentPane extends BasicBeanPane Date: Tue, 29 Dec 2020 17:00:14 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0=E6=9B=B4=E6=96=B0=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 --- .../component/VanChartTooltipContentPane.java | 56 ++++++++++++++++--- .../richText/VanChartFieldButton.java | 4 ++ .../richText/VanChartFieldListPane.java | 20 +++++++ .../richText/VanChartRichTextPane.java | 7 ++- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index ba6a55cb8..66f04a3d3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -16,7 +16,11 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; @@ -50,7 +54,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -436,15 +442,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); - // 更新字段格式和汇总方式 richTextPane.populateBean(this.richTextTooltipContent); - // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); richTextDialog.addDialogActionListener(new DialogActionAdapter() { @@ -486,6 +491,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames, ModernUIPane richEditorPane) { + return new VanChartRichTextPane(tableFieldNames, richEditorPane); + } + + protected void refreshRichTextFormat(AttrTooltipRichText richText) { + String[] fieldNames = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + + AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + + Map params = new HashMap<>(); + + for (int i = 0, len = fieldNames.length; i < len; i++) { + params.put(fieldNames[i], fieldFormats[i].getJs()); + } + + List tableFieldNames = this.getTableFieldNames(); + + if (tableFieldNames != null) { + for (String fieldName : tableFieldNames) { + params.put(fieldName, fieldName); + } + } + + richText.setParams(params); + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -734,11 +775,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,6 +59,11 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } + protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditor) { + return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + } + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); From 9fa14e369f1c787ba5ceeba4c96bbace54e7d5ef Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 31 Dec 2020 15:56:38 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartOtherPane.java | 8 ++- .../component/VanChartTooltipContentPane.java | 44 +++----------- .../richText/VanChartFieldListPane.java | 7 ++- .../richText/VanChartRichEditorPane.java | 60 +++++++++++++++++++ .../richText/VanChartRichTextPane.java | 11 ++-- .../designer/style/VanChartStylePane.java | 55 +---------------- 6 files changed, 85 insertions(+), 100 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java index 9b494a1a4..54c010119 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane; import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane; import com.fr.design.mainframe.chart.gui.type.ChartTabPane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import javax.swing.JPanel; import java.util.ArrayList; @@ -76,11 +77,11 @@ public class ChartOtherPane extends AbstractChartAttrPane { public String title4PopupWindow() { return PaneTitleConstants.CHART_OTHER_TITLE; } - + private boolean isHaveCondition() { return hasCondition; } - + /** * 设置选中的界面id */ @@ -110,6 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { public void populateBean(Chart chart) { interactivePane.populateBean(chart); if (ChartOtherPane.this.isHaveCondition()) { + VanChartRichEditorPane.refreshFieldNames(chart); conditionAttrPane.populateBean(chart); } } @@ -126,7 +128,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { //特效埋点 ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.EFFECT, chart.getBuryingPointEffectConfig()); } - + /** * 注册 切换按钮的切换事件. * @param currentChartEditPane 当前编辑的图表编辑界面. diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 66f04a3d3..544bd3825 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -36,7 +36,6 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutChe import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; @@ -445,7 +444,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); @@ -483,19 +482,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - if (parent == null) { - return null; - } - - return parent.getDataModelColumnNames(); - } - - protected VanChartRichTextPane createRichTextPane(List tableFieldNames, ModernUIPane richEditorPane) { - return new VanChartRichTextPane(tableFieldNames, richEditorPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane); } - protected void refreshRichTextFormat(AttrTooltipRichText richText) { + protected void refreshRichTextParams(AttrTooltipRichText richText) { String[] fieldNames = new String[]{ Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), Toolkit.i18nText("Fine-Design_Chart_Series_Name"), @@ -516,7 +507,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames = this.getTableFieldNames(); + List tableFieldNames = VanChartRichEditorPane.getFieldNames(); if (tableFieldNames != null) { for (String fieldName : tableFieldNames) { @@ -757,30 +748,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditorPane) { + public VanChartFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; + List richEditorFieldNames = VanChartRichEditorPane.getFieldNames(); + + this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 87710da55..dcec83deb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -1,8 +1,19 @@ package com.fr.van.chart.designer.component.richText; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartdata.MoreNameCDDefinition; +import com.fr.chart.chartdata.OneValueCDDefinition; +import com.fr.data.TableDataSource; +import com.fr.data.impl.EmbeddedTableData; +import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.ui.ModernUIPane; +import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; @@ -11,6 +22,7 @@ import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -26,6 +38,54 @@ public class VanChartRichEditorPane { private static ModernUIPane richEditorPane; private static Browser browser; + private static List fieldNames; + + public static List getFieldNames() { + return fieldNames; + } + + public static void refreshFieldNames(Chart chart) { + VanChartRichEditorPane.fieldNames = null; + + if (chart == null) { + return; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + return; + } + + try { + EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, + tableData, TableData.RESULT_NOT_NEED, false); + + List fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); + VanChartRichEditorPane.fieldNames = fieldNames; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 83ef4853e..93fb9048a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -11,7 +11,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.Dimension; -import java.util.List; // 标签提示中的富文本面板,包含字段设置和富文本编辑器 public class VanChartRichTextPane extends BasicBeanPane { @@ -25,10 +24,9 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - + public VanChartRichTextPane(ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,9 +57,8 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditor) { - return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFieldListPane(fieldAttrPane, richEditor); } private JPanel createRichEditorPane(JPanel richEditor) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java index f9d0720dc..bb8df99fd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java @@ -1,21 +1,11 @@ package com.fr.van.chart.designer.style; -import com.fr.base.TableData; -import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; -import com.fr.chart.chartdata.MoreNameCDDefinition; -import com.fr.chart.chartdata.OneValueCDDefinition; -import com.fr.data.TableDataSource; -import com.fr.data.impl.EmbeddedTableData; -import com.fr.design.DesignModelAdapter; -import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; import com.fr.van.chart.designer.style.datasheet.VanChartDataSheetPane; @@ -87,46 +77,7 @@ public class VanChartStylePane extends ChartStylePane { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } - public List getDataModelColumnNames() { - Chart chart = getChart(); - - if (chart == null) { - return null; - } - - TopDefinitionProvider definition = chart.getFilterDefinition(); - - if (definition == null) { - return null; - } - - DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); - TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); - - TableData tableData = null; - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { - OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; - tableData = oneValueCDDefinition.getTableData(); - } - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { - MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; - tableData = moreNameCDDefinition.getTableData(); - } - - if (tableData == null) { - return null; - } - - try { - EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, - tableData, TableData.RESULT_NOT_NEED, false); - - return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return null; - } + public void refreshTableFieldNames() { + VanChartRichEditorPane.refreshFieldNames(getChart()); } } \ No newline at end of file From 51f08486e5d967821a76a247dc6648f1770c0f6b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 22:15:28 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E6=95=A3=E7=82=B9=E5=9B=BE=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 28 ++++- .../richText/VanChartFieldListPane.java | 16 +++ .../richText/VanChartRichTextPane.java | 10 +- ...ChartScatterRefreshTooltipContentPane.java | 9 +- .../VanChartScatterRichTextFieldListPane.java | 93 ++++++++++++++ .../VanChartScatterTooltipContentPane.java | 114 ++++++++---------- 6 files changed, 189 insertions(+), 81 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 544bd3825..0698a3291 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,9 +115,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = new HashMap<>(); @@ -874,6 +888,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } + public VanChartFieldListPane getFieldListPane() { + return fieldListPane; + } + private JPanel createFieldContentPane() { JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -71,12 +75,16 @@ public class VanChartRichTextPane extends BasicBeanPane { return richEditorPane; } + protected AttrTooltipContent getInitialTooltipContent() { + return new AttrTooltipContent(); + } + public void populateBean(AttrTooltipContent tooltipContent) { fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - AttrTooltipContent content = new AttrTooltipContent(); + AttrTooltipContent content = getInitialTooltipContent(); fieldListPane.update(content); return content; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index db7ce4152..e5416b1c2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -62,14 +62,7 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo @Override protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextXFormatPane(), null}, - new Component[]{getRichTextYFormatPane(), null}, - new Component[]{getRichTextSizeFormatPane(), null}, - new Component[]{richTextChangedSizeFormatPane, null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; + return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java new file mode 100644 index 000000000..776d5397d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java @@ -0,0 +1,93 @@ +package com.fr.van.chart.scatter; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartScatterRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextXFormatPane; + private VanChartFieldButton richTextYFormatPane; + private VanChartFieldButton richTextSizeFormatPane; + + public VanChartScatterRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + public VanChartFieldButton getRichTextXFormatPane() { + return richTextXFormatPane; + } + + public VanChartFieldButton getRichTextYFormatPane() { + return richTextYFormatPane; + } + + public VanChartFieldButton getRichTextSizeFormatPane() { + return richTextSizeFormatPane; + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + richTextXFormatPane = new VanChartFieldButton("x", new AttrTooltipXFormat(), false, listener); + richTextYFormatPane = new VanChartFieldButton("y", new AttrTooltipYFormat(), false, listener); + richTextSizeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), new AttrTooltipSizeFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextXFormatPane); + fieldPane.add(richTextYFormatPane); + fieldPane.add(richTextSizeFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextXFormatPane); + fieldButtonList.add(richTextYFormatPane); + fieldButtonList.add(richTextSizeFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + populateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + populateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + populateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + updateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + updateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + updateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java index 39b20bedb..8e33bd5e2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java @@ -1,17 +1,22 @@ package com.fr.van.chart.scatter; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa private YFormatPaneWithCheckBox yFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane; - private XFormatPaneWithoutCheckBox richTextXFormatPane; - private YFormatPaneWithoutCheckBox richTextYFormatPane; - private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane; - public XFormatPaneWithCheckBox getXFormatPane() { return xFormatPane; } @@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa return sizeFormatPane; } - public XFormatPaneWithoutCheckBox getRichTextXFormatPane() { - return richTextXFormatPane; - } - - public YFormatPaneWithoutCheckBox getRichTextYFormatPane() { - return richTextYFormatPane; - } - - public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() { - return richTextSizeFormatPane; - } - public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ super(parent, showOnPane); } @@ -71,13 +60,22 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); + protected void initRichTextTooltipContent() { + setRichTextTooltipContent(new ScatterAttrTooltipContent()); + } + + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartScatterRichTextFieldListPane(fieldAttrPane, richEditor); + } - richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane); - richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane); - richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected AttrTooltipContent getInitialTooltipContent() { + return new ScatterAttrTooltipContent(); + } + }; } @Override @@ -90,16 +88,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{richTextXFormatPane, null}, - new Component[]{richTextYFormatPane, null}, - new Component[]{richTextSizeFormatPane, null} - }; - } - @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); @@ -111,30 +99,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + "x", + "y", + Toolkit.i18nText("Fine-Design_Chart_Use_Value")}; + } - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - richTextXFormatPane, - richTextYFormatPane, - richTextSizeFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextSeriesFormat(), - scatterAttrTooltipContent.getRichTextXFormat(), - scatterAttrTooltipContent.getRichTextYFormat(), - scatterAttrTooltipContent.getRichTextSizeFormat() - }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipXFormat(), + new AttrTooltipYFormat(), + new AttrTooltipSizeFormat()}; } @Override @@ -148,14 +126,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - super.updateRichEditor(attrTooltipContent); + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat()); - richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat()); - richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat()); + if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target; + ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source; + + targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat()); + targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat()); + targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat()); } } From 8de94cf98e94527d828b514f6323235c7621de25 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 23:05:11 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E8=AF=8D=E4=BA=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 7 +--- .../VanChartScatterTooltipContentPane.java | 6 +-- ...anChartWordCloudRichTextFieldListPane.java | 41 +++++++++++++++++++ .../VanChartWordCloudTooltipContentPane.java | 37 ++++++----------- 4 files changed, 57 insertions(+), 34 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 0698a3291..f2c566230 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,8 +115,9 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane) { return new VanChartRichTextPane(richEditorPane) { @@ -73,7 +69,7 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } protected AttrTooltipContent getInitialTooltipContent() { - return new ScatterAttrTooltipContent(); + return createAttrTooltip(); } }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java new file mode 100644 index 000000000..3394e6f05 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.wordcloud.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartWordCloudRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartWordCloudRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + new AttrTooltipNameFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index c0e9ac6c3..99b437861 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -2,17 +2,18 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -53,31 +54,19 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP setPercentFormatPane(percentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); - } - }; - SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartWordCloudRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Value"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane); - setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane); - setRichTextValueFormatPane(richTextValueFormatPane); - setRichTextPercentFormatPane(richTextPercentFormatPane); } - @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 125386cc2fe6fd914daa6884962052b6e56006b1 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Mon, 4 Jan 2021 14:22:31 +0800 Subject: [PATCH 12/21] =?UTF-8?q?REPORT-45895=20war=E5=8C=85=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=20=E5=87=BD=E6=95=B0=E7=94=9F=E6=88=902=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/itree/filetree/EnvFileTree.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 435d5a465..e6b2c99d4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -201,7 +201,8 @@ public class EnvFileTree extends RefreshableJTree { if (filter != null) { java.util.List tList = new ArrayList(); for (int i = 0; i < resFns.length; i++) { - if (filter.accept(resFns[i])) { + // war包部署下会生成两份classes目录,需要去重一下 + if (filter.accept(resFns[i]) && !tList.contains(resFns[i])) { tList.add(resFns[i]); } } From 3c514adfb8287c229bc6028db3b1165cf60f3338 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:04:46 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=8D=E4=BA=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AF=8C=E6=96=87=E6=9C=AC=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartWordCloudTooltipContentPane.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index 99b437861..0abd60ac1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -4,7 +4,11 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; @@ -67,6 +71,24 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP }; } + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 16c43c8a77dc2992500105f80812693a2191516b Mon Sep 17 00:00:00 2001 From: Lanlan Date: Mon, 4 Jan 2021 16:19:28 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E6=94=B9=E7=94=A8TreeSet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/filetree/EnvFileTree.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index e6b2c99d4..461cc1d01 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -13,6 +13,9 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; +import java.util.Comparator; +import java.util.Set; +import java.util.TreeSet; import javax.swing.BorderFactory; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -21,7 +24,6 @@ import javax.swing.tree.TreePath; import java.awt.Color; import java.awt.Component; import java.io.File; -import java.util.ArrayList; import java.util.Arrays; /* @@ -199,15 +201,33 @@ public class EnvFileTree extends RefreshableJTree { // 用FileNodeFilter过滤一下 if (filter != null) { - java.util.List tList = new ArrayList(); + Set tSet = new TreeSet(new Comparator() { + private boolean isNull(FileNode node) { + return node == null || node.getName() == null; + } + + @Override + public int compare(FileNode o1, FileNode o2) { + if (isNull(o1) && !isNull(o2)) { + return 1; + } + if (!isNull(o1) && isNull(o2)) { + return -1; + } + if (isNull(o1) && isNull(o2)) { + return 0; + } + return o1.getName().compareTo(o2.getName()); + } + }); for (int i = 0; i < resFns.length; i++) { // war包部署下会生成两份classes目录,需要去重一下 - if (filter.accept(resFns[i]) && !tList.contains(resFns[i])) { - tList.add(resFns[i]); + if (filter.accept(resFns[i])) { + tSet.add(resFns[i]); } } - resFns = tList.toArray(new FileNode[tList.size()]); + resFns = tSet.toArray(new FileNode[tSet.size()]); } Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); From 97517d0b073588207e3c7da4170a34c0ac86836a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:33:58 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=9D=A2=E6=9D=BF=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartMapRichTextFieldListPane.java | 41 +++++++++++++++++++ .../label/VanChartMapLabelContentPane.java | 32 ++++++++++----- .../VanChartMapTooltipContentPane.java | 31 +++++++++----- 3 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java new file mode 100644 index 000000000..91e1817ef --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartMapRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + new AttrTooltipAreaNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java index 084953c99..baec70ca9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java @@ -1,18 +1,19 @@ package com.fr.van.chart.map.designer.style.label; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.type.TextAlign; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -21,6 +22,7 @@ import javax.swing.JPanel; * Created by Mitisky on 16/5/20. */ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { + public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -33,12 +35,22 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java index 12948b14d..03f720bf7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java @@ -1,17 +1,18 @@ package com.fr.van.chart.map.designer.style.tooltip; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -32,12 +33,22 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override From bce740a3929954afbf1217ba2f3d4fe9ab03023b Mon Sep 17 00:00:00 2001 From: Lanlan Date: Mon, 4 Jan 2021 16:53:53 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E6=94=B9=E7=94=A8HashMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/filetree/EnvFileTree.java | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 461cc1d01..f3771a0f9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -13,9 +13,8 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import java.util.Comparator; -import java.util.Set; -import java.util.TreeSet; +import java.util.HashMap; +import java.util.Map; import javax.swing.BorderFactory; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -201,33 +200,14 @@ public class EnvFileTree extends RefreshableJTree { // 用FileNodeFilter过滤一下 if (filter != null) { - Set tSet = new TreeSet(new Comparator() { - private boolean isNull(FileNode node) { - return node == null || node.getName() == null; - } - - @Override - public int compare(FileNode o1, FileNode o2) { - if (isNull(o1) && !isNull(o2)) { - return 1; - } - if (!isNull(o1) && isNull(o2)) { - return -1; - } - if (isNull(o1) && isNull(o2)) { - return 0; - } - return o1.getName().compareTo(o2.getName()); - } - }); - for (int i = 0; i < resFns.length; i++) { + Map fileNodes = new HashMap<>(); + for (FileNode fileNode : resFns) { // war包部署下会生成两份classes目录,需要去重一下 - if (filter.accept(resFns[i])) { - tSet.add(resFns[i]); + if (filter.accept(fileNode)) { + fileNodes.put(fileNode.getName(), fileNode); } } - - resFns = tSet.toArray(new FileNode[tSet.size()]); + resFns = fileNodes.values().toArray(new FileNode[fileNodes.size()]); } Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); From 064ac591acae802a42ca90160e693a665a89f1d6 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 5 Jan 2021 11:51:59 +0800 Subject: [PATCH 17/21] =?UTF-8?q?REPORT-45689=20=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/MobileParamUIProvider.java | 37 +++++ .../impl/AbstractMobileParamUIProvider.java | 25 +++ .../DefaultMobileParamUIProvider.java | 33 ++++ .../provider/EmptyMobileParamUIProvider.java | 43 +++++ .../ui/DefaultMobileParamDefinePane.java | 42 +++++ .../mobile/ui/EmptyMobileParamDefinePane.java | 47 ++++++ .../mobile/ui/MobileParamDefinePane.java | 55 +++++++ .../mobile/ui/MobileParamSettingPane.java | 150 ++++++++++++++++++ .../widget/wrappers/MobileParamWrapper.java | 32 ++++ .../AccessibleMobileParamEditor.java | 48 ++++++ .../designer/mobile/ParaMobileDefinePane.java | 76 ++------- 11 files changed, 528 insertions(+), 60 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java new file mode 100644 index 000000000..a8d8acc4e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java @@ -0,0 +1,37 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.stable.fun.mark.Mutable; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/30 + */ + +public interface MobileParamUIProvider extends Mutable { + String XML_TAG = "MobileParamUIProvider"; + + int CURRENT_LEVEL = 1; + + + /** + * 扩展项的参数面板样式 + * @return + */ + Class classForMobileParamStyle(); + + /** + * 移动端参数面板中扩展项的面板 + * @return + */ + Class> classForMobileParamAppearance(); + + /** + * 扩展项的名称描述 + * @return + */ + String displayName(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java new file mode 100644 index 000000000..c31e74f7f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.MobileParamUIProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/30 + */ +@API(level = MobileParamUIProvider.CURRENT_LEVEL) +public abstract class AbstractMobileParamUIProvider extends AbstractProvider implements MobileParamUIProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java new file mode 100644 index 000000000..3448ab202 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java @@ -0,0 +1,33 @@ +package com.fr.design.mainframe.mobile.provider; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractMobileParamUIProvider; +import com.fr.design.mainframe.mobile.ui.DefaultMobileParamDefinePane; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle; +import com.fr.locale.InterProviderFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class DefaultMobileParamUIProvider extends AbstractMobileParamUIProvider { + + @Override + public Class classForMobileParamStyle() { + return DefaultMobileParameterStyle.class; + } + + @Override + public Class> classForMobileParamAppearance() { + return DefaultMobileParamDefinePane.class; + } + + @Override + public String displayName() { + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT"); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java new file mode 100644 index 000000000..46ed13071 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java @@ -0,0 +1,43 @@ +package com.fr.design.mainframe.mobile.provider; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractMobileParamUIProvider; +import com.fr.design.mainframe.mobile.ui.EmptyMobileParamDefinePane; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.EmptyMobileParamStyle; + +/** + * 作为MobileParamStyleProvider接口实现兼容转换层 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class EmptyMobileParamUIProvider extends AbstractMobileParamUIProvider { + + private MobileParamStyleProvider styleProvider; + + public EmptyMobileParamUIProvider(MobileParamStyleProvider styleProvider) { + this.styleProvider = styleProvider; + } + + @Override + public Class classForMobileParamStyle() { + return EmptyMobileParamStyle.class; + } + + @Override + public Class> classForMobileParamAppearance() { + return EmptyMobileParamDefinePane.class; + } + + @Override + public String displayName() { + return styleProvider.descriptor(); + } + + public MobileParamStyleProvider getStyleProvider() { + return styleProvider; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java new file mode 100644 index 000000000..838e8f599 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java @@ -0,0 +1,42 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle; +import java.awt.BorderLayout; +import javax.swing.JPanel; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class DefaultMobileParamDefinePane extends BasicBeanPane { + + public DefaultMobileParamDefinePane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(new BorderLayout()); + JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set")); + this.add(centerPane); + } + + @Override + public void populateBean(MobileParamStyle ob) { + // do nothing + } + + @Override + public MobileParamStyle updateBean() { + return new DefaultMobileParameterStyle(); + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java new file mode 100644 index 000000000..b973d599a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java @@ -0,0 +1,47 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.EmptyMobileParamStyle; +import java.awt.BorderLayout; +import javax.swing.JPanel; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class EmptyMobileParamDefinePane extends BasicBeanPane { + + private final MobileParamStyleProvider styleProvider; + + public EmptyMobileParamDefinePane(MobileParamStyleProvider styleProvider) { + this.styleProvider = styleProvider; + initComponents(); + } + + private void initComponents() { + this.setLayout(new BorderLayout()); + JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set")); + this.add(centerPane); + } + + + @Override + public void populateBean(MobileParamStyle ob) { + + } + + @Override + public MobileParamStyle updateBean() { + return new EmptyMobileParamStyle(styleProvider); + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java new file mode 100644 index 000000000..cd9ee2202 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.MobileParamUIProvider; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.general.ComparatorUtils; +import com.fr.invoke.Reflect; +import com.fr.report.mobile.EmptyMobileParamStyle; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class MobileParamDefinePane extends BasicBeanPane { + + private BasicBeanPane customBeanPane; + + public MobileParamDefinePane(MobileParamUIProvider provider) { + if (provider == null || provider.classForMobileParamAppearance() == null || provider.classForMobileParamAppearance() == null) { + return; + } + if (ComparatorUtils.equals(provider.classForMobileParamStyle(), EmptyMobileParamStyle.class)) { + EmptyMobileParamUIProvider emptyMobileParamUIProvider = (EmptyMobileParamUIProvider) provider; + this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create(emptyMobileParamUIProvider.getStyleProvider()).get(); + } else { + this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create().get(); + } + initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(customBeanPane); + } + + @Override + public void populateBean(MobileParamStyle ob) { + this.customBeanPane.populateBean(ob); + } + + @Override + public MobileParamStyle updateBean() { + + return this.customBeanPane.updateBean(); + + } + + @Override + protected String title4PopupWindow() { + return "MobileParamDefinePane"; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java new file mode 100644 index 000000000..d2a358c19 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java @@ -0,0 +1,150 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.MobileParamUIProvider; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.mobile.provider.DefaultMobileParamUIProvider; +import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.general.ComparatorUtils; +import com.fr.report.ExtraReportClassManager; +import com.fr.report.fun.MobileParamStyleProvider; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JPanel; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class MobileParamSettingPane extends BasicPane { + + private DefaultListModel listModel; + private JPanel right; + private CardLayout card; + private JList paramStyleList; + + + private Map> map = new HashMap<>(); + + + public MobileParamSettingPane() { + initComponents(); + } + + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + listModel = new DefaultListModel<>(); + card = new CardLayout(); + right = FRGUIPaneFactory.createCardLayout_S_Pane(); + right.setLayout(card); + MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders(); + for (MobileParamUIProvider provider : mobileParamUIProviders) { + addShowPane(provider); + } + initLeftPane(); + initRightPane(); + } + + private void initLeftPane() { + paramStyleList = new JList<>(listModel); + paramStyleList.setCellRenderer(new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof MobileParamStyle) { + MobileParamStyle style = (MobileParamStyle) value; + this.setText(style.toString()); + } + return this; + } + }); + paramStyleList.addListSelectionListener(e -> { + String selectedValue = (String) paramStyleList.getSelectedValue(); + card.show(right, selectedValue); + }); + JPanel leftPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + leftPane.add(paramStyleList); + leftPane.setPreferredSize(new Dimension(100, 500)); + this.add(leftPane, BorderLayout.WEST); + } + + private void initRightPane() { + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setPreferredSize(new Dimension(500, 500)); + attrConfPane.add(right, BorderLayout.CENTER); + centerPane.add(attrConfPane, BorderLayout.CENTER); + this.add(centerPane, BorderLayout.CENTER); + } + + + public void populate(MobileParamStyle mobileParamStyle) { + if (mobileParamStyle != null) { + MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders(); + for (int i = 0; i < mobileParamUIProviders.length; i++) { + MobileParamUIProvider provider = mobileParamUIProviders[i]; + if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) { + String displayName = provider.displayName(); + paramStyleList.setSelectedIndex(i); + map.get(displayName).populateBean(mobileParamStyle); + card.show(right, displayName); + return; + } + } + } + paramStyleList.setSelectedIndex(0); + } + + private void addShowPane(MobileParamUIProvider provider) { + String displayName = provider.displayName(); + listModel.addElement(provider.displayName()); + BasicBeanPane paramStyleBasicBeanPane = new MobileParamDefinePane(provider); + right.add(displayName, paramStyleBasicBeanPane); + map.put(displayName, paramStyleBasicBeanPane); + } + + public MobileParamStyle update() { + return map.get(paramStyleList.getSelectedValue()).updateBean(); + } + + + @Override + protected String title4PopupWindow() { + return null; + } + + private MobileParamUIProvider[] getMobileParamUIProviders() { + Set paramUIProviders = ExtraDesignClassManager.getInstance().getArray(MobileParamUIProvider.XML_TAG); + List result = new ArrayList<>(); + result.add(new DefaultMobileParamUIProvider()); + result.addAll(paramUIProviders); + Set nameSets = paramUIProviders.stream().map(MobileParamUIProvider::displayName).collect(Collectors.toSet()); + // 兼容老接口 + Set paramStyleProviders = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); + + paramStyleProviders = paramStyleProviders.stream().filter(provider -> !nameSets.contains(provider.descriptor())).collect(Collectors.toSet()); + + for (MobileParamStyleProvider provider : paramStyleProviders) { + result.add(new EmptyMobileParamUIProvider(provider)); + } + + return result.toArray(new MobileParamUIProvider[0]); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java new file mode 100644 index 000000000..3ac8ff376 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java @@ -0,0 +1,32 @@ +package com.fr.design.mainframe.widget.wrappers; + +import com.fr.design.Exception.ValidationException; +import com.fr.design.designer.properties.Decoder; +import com.fr.design.designer.properties.Encoder; +import com.fr.locale.InterProviderFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class MobileParamWrapper implements Encoder, Decoder { + + @Override + public Object decode(String txt) { + return null; + } + + @Override + public void validate(String txt) throws ValidationException { + // do nothing + } + + @Override + public String encode(Object v) { + if (v == null) { + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT"); + } + return v.toString(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java new file mode 100644 index 000000000..94fa4607c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java @@ -0,0 +1,48 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileParamSettingPane; +import com.fr.design.mainframe.widget.wrappers.MobileParamWrapper; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.report.mobile.EmptyMobileParamStyle; +import javax.swing.SwingUtilities; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class AccessibleMobileParamEditor extends UneditableAccessibleEditor { + + private MobileParamSettingPane mobileParamSettingPane; + + public AccessibleMobileParamEditor(MobileParamSettingPane mobileParamSettingPane) { + super(new MobileParamWrapper()); + this.mobileParamSettingPane = mobileParamSettingPane; + } + + @Override + protected void showEditorPane() { + mobileParamSettingPane.setPreferredSize(BasicDialog.MEDIUM); + BasicDialog dlg = mobileParamSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); + dlg.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + MobileParamStyle mobileParamStyle = mobileParamSettingPane.update(); + setValue(mobileParamStyle); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + WParameterLayout wParameterLayout = (WParameterLayout) formDesigner.getSelectionModel().getSelection().getSelectedCreator().toData(); + if (mobileParamStyle instanceof EmptyMobileParamStyle) { + wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider()); + } + fireStateChanged(); + } + }); + mobileParamSettingPane.populate((MobileParamStyle) getValue()); + dlg.setVisible(true); + } +} 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 cf909618c..1c1fe0150 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 @@ -5,11 +5,9 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.PropertyTab; -import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -17,25 +15,21 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileParamSettingPane; +import com.fr.design.mainframe.widget.accessibles.AccessibleMobileParamEditor; 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.general.ComparatorUtils; -import com.fr.general.SiteCenter; import com.fr.log.FineLoggerFactory; -import com.fr.report.ExtraReportClassManager; -import com.fr.report.fun.MobileParamStyleProvider; -import com.fr.report.mobile.DefaultMobileParamStyle; - +import com.fr.report.mobile.EmptyMobileParamStyle; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Cursor; import java.awt.Desktop; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URI; @@ -47,10 +41,9 @@ import java.util.Set; public class ParaMobileDefinePane extends MobileWidgetDefinePane { private XCreator paraCreator; private FormDesigner designer; - private Item[] items; - private UIComboBox paramLocationComboBox; private AttributeChangeListener changeListener; private MobileWidgetListPane mobileWidgetListPane; + private AccessibleMobileParamEditor mobileParamEditor; public ParaMobileDefinePane(XCreator xCreator) { this.paraCreator = xCreator; @@ -81,18 +74,15 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { // 手机属性 private UIExpandablePane getMobilePropertyPane() { - paramLocationComboBox = getParamLocationComboBox(); + mobileParamEditor = new AccessibleMobileParamEditor(new MobileParamSettingPane()); UILabel tipLabel = getTipLabel(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}}; - if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) { - ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); - } Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), mobileParamEditor}, new Component[]{tipLabel, null}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); @@ -102,18 +92,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel); } - private Item[] getItems() { - Set pluginCreators = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); - Item[] items = new Item[pluginCreators.size() + 1]; - MobileParamStyleProvider provider = new DefaultMobileParamStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); - items[0] = new Item(provider.descriptor(), provider); - int i = 1; - for (MobileParamStyleProvider mobileParamStyleProvider : pluginCreators) { - items[i++] = new Item(mobileParamStyleProvider.descriptor(), mobileParamStyleProvider); - } - return items; - } - private UILabel getTipLabel() { UILabel tipLabel = new UILabel(); StringBuilder text = new StringBuilder(); @@ -156,21 +134,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { return tipLabel; } - private UIComboBox getParamLocationComboBox() { - items = getItems(); - - UIComboBox paramLocationComoBox = new UIComboBox(items); - paramLocationComoBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) e.getItem()).getValue()); - } - } - }); - return paramLocationComoBox; - } - // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -205,27 +168,20 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { // 设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); - int index = 0; - try { - MobileParamStyleProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); - String currentQueryType = provider.createJSON().getString("queryType"); - for (int i = 0; i < items.length; i++) { - String existedQueryType = ((MobileParamStyleProvider) items[i].getValue()).createJSON().getString("queryType"); - if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { - index = i; - break; - } - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - paramLocationComboBox.setSelectedIndex(index); - + WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData(); + this.mobileParamEditor.setValue(wParameterLayout.getMobileParamStyle()); } @Override public void update() { mobileWidgetListPane.updateToDesigner(); + WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData(); + MobileParamStyle mobileParamStyle = (MobileParamStyle) this.mobileParamEditor.getValue(); + if (mobileParamStyle instanceof EmptyMobileParamStyle) { + wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider()); + } + wParameterLayout.setMobileParamStyle(mobileParamStyle); + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } } From 3fd24c84b31da1c055df2bcf7a04e8bad9f39df8 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 5 Jan 2021 14:38:55 +0800 Subject: [PATCH 18/21] =?UTF-8?q?REPORT-45689=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/widget/wrappers/MobileParamWrapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java index 3ac8ff376..d4f2b8129 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java @@ -4,6 +4,7 @@ import com.fr.design.Exception.ValidationException; import com.fr.design.designer.properties.Decoder; import com.fr.design.designer.properties.Encoder; import com.fr.locale.InterProviderFactory; +import org.jetbrains.annotations.Nullable; /** * @author hades @@ -12,6 +13,7 @@ import com.fr.locale.InterProviderFactory; */ public class MobileParamWrapper implements Encoder, Decoder { + @Nullable @Override public Object decode(String txt) { return null; From 7166140eefb0e2b7f1618b966c8c2ed3e38db94a Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 5 Jan 2021 14:45:34 +0800 Subject: [PATCH 19/21] =?UTF-8?q?REPORT-46495=20=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=AF=AD=E8=A8=80=E4=B8=BA=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=97=B6=E4=BC=9A=E6=98=BE=E7=A4=BA=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E7=9A=84=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/upm/UpmUtils.java | 2 + .../java/com/fr/design/upm/UpmUtilsTest.java | 57 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java index d27b6721a..e97a5826a 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java @@ -3,6 +3,7 @@ package com.fr.design.upm; import com.fr.common.annotations.Negative; import com.fr.config.ServerPreferenceConfig; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.stable.StringUtils; import java.util.ArrayList; @@ -31,6 +32,7 @@ public class UpmUtils { Map map4Tpl = new HashMap<>(); map4Tpl.put("version", ServerPreferenceConfig.getInstance().getOptimizedUPMVersion()); map4Tpl.put("new_version", fetchLatestVersion()); + map4Tpl.put("language", GeneralContext.getLocale().toString()); return map4Tpl; } diff --git a/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java b/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java new file mode 100644 index 000000000..31119d049 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java @@ -0,0 +1,57 @@ +package com.fr.design.upm; + +import com.fr.config.ServerPreferenceConfig; +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.Locale; +import java.util.Map; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/1/5 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({ServerPreferenceConfig.class, CloudCenter.class}) +@SuppressStaticInitializationFor("com.fr.general.CloudCenter") +public class UpmUtilsTest { + + @Test + public void testRenderMap() { + + ServerPreferenceConfig serverPreferenceConfig = EasyMock.mock(ServerPreferenceConfig.class); + EasyMock.expect(serverPreferenceConfig.getOptimizedUPMVersion()).andReturn("1.0").anyTimes(); + PowerMock.mockStatic(ServerPreferenceConfig.class); + EasyMock.expect(ServerPreferenceConfig.getInstance()).andReturn(serverPreferenceConfig).anyTimes(); + + CloudCenter cloudCenter = EasyMock.mock(CloudCenter.class); + EasyMock.expect(cloudCenter.acquireUrlByKind("upm.script.version")).andReturn("2.0").anyTimes(); + PowerMock.mockStatic(CloudCenter.class); + EasyMock.expect(CloudCenter.getInstance()).andReturn(cloudCenter).anyTimes(); + + EasyMock.replay(serverPreferenceConfig, cloudCenter); + PowerMock.replayAll(); + + GeneralContext.setLocale(Locale.CHINA); + + Map map4Tpl = UpmUtils.renderMap(); + Assert.assertEquals(map4Tpl.size(), 3); + Assert.assertEquals(map4Tpl.get("version"), "1.0"); + Assert.assertEquals(map4Tpl.get("new_version"), "2.0"); + Assert.assertEquals(map4Tpl.get("language"), "zh_CN"); + + + EasyMock.verify(serverPreferenceConfig, cloudCenter); + PowerMock.verifyAll(); + + } +} From 50ec0a73e8c4df18694bbab96b8c9cd23bea5a28 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 5 Jan 2021 17:46:01 +0800 Subject: [PATCH 20/21] =?UTF-8?q?REPORT-46575=E3=80=9010.0.13=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91mac=E4=B8=8B=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=B1=95=E7=A4=BA=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/MutilTempalteTabPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 269918448..99cd17916 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; @@ -35,7 +36,6 @@ import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; @@ -136,7 +136,7 @@ public class MutilTempalteTabPane extends JComponent { this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener()); this.setBorder(null); this.setForeground(new Color(58, 56, 58)); - this.setFont(new Font(Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"), 0, 12)); + this.setFont(DesignUtils.getDefaultGUIFont().applySize(12)); openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); selectedIndex = openedTemplate.size() - 1; AWTEventListener awt = new AWTEventListener() { From 04007d7e046678c58bbfd9d5286f19d7788f260c Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 6 Jan 2021 11:33:39 +0800 Subject: [PATCH 21/21] =?UTF-8?q?REPORT-32210=20Tab=E5=9D=97=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E6=B7=BB=E5=8A=A0=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/beans/LayoutAdapter.java | 14 ++++++++++++- .../layout/AbstractLayoutAdapter.java | 21 +++++++++++++++++-- .../layout/FRTabFitLayoutAdapter.java | 6 +++--- 3 files changed, 35 insertions(+), 6 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 c087d78fe..b961aaee0 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 @@ -42,6 +42,18 @@ public interface LayoutAdapter { */ boolean addBean(XCreator creator, int x, int y); + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + boolean addBean(XCreator creator, int x, int y, boolean accept); + /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 */ @@ -91,4 +103,4 @@ public interface LayoutAdapter { * @param initHeight 组件之前高度 */ void removeBean(XCreator creator, int initWidth, int initHeight); -} \ No newline at end of file +} 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 493dd02aa..e9851a7e8 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 @@ -78,7 +78,23 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { */ @Override public boolean addBean(XCreator creator, int x, int y) { - if (!accept(creator, x, y)) { + boolean accept = accept(creator, x, y); + return addBean(creator, x, y, accept); + } + + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + @Override + public boolean addBean(XCreator creator, int x, int y, boolean accept) { + if (!accept) { return false; } addComp(creator, x, y); @@ -86,6 +102,7 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { return true; } + /** * 删除组件 * @@ -186,4 +203,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { public XLayoutContainer getContainer() { return this.container; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index d5a680b61..2b33159e8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -18,7 +18,8 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; -import java.awt.*; +import java.awt.Rectangle; + /** * tab布局tabFit适配器 @@ -73,8 +74,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { y = adjustY(y, tabLayout); } //这时候应该要用计算后的父fit布局添加 - this.container.getLayoutAdapter().addBean(creator, x, y); - ((XWidgetCreator) creator).recalculateChildrenSize(); + this.container.getLayoutAdapter().addBean(creator, x, y, true); return true; } // 如果不在边缘,容器为本自适应布局,增加组件的位置就是相对于容器的位置