Browse Source

Pull request #3550: CHART-18070 & CHART-18139 & CHART-18092 & CHART-18060 & CHART-18058 调整富文本增加字段交互效果、富文本新增字段支持组合图

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

* commit '9ae87be65372a77383a0b6ada37701bfbcf15ca0':
  修改富文本编辑器界面
  merge code
  CHART-18070 富文本新增字段支持组合图
feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
68cad33863
  1. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  2. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java
  3. 21
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  4. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  5. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java
  6. 11
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  7. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  8. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  9. 35
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  10. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  11. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java
  12. 30
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  13. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java

@ -111,7 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
interactivePane.populateBean(chart); interactivePane.populateBean(chart);
if (ChartOtherPane.this.isHaveCondition()) { if (ChartOtherPane.this.isHaveCondition()) {
VanChartRichEditorPane.refreshFieldNames(chart); VanChartRichEditorPane.refreshCommonChartFieldNames(chart);
conditionAttrPane.populateBean(chart); conditionAttrPane.populateBean(chart);
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java

@ -39,7 +39,9 @@ public class VanChartCustomConditionAttrPane extends BasicScrollPane<Chart> {
layoutContentPane(); layoutContentPane();
} }
if(conditionAttrPane != null) { if(conditionAttrPane != null) {
conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot()); conditionAttrPane.setChart(chart);
conditionAttrPane.populateBean(chart.getPlot());
conditionAttrPane.tabChanged();
} }
} }

21
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java

@ -1,11 +1,13 @@
package com.fr.van.chart.custom.other; package com.fr.van.chart.custom.other;
import com.fr.chart.chartattr.Chart;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane; import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.other.VanChartConditionAttrPane; import com.fr.van.chart.designer.other.VanChartConditionAttrPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -16,10 +18,17 @@ import java.util.List;
* Created by Fangjie on 2016/4/28. * Created by Fangjie on 2016/4/28.
*/ */
public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> {
private Chart chart;
public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) {
super(plot, parent); super(plot, parent);
} }
public void setChart(Chart chart) {
this.chart = chart;
}
@Override @Override
protected void initTabTitle() { protected void initTabTitle() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); List<VanChartPlot> customPlotList = plot.getCustomPlotList();
@ -73,6 +82,18 @@ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTa
} }
} }
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType);
}
}
@Override @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; return null;

15
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java

@ -68,6 +68,21 @@ public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane<Va
} }
} }
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane)paneList.get(index);
VanChartCustomStylePane stylePane = (VanChartCustomStylePane)labelPane.getParentPane();
if (stylePane != null) {
stylePane.refreshTableFieldNames(chartPlot);
}
}
}
@Override @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; return null;

15
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java

@ -67,6 +67,21 @@ public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane<
} }
} }
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane)paneList.get(index);
VanChartCustomStylePane stylePane = (VanChartCustomStylePane)tooltipPane.getParentPane();
if (stylePane != null) {
stylePane.refreshTableFieldNames(chartPlot);
}
}
}
@Override @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; return null;

11
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java

@ -5,8 +5,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import java.util.List; import java.util.List;
@ -68,4 +71,12 @@ public class VanChartCustomStylePane extends VanChartStylePane {
CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot());
} }
public void refreshTableFieldNames(VanChartPlot plot) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(plot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType);
}
public void refreshTableFieldNames() {
}
} }

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

@ -28,7 +28,7 @@ public class VanChartFieldButton extends JPanel {
private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png");
private static final int W = 200; private static final int W = 200;
private static final int H = 28; private static final int H = 24;
private final String fieldName; private final String fieldName;
private final String fieldId; private final String fieldId;
@ -146,6 +146,9 @@ public class VanChartFieldButton extends JPanel {
listener.addSelectedField(fieldName, fieldId); listener.addSelectedField(fieldName, fieldId);
} }
}); });
fieldButton.setBorderPaintedOnlyWhenPressed(true);
addButton.setBorderPaintedOnlyWhenPressed(true);
} }
private JPanel getContentPane() { private JPanel getContentPane() {
@ -160,7 +163,7 @@ public class VanChartFieldButton extends JPanel {
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {e, d}; double[] columnSize = {e, d};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0);
content.setPreferredSize(new Dimension(W, H)); content.setPreferredSize(new Dimension(W, H));
return content; return content;

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java

@ -114,7 +114,7 @@ public class VanChartFieldListPane extends JPanel {
addDefaultFieldButton(fieldPane); addDefaultFieldButton(fieldPane);
fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H));
fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); fieldPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0));
return fieldPane; return fieldPane;
} }

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

@ -16,6 +16,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
@ -48,21 +50,46 @@ public class VanChartRichEditorPane {
return fieldNames; return fieldNames;
} }
public static void refreshFieldNames(Chart chart) { // 更新普通图表中指定plot的数据集字段
VanChartRichEditorPane.fieldNames = null; public static void refreshCommonChartFieldNames(Chart chart) {
if (chart == null) { if (chart == null) {
return; return;
} }
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) { if (plot == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
if (!PlotFactory.plotSupportAddTableField(plot)) {
return; return;
} }
TopDefinitionProvider definition = chart.getFilterDefinition(); TopDefinitionProvider definition = chart.getFilterDefinition();
VanChartRichEditorPane.refreshFieldNames(definition);
}
// 更新组合图表中指定plot的数据集字段
public static void refreshCustomChartTableFieldNames(Chart chart, CustomPlotType plotType) {
if (chart == null || plotType == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
TopDefinitionProvider filterDefinition = chart.getFilterDefinition();
if (filterDefinition instanceof CustomDefinition) {
CustomDefinition customDefinition = (CustomDefinition) filterDefinition;
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = customDefinition.getDefinitionProviderMap();
VanChartRichEditorPane.refreshFieldNames(definitionProviderMap.get(plotType));
}
}
// 更新富文本数据集字段
public static void refreshFieldNames(TopDefinitionProvider definition) {
if (definition == null) { if (definition == null) {
return; return;
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java

@ -78,6 +78,6 @@ public class VanChartStylePane extends ChartStylePane {
} }
public void refreshTableFieldNames() { public void refreshTableFieldNames() {
VanChartRichEditorPane.refreshFieldNames(getChart()); VanChartRichEditorPane.refreshCommonChartFieldNames(getChart());
} }
} }

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

@ -98,6 +98,9 @@ public class VanChartPlotTooltipPane extends BasicPane {
return components; return components;
} }
public VanChartStylePane getParentPane() {
return parent;
}
protected void initTooltipContentPane(Plot plot){ protected void initTooltipContentPane(Plot plot){
tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this); tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this);

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

@ -26,6 +26,8 @@
var initParams = Pool.data.getInitParams(); var initParams = Pool.data.getInitParams();
var align = Pool.data.getAlign(); var align = Pool.data.getAlign();
var insert_param;
var getDimensionIds = function (params) { var getDimensionIds = function (params) {
var result = []; var result = [];
var paramGroup = params.split("|"); var paramGroup = params.split("|");
@ -88,7 +90,13 @@
{type: "bi.rich_editor_color_chooser"}, {type: "bi.rich_editor_color_chooser"},
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"} {type: "bi.rich_editor_align_right_button"},
{
type: "bi.design.chart.common.editor.insert_param",
ref: function (_ref) {
insert_param = _ref;
}
}
] ]
}, },
ref: function (_ref) { ref: function (_ref) {
@ -119,27 +127,11 @@
}; };
Pool.addField = function () { Pool.addField = function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var addition = Pool.data.getAddition(); var addition = Pool.data.getAddition();
if (addition) { if (addition && insert_param) {
// todo 暂时先处理成在content后加一行 insert_param.selectedParam(addition);
content += '<p style="text-align:' + align + ';">' + editorService.getEditorParamImage(addition) + '<br></p>';
} }
rich_editor.editor.bindToolbar(rich_editor.bar);
rich_editor.setValue({
content: content,
isAuto: isAuto,
dimensionIds: getDimensionIds(params)
});
rich_editor.setFocus();
}; };
Pool.update = function () { Pool.update = function () {

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

@ -54,6 +54,7 @@
type: "bi.combo", type: "bi.combo",
direction: "bottom,left", direction: "bottom,left",
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
invisible: true,
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
items: [{ items: [{
@ -99,6 +100,11 @@
_getInstance: function () { _getInstance: function () {
return this.options.editor.selectedInstance || this.options.editor.getInstance(); return this.options.editor.selectedInstance || this.options.editor.getInstance();
},
selectedParam: function (param) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
this.addParam(param, editorService.encode);
} }
}); });

Loading…
Cancel
Save