Browse Source

Merge pull request #3545 in DESIGN/design from feature/10.0 to feature/x

* commit '8276c47ce9a41abb0e2a9d6b2a58de6c28346619':
  修改富文本编辑器界面
  merge code
  CHART-18070 富文本新增字段支持组合图
  CHART-18182 代码结构调整
  CHART-18055 修改新增字段汇总方式默认值
  CHART-18127 修改富文本参数分隔符
  REPORT-47453 和产品商量一下,控件编辑行默认不开启颜色
  CHART-18182 模糊匹配方法移动到平台 & CHART-18190 点地图透明度控件
  REPORT-47797 本地和远程工程切换,日志有两个插件的报错 【问题原因】有些插件只用了_normal和_selected两种图标,没有使用_disabled图标,但是之前的逻辑没有对资源是否存在进行判断,会导致IOUtils中输出错误日志 【改动思路】添加判断;把适配插件的逻辑抽取一下
research/11.0
superman 4 years ago
parent
commit
dd1c995c42
  1. 16
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  3. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  4. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  5. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java
  6. 21
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  7. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  8. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java
  9. 11
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  10. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  11. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  12. 39
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  13. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  14. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java
  15. 2
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  16. 34
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  17. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  18. 2
      designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

16
designer-base/src/main/java/com/fr/base/svg/IconUtils.java

@ -38,9 +38,8 @@ public class IconUtils {
if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource);
}
// 适配某些插件里是_normal.png、_selected.png的情况
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
return IOUtils.readIcon(pngResource);
// 适配插件
return adjustPluginsPng(resource);
}
return IOUtils.readIcon(resource);
}
@ -48,6 +47,17 @@ public class IconUtils {
return readNoSuffixResource(resource, ICON_TYPE_NORMAL);
}
/**
* 适配插件中使用_normal.png_selected.png_disabled.png的情况
* @param resource 图片路径
* @return Icon
*/
private static Icon adjustPluginsPng(String resource) {
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
// 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错
return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource);
}
/**
* 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon
* @param resource 图片路径

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

@ -6,6 +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.GEOMatchHelper;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
@ -21,7 +22,6 @@ import com.fr.general.GeneralUtils;
import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
private void populateMatchData(Object[] columnData) {
Set<String> geoAreas = matchAreaTable.getItems();
Map<String, String> resultMap = ChartGEOJSONHelper.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,8 +1,8 @@
package com.fr.design.chartx.component;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable {
return;
}
int index = areaNameIndex.get(areaName);
String result = ChartGEOJSONHelper.matchArea(GeneralUtils.objectToString(areaName), items);
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);

2
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -443,7 +443,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//不透明度
private JPanel createPointAlphaPane() {
pointAlphaPane = new UINumberDragPane(0, 100);
pointAlphaPane = new UINumberDragPaneWithPercent(0, 100);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane);
}

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