diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index 77b16b499..98dbbbb6e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -76,7 +76,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { }; } - protected JPanel createCommonPanel() { + protected JPanel createCommonFormatPanel() { JPanel commonPanel = new JPanel(new BorderLayout()); commonPanel.add(createCateAndSeriesPane(), BorderLayout.NORTH); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java index 0c3b5a454..18f50e143 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java @@ -1,7 +1,9 @@ package com.fr.van.chart.designer.component; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -28,6 +30,14 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected Component[][] getPaneComponents(){ return new Component[][]{ new Component[]{categoryNameFormatPane,null}, @@ -39,4 +49,15 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan }; } + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } + } 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/VanChartRichEditorPane.java index 4dfd250a1..d1f294e41 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/VanChartRichEditorPane.java @@ -8,9 +8,6 @@ import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; import java.util.Map; public class VanChartRichEditorPane { @@ -75,23 +72,6 @@ public class VanChartRichEditorPane { return new RichEditorModel(richText.getContent(), richText.isAuto(), paramsStr.toString()); } - public static List richParamsParser(String content, Map paramsMap) { - if (content == null || paramsMap == null) { - return null; - } - - List result = new ArrayList<>(); - - for (Map.Entry entry : paramsMap.entrySet()) { - String param = entry.getValue(); - if (content.contains(URLEncoder.encode(param))) { - result.add(param); - } - } - - return result; - } - public static class RichEditorModel { private String content; private boolean auto; 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 a5aafc79a..e8825f246 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 @@ -9,19 +9,26 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; 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.format.AttrTooltipFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; 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.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; 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.format.VanChartFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JComponent; @@ -36,28 +43,38 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.List; /** - * 内容界面 。数据点提示 + * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 */ public class VanChartTooltipContentPane extends BasicBeanPane { private static final long serialVersionUID = 8825929000117843641L; protected UIButtonGroup content; - protected ValueFormatPaneWithCheckBox valueFormatPane; - protected PercentFormatPaneWithCheckBox percentFormatPane; + protected CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; protected SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; + protected ValueFormatPaneWithCheckBox valueFormatPane; + protected PercentFormatPaneWithCheckBox percentFormatPane; //监控刷新时,自动数据点提示使用 protected ChangedValueFormatPaneWithCheckBox changedValueFormatPane; protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; - private JPanel centerPane; + protected CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane; + protected SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane; + protected ValueFormatPaneWithoutCheckBox richTextValueFormatPane; + protected PercentFormatPaneWithoutCheckBox richTextPercentFormatPane; + protected ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane; + protected ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane; + + private JPanel centerPanel; private JPanel commonPanel; - private JPanel editorPane; + private JPanel editorPanel; + private JPanel htmlPanel; + private UIButtonGroup styleButton; + private ChartTextAttrPane textAttrPane; private VanChartHtmlLabelPane htmlLabelPane; private VanChartStylePane parent; @@ -75,55 +92,44 @@ public class VanChartTooltipContentPane extends BasicBeanPane(new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Common"), - Toolkit.i18nText("Fine-Design_Chart_Custom") - }); - initFormatPane(parent, showOnPane); + initRichTextFormatPane(parent, showOnPane); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + initDetailPane(); + initCenterPane(); + + JPanel content = new JPanel(new BorderLayout()); + + content.add(createButtonPane(), BorderLayout.NORTH); + content.add(centerPanel, BorderLayout.CENTER); + + initContentListener(); + + return getLabelContentPane(content); + } + private void initDetailPane() { commonPanel = createCommonPanel(); - htmlLabelPane = createHtmlLabelPane(); - htmlLabelPane.setParent(parent); + editorPanel = createRichEditorPanel(); + htmlPanel = createHtmlPane(); + } - centerPane = new JPanel(new CardLayout()){ - @Override + private void initCenterPane() { + centerPanel = new JPanel(new CardLayout()) { public Dimension getPreferredSize() { - if(content.getSelectedIndex() == 0){ + if (content.getSelectedIndex() == 0) { return commonPanel.getPreferredSize(); + } else if (content.getSelectedIndex() == 1) { + return editorPanel.getPreferredSize(); } else { - return new Dimension(commonPanel.getPreferredSize().width,htmlLabelPane.getPreferredSize().height); + return htmlPanel.getPreferredSize(); } } }; - centerPane.add(htmlLabelPane, Toolkit.i18nText("Fine-Design_Chart_Custom")); - centerPane.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); - - double[] column = {f, e}; - double[] row = {p,p,p}; - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(getLabelContentTitle()),content}, - new Component[]{null,centerPane}, - }; - - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); - - // editorPane = createRichEditorPanel(); - - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add(contentPane, BorderLayout.CENTER); - // panel.add(editorPane, BorderLayout.SOUTH); - - initContentListener(); - - return getLabelContentPane(panel); + centerPanel.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); + centerPanel.add(editorPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text")); + centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); } protected String getLabelContentTitle () { @@ -134,18 +140,88 @@ public class VanChartTooltipContentPane extends BasicBeanPane(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Common"), + Toolkit.i18nText("Fine-Design_Chart_Rich_Text"), + Toolkit.i18nText("Fine-Design_Chart_Custom") + }); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{content, null} + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); + } + + private JPanel createCommonPanel() { + JPanel common = new JPanel(new BorderLayout()); + + common.add(createCommonFormatPanel(), BorderLayout.CENTER); + common.add(createCommonStylePane(), BorderLayout.SOUTH); + + return common; } - protected JPanel createCommonPanel() { + protected JPanel createCommonFormatPanel() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f, p}; - double[] rowSize = getRowSize(p); + JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), getRowSize(p), new double[]{f, p}); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(getLabelContentTitle()), formatContent} + }; - return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); + return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); + } + + private JPanel createCommonStylePane() { + styleButton = new UIButtonGroup<>(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom") + }); + + textAttrPane = new ChartTextAttrPane() { + protected Component[][] getComponents(JPanel buttonPane) { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{null, getFontNameComboBox()}, + new Component[]{null, buttonPane} + }; + } + }; + + JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton); + + JPanel stylePanel = new JPanel(new BorderLayout()); + stylePanel.add(buttonPane, BorderLayout.CENTER); + stylePanel.add(textAttrPane, BorderLayout.SOUTH); + + initStyleButtonListener(); + + return stylePanel; + } + + private void initStyleButtonListener() { + styleButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkStylePane(); + } + }); + } + + private void checkStylePane() { + textAttrPane.setVisible(styleButton.getSelectedIndex() == 1); } private JPanel createRichEditorPanel() { @@ -154,18 +230,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = VanChartRichEditorPane.richParamsParser(content, richText.getParams()); - populateFormatParams(params); updateLocalRichText(content, model.isAuto()); SwingUtilities.getWindowAncestor(pane).setVisible(false); @@ -207,6 +284,28 @@ public class VanChartTooltipContentPane extends BasicBeanPane", - "\"%24%7BSERIES%7D\"", - "\"%24%7BVALUE%7D\"", - "\"%24%7BPERCENT%7D\"", - "\"%24%7BCHANGEDVALUE%7D\"", - "\"%24%7BCHANGEDPERCENT%7D\"" + return new VanChartFormatPaneWithoutCheckBox[]{ + richTextCategoryNameFormatPane, + richTextSeriesNameFormatPane, + richTextValueFormatPane, + richTextPercentFormatPane, + richTextChangedValueFormatPane, + richTextChangedPercentFormatPane }; - - StringBuilder result = new StringBuilder("

"); - - for (int i = 0, len = formatPaneGroup.length; i < len; i++) { - VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i]; - String paramRichText = richTextGroup[i]; - - if (formatPane != null && formatPane.isSelected()) { - result.append(paramRichText); - } - } - - result.append("

"); - - return result.toString(); } @Override @@ -346,19 +435,36 @@ public class VanChartTooltipContentPane extends BasicBeanPane params) { - if (params == null) { - return; - } + for (int i = 0, len = formatPaneGroup.length; i < len; i++) { + VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i]; + AttrTooltipFormat format = formatGroup[i]; - VanChartFormatPaneWithCheckBox[] formatPaneGroup = getFormatPaneGroup(); + if (formatPane != null && format != null) { + formatPane.populate(format); - for (VanChartFormatPaneWithCheckBox formatPane : formatPaneGroup) { - if (formatPane != null) { - formatPane.setSelected(false); + // 填充面板时,更新富文本编辑器参数 + formatPane.updateFormatParams(richText.getParams(), format.getJs()); } } - for (String param : params) { - VanChartFormatPaneWithCheckBox formatPane = getTargetFormatPane(param); + AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr(); - if (formatPane != null) { - formatPane.setSelected(true); - } + if (tooltipRichText != null) { + updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); + setDirty(false); } } public AttrTooltipContent updateBean() { AttrTooltipContent attrTooltipContent = createAttrTooltip(); - boolean isCommon = content.getSelectedIndex() == 0; - - attrTooltipContent.setCommon(isCommon); - if (isDirty() && isCommon) { - updateLocalRichText(getParamsRichText(), false); - setDirty(false); - } + attrTooltipContent.setCommon(content.getSelectedIndex() == 0); + attrTooltipContent.setRichText(content.getSelectedIndex() == 1); + attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1); + attrTooltipContent.setTextAttr(this.textAttrPane.update()); updateFormatPane(attrTooltipContent); + updateRichEditor(attrTooltipContent); updateTooltipRichText(attrTooltipContent); updateFormatsWithPaneWidth(attrTooltipContent); @@ -449,6 +553,20 @@ public class VanChartTooltipContentPane extends BasicBeanPane align; private JPanel alignPane; private Integer[] oldAlignValues; + protected UIButtonGroup style; + protected ChartTextAttrPane textFontPane; public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); @@ -63,6 +67,15 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } + protected void initStyleListener() { + style.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkStyleUse(); + } + }); + } + protected boolean isFontSizeAuto() { return false; } @@ -120,7 +133,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { }; } else { - return super.getLabelPaneComponents(plot, p, columnSize); + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, + }; } } @@ -210,15 +226,21 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { super.populate(detail); style.setSelectedIndex(1); + textFontPane.populate(detail.getTextAttr()); if (hasLabelAlign(this.getPlot()) && align != null) { align.setSelectedItem(detail.getAlign()); } + + checkStyleUse(); } public void update(AttrLabelDetail detail) { super.update(detail); detail.setCustom(true); + if (textFontPane != null) { + detail.setTextAttr(textFontPane.update()); + } if (align != null) { if (align.getSelectedItem() != null) { detail.setAlign(align.getSelectedItem()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index c506d89ea..b5d36b07a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -44,9 +44,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected UIButtonGroup autoAdjust; protected UIToggleButton tractionLine; - protected UIButtonGroup style; - protected ChartTextAttrPane textFontPane; - protected ColorSelectBox backgroundColor; private JPanel tractionLinePane; @@ -93,13 +90,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(hasLabelPosition(plot)){ return new Component[][]{ new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, - new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null} }; } else { return new Component[][]{ - new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, + new Component[]{dataLabelContentPane,null} }; } } @@ -214,17 +209,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane { }); } - protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), - Toolkit.i18nText("Fine-Design_Chart_Custom")}); - textFontPane =initTextFontPane(); - - initStyleListener(); - - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col); - return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); - } - protected ChartTextAttrPane initTextFontPane () { return new ChartTextAttrPane(){ protected Component[][] getComponents(JPanel buttonPane) { @@ -237,24 +221,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane { }; } - protected Component[][] getLabelStyleComponents(Plot plot) { - UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{null,null}, - new Component[]{text,style}, - new Component[]{textFontPane,null}, - }; - } - - protected void initStyleListener() { - style.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkStyleUse(); - } - }); - } - protected JPanel createBackgroundColorPane() { backgroundColor = new ColorSelectBox(100); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); @@ -265,18 +231,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } private void checkAllUse() { - checkStyleUse(); if(tractionLine == null){ return; } checkPositionEnabled(); } - protected void checkStyleUse() { - textFontPane.setVisible(style.getSelectedIndex() == 1); - textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); - } - private void checkPosition() { tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); checkPositionEnabled(); @@ -301,8 +261,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(autoAdjust != null){ autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); } - style.setSelectedIndex(detail.isCustom() ? 1 : 0); - textFontPane.populate(detail.getTextAttr()); if(backgroundColor != null){ backgroundColor.setSelectObject(detail.getBackgroundColor()); @@ -327,10 +285,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(tractionLine != null){ detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); } - detail.setCustom(style.getSelectedIndex() == 1); - if(textFontPane != null){ - detail.setTextAttr(textFontPane.update()); - } if(backgroundColor != null){ detail.setBackgroundColor(backgroundColor.getSelectObject()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java index ade1d85bd..0f71c9de6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java @@ -72,7 +72,6 @@ public class VanChartPlotRefreshTooltipPane extends VanChartPlotTooltipNoCheckPa Component[][] components = new Component[][]{ new Component[]{refreshTooltipContentPane,null}, new Component[]{initDurationPane(),null}, - new Component[]{createLabelStylePane(),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index 1c3ed4aa5..bb5b46b63 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -7,8 +7,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrTooltip; @@ -32,9 +30,6 @@ public class VanChartPlotTooltipPane extends BasicPane { protected VanChartTooltipContentPane tooltipContentPane; - protected UIButtonGroup style; - protected ChartTextAttrPane textFontPane; - protected VanChartBorderWithRadiusPane borderPane; protected VanChartBackgroundWithOutImagePane backgroundPane; @@ -95,7 +90,6 @@ public class VanChartPlotTooltipPane extends BasicPane { protected Component[][] createComponents(Plot plot) { Component[][] components = new Component[][]{ new Component[]{tooltipContentPane,null}, - new Component[]{createLabelStylePane(),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{createDisplayStrategy(plot),null}, @@ -108,38 +102,6 @@ public class VanChartPlotTooltipPane extends BasicPane { tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this); } - protected JPanel createLabelStylePane() { - style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),Toolkit.i18nText("Fine-Design_Chart_Custom")}); - textFontPane = new ChartTextAttrPane() { - protected Component[][] getComponents(JPanel buttonPane) { - return new Component[][]{ - new Component[]{null, null}, - new Component[]{null, getFontNameComboBox()}, - new Component[]{null, buttonPane} - }; - } - }; - - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Character"), style); - JPanel panel1 = new JPanel(new BorderLayout()); - panel1.add(panel, BorderLayout.CENTER); - panel1.add(textFontPane, BorderLayout.SOUTH); - - initStyleListener(); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); - } - - - private void initStyleListener() { - style.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkStyleUse(); - } - }); - } - protected JPanel createDisplayStrategy(Plot plot) { showAllSeries = new UICheckBox(getShowAllSeriesLabelText()); followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), @@ -175,7 +137,6 @@ public class VanChartPlotTooltipPane extends BasicPane { private void checkAllUse() { checkBoxUse(); - checkStyleUse(); } /** * 检查box使用. @@ -184,10 +145,6 @@ public class VanChartPlotTooltipPane extends BasicPane { tooltipPane.setVisible(isTooltipShow.isSelected()); } - private void checkStyleUse() { - textFontPane.setVisible(style.getSelectedIndex() == 1); - } - protected AttrTooltip getAttrTooltip() { return new AttrTooltip(); } @@ -202,8 +159,6 @@ public class VanChartPlotTooltipPane extends BasicPane { tooltipContentPane.populateBean(attr.getContent()); } - style.setSelectedIndex(attr.isCustom() ? 1 : 0); - textFontPane.populate(attr.getTextAttr()); borderPane.populate(attr.getGeneralInfo()); backgroundPane.populate(attr.getGeneralInfo()); if(showAllSeries != null) { @@ -224,10 +179,6 @@ public class VanChartPlotTooltipPane extends BasicPane { attrTooltip.setContent(tooltipContentPane.updateBean()); } - attrTooltip.setCustom(style.getSelectedIndex() == 1); - if(textFontPane != null){ - attrTooltip.setTextAttr(textFontPane.update()); - } borderPane.update(attrTooltip.getGeneralInfo()); backgroundPane.update(attrTooltip.getGeneralInfo()); if(showAllSeries != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/FunnelPercentFormatPaneWithoutCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/FunnelPercentFormatPaneWithoutCheckBox.java new file mode 100644 index 000000000..5495131b3 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/FunnelPercentFormatPaneWithoutCheckBox.java @@ -0,0 +1,18 @@ +package com.fr.van.chart.funnel.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +public class FunnelPercentFormatPaneWithoutCheckBox extends PercentFormatPaneWithoutCheckBox { + + public FunnelPercentFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Value_Conversion"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java index e2382c685..20451e343 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java @@ -4,8 +4,12 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.van.chart.designer.component.VanChartLabelContentPane; 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.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; @@ -31,6 +35,14 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane { }; } + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null} + }; + } + @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); @@ -39,6 +51,13 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane { percentFormatPane = new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.getCategoryFormat().setEnable(false); diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java index c98dfcce4..c751e1731 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java @@ -1,7 +1,9 @@ package com.fr.van.chart.funnel.designer.style; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -22,6 +24,14 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p}; } @@ -35,4 +45,14 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt new Component[]{changedPercentFormatPane,null}, }; } + + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java index 1a5199c09..280d7e2bc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java @@ -4,8 +4,11 @@ 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.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; @@ -31,6 +34,14 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane }; } + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null} + }; + } + @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); @@ -39,6 +50,14 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane percentFormatPane = new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.getCategoryFormat().setEnable(false); 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 c918088ca..c257c8ffd 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 @@ -5,9 +5,13 @@ import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; 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; @@ -28,6 +32,14 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java index 76bd33f59..9b9b3aac4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java @@ -3,7 +3,9 @@ package com.fr.van.chart.map.designer.style.tooltip; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -20,10 +22,19 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { super.initFormatPane(parent, showOnPane); + changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); + } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); } + protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -39,6 +50,17 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont }; } + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); 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 1a2b593a3..f39107d6d 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 @@ -5,9 +5,13 @@ import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; 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; @@ -28,6 +32,14 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane { percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/StartAndEndNameFormatPaneWithoutCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/StartAndEndNameFormatPaneWithoutCheckBox.java new file mode 100644 index 000000000..9630f9b12 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/StartAndEndNameFormatPaneWithoutCheckBox.java @@ -0,0 +1,17 @@ +package com.fr.van.chart.map.line; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +public class StartAndEndNameFormatPaneWithoutCheckBox extends CategoryNameFormatPaneWithoutCheckBox { + public StartAndEndNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Start_And_End"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java index 66566c6bf..9c46c351b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java @@ -4,9 +4,13 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; +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.style.VanChartStylePane; import javax.swing.JPanel; @@ -27,6 +31,14 @@ public class VanChartLineMapTooltipContentPane extends VanChartTooltipContentPan percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new StartAndEndNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieLevelNameFormatPaneWithoutCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieLevelNameFormatPaneWithoutCheckBox.java new file mode 100644 index 000000000..71789e63a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieLevelNameFormatPaneWithoutCheckBox.java @@ -0,0 +1,18 @@ +package com.fr.van.chart.multilayer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +public class MultiPieLevelNameFormatPaneWithoutCheckBox extends CategoryNameFormatPaneWithoutCheckBox { + + public MultiPieLevelNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Level_Name"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieSeriesNameFormatPaneWithoutCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieSeriesNameFormatPaneWithoutCheckBox.java new file mode 100644 index 000000000..95cf23f2e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieSeriesNameFormatPaneWithoutCheckBox.java @@ -0,0 +1,18 @@ +package com.fr.van.chart.multilayer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +public class MultiPieSeriesNameFormatPaneWithoutCheckBox extends SeriesNameFormatPaneWithoutCheckBox { + + public MultiPieSeriesNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java index 637279d13..8b755a18c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java @@ -4,7 +4,9 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartLabelContentPane; 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.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,6 +27,13 @@ public class VanChartMultiPieLabelContentPane extends VanChartLabelContentPane { percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); content.setCategoryFormat(new AttrTooltipMultiLevelNameFormat()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java index 3c500d3bf..7e94fb8cb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java @@ -4,7 +4,9 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; 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.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,6 +27,13 @@ public class VanChartMultiPieTooltipContentPane extends VanChartTooltipContentPa percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSeriesNameFormatPane = new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane); + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java index 56893ec66..1cd5a6e84 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java @@ -1,7 +1,9 @@ package com.fr.van.chart.multilayer.style; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,6 +27,14 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -40,4 +50,15 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo }; } + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } + } 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 902f65517..37a846076 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 @@ -3,7 +3,9 @@ package com.fr.van.chart.scatter; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -15,7 +17,7 @@ import java.awt.Component; public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterTooltipContentPane { private ChangedValueFormatPaneWithCheckBox changedSizeFormatPane; - + private ChangedValueFormatPaneWithoutCheckBox richTextChangedSizeFormatPane; public VanChartScatterRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(null, showOnPane); @@ -28,6 +30,12 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedSizeFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } protected double[] getRowSize(double p) { return new double[]{p, p, p, p, p, p}; @@ -36,14 +44,26 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo protected Component[][] getPaneComponents() { return new Component[][]{ new Component[]{seriesNameFormatPane, null}, - new Component[]{getxFormatPane(), null}, - new Component[]{getyFormatPane(), null}, + new Component[]{getXFormatPane(), null}, + new Component[]{getYFormatPane(), null}, new Component[]{getSizeFormatPane(), null}, new Component[]{changedSizeFormatPane, null}, new Component[]{changedPercentFormatPane, null}, }; } + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{getRichTextXFormatPane(), null}, + new Component[]{getRichTextYFormatPane(), null}, + new Component[]{getRichTextSizeFormatPane(), null}, + new Component[]{richTextChangedSizeFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } + @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { 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 705ea1a0f..f1a13d8cf 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 @@ -4,8 +4,11 @@ import com.fr.plugin.chart.base.AttrTooltipContent; 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.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.style.VanChartStylePane; import javax.swing.JPanel; @@ -20,11 +23,15 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa private YFormatPaneWithCheckBox yFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane; - public XFormatPaneWithCheckBox getxFormatPane() { + private XFormatPaneWithoutCheckBox richTextXFormatPane; + private YFormatPaneWithoutCheckBox richTextYFormatPane; + private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane; + + public XFormatPaneWithCheckBox getXFormatPane() { return xFormatPane; } - public YFormatPaneWithCheckBox getyFormatPane() { + public YFormatPaneWithCheckBox getYFormatPane() { return yFormatPane; } @@ -32,6 +39,18 @@ 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); } @@ -45,6 +64,15 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); } + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane); + richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane); + richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected Component[][] getPaneComponents(){ return new Component[][]{ @@ -55,6 +83,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa }; } + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextXFormatPane, null}, + new Component[]{richTextYFormatPane, null}, + new Component[]{richTextSizeFormatPane, null} + }; + } + @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java index 5fa83be5b..f5dd6fbd5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java @@ -1,7 +1,9 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -23,6 +25,13 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p}; } @@ -37,4 +46,15 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur new Component[]{changedPercentFormatPane,null}, }; } + + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java index 63490eaff..29fd61739 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java @@ -1,13 +1,18 @@ package com.fr.van.chart.structure.desinger.style; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; 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.style.VanChartStylePane; import javax.swing.JPanel; @@ -30,24 +35,48 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP }; } + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null} + }; + } + @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Name"); + return Toolkit.i18nText("Fine-Design_Chart_Node_Name"); } }; seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); } }; valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Node_Name"); + } + }; + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + } + }; + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java index 4f748214f..513f9f386 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java @@ -1,8 +1,11 @@ package com.fr.van.chart.wordcloud.designer.style; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -23,13 +26,25 @@ public class VanChartWordCloudRefreshTootipContentPane extends VanChartWordCloud changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value"); + return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value"); } }; changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initRichTextFormatPane(parent, showOnPane); + + richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value"); + } + }; + + richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -44,4 +59,15 @@ public class VanChartWordCloudRefreshTootipContentPane extends VanChartWordCloud new Component[]{changedPercentFormatPane,null}, }; } + + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{richTextCategoryNameFormatPane, null}, + new Component[]{richTextSeriesNameFormatPane, null}, + new Component[]{richTextValueFormatPane, null}, + new Component[]{richTextChangedValueFormatPane, null}, + new Component[]{richTextPercentFormatPane, null}, + new Component[]{richTextChangedPercentFormatPane, null} + }; + } } 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 08845b2b7..90c017b82 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 @@ -1,13 +1,18 @@ package com.fr.van.chart.wordcloud.designer.style; +import com.fr.design.i18n.Toolkit; 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.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,24 +30,43 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); } }; seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Word_Name"); + return Toolkit.i18nText("Fine-Design_Chart_Word_Name"); } }; valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane){ @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Word_Value"); + return Toolkit.i18nText("Fine-Design_Chart_Word_Value"); } }; percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); } + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane){ + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + } + }; + richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane){ + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Word_Name"); + } + }; + richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane){ + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Word_Value"); + } + }; + richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); + } + @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); 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 new file mode 100644 index 000000000..3189374da --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.constant.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.constant.js new file mode 100644 index 000000000..3642aed28 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.constant.js @@ -0,0 +1,6 @@ +!(function () { + + BI.constant("bi.constant.design.chart.common.editor.placeholder_style", { + fontColor: "#c4c9d1" + }); +}()); \ No newline at end of file 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 new file mode 100644 index 000000000..216243069 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -0,0 +1,241 @@ +!(function () { + var Widget = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-design-chart-common-editor", + isAuto: true, + content: "", + placeholder: "", + fontStyle: {}, + dimensionIds: [], + toolbar: { + buttons: [] + }, + textAlign: "center" + }, + + _store: function () { + var o = this.options; + + return BI.Models.getModel("bi.model.design.chart.common.editor", { + dimensionIds: o.dimensionIds, + isAuto: o.isAuto + }); + }, + + render: function () { + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.nic_editor", + $value: "chart-common-editor", + height: 365, + cls: "editor bi-border bi-focus-shadow " + (o.textAlign === "center" ? "editor-center-text" : ""), + listeners: [{ + eventName: BI.NicEditor.EVENT_FOCUS, + action: function () { + self.clearPlaceholder(); + self.store.setEditorBlurState(false); + } + }, { + eventName: BI.NicEditor.EVENT_BLUR, + action: function () { + self.setPlaceholder(); + self.store.setEditorBlurState(true); + } + }] + }); + + return { + type: "bi.vtape", + ref: function (_ref) { + self.bar = _ref; + }, + items: [{ + type: "bi.htape", + items: [{ + type: "bi.label", + text: "字体样式: ", + textAlign: "left", + width: 70 + }, { + type: "bi.button_group", + items: this.model.fontStyleItems, + ref: function (_ref) { + self.fontStyleGroup = _ref; + }, + listeners: [{ + eventName: BI.ButtonGroup.EVENT_CHANGE, + action: function () { + var isAuto = this.getValue()[0]; + self.store.changeIsAuto(isAuto); + self.changeFontStyleMode(isAuto); + } + }], + layouts: [{ + type: "bi.left", + rgap: 5 + }], + value: this.model.mode, + width: 125 + }, this._getToolBar()], + height: 24 + }, { + el: this.editor, + tgap: 10 + }] + }; + }, + + _getToolBar: function () { + var self = this; + return { + type: "bi.design.chart.common.editor.toolbar", + cls: "toolbar-region", + wId: this.options.wId, + editor: this.editor, + buttons: this.options.toolbar.buttons, + ref: function (_ref) { + self.toolbar = _ref; + } + }; + }, + + mounted: function () { + this.editor.bindToolbar(this.bar); + this.editor.setValue(this._formatContent(this.options.content)); + this.setFocus(); + }, + + _cleanHtml: function (value) { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + var result = BI.replaceAll(value, "

", ""); + // 去掉image的src属性,因为数据太大了 + result = value.replaceAll("", function (imageStr) { + var attrs = editorService.getImageAttr(imageStr); + var str = ""; + }); + + return result; + }, + + getValue: function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + var value = this._cleanHtml(this.editor.getValue(BI.NicEditor.FormatType.ESCAPE)); + // BI.each(this.model.dimensionIds, function (idx, dId) { + // var fullName = BI.Utils.getNotGeoDimensionFullName(dId); + // value = editorService.appendImageAttr(value, fullName, BICst.RICH_TEXT_INFO.DATA_ID, dId); + // }); + + if (editorService.isEmptyRichText(value)) { + value = ""; + } + + if (BI.isNotEmptyString(this.options.placeholder) && editorService.isRichTextEqual(value, this.options.placeholder)) { + value = null; + } + + return { + isAuto: this.model.isAuto, + content: value + }; + }, + + setValue: function (obj) { + var keys = BI.keys(obj); + if (BI.contains(keys, "content")) { + this.editor.setValue(this._formatContent(obj.content)); + } + if (BI.contains(keys, "isAuto")) { + this.store.changeIsAuto(obj.isAuto); + this.fontStyleGroup.setValue(obj.isAuto); + } + }, + + _formatContent: function (content) { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + + content = editorService.setImageSrc(content); + + if (editorService.isBlankRichText(content) + || editorService.isRichTextEqual(content, this.options.placeholder)) { + content = this.options.placeholder || ""; + } + + return content; + }, + + // 切换到“自动”时的处理方法 + _switchToAutoStyle: function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"), + content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE), + isEqualToPlaceholder = editorService.isRichTextEqual(content, this.options.placeholder); + + var HTML_ONLY_STYLE_TAG = "||||||||||||||||||||

"; + + if (!isEqualToPlaceholder) { + content = content.replaceAll(HTML_ONLY_STYLE_TAG, ""); + } + + return content; + }, + + clearPlaceholder: function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + var content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE); + var isSameContent = editorService.isRichTextEqual(content, this.options.placeholder); + + if (isSameContent) { + content = editorService.convertText2RichText("", this.options.fontStyle); + this.editor.setValue(content); + this.setFocus(); + } + }, + + setPlaceholder: function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + var content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE); + var isSameContent = editorService.isBlankRichText(content); + + if (isSameContent) { + this.editor.setValue(this.options.placeholder); + } + }, + + // 字体样式切换 + changeFontStyleMode: function (isAuto) { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + var switchFn = this.options.switchFn, + content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE), + origin = content; + if (isAuto) { + content = this._switchToAutoStyle(); + this.setFocus(); + } else if (editorService.isRichTextEqual(content, this.options.placeholder)) { + content = ""; + } + if (BI.isFunction(switchFn)) { + content = switchFn(isAuto, content); + } + if (content !== origin) { + this.editor.setValue(content); + } + }, + + setFocus: function () { + var instance = this.editor.instance; + instance && instance.initSelection(); + } + }); + + Widget.EVENT_CHANGE = "EVENT_CHANGE"; + + BI.shortcut("bi.design.chart.common.editor", Widget); + +}()); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js new file mode 100644 index 000000000..dbe278446 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js @@ -0,0 +1,53 @@ +!(function () { + + var Model = BI.inherit(Fix.Model, { + childContext: ["isAuto", "dimensionIds"], + + state: function () { + var o = this.options; + + return { + isAuto: o.isAuto, + dimensionIds: o.dimensionIds, + isEditorBlur: true + }; + }, + + computed: { + fontStyleItems: function () { + return [{ + type: "bi.single_select_radio_item", + text: "自动", + hgap: 5, + logic: { + dynamic: true + }, + value: true, + selected: this.options.isAuto + }, { + type: "bi.single_select_radio_item", + text: "自定义", + hgap: 5, + logic: { + dynamic: true + }, + value: false, + selected: !this.options.isAuto + }]; + } + }, + + actions: { + changeIsAuto: function (isAuto) { + this.model.isAuto = isAuto; + }, + + setEditorBlurState: function (isBlur) { + this.model.isEditorBlur = isBlur; + } + } + }); + + BI.model("bi.model.design.chart.common.editor", Model); + +}()); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.service.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.service.js new file mode 100644 index 000000000..87fa2bdf6 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.service.js @@ -0,0 +1,562 @@ +!(function () { + + /** + * HTML解析类,使用方法: + * new HTMLParser().parse(htmlText, { + * startTag: function (tagName, attrs) {}, + * endTag: function (tagName) {}, + * text: function (text) {} + * }) + */ + function HTMLParser () { + + } + + HTMLParser.prototype = { + constructor: HTMLParser, + + startTagPattern: /<([-\w\d_]+)\s*([^>]*)\s*(\/?)>/, + endTagPattern: /^<\/([-\w\d_]+)[^>]*>/, + attrPattern: /([-\w\d_]+)\s*=\s*["']([^"']*)["']/g, + // 特殊的字符 + specialCharsPatterns: [{ + pattern: / /g, + subStr: " " + }, { + pattern: /</g, + subStr: "<" + }, { + pattern: />/g, + subStr: ">" + }, { + pattern: /&/g, + subStr: "&" + }], + + handle: { + // 以下为处理开始标签和文本的时候触发的函数,可以自定义 + startTag: function () { + }, + endTag: function () { + }, + text: function () { + } + }, + + /** + * + * @param html + * @param handle + * @param isReplaceSpecialChars 是否需要替换HTML中的特殊字符 + */ + parse: function (html, handle, isReplaceSpecialChars) { + var index, isText = false, + match, last = html, + me = this; + + isReplaceSpecialChars = isReplaceSpecialChars !== null ? isReplaceSpecialChars : true; + + if (BI.isPlainObject(handle)) { + BI.isFunction(handle.startTag) && (this.handle.startTag = handle.startTag); + BI.isFunction(handle.endTag) && (this.handle.endTag = handle.endTag); + BI.isFunction(handle.text) && (this.handle.text = handle.text); + } + + while (html) { + isText = true; + + // 结束标签 + if (html.indexOf("'$%{}"]/.test(params)) { + return window.encodeURIComponent(params).replace(/'/g, escape); + } + return params; + }, + + decode: function (params) { + try { + var result = window.decodeURIComponent(params); + if (/[<>'$%{}"]/.test(result)) { + return result; + } + return params; + } catch (e) { + return params; + } + }, + + HTMLParser: HTMLParser, + + getImageAttr: getImageAttr, + + /** + * 构造一个富文本中的参数图片 + */ + getEditorParamImage: function (param, fillStyle) { + var attr = BI.DOM.getImage(param, fillStyle); + return "" + this.encode(attr.param)
+                + ""; + }, + + /** + * 给image设置属性 + */ + appendImageAttr: function (html, altValue, attrName, attrValue, isCovered) { + altValue = this.encode(altValue); + attrName = this.encode(attrName); + attrValue = this.encode(attrValue); + isCovered = isCovered || false; // 属性是否可以覆盖 + + return html.replaceAll("", function (imageStr) { + var attrs = getImageAttr(imageStr); + + if (attrs && attrs["alt"] === altValue && (BI.isNull(attrs[attrName]) || isCovered)) { + attrs[attrName] = attrValue; + imageStr = ""; + }); + + return { + startHtml: startHtml, + endHtml: endHtml + }; + }, + + /** + * 将富文本HTML转化成普通的文本,不需要记录fontStyle + */ + convertRichText2Text: function (html) { + var content = "", + line = "", + htmlFragments = []; + + new HTMLParser().parse(html, { + startTag: function (tagName, attrs) { + // 只关心br、img + switch (tagName) { + case "br": + line += "\n"; + htmlFragments.push(tagName); + break; + case "img": + BI.each(attrs, function (idx, obj) { + if (obj.name === "alt") { + line += "${" + obj.value + "}"; + } + }); + break; + default: + break; + } + }, + endTag: function (tagName) { + if (tagName === "div") { + //

这样的情况下应该只代表一个回车符 + htmlFragments[htmlFragments.length - 1] !== "br" && (line += "\n"); + htmlFragments = []; + } + + content += line; + line = ""; + }, + text: function (text) { + htmlFragments.push(text); + line += text; + } + }); + + // 去掉最后的换行符 + content = content.replace(/\n$/, ""); + + return content; + }, + + convertImage2Text: function (html) { + if (BI.isNull(html)) { + return html; + } + return html.replaceAll("", function (imageStr) { + var matched = imageStr.match(/alt="(.*?)"/); + var startHtml = ""; + var endHtml = ""; + return startHtml + (matched ? matched[1] : imageStr) + endHtml; + }); + }, + + isRichTextEqual: function (html1, html2) { + if (BI.isNotNull(html1)) { + html1 = this.convertImage2Text(html1); + } + if (BI.isNotNull(html2)) { + html2 = this.convertImage2Text(html2); + } + + return html1 === html2; + }, + + isRichTextNotEqual: function (html1, html2) { + return !this.isRichTextEqual(html1, html2); + }, + + isBlankRichText: function (html) { + html = html || ""; + html = this.convertRichText2Text(html); + return BI.trim(html).length === 0; + }, + + // 显示整个富文本中缺失的字段 + showMissingFields: function (html, validDimensionIds) { + var self = this; + + return html.replaceAll("", function (imageStr) { + var attrs = getImageAttr(imageStr); + return attrs && BI.contains(validDimensionIds, attrs[BICst.RICH_TEXT_INFO.DATA_ID]) + ? imageStr + : self.getMissingFieldImage( + attrs[BICst.RICH_TEXT_INFO.DATA_ID], + attrs[BICst.RICH_TEXT_INFO.DATA_NAME], + attrs[BICst.RICH_TEXT_INFO.ALT] + ); + }); + }, + + // 获取缺失元素的图片 + getMissingFieldImage: function (dId, name, fullName) { + var missingText = ""; + var missingImage = BI.DOM.getImage(missingText, "#ff0000"); + var html = this.getEditorParamImage(fullName, "#ff0000"); + + // 将原来的dId、name、fullName保存起来 + html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID, dId); + html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_NAME, name); + html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_FULL_NAME, fullName); + html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.SRC, missingImage.src, true); + // 标记出这个参数是一个“缺失元素” + html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_IS_MISSING_FIELD, "true", true); + html = this.appendImageAttr(html, fullName, "style", missingImage.style, true); + return html; + }, + + // 将“缺失元素”替换成原来的字段 + restoreMissingField: function (html) { + var self = this; + + return html.replaceAll("", function (imageStr) { + var attrs = getImageAttr(imageStr); + + if (attrs && attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID]) { + var fullName = attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_FULL_NAME]; + var image = self.getEditorParamImage(fullName); + + image = self.appendImageAttr(image, fullName, BICst.RICH_TEXT_INFO.DATA_ID, attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID]); + image = self.appendImageAttr(image, fullName, BICst.RICH_TEXT_INFO.DATA_NAME, attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_NAME]); + return image; + } + + if (attrs + && attrs[BICst.RICH_TEXT_INFO.DATA_IS_INSERT_PARAM] + && !attrs[BICst.RICH_TEXT_INFO.DATA_ID] + ) { + imageStr = self.appendImageAttr( + imageStr, + attrs[BICst.RICH_TEXT_INFO.ALT], + BICst.RICH_TEXT_INFO.DATA_UN_VALID, + "true", + true + ); + } + + return imageStr; + }); + }, + + // 将富文本字符串中由用户主动插入的字段参数标记出来 + markTheInsertParamImages: function (html) { + return html.replaceAll("", function (imageStr) { + var attrs = getImageAttr(imageStr); + + // "缺失元素"和普通的字段参数直接过滤(从富文本编辑器中插入的参数只有data-id属性) + if (BI.has(attrs, BICst.RICH_TEXT_INFO.DATA_NAME) + || BI.has(attrs, BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID)) { + return imageStr; + } + + attrs[BICst.RICH_TEXT_INFO.DATA_IS_INSERT_PARAM] = "true"; + imageStr = "", function (imageStr) { + var attrs = self.getImageAttr(imageStr); + // 已有src + if (BI.has(attrs, BICst.RICH_TEXT_INFO.SRC) && attrs[BICst.RICH_TEXT_INFO.SRC]) { + return imageStr; + } + var alt = self.decode(attrs[BICst.RICH_TEXT_INFO.ALT]); + var image = BI.DOM.getImage(alt); + imageStr = self.appendImageAttr(imageStr, alt, BICst.RICH_TEXT_INFO.SRC, image.src, true); + imageStr = self.appendImageAttr(imageStr, alt, "style", image.style, true); + return imageStr; + }); + }, + + isEmptyRichText: function (html) { + return "" === html.replaceAll("|

|
", ""); + }, + + // BI-23091 设置显示名之后更新参数名称 + getNewParamNameRichText: function (content) { + if (!content) { + return content; + } + var self = this; + return content.replaceAll("", function (imageStr) { + var attrs = self.getImageAttr(imageStr); + // 缺失元素 + if (attrs[BICst.RICH_TEXT_INFO.DATA_IS_MISSING_FIELD]) { + return imageStr; + } + var alt = attrs[BICst.RICH_TEXT_INFO.ALT], + dId = attrs[BICst.RICH_TEXT_INFO.DATA_ID], + name = BI.Utils.getNotGeoDimensionFullName(dId); + + if (name !== alt) { + imageStr = self.appendImageAttr(imageStr, alt, BICst.RICH_TEXT_INFO.ALT, name, true); + } + return imageStr; + }); + } + }); + + BI.service("bi.service.design.chart.common.editor", Service); + +}()); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js new file mode 100644 index 000000000..841860fc0 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js @@ -0,0 +1,114 @@ +!(function () { + var Widget = BI.inherit(BI.RichEditorParamAction, { + props: { + baseCls: "bi-design-chart-common-editor-insert-param", + dimensionIds: [], + editor: null + }, + + _store: function () { + return BI.Models.getModel("bi.model.design.chart.common.editor.insert_param"); + }, + + watch: { + isSelectedParam: function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + this.addParam(this.model.param, editorService.encode); + this.combo.hideView(); + // this._restorePosition(); + } + }, + + render: function () { + var self = this; + + var adapter = BI.createWidget({ + type: "bi.button_group", + items: this.model.items, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + behaviors: {}, + layouts: [{ + type: "bi.vertical" + }], + listeners: [{ + eventName: BI.ButtonGroup.EVENT_CHANGE, + action: function () { + self._savePosition(); + self.store.changeParam(this.getValue()[0]); + } + }] + }); + + var searchPopup = { + type: "bi.vertical", + cls: "bi-border", + hgap: 15, + tgap: 5, + bgap: 10, + items: [{ + type: "bi.searcher", + adapter: adapter, + width: 210, + height: 24, + listeners: [{ + eventName: BI.Searcher.EVENT_CHANGE, + action: function () { + self.store.changeParam(this.getValue()[0]); + } + }] + }, adapter] + }; + + return { + type: "bi.combo", + direction: "bottom,left", + isNeedAdjustWidth: false, + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.icon_change_button", + iconCls: "editor-insert-param-inactivated-font", + iconWidth: 24, + iconHeight: 24, + ref: function (_ref) { + self.iconButtonTrigger = _ref; + } + }] + }, + popup: { + el: searchPopup + }, + ref: function (_ref) { + self.combo = _ref; + }, + listeners: [{ + eventName: BI.Combo.EVENT_AFTER_POPUPVIEW, + action: function () { + self.iconButtonTrigger.setIcon("editor-insert-param-active-font"); + } + }, { + eventName: BI.Combo.EVENT_BEFORE_HIDEVIEW, + action: function () { + self.iconButtonTrigger.setIcon("editor-insert-param-inactivated-font"); + } + }] + }; + }, + + _savePosition: function () { + var instance = this._getInstance(); + instance.saveRng(); + }, + + _restorePosition: function () { + var instance = this._getInstance(); + instance.initSelection(); + }, + + _getInstance: function () { + return this.options.editor.selectedInstance || this.options.editor.getInstance(); + } + }); + + BI.shortcut("bi.design.chart.common.editor.insert_param", Widget); +}()); \ No newline at end of file diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js new file mode 100644 index 000000000..d0a8f084e --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js @@ -0,0 +1,40 @@ +/* + * @Maintainers: xiaofu.qin + */ +!(function () { + + var Model = BI.inherit(Fix.Model, { + context: ["dimensionIds"], + + state: function () { + return { + param: "", + isSelectedParam: false + }; + }, + + computed: { + items: function () { + return BI.map(this.model.dimensionIds, function (idx, dId) { + var key = BI.keys(dId)[0]; + + return { + type: "bi.design.chart.common.editor.search", + text: key, + value: dId[key] + }; + }); + } + }, + + actions: { + changeParam: function (param) { + this.model.isSelectedParam = !this.model.isSelectedParam; + this.model.param = param; + } + } + }); + + BI.model("bi.model.design.chart.common.editor.insert_param", Model); + +} ()); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/item/item.js b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/item/item.js new file mode 100644 index 000000000..bfd564441 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/item/item.js @@ -0,0 +1,38 @@ +!(function () { + + var Widget = BI.inherit(BI.BasicButton, { + props: { + text: "", + iconCls: "", + extraCls: "bi-list-item-active" + }, + + render: function () { + var o = this.options; + return { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.center_adapt", + cls: o.iconCls, + items: [{ + type: "bi.icon", + width: 16, + height: 16 + }], + width: 16, + height: 16 + }, { + type: "bi.label", + textAlign: "left", + lgap: 5, + text: o.text, + value: o.text + }] + }; + } + }); + + BI.shortcut("bi.design.chart.common.editor.search", Widget); + +}()); \ No newline at end of file diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/disabled_bar_wrapper.js b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/disabled_bar_wrapper.js new file mode 100644 index 000000000..5b07ea39f --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/disabled_bar_wrapper.js @@ -0,0 +1,22 @@ +/** + * 灰化toolbar的item + */ +!(function () { + + var Widget = BI.inherit(BI.Single, { + props: { + button: null + }, + + render: function () { + return { + type: "bi.vertical_adapt", + disabled: true, + items: [this.options.button] + }; + } + }); + + BI.shortcut("bi.design.chart.common.editor.toolbar.disabled_item_wrapper", Widget); + +}()); \ No newline at end of file diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.js b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.js new file mode 100644 index 000000000..4246ec9bc --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.js @@ -0,0 +1,124 @@ +!(function () { + var RichEditorTextToolbar = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-rich-editor-text-toolbar", + height: 25, + editor: null, + buttons: [ + {type: "bi.rich_editor_font_chooser"}, + {type: "bi.rich_editor_size_chooser"}, + {type: "bi.rich_editor_bold_button"}, + {type: "bi.rich_editor_italic_button"}, + {type: "bi.rich_editor_underline_button"}, + {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"} + ] + }, + + _store: function () { + return BI.Models.getModel("bi.model.design.chart.common.editor.toolbar"); + }, + + watch: { + isAuto: function (isAuto) { + this[isAuto ? "hideCustomFontTool" : "showCustomFontTool"](); + } + }, + + render: function () { + var self = this, + o = this.options; + + this.hasInsertCombo = o.buttons[o.buttons.length - 1].type === "bi.design.chart.common.editor.insert_param"; + + this.buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) { + return BI.extend(btn, { + editor: o.editor + }); + })); + + if (this.hasInsertCombo) { + var leftItems = BI.filter(this.buttons, function (idx) { + return idx !== self.buttons.length - 1; + }); + return { + type: "bi.left_right_vertical_adapt", + lrgap: 10, + items: { + left: this._getButtons(leftItems), + right: [this.buttons[this.buttons.length - 1]] + } + }; + } + + return { + type: "bi.vertical_adapt", + rgap: 10, + items: this._getButtons(this.buttons) + }; + }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + + this.model.isAuto && this.hideCustomFontTool(); + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() !== "input" && element.nodeName.toLowerCase() !== "textarea") { + element.setAttribute("unselectable", "on"); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + }, + + hideCustomFontTool: function () { + var self = this; + BI.each(this.buttons, function (idx, button) { + if (self.hasInsertCombo) { + idx !== self.buttons.length - 1 && button.setVisible(false); + } else { + button.setVisible(false); + } + }); + }, + + showCustomFontTool: function () { + var self = this; + BI.each(this.buttons, function (idx, button) { + if (self.hasInsertCombo) { + idx !== self.buttons.length - 1 && button.setVisible(true); + } else { + button.setVisible(true); + } + }); + }, + + _getButtons: function (buttons) { + return BI.map(buttons, function (idx, button) { + if (button.options.used === false) { + return { + type: "bi.design.chart.common.editor.toolbar.disabled_item_wrapper", + button: button, + title: button.options.title + }; + } + + return button; + }); + } + }); + + BI.shortcut("bi.design.chart.common.editor.toolbar", RichEditorTextToolbar); +})(); \ No newline at end of file diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.model.js b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.model.js new file mode 100644 index 000000000..96e30eee4 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.model.js @@ -0,0 +1,12 @@ +/* + * @Maintainers: xiaofu.qin + */ +!(function () { + + var Model = BI.inherit(Fix.Model, { + context: ["isAuto", "wId", "dimensionIds"] + }); + + BI.model("bi.model.design.chart.common.editor.toolbar", Model); + +} ()); \ No newline at end of file