Browse Source

Pull request #2565: CHART-16111 & CHART-16097 & CHART-16116 & CHART-15948 & CHART-16117 设计修改:富文本字符样式切换时不保留content 、柱形图选择富文本时,文本方向灰化、修改气泡图散点图标签HTMl组件、富文本编辑器增加默认内容

Merge in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit '0262fd4c7d9e3a6017441780468a44330617b1fa':
  CHART-16117 选择富文本编辑器时,不应设置dirty
  填充面板时更新初始参数
  CHART-15948 富文本编辑器默认内容
  CHART-16116 修改气泡图散点图标签HTMl组件
  CHART-16097 柱形图选择富文本时,文本方向灰化
  CHART-16111 富文本字符样式切换时不保留content
feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
0a131c2f63
  1. 2
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  2. 22
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  3. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
  4. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  5. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java
  6. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  7. 6
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  8. 10
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java
  9. 2
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  10. 3
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java
  11. 2
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java
  12. 2
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java
  13. 37
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  14. 2
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

2
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -308,6 +308,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
} }

22
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java

@ -1,6 +1,9 @@
package com.fr.van.chart.column; package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
@ -14,4 +17,23 @@ public class VanChartColumnPlotLabelDetailPane extends VanChartPlotLabelDetailPa
protected boolean hasLabelOrientationPane() { protected boolean hasLabelOrientationPane() {
return !((VanChartColumnPlot) this.getPlot()).isBar(); return !((VanChartColumnPlot) this.getPlot()).isBar();
} }
private void checkOrientationEnable(AttrLabelDetail detail) {
AttrTooltipContent content = detail.getContent();
UIButtonGroup<Integer> orientation = getOrientation();
if (orientation != null) {
orientation.setEnabled(content != null && !content.isRichText());
}
}
public void populate(AttrLabelDetail detail) {
super.populate(detail);
checkOrientationEnable(detail);
}
public void update(AttrLabelDetail detail) {
super.update(detail);
checkOrientationEnable(detail);
}
} }

21
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java

@ -69,18 +69,27 @@ public class VanChartRichEditorPane {
paramsStr.deleteCharAt(len - 1); paramsStr.deleteCharAt(len - 1);
} }
return new RichEditorModel(richText.getContent(), richText.isAuto(), paramsStr.toString()); String content = richText.getContent();
String initParams = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
}
return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams);
} }
public static class RichEditorModel { public static class RichEditorModel {
private String content; private String content;
private boolean auto; private boolean auto;
private String params; private String params;
private String initParams;
public RichEditorModel(String content, boolean auto, String params) { public RichEditorModel(String content, boolean auto, String params, String initParams) {
this.content = content; this.content = content;
this.auto = auto; this.auto = auto;
this.params = params; this.params = params;
this.initParams = initParams;
} }
public String getContent() { public String getContent() {
@ -106,5 +115,13 @@ public class VanChartRichEditorPane {
public void setParams(String params) { public void setParams(String params) {
this.params = params; this.params = params;
} }
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
} }
} }

15
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -12,9 +12,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; 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.CategoryNameFormatPaneWithoutCheckBox;
@ -604,7 +606,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if (!attrTooltipContent.isCommon()) { if (!(attrTooltipContent.isCommon() || attrTooltipContent.isRichText())) {
setDirty(false); setDirty(false);
} }
@ -683,6 +685,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
richText = new AttrTooltipRichText(); richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) { protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) {
@ -702,6 +706,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected void populateRichText(AttrTooltipRichText tooltipRichText) { protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) { if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
richText.setInitParamsContent(tooltipRichText.getInitParamsContent());
}
}
protected void checkRichEditorState(AttrTooltipContent attrTooltipContent) {
if (ComparatorUtils.equals(richText.getInitParamsContent(), StringUtils.EMPTY)) {
richText.setContent(attrTooltipContent.getRichTextDefaultContent());
richText.setInitParamsContent(attrTooltipContent.getRichTextDefaultParams());
} }
} }
@ -793,6 +805,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
if (attrTooltipContent != null) { if (attrTooltipContent != null) {
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr(); AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr();
tooltipRichText.setContent(richText.getContent()); tooltipRichText.setContent(richText.getContent());
tooltipRichText.setInitParamsContent(richText.getInitParamsContent());
tooltipRichText.setAuto(richText.isAuto()); tooltipRichText.setAuto(richText.isAuto());
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java

@ -57,5 +57,7 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane
setRichTextAttr(new AttrTooltipRichText()); setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -88,6 +88,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return plot; return plot;
} }
public UIButtonGroup<Integer> getOrientation() {
return orientation;
}
//默认从factory中取 //默认从factory中取
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this); dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this);

6
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java

@ -77,13 +77,19 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane {
setRichTextAttr(new AttrTooltipRichText()); setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.getCategoryFormat().setEnable(false); attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.getRichTextCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
return attrTooltipContent; return attrTooltipContent;
} }

10
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java

@ -77,15 +77,23 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane
setRichTextAttr(new AttrTooltipRichText()); setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); AttrTooltipContent attrTooltipContent = new AttrTooltipContent();
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat()); attrTooltipContent.setRichTextSeriesFormat(new AttrTooltipNameFormat());
attrTooltipContent.getCategoryFormat().setEnable(false);
attrTooltipContent.getSeriesFormat().setEnable(true); attrTooltipContent.getSeriesFormat().setEnable(true);
attrTooltipContent.getValueFormat().setEnable(true); attrTooltipContent.getValueFormat().setEnable(true);
attrTooltipContent.getRichTextCategoryFormat().setEnable(false);
attrTooltipContent.getRichTextSeriesFormat().setEnable(true);
attrTooltipContent.getRichTextValueFormat().setEnable(true);
return attrTooltipContent; return attrTooltipContent;
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java

@ -167,6 +167,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs()); richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs());
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.scatter; package com.fr.van.chart.scatter;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPaneWithBackGroundLabel;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -17,7 +18,7 @@ public class VanChartScatterLabelContentPane extends VanChartScatterTooltipCont
@Override @Override
protected VanChartHtmlLabelPane createHtmlLabelPane() { protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane(); return new VanChartHtmlLabelPaneWithBackGroundLabel();
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java

@ -128,6 +128,8 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
setRichTextAttr(new AttrTooltipRichText()); setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java

@ -106,6 +106,8 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP
setRichTextAttr(new AttrTooltipRichText()); setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
} }
@Override @Override

37
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -40,6 +40,7 @@
var content = Pool.data.getContent(); var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto(); var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams(); var params = Pool.data.getParams();
var initParams = Pool.data.getInitParams();
var getDimensionIds = function (params) { var getDimensionIds = function (params) {
var result = []; var result = [];
@ -57,8 +58,29 @@
return result; return result;
} }
var getInitContent = function (params, initParams) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var paramGroup = params.split("-");
content = "";
for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":");
if (initParams.indexOf(value) > -1) {
content += '<p style="text-align: center;">' + editorService.getEditorParamImage(key) + '<br></p>';
}
}
return content;
}
var dimensionIds = getDimensionIds(params); var dimensionIds = getDimensionIds(params);
if (initParams) {
content = getInitContent(params, initParams);
}
var rich_editor = BI.createWidget({ var rich_editor = BI.createWidget({
type: "bi.design.chart.common.editor", type: "bi.design.chart.common.editor",
element: "body", element: "body",
@ -92,10 +114,19 @@
}); });
Pool.dispatch = function () { Pool.dispatch = function () {
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var initParams = Pool.data.getInitParams();
if (initParams) {
content = getInitContent(params, initParams);
}
rich_editor.setValue({ rich_editor.setValue({
content: Pool.data.getContent(), content: content,
isAuto: Pool.data.isAuto(), isAuto: isAuto,
dimensionIds: getDimensionIds(Pool.data.getParams()) dimensionIds: getDimensionIds(params)
}); });
} }

2
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -232,7 +232,7 @@
content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE), content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE),
origin = content; origin = content;
if (isAuto) { if (isAuto) {
// content = this._switchToAutoStyle(); content = this._switchToAutoStyle();
this.setFocus(); this.setFocus();
} else if (editorService.isRichTextEqual(content, this.options.placeholder)) { } else if (editorService.isRichTextEqual(content, this.options.placeholder)) {
content = ""; content = "";

Loading…
Cancel
Save