Browse Source

CHART-15975 富文本编辑器populate时更新参数

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
f43a5f0d91
  1. 2
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  2. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  3. 3
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  4. 27
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  5. 3
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  6. 4
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  7. 9
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

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

@ -5,6 +5,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
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.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
@ -276,6 +277,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams(); Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat(); AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();

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

@ -195,6 +195,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return richText; return richText;
} }
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
}
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
initDetailPane(); initDetailPane();
initCenterPane(); initCenterPane();
@ -583,6 +587,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.getRichTextChangedPercentFormat() attrTooltipContent.getRichTextChangedPercentFormat()
}; };
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup); populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr()); populateRichText(attrTooltipContent.getRichTextAttr());
} }

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

@ -2,6 +2,7 @@ package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
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.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat;
@ -136,6 +137,8 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent){ if(attrTooltipContent instanceof AttrGanttTooltipContent){
setRichTextAttr(new AttrTooltipRichText());
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
Map<String, String> params = getRichTextAttr().getParams(); Map<String, String> params = getRichTextAttr().getParams();

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

@ -41,19 +41,24 @@
var isAuto = Pool.data.isAuto(); var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams(); var params = Pool.data.getParams();
var dimensionIds = []; var getDimensionIds = function (params) {
var result = [];
var paramGroup = params.split("-");
var paramGroup = params.split("-"); for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":");
var param = {};
for (var i = 0, len = paramGroup.length; i < len; i++) { param[key] = value;
var [key, value] = paramGroup[i].split(":");
var param = {};
param[key] = value; result.push(param);
}
dimensionIds.push(param); return result;
} }
var dimensionIds = getDimensionIds(params);
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",
@ -86,8 +91,12 @@
} }
}); });
Pool.dispatch = function(){ Pool.dispatch = function () {
rich_editor.setValue({content: Pool.data.getContent(), isAuto: Pool.data.isAuto()}); rich_editor.setValue({
content: Pool.data.getContent(),
isAuto: Pool.data.isAuto(),
dimensionIds: getDimensionIds(Pool.data.getParams())
});
} }
Pool.update = function () { Pool.update = function () {

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

@ -170,6 +170,9 @@
this.store.changeIsAuto(obj.isAuto); this.store.changeIsAuto(obj.isAuto);
this.fontStyleGroup.setValue(obj.isAuto); this.fontStyleGroup.setValue(obj.isAuto);
} }
if (BI.contains(keys, "dimensionIds")) {
this.store.changeDimensionIds(obj.dimensionIds);
}
}, },
_formatContent: function (content) { _formatContent: function (content) {

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

@ -42,6 +42,10 @@
this.model.isAuto = isAuto; this.model.isAuto = isAuto;
}, },
changeDimensionIds: function (dimensionIds) {
this.model.dimensionIds = dimensionIds;
},
setEditorBlurState: function (isBlur) { setEditorBlurState: function (isBlur) {
this.model.isEditorBlur = isBlur; this.model.isEditorBlur = isBlur;
} }

9
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

@ -16,13 +16,16 @@
this.addParam(this.model.param, editorService.encode); this.addParam(this.model.param, editorService.encode);
this.combo.hideView(); this.combo.hideView();
// this._restorePosition(); // this._restorePosition();
},
items: function () {
this.adapter.populate(this.model.items);
} }
}, },
render: function () { render: function () {
var self = this; var self = this;
var adapter = BI.createWidget({ this.adapter = BI.createWidget({
type: "bi.button_group", type: "bi.button_group",
items: this.model.items, items: this.model.items,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
@ -47,7 +50,7 @@
bgap: 10, bgap: 10,
items: [{ items: [{
type: "bi.searcher", type: "bi.searcher",
adapter: adapter, adapter: this.adapter,
width: 210, width: 210,
height: 24, height: 24,
listeners: [{ listeners: [{
@ -56,7 +59,7 @@
self.store.changeParam(this.getValue()[0]); self.store.changeParam(this.getValue()[0]);
} }
}] }]
}, adapter] }, this.adapter]
}; };
return { return {

Loading…
Cancel
Save