Browse Source

Merge pull request #2400 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'f35223e4e6bdec6e3d24240e12bb65831764b956':
  REPORT-40025 修改在已选择组件中按坐标获取组件的逻辑
  REPORT-40025 修改在已选择组件中按坐标获取组件的逻辑
  CHART-15518 轴数量控制到20个
  备注待修改的属性
  补充遗漏的参数
  修改字符样式属性
  完善散点图、箱型图数据点提示
  REPORT-40094 【回归】远程切换回本地,网页框控件不显示
  REPORT-39601 在单元格中插入 富文本。 字体设置为14的时候,自动给我变成13了
  REPORT-39884 换一个改动方案
  REPORT-40154 设计器共享数据集缓存到磁盘记录数输入框太短 1. bug原因:之前的UISpinner中的数字框默认的columns只有2,所以当输入数字超过三位数时,会显示不全 2. 修改方案:与产品及交互确认后,为UISpinner添加一种构造方法,可以指定其数字框的columns,将MaxMemRowCountPanel中的UISpinner的columns设置为4,即可以最多展示5位数
  REPORT-39965 新建聚合报表下方没有添加普通报表的按钮
  完善甘特图标签和提示
  修改标签
  修改属性
  CHART-15510 调整富文本标签和数据点提示界面
  CHART-15840 图表第一次加载慢
bugfix/10.0
superman 4 years ago
parent
commit
b2a10c737b
  1. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  2. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  4. 176
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  5. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  6. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  7. 295
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  8. 37
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java
  9. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
  10. 561
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  11. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithoutCheckBox.java
  12. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/ChangedPercentFormatPaneWithoutCheckBox.java
  13. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/ChangedValueFormatPaneWithoutCheckBox.java
  14. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/MapAreaNameFormatPaneWithoutCheckBox.java
  15. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/PercentFormatPaneWithoutCheckBox.java
  16. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SeriesNameFormatPaneWithoutCheckBox.java
  17. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/ValueFormatPaneWithoutCheckBox.java
  18. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java
  19. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithoutCheckBox.java
  20. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/XFormatPaneWithoutCheckBox.java
  21. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/YFormatPaneWithoutCheckBox.java
  22. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java
  23. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithCate.java
  24. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithCateValue.java
  25. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithOutCate.java
  26. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithPercent.java
  27. 34
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java
  28. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java
  29. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  30. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  31. 30
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  32. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java
  33. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java
  34. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  35. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelNoCheckPane.java
  36. 41
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java
  37. 1
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java
  38. 50
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java
  39. 18
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/FunnelPercentFormatPaneWithoutCheckBox.java
  40. 34
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  41. 34
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java
  42. 33
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java
  43. 20
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttLabelContentPane.java
  44. 121
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java
  45. 16
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelDetailPane.java
  46. 20
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelPane.java
  47. 18
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartDateFormatPaneWithCheckBox.java
  48. 18
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartDateFormatPaneWithoutCheckBox.java
  49. 100
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java
  50. 8
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithoutCheckBox.java
  51. 204
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java
  52. 20
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  53. 42
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java
  54. 20
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java
  55. 17
      designer-chart/src/main/java/com/fr/van/chart/map/line/StartAndEndNameFormatPaneWithoutCheckBox.java
  56. 19
      designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java
  57. 18
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieLevelNameFormatPaneWithoutCheckBox.java
  58. 18
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieSeriesNameFormatPaneWithoutCheckBox.java
  59. 18
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java
  60. 18
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java
  61. 37
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java
  62. 75
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java
  63. 82
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java
  64. 2
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java
  65. 6
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelNoCheckPane.java
  66. 5
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java
  67. 28
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureLabelContentPane.java
  68. 16
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructurePlotLabelDetailPane.java
  69. 20
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructurePlotLabelPane.java
  70. 48
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java
  71. 61
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java
  72. 79
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java
  73. 47
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java
  74. 48
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java
  75. 103
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  76. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.constant.js
  77. 241
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  78. 53
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  79. 562
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.service.js
  80. 114
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  81. 40
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js
  82. 38
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/item/item.js
  83. 22
      designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/disabled_bar_wrapper.js
  84. 124
      designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.js
  85. 12
      designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/toolbar.model.js
  86. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  87. 59
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  88. 5
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  89. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java
  90. 14
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  91. 43
      designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java
  92. 69
      designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -72,7 +72,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setBackground(UIConstants.NORMAL_BACKGROUND);
switchCache = new UIComboBox(CACHE_LIST); switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL); switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 4);
} }
private void showAllPanel() { private void showAllPanel() {

26
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -30,6 +30,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private static final int LEN = 13; private static final int LEN = 13;
private static final int WIDTH = 13; private static final int WIDTH = 13;
private static final int HEIGHT = 10; private static final int HEIGHT = 10;
private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2;
private UINumberField textField; private UINumberField textField;
private UIButton preButton; private UIButton preButton;
private UIButton nextButton; private UIButton nextButton;
@ -40,9 +41,26 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false; private boolean lessMinValue = false;
/**
* Spinner内的数字文本框长度
*/
private int numberFieldColumns;
public UISpinner(double minValue, double maxValue, double dierta) { public UISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
}
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
init(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
public UISpinner(double minValue, double maxValue, double dierta, int numberFieldColumns) {
this.numberFieldColumns = numberFieldColumns;
init(minValue, maxValue, dierta);
}
private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
this.dierta = dierta; this.dierta = dierta;
@ -50,11 +68,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
iniListener(); iniListener();
} }
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
this(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void iniListener() { private void iniListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@ -308,7 +321,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
} }
protected UINumberField initNumberField() { protected UINumberField initNumberField() {
return new UINumberField(2) { int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns;
return new UINumberField(columns) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }

5
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -511,7 +511,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
propertyItemMap.get(key).replaceContentPane(pane); PropertyItem item = propertyItemMap.get(key);
if (item != null) {
item.replaceContentPane(pane);
}
} }
}); });
} }

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

@ -1,19 +1,28 @@
package com.fr.van.chart.box; package com.fr.van.chart.box;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; 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.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
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.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.util.Map;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
@ -27,6 +36,14 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox min; private VanChartFormatPaneWithCheckBox min;
private VanChartFormatPaneWithCheckBox outlier; private VanChartFormatPaneWithCheckBox outlier;
private VanChartFormatPaneWithoutCheckBox richTextNumber;
private VanChartFormatPaneWithoutCheckBox richTextMax;
private VanChartFormatPaneWithoutCheckBox richTextQ3;
private VanChartFormatPaneWithoutCheckBox richTextMedian;
private VanChartFormatPaneWithoutCheckBox richTextQ1;
private VanChartFormatPaneWithoutCheckBox richTextMin;
private VanChartFormatPaneWithoutCheckBox richTextOutlier;
private JPanel dataNumberPane; private JPanel dataNumberPane;
private JPanel dataOutlierPane; private JPanel dataOutlierPane;
@ -36,8 +53,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() { protected String getCheckBoxText() {
@ -76,7 +93,48 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}; };
} }
protected JPanel createCommonPanel() { protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
richTextNumber = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Number");
}
};
richTextMax = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Max_Value");
}
};
richTextQ3 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q3");
}
};
richTextMedian = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Median");
}
};
richTextQ1 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q1");
}
};
richTextMin = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Min_Value");
}
};
richTextOutlier = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Outlier_Value");
}
};
}
protected JPanel createCommonFormatPanel() {
JPanel commonPanel = new JPanel(new BorderLayout()); JPanel commonPanel = new JPanel(new BorderLayout());
commonPanel.add(createCateAndSeriesPane(), BorderLayout.NORTH); commonPanel.add(createCateAndSeriesPane(), BorderLayout.NORTH);
@ -86,6 +144,20 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return commonPanel; return commonPanel;
} }
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextNumber, null},
new Component[]{richTextMax, null},
new Component[]{richTextQ3, null},
new Component[]{richTextMedian, null},
new Component[]{richTextQ1, null},
new Component[]{richTextMin, null},
new Component[]{richTextOutlier, null}
};
}
protected double[] getRowSize(double p) { protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p, p, p, p, p, p, p}; return new double[]{p, p, p, p, p, p, p, p, p, p, p, p};
} }
@ -93,13 +165,15 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createCateAndSeriesPane() { private JPanel createCateAndSeriesPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p}; double[] columnSize = {f, e};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
Component[][] cateAndSeries = new Component[][]{ Component[][] cateAndSeries = new Component[][]{
new Component[]{categoryNameFormatPane, null}, new Component[]{null, null},
new Component[]{seriesNameFormatPane, null} new Component[]{null, getCategoryNameFormatPane()},
new Component[]{null, getSeriesNameFormatPane()}
}; };
return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize);
@ -108,13 +182,14 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createDataNumberPane() { private JPanel createDataNumberPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p}; double[] columnSize = {f, e};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] dataNumber = new Component[][]{ Component[][] dataNumber = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{number, null}, new Component[]{null, number},
}; };
dataNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize); dataNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize);
@ -125,22 +200,24 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel createDataDetailPane() { private JPanel createDataDetailPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f, p}; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
JPanel detailPane = new JPanel(new BorderLayout()); JPanel detailPane = new JPanel(new BorderLayout());
Component[][] dataDetail = new Component[][]{ Component[][] dataDetail = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{max, null}, new Component[]{null, max},
new Component[]{q3, null}, new Component[]{new UILabel(getLabelContentTitle()), q3},
new Component[]{median, null}, new Component[]{null, median},
new Component[]{q1, null}, new Component[]{null, q1},
new Component[]{min, null} new Component[]{null, min}
}; };
Component[][] dataOutlier = new Component[][]{ Component[][] dataOutlier = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{outlier, null}, new Component[]{null, outlier},
}; };
dataOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize); dataOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize);
@ -152,8 +229,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
public boolean isDirty() { public boolean isDirty() {
return categoryNameFormatPane.isDirty() return getCategoryNameFormatPane().isDirty()
|| seriesNameFormatPane.isDirty() || getSeriesNameFormatPane().isDirty()
|| number.isDirty() || number.isDirty()
|| max.isDirty() || max.isDirty()
|| q3.isDirty() || q3.isDirty()
@ -164,8 +241,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty); getCategoryNameFormatPane().setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty); getSeriesNameFormatPane().setDirty(isDirty);
number.setDirty(isDirty); number.setDirty(isDirty);
max.setDirty(isDirty); max.setDirty(isDirty);
q3.setDirty(isDirty); q3.setDirty(isDirty);
@ -180,8 +257,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); getCategoryNameFormatPane().populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); getSeriesNameFormatPane().populate(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) { if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
@ -198,9 +275,43 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();
getRichTextCategoryNameFormatPane().populate(categoryFormat);
getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs());
AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat();
getRichTextSeriesNameFormatPane().populate(seriesFormat);
getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextNumber, richTextMax, richTextQ3, richTextMedian,
richTextQ1, richTextMin, richTextOutlier
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
boxTooltipContent.getRichTextNumber(),
boxTooltipContent.getRichTextMax(),
boxTooltipContent.getRichTextQ3(),
boxTooltipContent.getRichTextMedian(),
boxTooltipContent.getRichTextQ1(),
boxTooltipContent.getRichTextMin(),
boxTooltipContent.getRichTextOutlier()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); getCategoryNameFormatPane().update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); getSeriesNameFormatPane().update(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) { if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
@ -217,6 +328,23 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat());
getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
richTextNumber.update(boxTooltipContent.getRichTextNumber());
richTextMax.update(boxTooltipContent.getRichTextMax());
richTextQ3.update(boxTooltipContent.getRichTextQ3());
richTextMedian.update(boxTooltipContent.getRichTextMedian());
richTextQ1.update(boxTooltipContent.getRichTextQ1());
richTextMin.update(boxTooltipContent.getRichTextMin());
richTextOutlier.update(boxTooltipContent.getRichTextOutlier());
}
}
public void checkFormatVisible(boolean detailed) { public void checkFormatVisible(boolean detailed) {
this.detailed = detailed; this.detailed = detailed;

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane; import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane; import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面 //配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null)); deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null));
deployPane.add(createDeployPane()); deployPane.add(createDeployPane());
UIScrollPane scrollPane = new UIScrollPane(deployPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(scrollPane);
//条件界面 //条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();

12
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -38,7 +38,7 @@ import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelLabelContentPane; import com.fr.van.chart.funnel.designer.style.VanChartFunnelLabelContentPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane; import com.fr.van.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane;
import com.fr.van.chart.funnel.designer.style.VanChartFunnelTooltipContentPane; import com.fr.van.chart.funnel.designer.style.VanChartFunnelTooltipContentPane;
import com.fr.van.chart.gantt.designer.style.VanChartGanttLabelContentPane; import com.fr.van.chart.gantt.designer.style.label.VanChartGanttPlotLabelPane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane; import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane; import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane;
import com.fr.van.chart.gauge.VanChartGaugePlotRefreshTooltipPane; import com.fr.van.chart.gauge.VanChartGaugePlotRefreshTooltipPane;
@ -53,10 +53,10 @@ import com.fr.van.chart.multilayer.style.VanChartMutiPieRefreshTooltipContentPan
import com.fr.van.chart.scatter.VanChartScatterPlotTooltipPane; import com.fr.van.chart.scatter.VanChartScatterPlotTooltipPane;
import com.fr.van.chart.scatter.VanChartScatterRefreshTooltipContentPane; import com.fr.van.chart.scatter.VanChartScatterRefreshTooltipContentPane;
import com.fr.van.chart.scatter.component.label.VanChartScatterPlotLabelPane; import com.fr.van.chart.scatter.component.label.VanChartScatterPlotLabelPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureLabelContentPane; import com.fr.van.chart.structure.desinger.style.VanChartStructurePlotLabelPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane; import com.fr.van.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane;
import com.fr.van.chart.structure.desinger.style.VanChartStructureTooltipContentPane; import com.fr.van.chart.structure.desinger.style.VanChartStructureTooltipContentPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudRefreshTootipContentPane; import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudRefreshTooltipContentPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane; import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -98,6 +98,8 @@ public class PlotFactory {
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class);
labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartGanttPlot.class, VanChartGanttPlotLabelPane.class);
labelMap.put(VanChartStructurePlot.class, VanChartStructurePlotLabelPane.class);
} }
/** /**
@ -139,8 +141,6 @@ public class PlotFactory {
labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class); labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class);
labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class); labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class);
labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class); labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class);
labelContentMap.put(VanChartGanttPlot.class, VanChartGanttLabelContentPane.class);
labelContentMap.put(VanChartStructurePlot.class, VanChartStructureLabelContentPane.class);
} }
private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> tooltipContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>(); private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> tooltipContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>();
@ -182,7 +182,7 @@ public class PlotFactory {
refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class); refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class); refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class); refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTootipContentPane.class); refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTooltipContentPane.class);
refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class); refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class);
} }

295
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java

@ -0,0 +1,295 @@
package com.fr.van.chart.designer.component;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrTooltipContent> {
private UIButtonGroup<Integer> content;
private ValueFormatPaneWithCheckBox valueFormatPane;
private PercentFormatPaneWithCheckBox percentFormatPane;
private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
private SeriesNameFormatPaneWithCheckBox seriesNameFormatPane;
//监控刷新时,自动数据点提示使用
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private JPanel centerPane;
private JPanel commonPanel;
private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent;
private JPanel showOnPane;
public VanChartLabelContentPaneWithoutRichText(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent;
this.showOnPane = showOnPane;
this.setLayout(new BorderLayout());
this.add(createLabelContentPane(), BorderLayout.CENTER);
}
public ValueFormatPaneWithCheckBox getValueFormatPane() {
return valueFormatPane;
}
public void setValueFormatPane(ValueFormatPaneWithCheckBox valueFormatPane) {
this.valueFormatPane = valueFormatPane;
}
public PercentFormatPaneWithCheckBox getPercentFormatPane() {
return percentFormatPane;
}
public void setPercentFormatPane(PercentFormatPaneWithCheckBox percentFormatPane) {
this.percentFormatPane = percentFormatPane;
}
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
return categoryNameFormatPane;
}
public void setCategoryNameFormatPane(CategoryNameFormatPaneWithCheckBox categoryNameFormatPane) {
this.categoryNameFormatPane = categoryNameFormatPane;
}
public SeriesNameFormatPaneWithCheckBox getSeriesNameFormatPane() {
return seriesNameFormatPane;
}
public void setSeriesNameFormatPane(SeriesNameFormatPaneWithCheckBox seriesNameFormatPane) {
this.seriesNameFormatPane = seriesNameFormatPane;
}
private JPanel createLabelContentPane() {
content = new UIButtonGroup<Integer>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
initFormatPane(parent, showOnPane);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent);
centerPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return commonPanel.getPreferredSize();
} else {
return new Dimension(commonPanel.getPreferredSize().width, htmlLabelPane.getPreferredSize().height);
}
}
};
centerPane.add(htmlLabelPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
centerPane.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
double[] column = {f, e};
double[] row = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(getLabelContentTitle()), content},
new Component[]{null, centerPane},
};
initContentListener();
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
return getLabelContentPane(contentPane);
}
protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
}
protected JPanel createCommonPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = getRowSize(p);
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null},
new Component[]{valueFormatPane, null},
new Component[]{percentFormatPane, null},
};
}
private void initContentListener() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (content.getSelectedIndex() == 1) {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if (isDirty()) {
setCustomFormatterText();
setDirty(false);
}
} else {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
}
protected void setCustomFormatterText() {
htmlLabelPane.setCustomFormatterText(updateBean().getFormatterTextFromCommon());
}
public boolean isDirty() {
return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty()
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) || (changedValueFormatPane != null && changedPercentFormatPane.isDirty());
}
public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty);
valueFormatPane.setDirty(isDirty);
percentFormatPane.setDirty(isDirty);
if (changedValueFormatPane != null) {
changedValueFormatPane.setDirty(isDirty);
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.setDirty(isDirty);
}
}
@Override
protected String title4PopupWindow() {
return "";
}
@Override
public void populateBean(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent == null) {
return;
}
content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1);
populateFormatPane(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if (!attrTooltipContent.isCommon()) {
setDirty(false);
}
checkCardPane();
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat());
valueFormatPane.populate(attrTooltipContent.getValueFormat());
percentFormatPane.populate(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat());
}
}
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip();
attrTooltipContent.setCommon(content.getSelectedIndex() == 0);
updateFormatPane(attrTooltipContent);
updateFormatsWithPaneWidth(attrTooltipContent);
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
return attrTooltipContent;
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrTooltipContent();
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
valueFormatPane.update(attrTooltipContent.getValueFormat());
percentFormatPane.update(attrTooltipContent.getPercentFormat());
if (changedValueFormatPane != null) {
changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat());
}
if (changedPercentFormatPane != null) {
changedPercentFormatPane.update(attrTooltipContent.getChangedPercentFormat());
}
}
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);
}
}
}

37
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java

@ -1,7 +1,9 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -24,18 +26,37 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); setChangedValueFormatPane(new ChangedValueFormatPaneWithCheckBox(parent, showOnPane));
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(), null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{changedValueFormatPane,null}, new Component[]{getChangedValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }

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

@ -8,9 +8,6 @@ import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
public class VanChartRichEditorPane { public class VanChartRichEditorPane {
@ -75,23 +72,6 @@ public class VanChartRichEditorPane {
return new RichEditorModel(richText.getContent(), richText.isAuto(), paramsStr.toString()); return new RichEditorModel(richText.getContent(), richText.isAuto(), paramsStr.toString());
} }
public static List<String> richParamsParser(String content, Map<String, String> paramsMap) {
if (content == null || paramsMap == null) {
return null;
}
List<String> result = new ArrayList<>();
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
String param = entry.getValue();
if (content.contains(URLEncoder.encode(param))) {
result.add(param);
}
}
return result;
}
public static class RichEditorModel { public static class RichEditorModel {
private String content; private String content;
private boolean auto; private boolean auto;

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

@ -9,19 +9,26 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; 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.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.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.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -36,28 +43,38 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.List;
/** /**
* 内容界面 数据点提示 * 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
*/ */
public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent> { public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent> {
private static final long serialVersionUID = 8825929000117843641L; private static final long serialVersionUID = 8825929000117843641L;
protected UIButtonGroup<Integer> content; private UIButtonGroup<Integer> content;
protected ValueFormatPaneWithCheckBox valueFormatPane;
protected PercentFormatPaneWithCheckBox percentFormatPane; private CategoryNameFormatPaneWithCheckBox categoryNameFormatPane;
protected CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; private SeriesNameFormatPaneWithCheckBox seriesNameFormatPane;
protected SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; private ValueFormatPaneWithCheckBox valueFormatPane;
private PercentFormatPaneWithCheckBox percentFormatPane;
//监控刷新时,自动数据点提示使用 //监控刷新时,自动数据点提示使用
protected ChangedValueFormatPaneWithCheckBox changedValueFormatPane; private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane;
private SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane;
private ValueFormatPaneWithoutCheckBox richTextValueFormatPane;
private PercentFormatPaneWithoutCheckBox richTextPercentFormatPane;
private ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane;
private ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane;
private JPanel centerPane; private JPanel centerPanel;
private JPanel commonPanel; private JPanel commonPanel;
private JPanel editorPane; private JPanel editorPanel;
private JPanel htmlPanel;
private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent; private VanChartStylePane parent;
@ -70,82 +87,241 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.showOnPane = showOnPane; this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText(); this.richText = new AttrTooltipRichText();
initFormatPane(parent, showOnPane);
initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createLabelContentPane(),BorderLayout.CENTER); this.add(createLabelContentPane(),BorderLayout.CENTER);
} }
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
return categoryNameFormatPane;
}
public void setCategoryNameFormatPane(CategoryNameFormatPaneWithCheckBox categoryNameFormatPane) {
this.categoryNameFormatPane = categoryNameFormatPane;
}
public SeriesNameFormatPaneWithCheckBox getSeriesNameFormatPane() {
return seriesNameFormatPane;
}
public void setSeriesNameFormatPane(SeriesNameFormatPaneWithCheckBox seriesNameFormatPane) {
this.seriesNameFormatPane = seriesNameFormatPane;
}
public ValueFormatPaneWithCheckBox getValueFormatPane() {
return valueFormatPane;
}
public void setValueFormatPane(ValueFormatPaneWithCheckBox valueFormatPane) {
this.valueFormatPane = valueFormatPane;
}
public PercentFormatPaneWithCheckBox getPercentFormatPane() {
return percentFormatPane;
}
public void setPercentFormatPane(PercentFormatPaneWithCheckBox percentFormatPane) {
this.percentFormatPane = percentFormatPane;
}
public ChangedValueFormatPaneWithCheckBox getChangedValueFormatPane() {
return changedValueFormatPane;
}
public void setChangedValueFormatPane(ChangedValueFormatPaneWithCheckBox changedValueFormatPane) {
this.changedValueFormatPane = changedValueFormatPane;
}
public ChangedPercentFormatPaneWithCheckBox getChangedPercentFormatPane() {
return changedPercentFormatPane;
}
public void setChangedPercentFormatPane(ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane) {
this.changedPercentFormatPane = changedPercentFormatPane;
}
public CategoryNameFormatPaneWithoutCheckBox getRichTextCategoryNameFormatPane() {
return richTextCategoryNameFormatPane;
}
public void setRichTextCategoryNameFormatPane(CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane) {
this.richTextCategoryNameFormatPane = richTextCategoryNameFormatPane;
}
public SeriesNameFormatPaneWithoutCheckBox getRichTextSeriesNameFormatPane() {
return richTextSeriesNameFormatPane;
}
public void setRichTextSeriesNameFormatPane(SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane) {
this.richTextSeriesNameFormatPane = richTextSeriesNameFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextValueFormatPane() {
return richTextValueFormatPane;
}
public void setRichTextValueFormatPane(ValueFormatPaneWithoutCheckBox richTextValueFormatPane) {
this.richTextValueFormatPane = richTextValueFormatPane;
}
public PercentFormatPaneWithoutCheckBox getRichTextPercentFormatPane() {
return richTextPercentFormatPane;
}
public void setRichTextPercentFormatPane(PercentFormatPaneWithoutCheckBox richTextPercentFormatPane) {
this.richTextPercentFormatPane = richTextPercentFormatPane;
}
public ChangedValueFormatPaneWithoutCheckBox getRichTextChangedValueFormatPane() {
return richTextChangedValueFormatPane;
}
public void setRichTextChangedValueFormatPane(ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane) {
this.richTextChangedValueFormatPane = richTextChangedValueFormatPane;
}
public ChangedPercentFormatPaneWithoutCheckBox getRichTextChangedPercentFormatPane() {
return richTextChangedPercentFormatPane;
}
public void setRichTextChangedPercentFormatPane(ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane) {
this.richTextChangedPercentFormatPane = richTextChangedPercentFormatPane;
}
public AttrTooltipRichText getRichTextAttr() {
return richText;
}
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
content = new UIButtonGroup<>(new String[]{ initDetailPane();
Toolkit.i18nText("Fine-Design_Chart_Common"), initCenterPane();
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
initFormatPane(parent, showOnPane); JPanel content = new JPanel(new BorderLayout());
double p = TableLayout.PREFERRED; content.add(createButtonPane(), BorderLayout.NORTH);
double f = TableLayout.FILL; content.add(centerPanel, BorderLayout.CENTER);
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
initContentListener();
return getLabelContentPane(content);
}
private void initDetailPane() {
commonPanel = createCommonPanel(); commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane(); editorPanel = createRichEditorPanel();
htmlLabelPane.setParent(parent); htmlPanel = createHtmlPane();
}
centerPane = new JPanel(new CardLayout()){ private void initCenterPane() {
@Override centerPanel = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if(content.getSelectedIndex() == 0){ if (content.getSelectedIndex() == 0) {
return commonPanel.getPreferredSize(); return commonPanel.getPreferredSize();
} else if (content.getSelectedIndex() == 1) {
return editorPanel.getPreferredSize();
} else { } else {
return new Dimension(commonPanel.getPreferredSize().width,htmlLabelPane.getPreferredSize().height); return htmlPanel.getPreferredSize();
} }
} }
}; };
centerPane.add(htmlLabelPane, Toolkit.i18nText("Fine-Design_Chart_Custom"));
centerPane.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
double[] column = {f, e}; centerPanel.add(commonPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
double[] row = {p,p,p}; centerPanel.add(editorPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text"));
Component[][] components = new Component[][]{ centerPanel.add(htmlPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
new Component[]{null,null}, }
new Component[]{new UILabel(getLabelContentTitle()),content},
new Component[]{null,centerPane},
};
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
// editorPane = createRichEditorPanel(); protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
JPanel panel = new JPanel(); private JPanel createButtonPane() {
panel.setLayout(new BorderLayout()); double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
panel.add(contentPane, BorderLayout.CENTER); double[] column = {f, p};
// panel.add(editorPane, BorderLayout.SOUTH); double[] row = {p, p};
initContentListener(); content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
return getLabelContentPane(panel); Component[][] components = new Component[][]{
} new Component[]{null, null},
new Component[]{content, null}
};
protected String getLabelContentTitle () { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
return Toolkit.i18nText("Fine-Design_Report_Text");
} }
protected JPanel getLabelContentPane(JPanel contentPane) { private JPanel createCommonPanel() {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane); JPanel common = new JPanel(new BorderLayout());
}
protected VanChartHtmlLabelPane createHtmlLabelPane() { common.add(createCommonFormatPanel(), BorderLayout.CENTER);
return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); common.add(createCommonStylePane(), BorderLayout.SOUTH);
return common;
} }
protected JPanel createCommonPanel() { protected JPanel createCommonFormatPanel() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p}; JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), getRowSize(p), new double[]{f, p});
double[] rowSize = getRowSize(p);
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(getLabelContentTitle()), formatContent}
};
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
}
private JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
textAttrPane = new ChartTextAttrPane() {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton);
JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(buttonPane, BorderLayout.CENTER);
stylePanel.add(textAttrPane, BorderLayout.SOUTH);
initStyleButtonListener();
return stylePanel;
}
private void initStyleButtonListener() {
styleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkStylePane();
}
});
}
private void checkStylePane() {
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1);
} }
private JPanel createRichEditorPanel() { private JPanel createRichEditorPanel() {
@ -154,18 +330,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
JPanel formatContent = TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createContentStylePane()} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), formatContent}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JComponent createContentStylePane() { private JComponent createRichEditorButton() {
UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit"));
contentTextArea.addMouseListener(new MouseAdapter() { contentTextArea.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -188,8 +367,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
VanChartRichEditorPane.RichEditorModel model = pane.update(); VanChartRichEditorPane.RichEditorModel model = pane.update();
String content = model.getContent(); String content = model.getContent();
List<String> params = VanChartRichEditorPane.richParamsParser(content, richText.getParams());
populateFormatParams(params);
updateLocalRichText(content, model.isAuto()); updateLocalRichText(content, model.isAuto());
SwingUtilities.getWindowAncestor(pane).setVisible(false); SwingUtilities.getWindowAncestor(pane).setVisible(false);
@ -207,13 +384,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
} }
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ private JPanel createHtmlPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {f, p};
double[] row = {p, p};
htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent);
Component[][] htmlComponents = new Component[][]{
new Component[]{null, null},
new Component[]{htmlLabelPane, null}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(htmlComponents, row, column);
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPaneWithOutWidthAndHeight();
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
} }
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane);
richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane);
richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
} }
@ -222,12 +428,21 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return new double[]{p,p,p,p}; return new double[]{p,p,p,p};
} }
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane,null}, new Component[]{seriesNameFormatPane, null},
new Component[]{valueFormatPane,null}, new Component[]{valueFormatPane, null},
new Component[]{percentFormatPane,null}, new Component[]{percentFormatPane, null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{richTextCategoryNameFormatPane, null},
new Component[]{richTextSeriesNameFormatPane, null},
new Component[]{richTextValueFormatPane, null},
new Component[]{richTextPercentFormatPane, null},
}; };
} }
@ -242,19 +457,17 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void checkCardPane() { private void checkCardPane() {
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == 1) { if (content.getSelectedIndex() == 2) {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if(isDirty()){ if(isDirty()){
setCustomFormatterText(); setCustomFormatterText();
setDirty(false); setDirty(false);
} }
} else if (content.getSelectedIndex() == 1) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Rich_Text"));
} else { } else {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Common")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
if (editorPane != null) {
editorPane.setVisible(content.getSelectedIndex() == 0);
} }
} }
@ -263,8 +476,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
public boolean isDirty() { public boolean isDirty() {
return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty()
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty()) || (changedValueFormatPane != null && changedPercentFormatPane.isDirty()); return categoryNameFormatPane.isDirty()
|| seriesNameFormatPane.isDirty()
|| valueFormatPane.isDirty()
|| percentFormatPane.isDirty()
|| (changedValueFormatPane != null && changedValueFormatPane.isDirty())
|| (changedValueFormatPane != null && changedPercentFormatPane.isDirty());
} }
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
@ -281,59 +499,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
} }
protected VanChartFormatPaneWithCheckBox[] getFormatPaneGroup() {
return new VanChartFormatPaneWithCheckBox[]{
categoryNameFormatPane, seriesNameFormatPane,
valueFormatPane, percentFormatPane,
changedValueFormatPane, changedPercentFormatPane
};
}
protected VanChartFormatPaneWithCheckBox getTargetFormatPane(Object param) {
VanChartFormatPaneWithCheckBox[] formatPaneGroup = getFormatPaneGroup();
Object[] params = richText.getParams().values().toArray();
for (int i = 0, len = Math.min(params.length, formatPaneGroup.length); i < len; i++) {
if (ComparatorUtils.equals(params[i], param) && formatPaneGroup[i] != null) {
return formatPaneGroup[i];
}
}
return null;
}
private String getParamsRichText() {
VanChartFormatPaneWithCheckBox[] formatPaneGroup = getFormatPaneGroup();
// todo 获取参数对应的富文本字符串,正确的流程是:
// 在BI的富文本组件中,先清空content,然后addParam,最后读取最新的content,
// 但是当前接口还没开出来,暂时先在本地写死,模拟类似的效果
String[] richTextGroup = new String[]{
"<img alt=\"%24%7BCATEGORY%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:86.095703125px;height: 16px; max-width:86.095703125px;max-height: 16px; min-width:86.095703125px;min-height: 16px\" name=\"%24%7BCATEGORY%7D\" />",
"<img alt=\"%24%7BSERIES%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:63.8828125px;height: 16px; max-width:63.8828125px;max-height: 16px; min-width:63.8828125px;min-height: 16px\" name=\"%24%7BSERIES%7D\" />",
"<img alt=\"%24%7BVALUE%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:61.849609375px;height: 16px; max-width:61.849609375px;max-height: 16px; min-width:61.849609375px;min-height: 16px\" name=\"%24%7BVALUE%7D\" />",
"<img alt=\"%24%7BPERCENT%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:77.39453125px;height: 16px; max-width:77.39453125px;max-height: 16px; min-width:77.39453125px;min-height: 16px\" name=\"%24%7BPERCENT%7D\" />",
"<img alt=\"%24%7BCHANGEDVALUE%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:122.119140625px;height: 16px; max-width:122.119140625px;max-height: 16px; min-width:122.119140625px;min-height: 16px\" name=\"%24%7BCHANGEDVALUE%7D\" />",
"<img alt=\"%24%7BCHANGEDPERCENT%7D\" class=\"rich-editor-param\" style=\"background-color: rgba(54, 133, 242, 0.1);vertical-align: middle; margin: 0 1px; width:137.6640625px;height: 16px; max-width:137.6640625px;max-height: 16px; min-width:137.6640625px;min-height: 16px\" name=\"%24%7BCHANGEDPERCENT%7D\" />"
};
StringBuilder result = new StringBuilder("<p>");
for (int i = 0, len = formatPaneGroup.length; i < len; i++) {
VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i];
String paramRichText = richTextGroup[i];
if (formatPane != null && formatPane.isSelected()) {
result.append(paramRichText);
}
}
result.append("</p>");
return result.toString();
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return ""; return "";
@ -346,19 +511,43 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return; return;
} }
content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1); if (attrTooltipContent.isCommon()) {
content.setSelectedIndex(0);
} else if (attrTooltipContent.isRichText()) {
content.setSelectedIndex(1);
} else {
content.setSelectedIndex(2);
}
if (attrTooltipContent.isCustom()) {
styleButton.setSelectedIndex(1);
} else {
styleButton.setSelectedIndex(0);
}
this.textAttrPane.populate(attrTooltipContent.getTextAttr());
populateFormatPane(attrTooltipContent); populateFormatPane(attrTooltipContent);
populateRichEditor(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if(!attrTooltipContent.isCommon()){ if(!attrTooltipContent.isCommon()){
setDirty(false); setDirty(false);
} }
checkCardPane(); checkCardPane();
checkStylePane();
} }
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithCheckBox[] formatPaneGroup = getFormatPaneGroup(); VanChartFormatPaneWithCheckBox[] formatPaneGroup = new VanChartFormatPaneWithCheckBox[]{
categoryNameFormatPane,
seriesNameFormatPane,
valueFormatPane,
percentFormatPane,
changedValueFormatPane,
changedPercentFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getCategoryFormat(), attrTooltipContent.getCategoryFormat(),
@ -375,54 +564,64 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
if (formatPane != null && format != null) { if (formatPane != null && format != null) {
formatPane.populate(format); formatPane.populate(format);
// 填充面板时,更新富文本编辑器参数
formatPane.updateFormatParams(richText.getParams(), format.getJs());
} }
} }
}
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichText(); protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextCategoryNameFormatPane,
richTextSeriesNameFormatPane,
richTextValueFormatPane,
richTextPercentFormatPane,
richTextChangedValueFormatPane,
richTextChangedPercentFormatPane
};
if (tooltipRichText != null) { AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); attrTooltipContent.getRichTextCategoryFormat(),
setDirty(false); attrTooltipContent.getRichTextSeriesFormat(),
} attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat(),
attrTooltipContent.getRichTextChangedValueFormat(),
attrTooltipContent.getRichTextChangedPercentFormat()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
} }
private void populateFormatParams(List<String> params) { protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) {
if (params == null) { for (int i = 0, len = formatPaneGroup.length; i < len; i++) {
return; VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i];
} AttrTooltipFormat format = formatGroup[i];
VanChartFormatPaneWithCheckBox[] formatPaneGroup = getFormatPaneGroup(); if (formatPane != null && format != null) {
formatPane.populate(format);
for (VanChartFormatPaneWithCheckBox formatPane : formatPaneGroup) { // 填充面板时,更新富文本编辑器参数
if (formatPane != null) { formatPane.updateFormatParams(richText.getParams(), format.getJs());
formatPane.setSelected(false);
} }
} }
}
for (String param : params) { protected void populateRichText(AttrTooltipRichText tooltipRichText) {
VanChartFormatPaneWithCheckBox formatPane = getTargetFormatPane(param); if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
if (formatPane != null) { setDirty(false);
formatPane.setSelected(true);
}
} }
} }
public AttrTooltipContent updateBean() { public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = createAttrTooltip(); AttrTooltipContent attrTooltipContent = createAttrTooltip();
boolean isCommon = content.getSelectedIndex() == 0; attrTooltipContent.setCommon(content.getSelectedIndex() == 0);
attrTooltipContent.setRichText(content.getSelectedIndex() == 1);
attrTooltipContent.setCommon(isCommon); attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
if (isDirty() && isCommon) { attrTooltipContent.setTextAttr(this.textAttrPane.update());
updateLocalRichText(getParamsRichText(), false);
setDirty(false);
}
updateFormatPane(attrTooltipContent); updateFormatPane(attrTooltipContent);
updateRichEditor(attrTooltipContent);
updateTooltipRichText(attrTooltipContent); updateTooltipRichText(attrTooltipContent);
updateFormatsWithPaneWidth(attrTooltipContent); updateFormatsWithPaneWidth(attrTooltipContent);
@ -436,11 +635,18 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); if (categoryNameFormatPane != null) {
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
valueFormatPane.update(attrTooltipContent.getValueFormat()); }
percentFormatPane.update(attrTooltipContent.getPercentFormat()); if (seriesNameFormatPane != null) {
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
}
if (valueFormatPane != null) {
valueFormatPane.update(attrTooltipContent.getValueFormat());
}
if (percentFormatPane != null) {
percentFormatPane.update(attrTooltipContent.getPercentFormat());
}
if (changedValueFormatPane != null) { if (changedValueFormatPane != null) {
changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat()); changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat());
} }
@ -449,6 +655,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
if (richTextCategoryNameFormatPane != null) {
richTextCategoryNameFormatPane.update(attrTooltipContent.getRichTextCategoryFormat());
}
if (richTextSeriesNameFormatPane != null) {
richTextSeriesNameFormatPane.update(attrTooltipContent.getRichTextSeriesFormat());
}
if (richTextValueFormatPane != null) {
richTextValueFormatPane.update(attrTooltipContent.getRichTextValueFormat());
}
if (richTextPercentFormatPane != null) {
richTextPercentFormatPane.update(attrTooltipContent.getRichTextPercentFormat());
}
if (richTextChangedValueFormatPane != null) {
richTextChangedValueFormatPane.update(attrTooltipContent.getRichTextChangedValueFormat());
}
if (richTextChangedPercentFormatPane != null) {
richTextChangedPercentFormatPane.update(attrTooltipContent.getRichTextChangedPercentFormat());
}
}
private void updateLocalRichText(String content, boolean isAuto) { private void updateLocalRichText(String content, boolean isAuto) {
richText.setContent(content); richText.setContent(content);
richText.setAuto(isAuto); richText.setAuto(isAuto);
@ -456,7 +683,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void updateTooltipRichText(AttrTooltipContent attrTooltipContent) { private void updateTooltipRichText(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent != null) { if (attrTooltipContent != null) {
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichText(); AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr();
tooltipRichText.setContent(richText.getContent()); tooltipRichText.setContent(richText.getContent());
tooltipRichText.setAuto(richText.isAuto()); tooltipRichText.setAuto(richText.isAuto());
} }

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class CategoryNameFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public CategoryNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name");
}
}

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

@ -0,0 +1,21 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class ChangedPercentFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public ChangedPercentFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Change_Percent");
}
protected boolean isPercent() {
return true;
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/ChangedValueFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class ChangedValueFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public ChangedValueFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Change_Value");
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/MapAreaNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class MapAreaNameFormatPaneWithoutCheckBox extends CategoryNameFormatPaneWithoutCheckBox {
public MapAreaNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Area_Name");
}
}

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

@ -0,0 +1,21 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class PercentFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public PercentFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Use_Percent");
}
protected boolean isPercent() {
return true;
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SeriesNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class SeriesNameFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public SeriesNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Series_Name");
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/ValueFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class ValueFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public ValueFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Use_Value");
}
}

57
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java

@ -5,6 +5,7 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
@ -15,6 +16,7 @@ import java.awt.BorderLayout;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.Format; import java.text.Format;
import java.util.Map; import java.util.Map;
@ -37,26 +39,55 @@ public abstract class VanChartFormatPaneWithCheckBox extends JPanel{
public VanChartFormatPaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane) { public VanChartFormatPaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane) {
this.parent = parent; this.parent = parent;
this.showOnPane = showOnPane; this.showOnPane = showOnPane;
this.isDirty = false; this.isDirty = true;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
isSelectedBox = new UICheckBox(getCheckBoxText());
formatButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Use_Format"));
isSelectedBox = new UICheckBox(getCheckBoxText()) { if (showSelectBox()) {
protected void attributeChange() { this.add(isSelectedBox, BorderLayout.CENTER);
isDirty = true; } else {
super.attributeChange(); this.add(new UILabel(getCheckBoxText()), BorderLayout.CENTER);
} }
};
formatButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Use_Format"));
this.add(isSelectedBox, BorderLayout.CENTER);
this.add(formatButton, BorderLayout.EAST); this.add(formatButton, BorderLayout.EAST);
initFormatListener(); initFormatListener();
isSelectedBox.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
isDirty = true;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
} }
protected abstract String getCheckBoxText(); protected abstract String getCheckBoxText();
protected boolean showSelectBox() {
return true;
}
protected boolean isPercent() { protected boolean isPercent() {
return false; return false;
} }
@ -107,14 +138,6 @@ public abstract class VanChartFormatPaneWithCheckBox extends JPanel{
this.isDirty = isDirty; this.isDirty = isDirty;
} }
public boolean isSelected() {
return this.isSelectedBox.isSelected();
}
public void setSelected(boolean isSelected) {
this.isSelectedBox.setSelected(isSelected);
}
public void populate(AttrTooltipFormat tooltipFormat) { public void populate(AttrTooltipFormat tooltipFormat) {
this.isSelectedBox.setSelected(tooltipFormat.isEnable()); this.isSelectedBox.setSelected(tooltipFormat.isEnable());
this.format = tooltipFormat.getFormat(); this.format = tooltipFormat.getFormat();

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithoutCheckBox.java

@ -0,0 +1,16 @@
package com.fr.van.chart.designer.component.format;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public abstract class VanChartFormatPaneWithoutCheckBox extends VanChartFormatPaneWithCheckBox {
public VanChartFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected boolean showSelectBox() {
return false;
}
}

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/XFormatPaneWithoutCheckBox.java

@ -0,0 +1,16 @@
package com.fr.van.chart.designer.component.format;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class XFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public XFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return "x";
}
}

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/YFormatPaneWithoutCheckBox.java

@ -0,0 +1,16 @@
package com.fr.van.chart.designer.component.format;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class YFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public YFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return "y";
}
}

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java

@ -1,7 +1,8 @@
package com.fr.van.chart.designer.component.label; package com.fr.van.chart.designer.component.label;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -9,14 +10,14 @@ import javax.swing.JPanel;
/** /**
* Created by mengao on 2017/8/13. * Created by mengao on 2017/8/13.
*/ */
public class GaugeLabelContentPane extends VanChartLabelContentPane { public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
public GaugeLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { public GaugeLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane); super(parent, showOnPane);
} }
protected String getLabelContentTitle() { protected String getLabelContentTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"); return Toolkit.i18nText("Fine-Design_Chart_Content");
} }
protected JPanel getLabelContentPane(JPanel contentPane) { protected JPanel getLabelContentPane(JPanel contentPane) {

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithCate.java

@ -27,7 +27,7 @@ public class LabelContentPaneWithCate extends GaugeLabelContentPane {
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(),null},
}; };
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithCateValue.java

@ -27,8 +27,8 @@ public class LabelContentPaneWithCateValue extends GaugeLabelContentPane {
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(),null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(),null},
}; };
} }
} }

6
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithOutCate.java

@ -27,9 +27,9 @@ public class LabelContentPaneWithOutCate extends GaugeLabelContentPane {
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane, null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane, null}, new Component[]{getValueFormatPane(), null},
new Component[]{percentFormatPane, null}, new Component[]{getPercentFormatPane(), null},
}; };
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/label/LabelContentPaneWithPercent.java

@ -26,7 +26,7 @@ public class LabelContentPaneWithPercent extends GaugeLabelContentPane {
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{percentFormatPane, null}, new Component[]{getPercentFormatPane(), null},
}; };
} }
} }

34
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java

@ -1,7 +1,9 @@
package com.fr.van.chart.designer.component.tooltip; package com.fr.van.chart.designer.component.tooltip;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,8 +21,16 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); setChangedValueFormatPane(new ChangedValueFormatPaneWithCheckBox(parent, showOnPane));
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected double[] getRowSize(double p){ protected double[] getRowSize(double p){
@ -29,11 +39,21 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(),null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(),null},
new Component[]{changedValueFormatPane,null}, new Component[]{getChangedValueFormatPane(),null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(),null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getChangedPercentFormatPane(),null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }
} }

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

@ -23,9 +23,17 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(),null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(),null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(),null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null}
}; };
} }
} }

75
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -8,7 +8,6 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
@ -18,6 +17,8 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -29,8 +30,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
/** /**
* 坐标轴-上方按钮界面 * 坐标轴-上方按钮界面
@ -41,9 +40,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private static final int B_W = 56; private static final int B_W = 56;
private static final int B_H = 21; private static final int B_H = 21;
private static final int COL_COUNT = 3; private static final int COL_COUNT = 3;
private static final int MAX_COUNT = 20;
private UIButton addButton; private UIButton addButton;
private UIPopupMenu popupMenu; private UIPopupMenu popupMenu;
private UIMenuItem itemX;
private UIMenuItem itemY;
private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>();
private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>();
@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private VanChartAxisPane parent; private VanChartAxisPane parent;
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){ public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) {
this.parent = vanChartAxisPane; this.parent = vanChartAxisPane;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0));
this.add(buttonPane, BorderLayout.CENTER); this.add(buttonPane, BorderLayout.CENTER);
itemX = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
itemX.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addXAxis();
}
});
itemY = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
itemY.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
addButton.addActionListener(addListener); addButton.addActionListener(addListener);
} }
@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane); buttonPane.add(pane);
} }
if(pane != null) { if (pane != null) {
pane.add(indexList_Y.get(i)); pane.add(indexList_Y.get(i));
} }
} }
if(popupMenu != null){ if (popupMenu != null) {
popupMenu.setVisible(false); popupMenu.setVisible(false);
} }
@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
indexList_X.clear(); indexList_X.clear();
indexList_Y.clear(); indexList_Y.clear();
List<VanChartAxis> xList = plot.getXAxisList(); List<VanChartAxis> xList = plot.getXAxisList();
for(VanChartAxis axis : xList){ for (VanChartAxis axis : xList) {
ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis)); ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis));
x.setToolTipText(plot.getXAxisName(axis)); x.setToolTipText(plot.getXAxisName(axis));
indexList_X.add(x); indexList_X.add(x);
} }
List<VanChartAxis> yList = plot.getYAxisList(); List<VanChartAxis> yList = plot.getYAxisList();
for(VanChartAxis axis : yList){ for (VanChartAxis axis : yList) {
ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis)); ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis));
y.setToolTipText(plot.getYAxisName(axis)); y.setToolTipText(plot.getYAxisName(axis));
indexList_Y.add(y); indexList_Y.add(y);
} }
if(indexList_X.isEmpty()){ if (indexList_X.isEmpty()) {
this.removeAll(); this.removeAll();
} else { } else {
indexList_X.get(0).setSelected(true); indexList_X.get(0).setSelected(true);
@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
return null; return null;
} }
public String getNewChartName(List<ChartAxisButton> existList, String prefix){ public String getNewChartName(List<ChartAxisButton> existList, String prefix) {
int count = existList.size() + 1; int count = existList.size() + 1;
while (true) { while (true) {
String name_test = prefix + count; String name_test = prefix + count;
@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
ActionListener addListener = new ActionListener() { ActionListener addListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if(popupMenu == null){ popupMenu = new UIPopupMenu();
popupMenu = new UIPopupMenu(); if (indexList_X.size() < MAX_COUNT) {
UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX); popupMenu.add(itemX);
item_x.addActionListener(new ActionListener() { }
@Override if (indexList_Y.size() < MAX_COUNT) {
public void actionPerformed(ActionEvent e) { popupMenu.add(itemY);
addXAxis();
}
});
UIMenuItem item_y = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
item_y.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
popupMenu.add(item_x);
popupMenu.add(item_y);
} }
popupMenu.setVisible(true); popupMenu.setVisible(true);
GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight()); GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight());
} }
}; };
private void addXAxis(){ private void addXAxis() {
String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX); String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
layoutPane(); layoutPane();
} }
private void addYAxis(){ private void addYAxis() {
String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX); String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private class AddButton extends UIButton { private class AddButton extends UIButton {
public AddButton(Icon icon){ public AddButton(Icon icon) {
super(icon); super(icon);
} }
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
} }
private void noSelected() { private void noSelected() {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.setSelected(false); button.setSelected(false);
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.setSelected(false); button.setSelected(false);
} }
} }
private void checkMoveOn(boolean moveOn) { private void checkMoveOn(boolean moveOn) {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.isMoveOn = false; button.isMoveOn = false;
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.isMoveOn = false; button.isMoveOn = false;
} }

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

@ -37,10 +37,10 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
switch (getGaugeStyle()) { switch (getGaugeStyle()) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); setDataLabelContentPane(new LabelContentPaneWithCate(getParentPane(), VanChartGaugeCateOrPercentLabelDetailPane.this));
break; break;
default: default:
dataLabelContentPane = new LabelContentPaneWithPercent(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); setDataLabelContentPane(new LabelContentPaneWithPercent(getParentPane(), VanChartGaugeCateOrPercentLabelDetailPane.this));
break; break;
} }
} }

30
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -24,6 +24,8 @@ import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by mengao on 2017/8/13. * Created by mengao on 2017/8/13.
@ -35,6 +37,8 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
private UIButtonGroup<Integer> align; private UIButtonGroup<Integer> align;
private JPanel alignPane; private JPanel alignPane;
private Integer[] oldAlignValues; private Integer[] oldAlignValues;
private UIButtonGroup<Integer> style;
private ChartTextAttrPane textFontPane;
public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent); super(plot, parent);
@ -63,6 +67,15 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col);
} }
protected void initStyleListener() {
style.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkStyleUse();
}
});
}
protected boolean isFontSizeAuto() { protected boolean isFontSizeAuto() {
return false; return false;
} }
@ -113,14 +126,17 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
if (hasLabelAlign(plot)) { if (hasLabelAlign(plot)) {
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane, null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null},
new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
}; };
} else { } else {
return super.getLabelPaneComponents(plot, p, columnSize); return new Component[][]{
new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
};
} }
} }
@ -170,8 +186,8 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
alignPane.setLayout(new BorderLayout()); alignPane.setLayout(new BorderLayout());
alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER);
if (parent != null) { if (getParentPane() != null) {
parent.initListener(alignPane); getParentPane().initListener(alignPane);
} }
} }
@ -210,15 +226,21 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
super.populate(detail); super.populate(detail);
style.setSelectedIndex(1); style.setSelectedIndex(1);
textFontPane.populate(detail.getTextAttr());
if (hasLabelAlign(this.getPlot()) && align != null) { if (hasLabelAlign(this.getPlot()) && align != null) {
align.setSelectedItem(detail.getAlign()); align.setSelectedItem(detail.getAlign());
} }
checkStyleUse();
} }
public void update(AttrLabelDetail detail) { public void update(AttrLabelDetail detail) {
super.update(detail); super.update(detail);
detail.setCustom(true); detail.setCustom(true);
if (textFontPane != null) {
detail.setTextAttr(textFontPane.update());
}
if (align != null) { if (align != null) {
if (align.getSelectedItem() != null) { if (align.getSelectedItem() != null) {
detail.setAlign(align.getSelectedItem()); detail.setAlign(align.getSelectedItem());

14
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java

@ -25,10 +25,10 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
} }
protected void createLabelPane() { protected void createLabelPane() {
labelPane = new JPanel(new BorderLayout(0, 4)); setLabelPane(new JPanel(new BorderLayout(0, 4)));
labelDetailPane = new VanChartGaugeCateOrPercentLabelDetailPane(this.plot, this.parent); setLabelDetailPane(new VanChartGaugeCateOrPercentLabelDetailPane(getPlot(), getParentPane()));
gaugeValueLabelPane = new VanChartGaugeValueLabelDetailPane(this.plot, this.parent); gaugeValueLabelPane = new VanChartGaugeValueLabelDetailPane(getPlot(), getParentPane());
GaugeStyle gaugeStyle = ((VanChartGaugePlot)this.plot).getGaugeStyle(); GaugeStyle gaugeStyle = ((VanChartGaugePlot)getPlot()).getGaugeStyle();
String cateTitle, valueTitle = Toolkit.i18nText("Fine-Design_Chart_Value_Label"); String cateTitle, valueTitle = Toolkit.i18nText("Fine-Design_Chart_Value_Label");
switch (gaugeStyle){ switch (gaugeStyle){
case POINTER: case POINTER:
@ -39,10 +39,10 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
cateTitle = Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); cateTitle = Toolkit.i18nText("Fine-Design_Chart_Percent_Label");
break; break;
} }
JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, labelDetailPane); JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane());
JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane); JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane);
labelPane.add(cateOrPercentPane, BorderLayout.NORTH); getLabelPane().add(cateOrPercentPane, BorderLayout.NORTH);
labelPane.add(valuePane, BorderLayout.SOUTH); getLabelPane().add(valuePane, BorderLayout.SOUTH);
} }
public void populate(AttrLabel attr) { public void populate(AttrLabel attr) {

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java

@ -24,10 +24,10 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
switch (getGaugeStyle()) { switch (getGaugeStyle()) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); setDataLabelContentPane(new LabelContentPaneWithOutCate(getParentPane(), VanChartGaugeValueLabelDetailPane.this));
break; break;
default: default:
dataLabelContentPane = new LabelContentPaneWithCateValue(parent, VanChartGaugeValueLabelDetailPane.this); setDataLabelContentPane(new LabelContentPaneWithCateValue(getParentPane(), VanChartGaugeValueLabelDetailPane.this));
break; break;
} }
} }
@ -44,7 +44,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) { private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) {
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane, null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null}, new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null},
new Component[]{createBackgroundColorPane(), null}, new Component[]{createBackgroundColorPane(), null},
}; };

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

@ -38,22 +38,19 @@ import java.awt.event.ActionListener;
public class VanChartPlotLabelDetailPane extends BasicPane { public class VanChartPlotLabelDetailPane extends BasicPane {
private static final long serialVersionUID = -22438250307946275L; private static final long serialVersionUID = -22438250307946275L;
protected BasicBeanPane<AttrTooltipContent> dataLabelContentPane; private BasicBeanPane<AttrTooltipContent> dataLabelContentPane;
protected UIButtonGroup<Integer> position; private UIButtonGroup<Integer> position;
protected UIButtonGroup<Boolean> autoAdjust; private UIButtonGroup<Boolean> autoAdjust;
protected UIToggleButton tractionLine; private UIToggleButton tractionLine;
protected UIButtonGroup<Integer> style; private ColorSelectBox backgroundColor;
protected ChartTextAttrPane textFontPane;
protected ColorSelectBox backgroundColor;
private JPanel tractionLinePane; private JPanel tractionLinePane;
private JPanel positionPane; private JPanel positionPane;
private Integer[] oldPositionValues; private Integer[] oldPositionValues;
protected VanChartStylePane parent; private VanChartStylePane parent;
private Plot plot; private Plot plot;
public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
@ -62,6 +59,18 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
initLabelDetailPane(plot); initLabelDetailPane(plot);
} }
public BasicBeanPane<AttrTooltipContent> getDataLabelContentPane() {
return dataLabelContentPane;
}
public void setDataLabelContentPane(BasicBeanPane<AttrTooltipContent> dataLabelContentPane) {
this.dataLabelContentPane = dataLabelContentPane;
}
public VanChartStylePane getParentPane() {
return parent;
}
protected void initLabelDetailPane (Plot plot) { protected void initLabelDetailPane (Plot plot) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
initToolTipContentPane(plot); initToolTipContentPane(plot);
@ -93,13 +102,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(hasLabelPosition(plot)){ if(hasLabelPosition(plot)){
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null}, new Component[]{dataLabelContentPane,null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null},
}; };
} else { } else {
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null}, new Component[]{dataLabelContentPane,null}
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null},
}; };
} }
} }
@ -214,17 +221,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
}); });
} }
protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) {
style = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
textFontPane =initTextFontPane();
initStyleListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel);
}
protected ChartTextAttrPane initTextFontPane () { protected ChartTextAttrPane initTextFontPane () {
return new ChartTextAttrPane(){ return new ChartTextAttrPane(){
protected Component[][] getComponents(JPanel buttonPane) { protected Component[][] getComponents(JPanel buttonPane) {
@ -237,24 +233,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
}; };
} }
protected Component[][] getLabelStyleComponents(Plot plot) {
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT);
return new Component[][]{
new Component[]{null,null},
new Component[]{text,style},
new Component[]{textFontPane,null},
};
}
protected void initStyleListener() {
style.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkStyleUse();
}
});
}
protected JPanel createBackgroundColorPane() { protected JPanel createBackgroundColorPane() {
backgroundColor = new ColorSelectBox(100); backgroundColor = new ColorSelectBox(100);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor);
@ -265,18 +243,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} }
private void checkAllUse() { private void checkAllUse() {
checkStyleUse();
if(tractionLine == null){ if(tractionLine == null){
return; return;
} }
checkPositionEnabled(); checkPositionEnabled();
} }
protected void checkStyleUse() {
textFontPane.setVisible(style.getSelectedIndex() == 1);
textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0));
}
private void checkPosition() { private void checkPosition() {
tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE);
checkPositionEnabled(); checkPositionEnabled();
@ -301,8 +273,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(autoAdjust != null){ if(autoAdjust != null){
autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1);
} }
style.setSelectedIndex(detail.isCustom() ? 1 : 0);
textFontPane.populate(detail.getTextAttr());
if(backgroundColor != null){ if(backgroundColor != null){
backgroundColor.setSelectObject(detail.getBackgroundColor()); backgroundColor.setSelectObject(detail.getBackgroundColor());
@ -327,10 +297,6 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(tractionLine != null){ if(tractionLine != null){
detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE);
} }
detail.setCustom(style.getSelectedIndex() == 1);
if(textFontPane != null){
detail.setTextAttr(textFontPane.update());
}
if(backgroundColor != null){ if(backgroundColor != null){
detail.setBackgroundColor(backgroundColor.getSelectObject()); detail.setBackgroundColor(backgroundColor.getSelectObject());
} }

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelNoCheckPane.java

@ -19,12 +19,12 @@ public class VanChartPlotLabelNoCheckPane extends VanChartPlotLabelPane {
protected void addComponents() { protected void addComponents() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(labelPane,BorderLayout.CENTER); this.add(getLabelPane(),BorderLayout.CENTER);
} }
public void populate(AttrLabel attr) { public void populate(AttrLabel attr) {
super.populate(attr); super.populate(attr);
isLabelShow.setSelected(true); getLabelShowCheckBox().setSelected(true);
labelPane.setVisible(true); getLabelPane().setVisible(true);
} }
} }

41
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
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;
@ -19,24 +20,52 @@ import java.awt.event.ActionListener;
public class VanChartPlotLabelPane extends BasicPane { public class VanChartPlotLabelPane extends BasicPane {
private static final long serialVersionUID = -1701936672446232396L; private static final long serialVersionUID = -1701936672446232396L;
protected UICheckBox isLabelShow; private UICheckBox isLabelShow;
protected VanChartPlotLabelDetailPane labelDetailPane; private VanChartPlotLabelDetailPane labelDetailPane;
protected VanChartStylePane parent; private VanChartStylePane parent;
protected Plot plot; private Plot plot;
protected JPanel labelPane; private JPanel labelPane;
public VanChartPlotLabelPane(Plot plot, VanChartStylePane parent) { public VanChartPlotLabelPane(Plot plot, VanChartStylePane parent) {
this.parent = parent; this.parent = parent;
this.plot = plot; this.plot = plot;
isLabelShow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Label")); isLabelShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Label"));
labelPane = new JPanel(new BorderLayout(0, 4)); labelPane = new JPanel(new BorderLayout(0, 4));
createLabelPane(); createLabelPane();
addComponents(); addComponents();
} }
public UICheckBox getLabelShowCheckBox() {
return isLabelShow;
}
public VanChartPlotLabelDetailPane getLabelDetailPane() {
return labelDetailPane;
}
public void setLabelDetailPane(VanChartPlotLabelDetailPane labelDetailPane) {
this.labelDetailPane = labelDetailPane;
}
public VanChartStylePane getParentPane() {
return parent;
}
public Plot getPlot() {
return plot;
}
public JPanel getLabelPane() {
return labelPane;
}
public void setLabelPane(JPanel labelPane) {
this.labelPane = labelPane;
}
protected void createLabelPane() { protected void createLabelPane() {
labelDetailPane = new VanChartPlotLabelDetailPane(this.plot, this.parent); labelDetailPane = new VanChartPlotLabelDetailPane(this.plot, this.parent);
labelPane.add(labelDetailPane, BorderLayout.CENTER); labelPane.add(labelDetailPane, BorderLayout.CENTER);

1
designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotRefreshTooltipPane.java

@ -72,7 +72,6 @@ public class VanChartPlotRefreshTooltipPane extends VanChartPlotTooltipNoCheckPa
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{refreshTooltipContentPane,null}, new Component[]{refreshTooltipContentPane,null},
new Component[]{initDurationPane(),null}, new Component[]{initDurationPane(),null},
new Component[]{createLabelStylePane(),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},

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

@ -7,8 +7,6 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; 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.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.AttrTooltip; import com.fr.plugin.chart.base.AttrTooltip;
@ -28,13 +26,11 @@ import java.awt.event.ActionListener;
public class VanChartPlotTooltipPane extends BasicPane { public class VanChartPlotTooltipPane extends BasicPane {
private static final long serialVersionUID = 6087381131907589370L; private static final long serialVersionUID = 6087381131907589370L;
// todo 使用private
protected UICheckBox isTooltipShow; protected UICheckBox isTooltipShow;
protected VanChartTooltipContentPane tooltipContentPane; protected VanChartTooltipContentPane tooltipContentPane;
protected UIButtonGroup<Integer> style;
protected ChartTextAttrPane textFontPane;
protected VanChartBorderWithRadiusPane borderPane; protected VanChartBorderWithRadiusPane borderPane;
protected VanChartBackgroundWithOutImagePane backgroundPane; protected VanChartBackgroundWithOutImagePane backgroundPane;
@ -95,7 +91,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
protected Component[][] createComponents(Plot plot) { protected Component[][] createComponents(Plot plot) {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{tooltipContentPane,null}, new Component[]{tooltipContentPane,null},
new Component[]{createLabelStylePane(),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},
new Component[]{createDisplayStrategy(plot),null}, new Component[]{createDisplayStrategy(plot),null},
@ -108,38 +103,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this); tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this);
} }
protected JPanel createLabelStylePane() {
style = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),Toolkit.i18nText("Fine-Design_Chart_Custom")});
textFontPane = new ChartTextAttrPane() {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Character"), style);
JPanel panel1 = new JPanel(new BorderLayout());
panel1.add(panel, BorderLayout.CENTER);
panel1.add(textFontPane, BorderLayout.SOUTH);
initStyleListener();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1);
}
private void initStyleListener() {
style.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkStyleUse();
}
});
}
protected JPanel createDisplayStrategy(Plot plot) { protected JPanel createDisplayStrategy(Plot plot) {
showAllSeries = new UICheckBox(getShowAllSeriesLabelText()); showAllSeries = new UICheckBox(getShowAllSeriesLabelText());
followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"),
@ -175,7 +138,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
private void checkAllUse() { private void checkAllUse() {
checkBoxUse(); checkBoxUse();
checkStyleUse();
} }
/** /**
* 检查box使用. * 检查box使用.
@ -184,10 +146,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
tooltipPane.setVisible(isTooltipShow.isSelected()); tooltipPane.setVisible(isTooltipShow.isSelected());
} }
private void checkStyleUse() {
textFontPane.setVisible(style.getSelectedIndex() == 1);
}
protected AttrTooltip getAttrTooltip() { protected AttrTooltip getAttrTooltip() {
return new AttrTooltip(); return new AttrTooltip();
} }
@ -202,8 +160,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
tooltipContentPane.populateBean(attr.getContent()); tooltipContentPane.populateBean(attr.getContent());
} }
style.setSelectedIndex(attr.isCustom() ? 1 : 0);
textFontPane.populate(attr.getTextAttr());
borderPane.populate(attr.getGeneralInfo()); borderPane.populate(attr.getGeneralInfo());
backgroundPane.populate(attr.getGeneralInfo()); backgroundPane.populate(attr.getGeneralInfo());
if(showAllSeries != null) { if(showAllSeries != null) {
@ -224,10 +180,6 @@ public class VanChartPlotTooltipPane extends BasicPane {
attrTooltip.setContent(tooltipContentPane.updateBean()); attrTooltip.setContent(tooltipContentPane.updateBean());
} }
attrTooltip.setCustom(style.getSelectedIndex() == 1);
if(textFontPane != null){
attrTooltip.setTextAttr(textFontPane.update());
}
borderPane.update(attrTooltip.getGeneralInfo()); borderPane.update(attrTooltip.getGeneralInfo());
backgroundPane.update(attrTooltip.getGeneralInfo()); backgroundPane.update(attrTooltip.getGeneralInfo());
if(showAllSeries != null) { if(showAllSeries != null) {

18
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/FunnelPercentFormatPaneWithoutCheckBox.java

@ -0,0 +1,18 @@
package com.fr.van.chart.funnel.designer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class FunnelPercentFormatPaneWithoutCheckBox extends PercentFormatPaneWithoutCheckBox {
public FunnelPercentFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Value_Conversion");
}
}

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

@ -4,8 +4,12 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
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.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -25,18 +29,34 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane {
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null}
}; };
} }
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {

34
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java

@ -1,7 +1,9 @@
package com.fr.van.chart.funnel.designer.style; package com.fr.van.chart.funnel.designer.style;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -18,8 +20,16 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); setChangedValueFormatPane(new ChangedValueFormatPaneWithCheckBox(parent, showOnPane));
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected double[] getRowSize(double p){ protected double[] getRowSize(double p){
@ -28,11 +38,21 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{changedValueFormatPane,null}, new Component[]{getChangedValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }
} }

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

@ -4,8 +4,11 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
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.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -25,18 +28,34 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null}
}; };
} }
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {

20
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttLabelContentPane.java

@ -1,20 +0,0 @@
package com.fr.van.chart.gantt.designer.style;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane;
import javax.swing.JPanel;
/**
* Created by hufan on 2017/1/13.
*/
public class VanChartGanttLabelContentPane extends VanChartGanttTooltipContentPane {
public VanChartGanttLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected VanChartHtmlLabelPane createHtmlLabelPane() {
return new VanChartHtmlLabelPane();
}
}

121
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttLabelContentPane.java

@ -0,0 +1,121 @@
package com.fr.van.chart.gantt.designer.style.label;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartDateFormatPaneWithCheckBox;
import com.fr.van.chart.gantt.designer.style.tooltip.VanChartFormatComBoxWithCheckBox;
import javax.swing.JPanel;
import java.awt.Component;
/**
* Created by hufan on 2017/1/13.
*/
public class VanChartGanttLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
private VanChartFormatPaneWithCheckBox processesFormatPane;
private VanChartDateFormatPaneWithCheckBox startTimeFormatPane;
private VanChartDateFormatPaneWithCheckBox endTimeFormatPane;
private VanChartFormatComBoxWithCheckBox durationFormatPane;
private VanChartFormatPaneWithCheckBox progressFormatPane;
public VanChartGanttLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
processesFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Project_Name");
}
};
setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
startTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane) {
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Start_Time");
}
};
endTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane) {
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_End_Time");
}
};
durationFormatPane = new VanChartFormatComBoxWithCheckBox();
progressFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Process");
}
};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{processesFormatPane, null},
new Component[]{getSeriesNameFormatPane(), null},
new Component[]{startTimeFormatPane, null},
new Component[]{endTimeFormatPane, null},
new Component[]{durationFormatPane, null},
new Component[]{progressFormatPane, null}
};
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p};
}
@Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof AttrGanttTooltipContent) {
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
processesFormatPane.populate(ganttTooltipContent.getProcessesFormat());
getSeriesNameFormatPane().populate(ganttTooltipContent.getSeriesFormat());
startTimeFormatPane.populate(ganttTooltipContent.getStartTimeFormat());
endTimeFormatPane.populate(ganttTooltipContent.getEndTimeFormat());
durationFormatPane.populate(ganttTooltipContent.getDurationFormat());
progressFormatPane.populate(ganttTooltipContent.getProgressFormat());
}
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof AttrGanttTooltipContent) {
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
processesFormatPane.update(ganttTooltipContent.getProcessesFormat());
getSeriesNameFormatPane().update(ganttTooltipContent.getSeriesFormat());
startTimeFormatPane.update(ganttTooltipContent.getStartTimeFormat());
endTimeFormatPane.update(ganttTooltipContent.getEndTimeFormat());
durationFormatPane.update(ganttTooltipContent.getDurationFormat());
progressFormatPane.update(ganttTooltipContent.getProgressFormat());
}
}
public boolean isDirty() {
return processesFormatPane.isDirty()
|| getSeriesNameFormatPane().isDirty()
|| startTimeFormatPane.isDirty()
|| endTimeFormatPane.isDirty()
|| durationFormatPane.isDirty()
|| progressFormatPane.isDirty();
}
public void setDirty(boolean isDirty) {
processesFormatPane.setDirty(isDirty);
getSeriesNameFormatPane().setDirty(isDirty);
startTimeFormatPane.setDirty(isDirty);
endTimeFormatPane.setDirty(isDirty);
durationFormatPane.setDirty(isDirty);
progressFormatPane.setDirty(isDirty);
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrGanttTooltipContent();
}
}

16
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelDetailPane.java

@ -0,0 +1,16 @@
package com.fr.van.chart.gantt.designer.style.label;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
public class VanChartGanttPlotLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartGanttPlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void initToolTipContentPane(Plot plot) {
setDataLabelContentPane(new VanChartGanttLabelContentPane(getParentPane(), VanChartGanttPlotLabelDetailPane.this));
}
}

20
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/label/VanChartGanttPlotLabelPane.java

@ -0,0 +1,20 @@
package com.fr.van.chart.gantt.designer.style.label;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
import java.awt.BorderLayout;
public class VanChartGanttPlotLabelPane extends VanChartPlotLabelPane {
public VanChartGanttPlotLabelPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void createLabelPane() {
VanChartGanttPlotLabelDetailPane labelDetailPane = new VanChartGanttPlotLabelDetailPane(getPlot(), getParentPane());
setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
}
}

18
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartDateFormatPaneWithCheckBox.java

@ -0,0 +1,18 @@
package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.gui.style.FormatPane;
import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public abstract class VanChartDateFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox {
public VanChartDateFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected FormatPane createFormatPane(){
return PlotFactory.createAutoFormatPane();
}
}

18
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartDateFormatPaneWithoutCheckBox.java

@ -0,0 +1,18 @@
package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.gui.style.FormatPane;
import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public abstract class VanChartDateFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public VanChartDateFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected FormatPane createFormatPane() {
return PlotFactory.createAutoFormatPane();
}
}

100
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithCheckBox.java

@ -0,0 +1,100 @@
package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Map;
public class VanChartFormatComBoxWithCheckBox extends JPanel {
private static final String LABEL_TEXT = Toolkit.i18nText("Fine-Design_Chart_Duration_Time");
private UICheckBox isSelectedBox;
private UIComboBox formatComBox;
private boolean isDirty;
public VanChartFormatComBoxWithCheckBox() {
this.setLayout(new BorderLayout());
isSelectedBox = new UICheckBox(LABEL_TEXT);
formatComBox = new UIComboBox(IntervalTimeFormat.getFormats());
isSelectedBox.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
isDirty = true;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
formatComBox.setPreferredSize(new Dimension(40, 20));
if (showSelectBox()) {
this.add(isSelectedBox, BorderLayout.CENTER);
} else {
this.add(new UILabel(LABEL_TEXT), BorderLayout.CENTER);
}
this.add(formatComBox, BorderLayout.EAST);
}
protected boolean showSelectBox() {
return true;
}
public boolean isDirty() {
return isDirty;
}
public void setDirty(boolean isDirty) {
this.isDirty = isDirty;
}
public void populate(AttrTooltipFormat tooltipFormat) {
if (tooltipFormat instanceof AttrTooltipDurationFormat) {
this.isSelectedBox.setSelected(tooltipFormat.isEnable());
formatComBox.setSelectedItem(((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat());
}
}
public void update(AttrTooltipFormat tooltipFormat) {
if (tooltipFormat instanceof AttrTooltipDurationFormat) {
tooltipFormat.setEnable(isSelectedBox.isSelected());
((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat((IntervalTimeFormat) formatComBox.getSelectedItem());
}
}
public void updateFormatParams(Map<String, String> paramMap, String value) {
String key = LABEL_TEXT;
if (paramMap != null && !paramMap.containsKey(key)) {
paramMap.put(key, value);
}
}
}

8
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartFormatComBoxWithoutCheckBox.java

@ -0,0 +1,8 @@
package com.fr.van.chart.gantt.designer.style.tooltip;
public class VanChartFormatComBoxWithoutCheckBox extends VanChartFormatComBoxWithCheckBox {
protected boolean showSelectBox() {
return false;
}
}

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

@ -1,26 +1,24 @@
package com.fr.van.chart.gantt.designer.style.tooltip; package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.style.FormatPane;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat;
import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.util.Map;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/** /**
* Created by hufan on 2017/1/13. * Created by hufan on 2017/1/13.
@ -32,6 +30,12 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
private VanChartFormatComBoxWithCheckBox durationFormatPane; private VanChartFormatComBoxWithCheckBox durationFormatPane;
private VanChartFormatPaneWithCheckBox progressFormatPane; private VanChartFormatPaneWithCheckBox progressFormatPane;
private VanChartFormatPaneWithoutCheckBox richTextProcessesFormatPane;
private VanChartDateFormatPaneWithoutCheckBox richTextStartTimeFormatPane;
private VanChartDateFormatPaneWithoutCheckBox richTextEndTimeFormatPane;
private VanChartFormatComBoxWithoutCheckBox richTextDurationFormatPane;
private VanChartFormatPaneWithoutCheckBox richTextProgressFormatPane;
public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane); super(parent, showOnPane);
} }
@ -40,27 +44,52 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
processesFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane){ processesFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Project_Name"); return Toolkit.i18nText("Fine-Design_Chart_Project_Name");
} }
}; };
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
startTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane){ startTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Time"); return Toolkit.i18nText("Fine-Design_Chart_Start_Time");
} }
}; };
endTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane){ endTimeFormatPane = new VanChartDateFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Time"); return Toolkit.i18nText("Fine-Design_Chart_End_Time");
} }
}; };
durationFormatPane = new VanChartFormatComBoxWithCheckBox(); durationFormatPane = new VanChartFormatComBoxWithCheckBox();
progressFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane){ progressFormatPane = new VanChartFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Process"); return Toolkit.i18nText("Fine-Design_Chart_Process");
}
};
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
richTextProcessesFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Project_Name");
}
};
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
richTextStartTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Start_Time");
}
};
richTextEndTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_End_Time");
}
};
richTextDurationFormatPane = new VanChartFormatComBoxWithoutCheckBox();
richTextProgressFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Process");
} }
}; };
} }
@ -68,7 +97,7 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{processesFormatPane,null}, new Component[]{processesFormatPane,null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(),null},
new Component[]{startTimeFormatPane,null}, new Component[]{startTimeFormatPane,null},
new Component[]{endTimeFormatPane,null}, new Component[]{endTimeFormatPane,null},
new Component[]{durationFormatPane, null}, new Component[]{durationFormatPane, null},
@ -76,16 +105,28 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
}; };
} }
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{richTextProcessesFormatPane,null},
new Component[]{getRichTextSeriesNameFormatPane(),null},
new Component[]{richTextStartTimeFormatPane,null},
new Component[]{richTextEndTimeFormatPane,null},
new Component[]{richTextDurationFormatPane, null},
new Component[]{richTextProgressFormatPane, null}
};
}
protected double[] getRowSize(double p){ protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p,p}; return new double[]{p,p,p,p,p,p};
} }
@Override @Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
// fixme 当前的样式面板设计都是基于一个大而全的父类,在子类中组合需要的属性,导致父类的属性多是protected,且子类不能明确获取自己Model的type
if (attrTooltipContent instanceof AttrGanttTooltipContent){ if (attrTooltipContent instanceof AttrGanttTooltipContent){
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
processesFormatPane.populate(ganttTooltipContent.getProcessesFormat()); processesFormatPane.populate(ganttTooltipContent.getProcessesFormat());
seriesNameFormatPane.populate(ganttTooltipContent.getSeriesFormat()); getSeriesNameFormatPane().populate(ganttTooltipContent.getSeriesFormat());
startTimeFormatPane.populate(ganttTooltipContent.getStartTimeFormat()); startTimeFormatPane.populate(ganttTooltipContent.getStartTimeFormat());
endTimeFormatPane.populate(ganttTooltipContent.getEndTimeFormat()); endTimeFormatPane.populate(ganttTooltipContent.getEndTimeFormat());
durationFormatPane.populate(ganttTooltipContent.getDurationFormat()); durationFormatPane.populate(ganttTooltipContent.getDurationFormat());
@ -93,11 +134,44 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent){
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipProcessesFormat processesFormat = ganttTooltipContent.getRichTextProcessesFormat();
richTextProcessesFormatPane.populate(processesFormat);
richTextProcessesFormatPane.updateFormatParams(params, processesFormat.getJs());
AttrTooltipSeriesFormat seriesFormat = ganttTooltipContent.getRichTextSeriesFormat();
getRichTextSeriesNameFormatPane().populate(seriesFormat);
getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs());
AttrTooltipStartTimeFormat startTimeFormat = ganttTooltipContent.getRichTextStartTimeFormat();
richTextStartTimeFormatPane.populate(startTimeFormat);
richTextStartTimeFormatPane.updateFormatParams(params, startTimeFormat.getJs());
AttrTooltipEndTimeFormat endTimeFormat = ganttTooltipContent.getRichTextEndTimeFormat();
richTextEndTimeFormatPane.populate(endTimeFormat);
richTextEndTimeFormatPane.updateFormatParams(params, endTimeFormat.getJs());
AttrTooltipDurationFormat durationFormat = ganttTooltipContent.getRichTextDurationFormat();
richTextDurationFormatPane.populate(durationFormat);
richTextDurationFormatPane.updateFormatParams(params, durationFormat.getJs());
AttrTooltipProgressFormat progressFormat = ganttTooltipContent.getRichTextProgressFormat();
richTextProgressFormatPane.populate(progressFormat);
richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs());
populateRichText(attrTooltipContent.getRichTextAttr());
}
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof AttrGanttTooltipContent){ if (attrTooltipContent instanceof AttrGanttTooltipContent){
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
processesFormatPane.update(ganttTooltipContent.getProcessesFormat()); processesFormatPane.update(ganttTooltipContent.getProcessesFormat());
seriesNameFormatPane.update(ganttTooltipContent.getSeriesFormat()); getSeriesNameFormatPane().update(ganttTooltipContent.getSeriesFormat());
startTimeFormatPane.update(ganttTooltipContent.getStartTimeFormat()); startTimeFormatPane.update(ganttTooltipContent.getStartTimeFormat());
endTimeFormatPane.update(ganttTooltipContent.getEndTimeFormat()); endTimeFormatPane.update(ganttTooltipContent.getEndTimeFormat());
durationFormatPane.update(ganttTooltipContent.getDurationFormat()); durationFormatPane.update(ganttTooltipContent.getDurationFormat());
@ -105,9 +179,22 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent instanceof AttrGanttTooltipContent) {
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
richTextProcessesFormatPane.update(ganttTooltipContent.getRichTextProcessesFormat());
getRichTextSeriesNameFormatPane().update(ganttTooltipContent.getRichTextSeriesFormat());
richTextStartTimeFormatPane.update(ganttTooltipContent.getRichTextStartTimeFormat());
richTextEndTimeFormatPane.update(ganttTooltipContent.getRichTextEndTimeFormat());
richTextDurationFormatPane.update(ganttTooltipContent.getRichTextDurationFormat());
richTextProgressFormatPane.update(ganttTooltipContent.getRichTextProgressFormat());
}
}
public boolean isDirty() { public boolean isDirty() {
return processesFormatPane.isDirty() return processesFormatPane.isDirty()
|| seriesNameFormatPane.isDirty() || getSeriesNameFormatPane().isDirty()
|| startTimeFormatPane.isDirty() || startTimeFormatPane.isDirty()
|| endTimeFormatPane.isDirty() || endTimeFormatPane.isDirty()
|| durationFormatPane.isDirty() || durationFormatPane.isDirty()
@ -116,7 +203,7 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
processesFormatPane.setDirty(isDirty); processesFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty); getSeriesNameFormatPane().setDirty(isDirty);
startTimeFormatPane.setDirty(isDirty); startTimeFormatPane.setDirty(isDirty);
endTimeFormatPane.setDirty(isDirty); endTimeFormatPane.setDirty(isDirty);
durationFormatPane.setDirty(isDirty); durationFormatPane.setDirty(isDirty);
@ -126,79 +213,4 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
return new AttrGanttTooltipContent(); return new AttrGanttTooltipContent();
} }
private abstract class VanChartDateFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox {
public VanChartDateFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
@Override
protected FormatPane createFormatPane(){
return PlotFactory.createAutoFormatPane();
}
}
private class VanChartFormatComBoxWithCheckBox extends JPanel{
private UICheckBox isSelectedBox;
private UIComboBox formatComBox;
private boolean isDirty;
private VanChartFormatComBoxWithCheckBox() {
this.setLayout(new BorderLayout());
isSelectedBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Duration_Time"));
formatComBox = new UIComboBox(IntervalTimeFormat.getFormats());
isSelectedBox.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
isDirty = true;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
formatComBox.setPreferredSize(new Dimension(40,20));
this.add(isSelectedBox, BorderLayout.CENTER);
this.add(formatComBox, BorderLayout.EAST);
}
private boolean isDirty() {
return isDirty;
}
private void setDirty(boolean isDirty) {
this.isDirty = isDirty;
}
private void populate(AttrTooltipFormat tooltipFormat) {
if(tooltipFormat instanceof AttrTooltipDurationFormat) {
this.isSelectedBox.setSelected(tooltipFormat.isEnable());
formatComBox.setSelectedItem(((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat());
}
}
private void update(AttrTooltipFormat tooltipFormat) {
if(tooltipFormat instanceof AttrTooltipDurationFormat) {
tooltipFormat.setEnable(isSelectedBox.isSelected());
((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat((IntervalTimeFormat) formatComBox.getSelectedItem());
}
}
}
} }

20
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -5,9 +5,13 @@ import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -22,10 +26,18 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new MapAreaNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new MapAreaNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
@Override @Override

42
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java

@ -3,7 +3,9 @@ package com.fr.van.chart.map.designer.style.tooltip;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
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,25 +19,45 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont
super(null, showOnPane); super(null, showOnPane);
} }
protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p,p};
}
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane);
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane);
setChangedValueFormatPane(new ChangedValueFormatPaneWithCheckBox(parent, showOnPane));
setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
} }
protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p,p}; @Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(), null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{changedValueFormatPane,null}, new Component[]{getChangedValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }

20
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java

@ -5,9 +5,13 @@ import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -22,10 +26,18 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane {
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new MapAreaNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new MapAreaNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
@Override @Override

17
designer-chart/src/main/java/com/fr/van/chart/map/line/StartAndEndNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,17 @@
package com.fr.van.chart.map.line;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class StartAndEndNameFormatPaneWithoutCheckBox extends CategoryNameFormatPaneWithoutCheckBox {
public StartAndEndNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Start_And_End");
}
}

19
designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java

@ -5,8 +5,11 @@ import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -21,10 +24,18 @@ public class VanChartLineMapTooltipContentPane extends VanChartTooltipContentPan
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){
categoryNameFormatPane = new StartAndEndNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new StartAndEndNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new StartAndEndNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
@Override @Override

18
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieLevelNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,18 @@
package com.fr.van.chart.multilayer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class MultiPieLevelNameFormatPaneWithoutCheckBox extends CategoryNameFormatPaneWithoutCheckBox {
public MultiPieLevelNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Level_Name");
}
}

18
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/MultiPieSeriesNameFormatPaneWithoutCheckBox.java

@ -0,0 +1,18 @@
package com.fr.van.chart.multilayer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
public class MultiPieSeriesNameFormatPaneWithoutCheckBox extends SeriesNameFormatPaneWithoutCheckBox {
public MultiPieSeriesNameFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
}
}

18
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java

@ -4,7 +4,9 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,10 +21,18 @@ public class VanChartMultiPieLabelContentPane extends VanChartLabelContentPane {
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new MultiPieLevelNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new MultiPieSeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {

18
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java

@ -4,7 +4,9 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,10 +21,18 @@ public class VanChartMultiPieTooltipContentPane extends VanChartTooltipContentPa
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new MultiPieLevelNameFormatPaneWithCheckBox(parent, showOnPane); setCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithCheckBox(parent, showOnPane));
seriesNameFormatPane = new MultiPieSeriesNameFormatPaneWithCheckBox(parent, showOnPane); setSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithCheckBox(parent, showOnPane));
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
@Override @Override

37
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java

@ -1,7 +1,9 @@
package com.fr.van.chart.multilayer.style; package com.fr.van.chart.multilayer.style;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -21,8 +23,16 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); setChangedValueFormatPane(new ChangedValueFormatPaneWithCheckBox(parent, showOnPane));
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
} }
protected double[] getRowSize(double p){ protected double[] getRowSize(double p){
@ -31,12 +41,23 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(), null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getValueFormatPane(), null},
new Component[]{changedValueFormatPane,null}, new Component[]{getChangedValueFormatPane(), null},
new Component[]{percentFormatPane,null}, new Component[]{getPercentFormatPane(), null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }

75
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java

@ -1,9 +1,13 @@
package com.fr.van.chart.scatter; package com.fr.van.chart.scatter;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -15,7 +19,7 @@ import java.awt.Component;
public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterTooltipContentPane { public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterTooltipContentPane {
private ChangedValueFormatPaneWithCheckBox changedSizeFormatPane; private ChangedValueFormatPaneWithCheckBox changedSizeFormatPane;
private ChangedValueFormatPaneWithoutCheckBox richTextChangedSizeFormatPane;
public VanChartScatterRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartScatterRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane); super(null, showOnPane);
@ -25,9 +29,17 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedSizeFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); changedSizeFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane);
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane);
setChangedPercentFormatPane(changedPercentFormatPane);
} }
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
richTextChangedSizeFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane);
ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane);
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
}
protected double[] getRowSize(double p) { protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p}; return new double[]{p, p, p, p, p, p};
@ -35,12 +47,24 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane, null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{getxFormatPane(), null}, new Component[]{getXFormatPane(), null},
new Component[]{getyFormatPane(), null}, new Component[]{getYFormatPane(), null},
new Component[]{getSizeFormatPane(), null}, new Component[]{getSizeFormatPane(), null},
new Component[]{changedSizeFormatPane, null}, new Component[]{changedSizeFormatPane, null},
new Component[]{changedPercentFormatPane, null}, new Component[]{getChangedPercentFormatPane(), null},
};
}
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextXFormatPane(), null},
new Component[]{getRichTextYFormatPane(), null},
new Component[]{getRichTextSizeFormatPane(), null},
new Component[]{richTextChangedSizeFormatPane, null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }
@ -51,18 +75,49 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
if (attrTooltipContent instanceof ScatterAttrTooltipContent) { if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
changedSizeFormatPane.populate(scatterAttrTooltipContent.getChangeSizeFormat()); changedSizeFormatPane.populate(scatterAttrTooltipContent.getChangeSizeFormat());
changedPercentFormatPane.populate(scatterAttrTooltipContent.getChangedSizePercentFormat()); getChangedPercentFormatPane().populate(scatterAttrTooltipContent.getChangedSizePercentFormat());
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
super.populateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextChangedSizeFormatPane,
getRichTextChangedPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextChangeSizeFormat(),
scatterAttrTooltipContent.getRichTextChangedSizePercentFormat()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
}
@Override @Override
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
super.updateFormatPane(attrTooltipContent); super.updateFormatPane(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) { if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
changedSizeFormatPane.update(scatterAttrTooltipContent.getChangeSizeFormat()); changedSizeFormatPane.update(scatterAttrTooltipContent.getChangeSizeFormat());
changedPercentFormatPane.update(scatterAttrTooltipContent.getChangedSizePercentFormat()); getChangedPercentFormatPane().update(scatterAttrTooltipContent.getChangedSizePercentFormat());
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
super.updateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
richTextChangedSizeFormatPane.update(scatterAttrTooltipContent.getRichTextChangeSizeFormat());
getRichTextChangedPercentFormatPane().update(scatterAttrTooltipContent.getRichTextChangedSizePercentFormat());
} }
} }
@ -70,13 +125,13 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
super.setDirty(isDirty); super.setDirty(isDirty);
changedSizeFormatPane.setDirty(isDirty); changedSizeFormatPane.setDirty(isDirty);
changedPercentFormatPane.setDirty(isDirty); getChangedPercentFormatPane().setDirty(isDirty);
} }
@Override @Override
public boolean isDirty() { public boolean isDirty() {
return super.isDirty() || changedSizeFormatPane.isDirty() || changedPercentFormatPane.isDirty(); return super.isDirty() || changedSizeFormatPane.isDirty() || getChangedPercentFormatPane().isDirty();
} }
} }

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

@ -1,11 +1,16 @@
package com.fr.van.chart.scatter; package com.fr.van.chart.scatter;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -20,11 +25,15 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
private YFormatPaneWithCheckBox yFormatPane; private YFormatPaneWithCheckBox yFormatPane;
private ValueFormatPaneWithCheckBox sizeFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane;
public XFormatPaneWithCheckBox getxFormatPane() { private XFormatPaneWithoutCheckBox richTextXFormatPane;
private YFormatPaneWithoutCheckBox richTextYFormatPane;
private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane;
public XFormatPaneWithCheckBox getXFormatPane() {
return xFormatPane; return xFormatPane;
} }
public YFormatPaneWithCheckBox getyFormatPane() { public YFormatPaneWithCheckBox getYFormatPane() {
return yFormatPane; return yFormatPane;
} }
@ -32,6 +41,18 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
return sizeFormatPane; return sizeFormatPane;
} }
public XFormatPaneWithoutCheckBox getRichTextXFormatPane() {
return richTextXFormatPane;
}
public YFormatPaneWithoutCheckBox getRichTextYFormatPane() {
return richTextYFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){
super(parent, showOnPane); super(parent, showOnPane);
} }
@ -45,16 +66,35 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
} }
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane);
richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane);
richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
}
@Override @Override
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(),null},
new Component[]{xFormatPane,null}, new Component[]{xFormatPane,null},
new Component[]{yFormatPane,null}, new Component[]{yFormatPane,null},
new Component[]{sizeFormatPane,null}, new Component[]{sizeFormatPane,null},
}; };
} }
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextXFormatPane, null},
new Component[]{richTextYFormatPane, null},
new Component[]{richTextSizeFormatPane, null}
};
}
@Override @Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
super.populateFormatPane(attrTooltipContent); super.populateFormatPane(attrTooltipContent);
@ -66,6 +106,27 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
super.populateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextXFormatPane, richTextYFormatPane, richTextSizeFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextXFormat(),
scatterAttrTooltipContent.getRichTextYFormat(),
scatterAttrTooltipContent.getRichTextSizeFormat()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
}
@Override @Override
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
super.updateFormatPane(attrTooltipContent); super.updateFormatPane(attrTooltipContent);
@ -77,17 +138,28 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
super.updateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat());
richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat());
richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat());
}
}
@Override @Override
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
xFormatPane.setDirty(isDirty); xFormatPane.setDirty(isDirty);
yFormatPane.setDirty(isDirty); yFormatPane.setDirty(isDirty);
sizeFormatPane.setDirty(isDirty); sizeFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty); getSeriesNameFormatPane().setDirty(isDirty);
} }
@Override @Override
public boolean isDirty() { public boolean isDirty() {
return xFormatPane.isDirty() || yFormatPane.isDirty() || sizeFormatPane.isDirty() || seriesNameFormatPane.isDirty(); return xFormatPane.isDirty() || yFormatPane.isDirty() || sizeFormatPane.isDirty() || getSeriesNameFormatPane().isDirty();
} }
@Override @Override

2
designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java

@ -19,6 +19,6 @@ public class VanChartScatterPlotLabelDetailPane extends VanChartPlotLabelDetailP
@Override @Override
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
dataLabelContentPane = new VanChartScatterLabelContentPane(parent,VanChartScatterPlotLabelDetailPane.this); setDataLabelContentPane(new VanChartScatterLabelContentPane(getParentPane(),VanChartScatterPlotLabelDetailPane.this));
} }
} }

6
designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelNoCheckPane.java

@ -19,12 +19,12 @@ public class VanChartScatterPlotLabelNoCheckPane extends VanChartScatterPlotLabe
protected void addComponents() { protected void addComponents() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(labelPane,BorderLayout.CENTER); this.add(getLabelPane(), BorderLayout.CENTER);
} }
public void populate(AttrLabel attr) { public void populate(AttrLabel attr) {
super.populate(attr); super.populate(attr);
isLabelShow.setSelected(true); getLabelShowCheckBox().setSelected(true);
labelPane.setVisible(true); getLabelPane().setVisible(true);
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java

@ -18,7 +18,8 @@ public class VanChartScatterPlotLabelPane extends VanChartPlotLabelPane {
@Override @Override
protected void createLabelPane() { protected void createLabelPane() {
labelDetailPane = new VanChartScatterPlotLabelDetailPane(this.plot, this.parent); VanChartScatterPlotLabelDetailPane labelDetailPane = new VanChartScatterPlotLabelDetailPane(getPlot(), getParentPane());
labelPane.add(labelDetailPane, BorderLayout.CENTER); setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
} }
} }

28
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureLabelContentPane.java

@ -1,9 +1,10 @@
package com.fr.van.chart.structure.desinger.style; package com.fr.van.chart.structure.desinger.style;
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.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPaneWithoutRichText;
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.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
@ -16,7 +17,7 @@ import java.awt.Component;
/** /**
* Created by shine on 2017/2/15. * Created by shine on 2017/2/15.
*/ */
public class VanChartStructureLabelContentPane extends VanChartLabelContentPane { public class VanChartStructureLabelContentPane extends VanChartLabelContentPaneWithoutRichText {
public VanChartStructureLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartStructureLabelContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane); super(parent, showOnPane);
} }
@ -24,28 +25,33 @@ public class VanChartStructureLabelContentPane extends VanChartLabelContentPane
@Override @Override
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents(){
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(),null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(),null},
new Component[]{valueFormatPane,null} new Component[]{getValueFormatPane(),null}
}; };
} }
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){ CategoryNameFormatPaneWithCheckBox categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Name"); return Toolkit.i18nText("Fine-Design_Chart_Node_Name");
} }
}; };
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){ SeriesNameFormatPaneWithCheckBox seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
} }
}; };
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); ValueFormatPaneWithCheckBox valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); PercentFormatPaneWithCheckBox percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
setCategoryNameFormatPane(categoryNameFormatPane);
setSeriesNameFormatPane(seriesNameFormatPane);
setValueFormatPane(valueFormatPane);
setPercentFormatPane(percentFormatPane);
} }
@Override @Override

16
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructurePlotLabelDetailPane.java

@ -0,0 +1,16 @@
package com.fr.van.chart.structure.desinger.style;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
public class VanChartStructurePlotLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartStructurePlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void initToolTipContentPane(Plot plot) {
setDataLabelContentPane(new VanChartStructureLabelContentPane(getParentPane(), VanChartStructurePlotLabelDetailPane.this));
}
}

20
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructurePlotLabelPane.java

@ -0,0 +1,20 @@
package com.fr.van.chart.structure.desinger.style;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
import java.awt.BorderLayout;
public class VanChartStructurePlotLabelPane extends VanChartPlotLabelPane {
public VanChartStructurePlotLabelPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void createLabelPane() {
VanChartStructurePlotLabelDetailPane labelDetailPane = new VanChartStructurePlotLabelDetailPane(getPlot(), getParentPane());
setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
}
}

48
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java

@ -1,7 +1,9 @@
package com.fr.van.chart.structure.desinger.style; package com.fr.van.chart.structure.desinger.style;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -10,7 +12,7 @@ import java.awt.Component;
/** /**
* Created by mengao on 2017/6/9. * Created by mengao on 2017/6/9.
*/ */
public class VanChartStructureRefreshTooltipContentPane extends VanChartStructureTooltipContentPane{ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructureTooltipContentPane {
public VanChartStructureRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartStructureRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane); super(null, showOnPane);
} }
@ -19,22 +21,44 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane); super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); ChangedValueFormatPaneWithCheckBox changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane);
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane);
setChangedValueFormatPane(changedValueFormatPane);
setChangedPercentFormatPane(changedPercentFormatPane);
} }
protected double[] getRowSize(double p){ protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
return new double[]{p,p,p,p,p}; super.initRichTextFormatPane(parent, showOnPane);
ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane);
ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane);
setRichTextChangedValueFormatPane(richTextChangedValueFormatPane);
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
} }
@Override protected double[] getRowSize(double p) {
protected Component[][] getPaneComponents(){ return new double[]{p, p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{getCategoryNameFormatPane(), null},
new Component[]{getSeriesNameFormatPane(), null},
new Component[]{getValueFormatPane(), null},
new Component[]{getChangedValueFormatPane(), null},
new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null}, new Component[]{getRichTextValueFormatPane(), null},
new Component[]{changedValueFormatPane,null}, new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{changedPercentFormatPane,null}, new Component[]{getRichTextChangedPercentFormatPane(), null}
}; };
} }
} }

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

@ -1,13 +1,18 @@
package com.fr.van.chart.structure.desinger.style; package com.fr.van.chart.structure.desinger.style;
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.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
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.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -22,30 +27,64 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP
} }
@Override @Override
protected Component[][] getPaneComponents(){ protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{categoryNameFormatPane,null}, new Component[]{getCategoryNameFormatPane(), null},
new Component[]{seriesNameFormatPane,null}, new Component[]{getSeriesNameFormatPane(), null},
new Component[]{valueFormatPane,null} new Component[]{getValueFormatPane(), null}
}; };
} }
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ protected Component[][] getRichTextComponents() {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){ return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null}
};
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
CategoryNameFormatPaneWithCheckBox categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane) {
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Name"); return Toolkit.i18nText("Fine-Design_Chart_Node_Name");
} }
}; };
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){ SeriesNameFormatPaneWithCheckBox seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane) {
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
} }
}; };
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); ValueFormatPaneWithCheckBox valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); PercentFormatPaneWithCheckBox percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
setCategoryNameFormatPane(categoryNameFormatPane);
setSeriesNameFormatPane(seriesNameFormatPane);
setValueFormatPane(valueFormatPane);
setPercentFormatPane(percentFormatPane);
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Node_Name");
}
};
SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
}
};
ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane);
setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane);
setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane);
setRichTextValueFormatPane(richTextValueFormatPane);
setRichTextPercentFormatPane(richTextPercentFormatPane);
} }
@Override @Override

79
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java

@ -0,0 +1,79 @@
package com.fr.van.chart.wordcloud.designer.style;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* Created by mengao on 2017/6/9.
*/
public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordCloudTooltipContentPane {
public VanChartWordCloudRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane);
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);
ChangedValueFormatPaneWithCheckBox changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane) {
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value");
}
};
ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane);
setChangedValueFormatPane(changedValueFormatPane);
setChangedPercentFormatPane(changedPercentFormatPane);
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value");
}
};
ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane);
setRichTextChangedValueFormatPane(richTextChangedValueFormatPane);
setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane);
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{getCategoryNameFormatPane(), null},
new Component[]{getSeriesNameFormatPane(), null},
new Component[]{getValueFormatPane(), null},
new Component[]{getChangedValueFormatPane(), null},
new Component[]{getPercentFormatPane(), null},
new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
}
}

47
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTootipContentPane.java

@ -1,47 +0,0 @@
package com.fr.van.chart.wordcloud.designer.style;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* Created by mengao on 2017/6/9.
*/
public class VanChartWordCloudRefreshTootipContentPane extends VanChartWordCloudTooltipContentPane {
public VanChartWordCloudRefreshTootipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(null, showOnPane);
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initFormatPane(parent, showOnPane);
changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane){
@Override
protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value");
}
};
changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane);
}
protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p,p};
}
protected Component[][] getPaneComponents(){
return new Component[][]{
new Component[]{categoryNameFormatPane,null},
new Component[]{seriesNameFormatPane,null},
new Component[]{valueFormatPane,null},
new Component[]{changedValueFormatPane,null},
new Component[]{percentFormatPane,null},
new Component[]{changedPercentFormatPane,null},
};
}
}

48
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java

@ -1,13 +1,18 @@
package com.fr.van.chart.wordcloud.designer.style; package com.fr.van.chart.wordcloud.designer.style;
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.format.AttrTooltipNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
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.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -22,25 +27,54 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP
@Override @Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane){ CategoryNameFormatPaneWithCheckBox categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane) {
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
} }
}; };
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane){ SeriesNameFormatPaneWithCheckBox seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane) {
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Word_Name"); return Toolkit.i18nText("Fine-Design_Chart_Word_Name");
} }
}; };
valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane){ ValueFormatPaneWithCheckBox valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane) {
@Override @Override
protected String getCheckBoxText() { protected String getCheckBoxText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Word_Value"); return Toolkit.i18nText("Fine-Design_Chart_Word_Value");
} }
}; };
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); PercentFormatPaneWithCheckBox percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
setCategoryNameFormatPane(categoryNameFormatPane);
setSeriesNameFormatPane(seriesNameFormatPane);
setValueFormatPane(valueFormatPane);
setPercentFormatPane(percentFormatPane);
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name");
}
};
SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Word_Name");
}
};
ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Word_Value");
}
};
PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane);
setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane);
setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane);
setRichTextValueFormatPane(richTextValueFormatPane);
setRichTextPercentFormatPane(richTextPercentFormatPane);
} }
@Override @Override

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

@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<script src="http://fanruan.design/fineui/2.0/fineui.js"></script>
<script src="https://fanruan.design/fineui/materials.bundle.min.js"></script>
</head>
<body>
<script>
BICst.RICH_TEXT_INFO = {
DATA_ID: "data-id",
DATA_NAME: "data-name",
DATA_FULL_NAME: "data-full-name",
DATA_ORIGIN_ID: "data-origin-id",
DATA_ORIGIN_NAME: "data-origin-name",
DATA_ORIGIN_FULL_NAME: "data-origin-full-name",
DATA_IS_INSERT_PARAM: "data-is-insert-param",
DATA_IS_MISSING_FIELD: "data-is-missing-field",
DATA_UN_VALID: "data-unvalid",
NAME: "name",
ALT: "alt",
SRC: "src"
};
</script>
<script src="script/insertcombo/item/item.js"></script>
<script src="script/insertcombo/combo.insert_param.js"></script>
<script src="script/insertcombo/combo.insert_param.model.js"></script>
<script src="script/toolbar/disabled_bar_wrapper.js"></script>
<script src="script/toolbar/toolbar.js"></script>
<script src="script/toolbar/toolbar.model.js"></script>
<script src="script/editor.constant.js"></script>
<script src="script/editor.js"></script>
<script src="script/editor.model.js"></script>
<script src="script/editor.service.js"></script>
<script>
window.onload = function () {
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var dimensionIds = [];
var paramGroup = params.split("-");
for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":");
var param = {};
param[key] = value;
dimensionIds.push(param);
}
var rich_editor = BI.createWidget({
type: "bi.design.chart.common.editor",
element: "body",
content: content,
fontStyle: {
textAlign: "center",
fontFamily: "",
fontSize: 18,
italic: true,
fontBold: false
},
isAuto: isAuto,
dimensionIds: dimensionIds,
toolbar: {
buttons: [
{type: "bi.rich_editor_font_chooser"},
{type: "bi.rich_editor_size_chooser"},
{type: "bi.rich_editor_bold_button"},
{type: "bi.rich_editor_italic_button"},
{type: "bi.rich_editor_underline_button"},
{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.design.chart.common.editor.insert_param"}
]
},
ref: function (_ref) {
self.editor = _ref;
}
});
Pool.dispatch = function(){
rich_editor.setValue({content: Pool.data.getContent(), isAuto: Pool.data.isAuto()});
}
Pool.update = function () {
var {content, isAuto} = rich_editor.getValue();
Pool.data.setContent(content);
Pool.data.setAuto(isAuto);
return Pool.data;
};
};
</script>
</body>
</html>

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

@ -0,0 +1,6 @@
!(function () {
BI.constant("bi.constant.design.chart.common.editor.placeholder_style", {
fontColor: "#c4c9d1"
});
}());

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

@ -0,0 +1,241 @@
!(function () {
var Widget = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-design-chart-common-editor",
isAuto: true,
content: "",
placeholder: "",
fontStyle: {},
dimensionIds: [],
toolbar: {
buttons: []
},
textAlign: "center"
},
_store: function () {
var o = this.options;
return BI.Models.getModel("bi.model.design.chart.common.editor", {
dimensionIds: o.dimensionIds,
isAuto: o.isAuto
});
},
render: function () {
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.nic_editor",
$value: "chart-common-editor",
height: 365,
cls: "editor bi-border bi-focus-shadow " + (o.textAlign === "center" ? "editor-center-text" : ""),
listeners: [{
eventName: BI.NicEditor.EVENT_FOCUS,
action: function () {
self.clearPlaceholder();
self.store.setEditorBlurState(false);
}
}, {
eventName: BI.NicEditor.EVENT_BLUR,
action: function () {
self.setPlaceholder();
self.store.setEditorBlurState(true);
}
}]
});
return {
type: "bi.vtape",
ref: function (_ref) {
self.bar = _ref;
},
items: [{
type: "bi.htape",
items: [{
type: "bi.label",
text: "字体样式: ",
textAlign: "left",
width: 70
}, {
type: "bi.button_group",
items: this.model.fontStyleItems,
ref: function (_ref) {
self.fontStyleGroup = _ref;
},
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
var isAuto = this.getValue()[0];
self.store.changeIsAuto(isAuto);
self.changeFontStyleMode(isAuto);
}
}],
layouts: [{
type: "bi.left",
rgap: 5
}],
value: this.model.mode,
width: 125
}, this._getToolBar()],
height: 24
}, {
el: this.editor,
tgap: 10
}]
};
},
_getToolBar: function () {
var self = this;
return {
type: "bi.design.chart.common.editor.toolbar",
cls: "toolbar-region",
wId: this.options.wId,
editor: this.editor,
buttons: this.options.toolbar.buttons,
ref: function (_ref) {
self.toolbar = _ref;
}
};
},
mounted: function () {
this.editor.bindToolbar(this.bar);
this.editor.setValue(this._formatContent(this.options.content));
this.setFocus();
},
_cleanHtml: function (value) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var result = BI.replaceAll(value, "<p></p>", "");
// 去掉image的src属性,因为数据太大了
result = value.replaceAll("<img.*?>", function (imageStr) {
var attrs = editorService.getImageAttr(imageStr);
var str = "<img ";
BI.each(attrs, function (key, value) {
if (key === "src") {
return;
}
str += " " + key + "=\"" + value + "\"";
});
return str + " />";
});
return result;
},
getValue: function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var value = this._cleanHtml(this.editor.getValue(BI.NicEditor.FormatType.ESCAPE));
// BI.each(this.model.dimensionIds, function (idx, dId) {
// var fullName = BI.Utils.getNotGeoDimensionFullName(dId);
// value = editorService.appendImageAttr(value, fullName, BICst.RICH_TEXT_INFO.DATA_ID, dId);
// });
if (editorService.isEmptyRichText(value)) {
value = "";
}
if (BI.isNotEmptyString(this.options.placeholder) && editorService.isRichTextEqual(value, this.options.placeholder)) {
value = null;
}
return {
isAuto: this.model.isAuto,
content: value
};
},
setValue: function (obj) {
var keys = BI.keys(obj);
if (BI.contains(keys, "content")) {
this.editor.setValue(this._formatContent(obj.content));
}
if (BI.contains(keys, "isAuto")) {
this.store.changeIsAuto(obj.isAuto);
this.fontStyleGroup.setValue(obj.isAuto);
}
},
_formatContent: function (content) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
content = editorService.setImageSrc(content);
if (editorService.isBlankRichText(content)
|| editorService.isRichTextEqual(content, this.options.placeholder)) {
content = this.options.placeholder || "";
}
return content;
},
// 切换到“自动”时的处理方法
_switchToAutoStyle: function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor"),
content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE),
isEqualToPlaceholder = editorService.isRichTextEqual(content, this.options.placeholder);
var HTML_ONLY_STYLE_TAG = "<font[\\s\\S]*?>|</font>|<span[\\s\\S]*?>|</span>|<b\\s+(.*?)>|<b>|</b>|<u[\\s\\S]*?>|</u>|<i\\s+(.*?)>|<i>|</i>|<strong[\\s\\S]*?>|</strong>|<em[\\s\\S]*?>|</em>|<div[\\s\\S]style(.*?)>|</div>|<p[\\s\\S]style(.*?)>|<p.[\\s\\S]*align(.*?)>|</p>";
if (!isEqualToPlaceholder) {
content = content.replaceAll(HTML_ONLY_STYLE_TAG, "");
}
return content;
},
clearPlaceholder: function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE);
var isSameContent = editorService.isRichTextEqual(content, this.options.placeholder);
if (isSameContent) {
content = editorService.convertText2RichText("", this.options.fontStyle);
this.editor.setValue(content);
this.setFocus();
}
},
setPlaceholder: function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE);
var isSameContent = editorService.isBlankRichText(content);
if (isSameContent) {
this.editor.setValue(this.options.placeholder);
}
},
// 字体样式切换
changeFontStyleMode: function (isAuto) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var switchFn = this.options.switchFn,
content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE),
origin = content;
if (isAuto) {
content = this._switchToAutoStyle();
this.setFocus();
} else if (editorService.isRichTextEqual(content, this.options.placeholder)) {
content = "";
}
if (BI.isFunction(switchFn)) {
content = switchFn(isAuto, content);
}
if (content !== origin) {
this.editor.setValue(content);
}
},
setFocus: function () {
var instance = this.editor.instance;
instance && instance.initSelection();
}
});
Widget.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.design.chart.common.editor", Widget);
}());

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

@ -0,0 +1,53 @@
!(function () {
var Model = BI.inherit(Fix.Model, {
childContext: ["isAuto", "dimensionIds"],
state: function () {
var o = this.options;
return {
isAuto: o.isAuto,
dimensionIds: o.dimensionIds,
isEditorBlur: true
};
},
computed: {
fontStyleItems: function () {
return [{
type: "bi.single_select_radio_item",
text: "自动",
hgap: 5,
logic: {
dynamic: true
},
value: true,
selected: this.options.isAuto
}, {
type: "bi.single_select_radio_item",
text: "自定义",
hgap: 5,
logic: {
dynamic: true
},
value: false,
selected: !this.options.isAuto
}];
}
},
actions: {
changeIsAuto: function (isAuto) {
this.model.isAuto = isAuto;
},
setEditorBlurState: function (isBlur) {
this.model.isEditorBlur = isBlur;
}
}
});
BI.model("bi.model.design.chart.common.editor", Model);
}());

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

@ -0,0 +1,562 @@
!(function () {
/**
* HTML解析类使用方法
* new HTMLParser().parse(htmlText, {
* startTag: function (tagName, attrs) {},
* endTag: function (tagName) {},
* text: function (text) {}
* })
*/
function HTMLParser () {
}
HTMLParser.prototype = {
constructor: HTMLParser,
startTagPattern: /<([-\w\d_]+)\s*([^>]*)\s*(\/?)>/,
endTagPattern: /^<\/([-\w\d_]+)[^>]*>/,
attrPattern: /([-\w\d_]+)\s*=\s*["']([^"']*)["']/g,
// 特殊的字符
specialCharsPatterns: [{
pattern: /&nbsp;/g,
subStr: " "
}, {
pattern: /&lt;/g,
subStr: "<"
}, {
pattern: /&gt;/g,
subStr: ">"
}, {
pattern: /&amp;/g,
subStr: "&"
}],
handle: {
// 以下为处理开始标签和文本的时候触发的函数,可以自定义
startTag: function () {
},
endTag: function () {
},
text: function () {
}
},
/**
*
* @param html
* @param handle
* @param isReplaceSpecialChars 是否需要替换HTML中的特殊字符
*/
parse: function (html, handle, isReplaceSpecialChars) {
var index, isText = false,
match, last = html,
me = this;
isReplaceSpecialChars = isReplaceSpecialChars !== null ? isReplaceSpecialChars : true;
if (BI.isPlainObject(handle)) {
BI.isFunction(handle.startTag) && (this.handle.startTag = handle.startTag);
BI.isFunction(handle.endTag) && (this.handle.endTag = handle.endTag);
BI.isFunction(handle.text) && (this.handle.text = handle.text);
}
while (html) {
isText = true;
// 结束标签
if (html.indexOf("</") === 0) {
match = html.match(this.endTagPattern);
if (match) {
html = html.substring(match[0].length);
match[0].replace(this.endTagPattern, function () {
me._parseEndTag.apply(me, arguments);
});
isText = false;
}
} else if (html.indexOf("<") === 0) {
// 遇到起始的标签,提取标签名称和属性之类的
match = html.match(this.startTagPattern);
if (match) {
html = html.substring(match[0].length);
match[0].replace(this.startTagPattern, function () {
me._parseStartTag.apply(me, arguments);
});
isText = false;
}
}
// 仅仅是一行文本的情况
if (isText) {
index = html.indexOf("<");
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? "" : html.substring(index);
if (isReplaceSpecialChars) {
BI.each(this.specialCharsPatterns, function (idx, obj) {
text = text.replace(obj.pattern, obj.subStr);
});
}
this.handle.text(text);
}
if (html === last) {
throw "Parse Error: " + html;
}
last = html;
}
this._parseEndTag();
},
/**
* 解析开始标签的字符串
* @param all 整个需要解析的字符串
* @param tagName
* @param rest 除去tagNAme之后allString剩下的部分
*/
_parseStartTag: function (all, tagName, rest) {
tagName = tagName.toLowerCase();
var attrs = [];
rest.replace(this.attrPattern, function (all, attrName, value) {
attrs.push({
name: attrName,
value: value,
escaped: value.replace(/(^|[^\\])"/g, "$1\\\"")
});
});
tagName && this.handle.startTag(tagName, attrs);
},
/**
* 解析关闭的标签
*/
_parseEndTag: function (all, tagName) {
tagName && this.handle.endTag(tagName);
}
};
// 获取一个HTML字符串中image的属性
function getImageAttr (html) {
var htmlParse = new HTMLParser();
var imageAttr;
htmlParse.parse(html, {
startTag: function (tagName, attrs) {
if (tagName === "img") {
imageAttr = {};
BI.each(attrs, function (idx, attr) {
imageAttr[attr.name] = attr.value;
});
}
}
});
return imageAttr;
}
var Service = BI.inherit(BI.OB, {
encode: function (params) {
if (/[<>'$%{}"]/.test(params)) {
return window.encodeURIComponent(params).replace(/'/g, escape);
}
return params;
},
decode: function (params) {
try {
var result = window.decodeURIComponent(params);
if (/[<>'$%{}"]/.test(result)) {
return result;
}
return params;
} catch (e) {
return params;
}
},
HTMLParser: HTMLParser,
getImageAttr: getImageAttr,
/**
* 构造一个富文本中的参数图片
*/
getEditorParamImage: function (param, fillStyle) {
var attr = BI.DOM.getImage(param, fillStyle);
return "<img class='rich-editor-param' height='16px'"
+ " alt='" + this.encode(attr.param)
+ "' name='" + this.encode(attr.param)
+ "' style='" + attr.style + "' />";
},
/**
* 给image设置属性
*/
appendImageAttr: function (html, altValue, attrName, attrValue, isCovered) {
altValue = this.encode(altValue);
attrName = this.encode(attrName);
attrValue = this.encode(attrValue);
isCovered = isCovered || false; // 属性是否可以覆盖
return html.replaceAll("<img(.*?)>", function (imageStr) {
var attrs = getImageAttr(imageStr);
if (attrs && attrs["alt"] === altValue && (BI.isNull(attrs[attrName]) || isCovered)) {
attrs[attrName] = attrValue;
imageStr = "<img ";
BI.each(attrs, function (attrName, attrValue) {
imageStr += "" + attrName + "=\"" + attrValue + "\" ";
});
imageStr += "/>";
}
return imageStr;
});
},
/**
* 将普通的文本转化成富文本字符串
*/
convertText2RichText: function (text, fontStyle, fontProcessFn) {
fontStyle = fontStyle || {};
if (BI.isEmptyString(text)) {
return text;
}
var lines = text.split("\n"),
pattern = "\\$\\{(.*?)\\}",
richText = "",
self = this,
html = self._getHtmlTagStr(fontStyle, fontProcessFn);
BI.each(lines, function (idx, lineText) {
// 替换参数为image
var newText = lineText.replaceAll(pattern, function (all, $1) {
return self.getEditorParamImage($1);
});
// 空字符串
if (!lineText) {
newText += "<br />";
}
richText += html.startHtml + newText + html.endHtml;
});
return richText;
},
/**
* 根据fontStyle构造标签
*/
_getHtmlTagStr: function (fontStyle, fontProcessFn) {
var tags = [{
tag: "p",
style: {}
}],
obj,
startHtml = "",
endHtml = "";
// fontSize 为number值
if (fontStyle.fontSize) {
obj = {
tag: "font",
style: {"font-size": fontStyle.fontSize + "px"}
};
tags.push(obj);
}
// 字体一般用默认值,不需要处理,但是KPI指标卡例外
if (BI.isFunction(fontProcessFn)) {
tags.push(fontProcessFn());
}
// fontBold 为boolean值
if (fontStyle.fontBold) {
obj = {
tag: "b",
style: {}
};
tags.push(obj);
}
// italic 为boolean值
if (fontStyle.italic) {
obj = {
tag: "i",
style: {}
};
tags.push(obj);
}
// underline 为boolean值
if (fontStyle.underline) {
obj = {
tag: "u",
style: {}
};
tags.push(obj);
}
BI.each(tags, function (idx, item) {
startHtml += "<" + item.tag;
// set style
if (BI.isNotEmptyObject(item.style)) {
startHtml += " style=\"";
BI.each(item.style, function (key, value) {
startHtml += key + ":" + value + ";";
});
startHtml += "\"";
}
// set attributes
BI.each(item.attr, function (key, value) {
startHtml += " " + key + "=\"" + value + "\"";
});
startHtml += ">";
});
BI.each(tags.reverse(), function (idx, item) {
endHtml += "</" + item.tag + ">";
});
return {
startHtml: startHtml,
endHtml: endHtml
};
},
/**
* 将富文本HTML转化成普通的文本不需要记录fontStyle
*/
convertRichText2Text: function (html) {
var content = "",
line = "",
htmlFragments = [];
new HTMLParser().parse(html, {
startTag: function (tagName, attrs) {
// 只关心br、img
switch (tagName) {
case "br":
line += "\n";
htmlFragments.push(tagName);
break;
case "img":
BI.each(attrs, function (idx, obj) {
if (obj.name === "alt") {
line += "${" + obj.value + "}";
}
});
break;
default:
break;
}
},
endTag: function (tagName) {
if (tagName === "div") {
// <div><br /></div>这样的情况下应该只代表一个回车符
htmlFragments[htmlFragments.length - 1] !== "br" && (line += "\n");
htmlFragments = [];
}
content += line;
line = "";
},
text: function (text) {
htmlFragments.push(text);
line += text;
}
});
// 去掉最后的换行符
content = content.replace(/\n$/, "");
return content;
},
convertImage2Text: function (html) {
if (BI.isNull(html)) {
return html;
}
return html.replaceAll("<img.*?>", function (imageStr) {
var matched = imageStr.match(/alt="(.*?)"/);
var startHtml = "<span class=\"rich-editor-param\" style=\"background-color: #EAF2FD;\">";
var endHtml = "</span>";
return startHtml + (matched ? matched[1] : imageStr) + endHtml;
});
},
isRichTextEqual: function (html1, html2) {
if (BI.isNotNull(html1)) {
html1 = this.convertImage2Text(html1);
}
if (BI.isNotNull(html2)) {
html2 = this.convertImage2Text(html2);
}
return html1 === html2;
},
isRichTextNotEqual: function (html1, html2) {
return !this.isRichTextEqual(html1, html2);
},
isBlankRichText: function (html) {
html = html || "";
html = this.convertRichText2Text(html);
return BI.trim(html).length === 0;
},
// 显示整个富文本中缺失的字段
showMissingFields: function (html, validDimensionIds) {
var self = this;
return html.replaceAll("<img.*?>", function (imageStr) {
var attrs = getImageAttr(imageStr);
return attrs && BI.contains(validDimensionIds, attrs[BICst.RICH_TEXT_INFO.DATA_ID])
? imageStr
: self.getMissingFieldImage(
attrs[BICst.RICH_TEXT_INFO.DATA_ID],
attrs[BICst.RICH_TEXT_INFO.DATA_NAME],
attrs[BICst.RICH_TEXT_INFO.ALT]
);
});
},
// 获取缺失元素的图片
getMissingFieldImage: function (dId, name, fullName) {
var missingText = "<!" + BI.i18nText("BI-Design_Missing_Field") + "!>";
var missingImage = BI.DOM.getImage(missingText, "#ff0000");
var html = this.getEditorParamImage(fullName, "#ff0000");
// 将原来的dId、name、fullName保存起来
html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID, dId);
html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_NAME, name);
html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_ORIGIN_FULL_NAME, fullName);
html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.SRC, missingImage.src, true);
// 标记出这个参数是一个“缺失元素”
html = this.appendImageAttr(html, fullName, BICst.RICH_TEXT_INFO.DATA_IS_MISSING_FIELD, "true", true);
html = this.appendImageAttr(html, fullName, "style", missingImage.style, true);
return html;
},
// 将“缺失元素”替换成原来的字段
restoreMissingField: function (html) {
var self = this;
return html.replaceAll("<img.*?>", function (imageStr) {
var attrs = getImageAttr(imageStr);
if (attrs && attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID]) {
var fullName = attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_FULL_NAME];
var image = self.getEditorParamImage(fullName);
image = self.appendImageAttr(image, fullName, BICst.RICH_TEXT_INFO.DATA_ID, attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID]);
image = self.appendImageAttr(image, fullName, BICst.RICH_TEXT_INFO.DATA_NAME, attrs[BICst.RICH_TEXT_INFO.DATA_ORIGIN_NAME]);
return image;
}
if (attrs
&& attrs[BICst.RICH_TEXT_INFO.DATA_IS_INSERT_PARAM]
&& !attrs[BICst.RICH_TEXT_INFO.DATA_ID]
) {
imageStr = self.appendImageAttr(
imageStr,
attrs[BICst.RICH_TEXT_INFO.ALT],
BICst.RICH_TEXT_INFO.DATA_UN_VALID,
"true",
true
);
}
return imageStr;
});
},
// 将富文本字符串中由用户主动插入的字段参数标记出来
markTheInsertParamImages: function (html) {
return html.replaceAll("<img.*?>", function (imageStr) {
var attrs = getImageAttr(imageStr);
// "缺失元素"和普通的字段参数直接过滤(从富文本编辑器中插入的参数只有data-id属性)
if (BI.has(attrs, BICst.RICH_TEXT_INFO.DATA_NAME)
|| BI.has(attrs, BICst.RICH_TEXT_INFO.DATA_ORIGIN_ID)) {
return imageStr;
}
attrs[BICst.RICH_TEXT_INFO.DATA_IS_INSERT_PARAM] = "true";
imageStr = "<img ";
BI.each(attrs, function (key, value) {
imageStr += key + "=\"" + value + "\" ";
});
imageStr += "/>";
return imageStr;
});
},
// editor在getValue时因为src太大去掉了,在展示之前需要set 一下src
setImageSrc: function (content) {
var self = this;
return content && content.replaceAll("<img.*?>", function (imageStr) {
var attrs = self.getImageAttr(imageStr);
// 已有src
if (BI.has(attrs, BICst.RICH_TEXT_INFO.SRC) && attrs[BICst.RICH_TEXT_INFO.SRC]) {
return imageStr;
}
var alt = self.decode(attrs[BICst.RICH_TEXT_INFO.ALT]);
var image = BI.DOM.getImage(alt);
imageStr = self.appendImageAttr(imageStr, alt, BICst.RICH_TEXT_INFO.SRC, image.src, true);
imageStr = self.appendImageAttr(imageStr, alt, "style", image.style, true);
return imageStr;
});
},
isEmptyRichText: function (html) {
return "" === html.replaceAll("<p.*?>|</p>|<br/?>", "");
},
// BI-23091 设置显示名之后更新参数名称
getNewParamNameRichText: function (content) {
if (!content) {
return content;
}
var self = this;
return content.replaceAll("<img.*?>", function (imageStr) {
var attrs = self.getImageAttr(imageStr);
// 缺失元素
if (attrs[BICst.RICH_TEXT_INFO.DATA_IS_MISSING_FIELD]) {
return imageStr;
}
var alt = attrs[BICst.RICH_TEXT_INFO.ALT],
dId = attrs[BICst.RICH_TEXT_INFO.DATA_ID],
name = BI.Utils.getNotGeoDimensionFullName(dId);
if (name !== alt) {
imageStr = self.appendImageAttr(imageStr, alt, BICst.RICH_TEXT_INFO.ALT, name, true);
}
return imageStr;
});
}
});
BI.service("bi.service.design.chart.common.editor", Service);
}());

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

@ -0,0 +1,114 @@
!(function () {
var Widget = BI.inherit(BI.RichEditorParamAction, {
props: {
baseCls: "bi-design-chart-common-editor-insert-param",
dimensionIds: [],
editor: null
},
_store: function () {
return BI.Models.getModel("bi.model.design.chart.common.editor.insert_param");
},
watch: {
isSelectedParam: function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
this.addParam(this.model.param, editorService.encode);
this.combo.hideView();
// this._restorePosition();
}
},
render: function () {
var self = this;
var adapter = BI.createWidget({
type: "bi.button_group",
items: this.model.items,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
behaviors: {},
layouts: [{
type: "bi.vertical"
}],
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self._savePosition();
self.store.changeParam(this.getValue()[0]);
}
}]
});
var searchPopup = {
type: "bi.vertical",
cls: "bi-border",
hgap: 15,
tgap: 5,
bgap: 10,
items: [{
type: "bi.searcher",
adapter: adapter,
width: 210,
height: 24,
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.store.changeParam(this.getValue()[0]);
}
}]
}, adapter]
};
return {
type: "bi.combo",
direction: "bottom,left",
isNeedAdjustWidth: false,
el: {
type: "bi.vertical_adapt",
items: [{
type: "bi.icon_change_button",
iconCls: "editor-insert-param-inactivated-font",
iconWidth: 24,
iconHeight: 24,
ref: function (_ref) {
self.iconButtonTrigger = _ref;
}
}]
},
popup: {
el: searchPopup
},
ref: function (_ref) {
self.combo = _ref;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_POPUPVIEW,
action: function () {
self.iconButtonTrigger.setIcon("editor-insert-param-active-font");
}
}, {
eventName: BI.Combo.EVENT_BEFORE_HIDEVIEW,
action: function () {
self.iconButtonTrigger.setIcon("editor-insert-param-inactivated-font");
}
}]
};
},
_savePosition: function () {
var instance = this._getInstance();
instance.saveRng();
},
_restorePosition: function () {
var instance = this._getInstance();
instance.initSelection();
},
_getInstance: function () {
return this.options.editor.selectedInstance || this.options.editor.getInstance();
}
});
BI.shortcut("bi.design.chart.common.editor.insert_param", Widget);
}());

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

@ -0,0 +1,40 @@
/*
* @Maintainers: xiaofu.qin
*/
!(function () {
var Model = BI.inherit(Fix.Model, {
context: ["dimensionIds"],
state: function () {
return {
param: "",
isSelectedParam: false
};
},
computed: {
items: function () {
return BI.map(this.model.dimensionIds, function (idx, dId) {
var key = BI.keys(dId)[0];
return {
type: "bi.design.chart.common.editor.search",
text: key,
value: dId[key]
};
});
}
},
actions: {
changeParam: function (param) {
this.model.isSelectedParam = !this.model.isSelectedParam;
this.model.param = param;
}
}
});
BI.model("bi.model.design.chart.common.editor.insert_param", Model);
} ());

38
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/item/item.js

@ -0,0 +1,38 @@
!(function () {
var Widget = BI.inherit(BI.BasicButton, {
props: {
text: "",
iconCls: "",
extraCls: "bi-list-item-active"
},
render: function () {
var o = this.options;
return {
type: "bi.vertical_adapt",
height: 25,
items: [{
type: "bi.center_adapt",
cls: o.iconCls,
items: [{
type: "bi.icon",
width: 16,
height: 16
}],
width: 16,
height: 16
}, {
type: "bi.label",
textAlign: "left",
lgap: 5,
text: o.text,
value: o.text
}]
};
}
});
BI.shortcut("bi.design.chart.common.editor.search", Widget);
}());

22
designer-chart/src/main/resources/com/fr/design/editor/script/toolbar/disabled_bar_wrapper.js

@ -0,0 +1,22 @@
/**
* 灰化toolbar的item
*/
!(function () {
var Widget = BI.inherit(BI.Single, {
props: {
button: null
},
render: function () {
return {
type: "bi.vertical_adapt",
disabled: true,
items: [this.options.button]
};
}
});
BI.shortcut("bi.design.chart.common.editor.toolbar.disabled_item_wrapper", Widget);
}());

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

@ -0,0 +1,124 @@
!(function () {
var RichEditorTextToolbar = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-rich-editor-text-toolbar",
height: 25,
editor: null,
buttons: [
{type: "bi.rich_editor_font_chooser"},
{type: "bi.rich_editor_size_chooser"},
{type: "bi.rich_editor_bold_button"},
{type: "bi.rich_editor_italic_button"},
{type: "bi.rich_editor_underline_button"},
{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.design.chart.common.editor.insert_param"}
]
},
_store: function () {
return BI.Models.getModel("bi.model.design.chart.common.editor.toolbar");
},
watch: {
isAuto: function (isAuto) {
this[isAuto ? "hideCustomFontTool" : "showCustomFontTool"]();
}
},
render: function () {
var self = this,
o = this.options;
this.hasInsertCombo = o.buttons[o.buttons.length - 1].type === "bi.design.chart.common.editor.insert_param";
this.buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, {
editor: o.editor
});
}));
if (this.hasInsertCombo) {
var leftItems = BI.filter(this.buttons, function (idx) {
return idx !== self.buttons.length - 1;
});
return {
type: "bi.left_right_vertical_adapt",
lrgap: 10,
items: {
left: this._getButtons(leftItems),
right: [this.buttons[this.buttons.length - 1]]
}
};
}
return {
type: "bi.vertical_adapt",
rgap: 10,
items: this._getButtons(this.buttons)
};
},
mounted: function () {
var self = this;
if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () {
self._noSelect(self.element[0]);
});
this._noSelect(this.element[0]);
}
this.model.isAuto && this.hideCustomFontTool();
},
_noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() !== "input" && element.nodeName.toLowerCase() !== "textarea") {
element.setAttribute("unselectable", "on");
}
for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]);
}
},
hideCustomFontTool: function () {
var self = this;
BI.each(this.buttons, function (idx, button) {
if (self.hasInsertCombo) {
idx !== self.buttons.length - 1 && button.setVisible(false);
} else {
button.setVisible(false);
}
});
},
showCustomFontTool: function () {
var self = this;
BI.each(this.buttons, function (idx, button) {
if (self.hasInsertCombo) {
idx !== self.buttons.length - 1 && button.setVisible(true);
} else {
button.setVisible(true);
}
});
},
_getButtons: function (buttons) {
return BI.map(buttons, function (idx, button) {
if (button.options.used === false) {
return {
type: "bi.design.chart.common.editor.toolbar.disabled_item_wrapper",
button: button,
title: button.options.title
};
}
return button;
});
}
});
BI.shortcut("bi.design.chart.common.editor.toolbar", RichEditorTextToolbar);
})();

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

@ -0,0 +1,12 @@
/*
* @Maintainers: xiaofu.qin
*/
!(function () {
var Model = BI.inherit(Fix.Model, {
context: ["isAuto", "wId", "dimensionIds"]
});
BI.model("bi.model.design.chart.common.editor.toolbar", Model);
} ());

7
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -345,17 +345,16 @@ public class XCreatorUtils {
} }
/** /**
* 获取组件的最顶层XMainBorderLayout,没有则返回null * 获取组件的上一层的XMainBorderLayout,没有则返回null
* */ * */
@Nullable @Nullable
public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) { public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) {
XWCardMainBorderLayout result = null;
while (creator != null) { while (creator != null) {
if (creator instanceof XWCardMainBorderLayout) { if (creator instanceof XWCardMainBorderLayout) {
result = (XWCardMainBorderLayout) creator; return (XWCardMainBorderLayout) creator;
} }
creator = creator.getParent(); creator = creator.getParent();
} }
return result; return null;
} }
} }

59
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -842,26 +842,61 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (shouldContinue) { if (shouldContinue) {
continue; continue;
} }
//如果组件为XWCardMainBorderLayout的子组件,直接从XWCardMainBorderLayout中去找 //获取当前组件父组件相对于rootComponent或者paraComponent的距离
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator); int relativeParentX = getRelativeParentX(creator.getParent());
if (borderLayout != null) { int relativeParentY = getRelativeParentY(creator.getParent());
return xCreatorAt(x, y, borderLayout, null);
//如果不是布局容器,直接进行对比
if (!(creator instanceof XLayoutContainer)) {
int newX = x - relativeParentX - creator.getX();
int newY = y - relativeParentY - creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (isIntersectArea(newX, newY, rect)) {
return creator;
}
} }
//如果是布局容器,从布局容器向下找
if (creator instanceof XLayoutContainer) { if (creator instanceof XLayoutContainer) {
return xCreatorAt(x, y, creator, null); XCreator result = xCreatorAt(x - relativeParentX, y - relativeParentY, creator, null);
if (result != null) {
return result;
}
} }
x -= creator.getX();
y -= creator.getY(); //最后,如果组件为Tab容器中的子组件,再从Tab容器中去找
Rectangle rect = ComponentUtils.computeVisibleRect(creator); XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
// 判断是否处于交叉区域 if (borderLayout != null) {
if (!isIntersectArea(x, y, rect)) { relativeParentX = getRelativeParentX(borderLayout.getParent());
continue; relativeParentY = getRelativeParentY(borderLayout.getParent());
return xCreatorAt(x - relativeParentX, y - relativeParentY, borderLayout, null);
} }
return creator;
} }
return null; return null;
} }
/**
* 获取当前组件相对于rootComponent或者paraComponent的横向距离
*/
private int getRelativeParentX(Container container) {
return returnZero(container) ? 0 : container.getX() + getRelativeParentX(container.getParent());
}
/**
* 获取当前组件相对于rootComponent或者paraComponent的纵向距离
*/
private int getRelativeParentY(Container container) {
return returnZero(container) ? 0 : container.getY() + getRelativeParentY(container.getParent());
}
private boolean returnZero(Container container) {
return !(container instanceof XLayoutContainer)
|| container == rootComponent
|| (paraComponent != null && container == paraComponent);
}
/** /**
* 刷新顶层组件 * 刷新顶层组件
* */ * */

5
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -502,14 +502,15 @@ public class RichTextToolBar extends BasicPane{
//pt转为px =*4/3 //pt转为px =*4/3
private int scaleUp(int fontSize) { private int scaleUp(int fontSize) {
return (int) FontTransformUtil.pt2px(fontSize); return roundUp(FontTransformUtil.pt2px(fontSize));
} }
//px转pt = *3/4 //px转pt = *3/4
private int scaleDown(int fontSize) { private int scaleDown(int fontSize) {
return (int) FontTransformUtil.px2pt(fontSize); return roundUp(FontTransformUtil.px2pt(fontSize));
} }
private DocumentListener inputListener = new DocumentListener() { private DocumentListener inputListener = new DocumentListener() {
@Override @Override

12
designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java

@ -1,6 +1,4 @@
/**
*
*/
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo; import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo;
@ -13,7 +11,6 @@ import com.fr.report.poly.PolyWorkSheet;
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet. * 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
* *
* @author neil * @author neil
*
* @date: 2015-2-5-上午8:58:39 * @date: 2015-2-5-上午8:58:39
*/ */
public class JPolyWorkBook extends JWorkBook { public class JPolyWorkBook extends JWorkBook {
@ -32,15 +29,12 @@ public class JPolyWorkBook extends JWorkBook {
* 创建sheet名称tab面板 * 创建sheet名称tab面板
* *
* @param reportCompositeX 当前组件对象 * @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板 * @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12 * @date 2015-2-5-上午11:42:12
*
*/ */
@Override @Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){ public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX) {
return new PolySheetNameTabPane(reportCompositeX); return new SheetNameTabPane(reportCompositeX);
} }
@Override @Override

14
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -208,13 +208,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
}; };
reportComposite.addTargetModifiedListener(new TargetModifiedListener() { reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified());
@Override
public void targetModified(TargetModifiedEvent e) {
JWorkBook.this.fireTargetModified();
}
});
reportComposite.setParentContainer(centerPane); reportComposite.setParentContainer(centerPane);
return centerPane; return centerPane;
@ -241,11 +235,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 判断sheet权限 * 判断sheet权限
* *
* @param rolsName 角色 * @param rolesName 角色
*/ */
@Override @Override
public void judgeSheetAuthority(String rolsName) { public void judgeSheetAuthority(String rolesName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName); boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolesName);
centerPane.setSheeetCovered(isCovered); centerPane.setSheeetCovered(isCovered);
centerPane.refreshContainer(); centerPane.refreshContainer();
} }

43
designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

@ -1,35 +1,38 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Graphics2D;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import java.awt.Graphics2D;
/** /**
* 获取 * 获取
* *
* @date 2015-2-5-上午10:19:17 * @date 2015-2-5-上午10:19:17
* * @deprecated 让聚合报表也可以新建普通报表sheet, 逻辑和普通报表保持一致, 弃用此个性化设置
*/ */
public class PolySheetNameTabPane extends SheetNameTabPane{ @Deprecated
public class PolySheetNameTabPane extends SheetNameTabPane {
/**
* 构造函数 /**
*/ * 构造函数
public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) { */
super(reportCompositeX); public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) {
} super(reportCompositeX);
}
protected void paintAddButton(Graphics2D g2d){
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3); protected void paintAddButton(Graphics2D g2d) {
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3);
} }
protected void firstInsertActionPerformed(){ protected void firstInsertActionPerformed() {
new PolyReportInsertAction().actionPerformed(null); new PolyReportInsertAction().actionPerformed(null);
} }
protected void addInsertGridShortCut(MenuDef def){ protected void addInsertGridShortCut(MenuDef def) {
} }
} }

69
designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

@ -0,0 +1,69 @@
package com.fr.design.cell.editor;
import com.fr.invoke.Reflect;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-09-21
*/
public class RichTextToolBarTest {
@Test
public void testScaleUpAndDown() {
RichTextToolBar textToolBar = EasyMock.mock(RichTextToolBar.class);
int result = Reflect.on(textToolBar).call("scaleUp", 10).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleDown", 13).get();
Assert.assertEquals(10, result);
result = Reflect.on(textToolBar).call("scaleUp", 11).get();
Assert.assertEquals(15, result);
result = Reflect.on(textToolBar).call("scaleDown", 15).get();
Assert.assertEquals(11, result);
result = Reflect.on(textToolBar).call("scaleUp", 12).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleDown", 16).get();
Assert.assertEquals(12, result);
result = Reflect.on(textToolBar).call("scaleUp", 13).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleDown", 17).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleUp", 14).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleDown", 19).get();
Assert.assertEquals(14, result);
result = Reflect.on(textToolBar).call("scaleUp", 16).get();
Assert.assertEquals(21, result);
result = Reflect.on(textToolBar).call("scaleDown", 21).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 19).get();
Assert.assertEquals(25, result);
result = Reflect.on(textToolBar).call("scaleDown", 25).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleUp", 20).get();
Assert.assertEquals(27, result);
result = Reflect.on(textToolBar).call("scaleDown", 27).get();
Assert.assertEquals(20, result);
}
}
Loading…
Cancel
Save