Browse Source

Merge pull request #3562 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit 'd0bf8ed4e4f4e1f3f00ad9ceef41b96039b5e06c':
  修改富文本编辑器界面
  merge code
  CHART-18070 富文本新增字段支持组合图
  CHART-18182 代码结构调整
  CHART-18055 修改新增字段汇总方式默认值
  CHART-18127 修改富文本参数分隔符
  REPORT-47453 和产品商量一下,控件编辑行默认不开启颜色
feature/10.0
superman 4 years ago
parent
commit
8276c47ce9
  1. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  2. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  3. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  4. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java
  5. 21
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  6. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  7. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java
  8. 11
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  9. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  10. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  11. 39
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  12. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  13. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java
  14. 34
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  15. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  16. 2
      designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

4
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -6,7 +6,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameTableData;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
private void populateMatchData(Object[] columnData) {
Set<String> geoAreas = matchAreaTable.getItems();
Map<String, String> resultMap = GEOJSONHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult());
Map<String, String> resultMap = GEOMatchHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult());
Object[][] data = new Object[resultMap.size()][2];

4
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -1,6 +1,6 @@
package com.fr.design.chartx.component;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable {
return;
}
int index = areaNameIndex.get(areaName);
String result = GEOJSONHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>());
String result = GEOMatchHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>());
getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, index, 1);
}

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) {
interactivePane.populateBean(chart);
if (ChartOtherPane.this.isHaveCondition()) {
VanChartRichEditorPane.refreshFieldNames(chart);
VanChartRichEditorPane.refreshCommonChartFieldNames(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();
}
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;
import com.fr.chart.chartattr.Chart;
import com.fr.design.dialog.BasicPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
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 javax.swing.JPanel;
@ -16,10 +18,17 @@ import java.util.List;
* Created by Fangjie on 2016/4/28.
*/
public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> {
private Chart chart;
public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) {
super(plot, parent);
}
public void setChart(Chart chart) {
this.chart = chart;
}
@Override
protected void initTabTitle() {
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
public VanChartCustomPlot updateBean() {
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
public VanChartCustomPlot updateBean() {
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
public VanChartCustomPlot updateBean() {
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.mainframe.chart.gui.style.series.ChartSeriesPane;
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.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 java.util.List;
@ -68,4 +71,12 @@ public class VanChartCustomStylePane extends VanChartStylePane {
CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot());
}
public void refreshTableFieldNames(VanChartPlot plot) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(plot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType);
}
public void refreshTableFieldNames() {
}
}

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

@ -2,11 +2,11 @@ package com.fr.van.chart.designer.component.richText;
import com.fr.base.BaseUtils;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.FirstFunction;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
@ -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 int W = 200;
private static final int H = 28;
private static final int H = 24;
private final String fieldName;
private final String fieldId;
@ -40,7 +40,7 @@ public class VanChartFieldButton extends JPanel {
private UIToggleButton fieldButton;
private UIButton addButton;
private DataFunction dataFunction = new NoneFunction();
private DataFunction dataFunction = new FirstFunction();
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) {
this(fieldName, format, false, false, listener);
@ -146,6 +146,9 @@ public class VanChartFieldButton extends JPanel {
listener.addSelectedField(fieldName, fieldId);
}
});
fieldButton.setBorderPaintedOnlyWhenPressed(true);
addButton.setBorderPaintedOnlyWhenPressed(true);
}
private JPanel getContentPane() {
@ -160,7 +163,7 @@ public class VanChartFieldButton extends JPanel {
double[] rowSize = {p};
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));
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);
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;
}

39
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.log.FineLoggerFactory;
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.stable.StringUtils;
import com.fr.van.chart.designer.PlotFactory;
@ -30,6 +32,8 @@ import java.util.Map;
public class VanChartRichEditorPane {
private static final String PARAMS_SPLITTER = "|";
private static final String NAME_SPACE = "Pool";
private static final String VARIABLE = "data";
@ -46,21 +50,46 @@ public class VanChartRichEditorPane {
return fieldNames;
}
public static void refreshFieldNames(Chart chart) {
VanChartRichEditorPane.fieldNames = null;
// 更新普通图表中指定plot的数据集字段
public static void refreshCommonChartFieldNames(Chart chart) {
if (chart == null) {
return;
}
Plot plot = chart.getPlot();
if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) {
if (plot == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
if (!PlotFactory.plotSupportAddTableField(plot)) {
return;
}
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) {
return;
}
@ -163,7 +192,7 @@ public class VanChartRichEditorPane {
if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append("-");
paramsStr.append(PARAMS_SPLITTER);
}
}

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() {
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;
}
public VanChartStylePane getParentPane() {
return parent;
}
protected void initTooltipContentPane(Plot plot){
tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this);

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

@ -26,9 +26,11 @@
var initParams = Pool.data.getInitParams();
var align = Pool.data.getAlign();
var insert_param;
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(":");
@ -44,7 +46,7 @@
var getInitContent = function (params, initParams, align) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var paramGroup = params.split("-");
var paramGroup = params.split("|");
content = "";
@ -88,7 +90,13 @@
{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.rich_editor_align_right_button"},
{
type: "bi.design.chart.common.editor.insert_param",
ref: function (_ref) {
insert_param = _ref;
}
}
]
},
ref: function (_ref) {
@ -119,27 +127,11 @@
};
Pool.addField = function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var addition = Pool.data.getAddition();
if (addition) {
// todo 暂时先处理成在content后加一行
content += '<p style="text-align:' + align + ';">' + editorService.getEditorParamImage(addition) + '<br></p>';
if (addition && insert_param) {
insert_param.selectedParam(addition);
}
rich_editor.editor.bindToolbar(rich_editor.bar);
rich_editor.setValue({
content: content,
isAuto: isAuto,
dimensionIds: getDimensionIds(params)
});
rich_editor.setFocus();
};
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",
direction: "bottom,left",
isNeedAdjustWidth: true,
invisible: true,
el: {
type: "bi.vertical_adapt",
items: [{
@ -99,6 +100,11 @@
_getInstance: function () {
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);
}
});

2
designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

@ -74,7 +74,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
northPane.add(GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT));
colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":");
colorBox.setSelected(true);
colorBox.setSelected(false);
colorBox.addActionListener(colorListener);
colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"));
northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT));

Loading…
Cancel
Save