Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/refactor/19.4.3)

* commit '5ca412689276abc73124c3107fa3eab33e9b45da':
  CHART-9141 ChartRequestService新增+chart service move to chart module+chartdata remove from engine-cross
  xchart rename to chartProvider
  CHART-9141 se.cellCC && floatCC 调用图表统一接口 删除BaseChart 各resultProcessor 初步的流程走通
  多层饼图
research/10.0
Bjorn 6 years ago
parent
commit
fc5e03cf77
  1. 15
      designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java
  2. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  3. 128
      designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java
  4. 12
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  5. 4
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  6. 6
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  7. 7
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  8. 5
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  9. 21
      designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java
  10. 2
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java
  11. 150
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java
  12. 10
      designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java
  13. 40
      designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java
  14. 25
      designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java
  15. 6
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java
  16. 67
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java
  17. 94
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java
  18. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  19. 41
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  20. 94
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java
  21. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  22. 13
      designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java
  23. 3
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java
  24. 15
      designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java
  25. 9
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java
  26. 24
      designer-realize/src/main/java/com/fr/poly/PolyUtils.java
  27. 133
      designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java
  28. 6
      designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java

15
designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java

@ -1,12 +1,11 @@
package com.fr.design.gui.chart;
import javax.swing.JComponent;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.chartx.attr.ChartProvider;
import com.fr.stable.core.PropertyChangeListener;
import javax.swing.JComponent;
/**
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-7-10 上午09:19:36
@ -18,8 +17,8 @@ public abstract class MiddleChartComponent extends JComponent {
public abstract BaseChartCollection update();
public abstract void reset();
public abstract BaseChart getEditingChart();
public abstract void addStopEditingListener(PropertyChangeListener list);
public abstract ChartProvider getEditingChart();
public abstract void addStopEditingListener(PropertyChangeListener list);
}

3
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -5,6 +5,7 @@ import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
@ -161,7 +162,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
int index = 0;
for (ChartInternationalNameContentBean bean : typeName) {
String plotID = bean.getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) {
continue;
}

128
designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java

@ -1,128 +0,0 @@
package com.fr.design.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import java.awt.*;
import java.util.HashMap;
/**
* 管理图表类型Pane
* @author kunsnat: ChartComponent移出.
*/
public class ChartControlPane extends JListControlPane {
private static final long serialVersionUID = 7336270815128413184L;
public ChartControlPane() {
super();
// 重新设定大小. 因为JControlPane默认的(450,450) 不适合图表这边 @ChartSize
// this.setPreferredSize(new Dimension(770, 520));
}
@Override
public NameableCreator[] createNameableCreators() {
return new NameableCreator[] {
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Chart"), Chart.class, ChartTypeUpdatePane.class)
};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Manage_Chart_Type");
}
public void populate(ChartCollection cc) {
if(cc == null)return;
NameObject[] nameObjects = new NameObject[cc.getChartCount()];
for (int i = 0; i < nameObjects.length; i++) {
nameObjects[i] = new NameObject(cc.getChartName(i), cc.getChart(i));
}
populate(nameObjects);
// kunsnat: 选中当前图表选中的name
String chartSelectedName = cc.getChartName(cc.getSelectedIndex() < cc.getChartCount() ? cc.getSelectedIndex() : 0);
setSelectedName(chartSelectedName);
}
public void update(ChartCollection cc) {
HashMap namesChart = new HashMap();// 暂存判断是否有必要更新
for(int i = 0; i < cc.getChartCount(); i++) {
try {
namesChart.put(cc.getChartName(i), cc.getChart(i).clone());
} catch (CloneNotSupportedException e) {
}
}
Nameable[] nameables = update();
if (nameables.length == 0 || cc == null) {
return;
}
cc.removeAllNameObject();
String select = getSelectedName();
for (int i = 0; i < nameables.length; i++) {
if (nameables[i] instanceof NameObject && ((NameObject)nameables[i]).getObject() instanceof Chart) {
NameObject no = (NameObject)nameables[i];
String name = no.getName();
Chart chart = (Chart)no.getObject();
if(namesChart.containsKey(name)) {
Chart tmpChart = (Chart)namesChart.get(name);
if(chart.getPlot() != null && tmpChart.getPlot() != null
&& chart.getPlot().match4GUI(tmpChart.getPlot())) {
chart = tmpChart;// 代替之前做过编辑的Chart
}
}
cc.addNamedChart(name, chart);
if(no.getName().equals(select)) {
cc.setSelectedIndex(i);
}
}
}
}
/*
* alex:继承UpdatePane的ChartTypePane
*/
public static class ChartTypeUpdatePane extends BasicBeanPane<Chart> {
private static final long serialVersionUID = -7058348930816218415L;
private Chart editing;
private ChartTypePane typePane;
public ChartTypeUpdatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
typePane = new ChartTypePane();
this.add(typePane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "Chart Type";
}
@Override
public void populateBean(Chart ob) {
editing = ob;
typePane.populate(ob);
}
@Override
public Chart updateBean() {
typePane.update(editing);
return editing;
}
}
}

12
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -11,6 +11,7 @@ import com.fr.chart.chartattr.ChartIcon;
import com.fr.chart.chartattr.MapPlot;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
@ -36,12 +37,13 @@ public class ChartTypePane extends ChartCommonWizardPane {
private static final long serialVersionUID = -1175602484968520546L;
private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames();
//todo@shinerefactor 这个页面所有强转Chart的地方都要处理一下
private Chart[][] charts4Icon = null;
{
charts4Icon = new Chart[this.typeName.length][];
for (int i = 0; i < this.typeName.length; i++) {
Chart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID());
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID());
int rowChartsCount = rowCharts.length;
charts4Icon[i] = new Chart[rowChartsCount];
for (int j = 0; j < rowChartsCount; j++) {
@ -145,9 +147,9 @@ public class ChartTypePane extends ChartCommonWizardPane {
int subIndex = 0;
for (int i = 0; i < typeName.length; i++) {
Chart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID());
ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID());
for (int j = 0; j < charts.length; j++) {
if (charts[j].getPlot().match4GUI(plot)) {
if (((Chart) charts[j]).getPlot().match4GUI(plot)) {
mainIndex = i;
subIndex = j;
// 一旦匹配 立马中断
@ -162,7 +164,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
public void update(Chart oldChart) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
Chart chart = (Chart) ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
if(chart.getPlot() != null){
if(chart.getPlot() instanceof MapPlot && !supportMap()){
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported"));
@ -191,7 +193,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
Chart chart4Update = cc.getSelectedChart();
if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
Chart chart = (Chart) ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try{
chart4Update = (Chart)chart.clone();
cc.addChart(chart4Update);

4
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -1,7 +1,6 @@
package com.fr.design.chart.gui;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
@ -10,6 +9,7 @@ import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
@ -162,7 +162,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount();
}
public BaseChart getEditingChart() {
public ChartProvider getEditingChart() {
return editingChart;
}

6
designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java

@ -1,7 +1,7 @@
package com.fr.design.chart.gui;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.core.WidgetOption;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget;
@ -38,8 +38,8 @@ public class ChartWidgetOption extends WidgetOption {
Class<? extends ChartEditor> clz = widgetClass();
try {
ChartEditor widget = clz.newInstance();
Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0];
widget.addChart((Chart) chart.clone());
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0];
widget.addChart((ChartProvider) chart.clone());
return widget;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

7
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java

@ -1,11 +1,10 @@
package com.fr.design.chart.gui.active.action;
import com.fr.base.chart.BaseChart;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.actions.UpdateAction;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
@ -29,10 +28,6 @@ public abstract class ChartComponentAction extends UpdateAction {
chartComponent.repaint();
}
public BaseChart getEditingChart() {
return chartComponent.getEditingChart();
}
public ChartCollection getChartCollection() {
return chartComponent.getChartCollection();
}

5
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -6,6 +6,7 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
@ -66,10 +67,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
private ChartCollection createChartCollection() {
ChartCollection cc = new ChartCollection();
Chart chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
if (chart != null) {
try {
cc.addChart((Chart) chart.clone());
cc.addChart((ChartProvider) chart.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

21
designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java

@ -0,0 +1,21 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiPieDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* Created by shine on 2019/6/18.
*/
public class MultiPieChartDataPane extends MultiCategoryChartDataPane {
public MultiPieChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane());
}
}

2
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java

@ -21,7 +21,7 @@ import java.util.List;
/**
* Created by shine on 2019/4/10.
* 一列组件<T extends JComponent> 可增可删
* 一列组件<T extends JComponent> 可增可删通过JComponent后面的加减button增删
*/
public abstract class AbstractMultiComponentPane<T extends JComponent> extends JPanel {
private static final int COM_W = 96;

150
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java

@ -0,0 +1,150 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2019/6/18.
* 一列组件<T extends JComponent> 可增可删通过UISpinner增删
*/
public abstract class AbstractMultiComponentPaneWithUISpinner<T extends JComponent> extends JPanel {
private UISpinner levelNumSpinner;
private List<T> levelComponentList = new ArrayList<T>();
private JPanel levelPane;
private int currentNum = 3;
public AbstractMultiComponentPaneWithUISpinner() {
initComps();
}
public List<T> getComponentList() {
return levelComponentList;
}
protected abstract T createJComponent();
protected abstract void populateField(T component, ColumnField field);
protected abstract void updateField(T component, ColumnField field);
protected void initComps() {
this.setLayout(new BorderLayout(0, 6));
levelNumSpinner = new UISpinner(1, 15, 1, currentNum) {
@Override
protected void fireStateChanged() {
//先处理自身的空间布局
refreshLevelPane();
//然后更新数据
super.fireStateChanged();
}
@Override
public void setTextFieldValue(double value) {
//如果为0,则没有改变值
if (value == 0) {
return;
}
super.setTextFieldValue(value);
}
};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumSpinner},
};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, new double[]{TableLayout.PREFERRED}, new double[]{ChartDataPane.LABEL_WIDTH, 122}, 0, 6);
this.add(northPane, BorderLayout.NORTH);
initLevelPane();
}
private void initLevelPane() {
double[] rows = new double[currentNum];
Component[][] components = new Component[currentNum][2];
List<T> newList = new ArrayList<T>();
int maxSize = levelComponentList.size();
for (int i = 0; i < currentNum; i++) {
rows[i] = TableLayout.PREFERRED;
T component = i < maxSize ? levelComponentList.get(i) : createJComponent();
newList.add(component);
components[i] = new Component[]{
new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i + 1)),
component
};
}
levelComponentList = newList;
levelPane = TableLayoutHelper.createGapTableLayoutPane(components, rows, new double[]{ChartDataPane.LABEL_WIDTH, 122}, 0, 6);
this.add(levelPane, BorderLayout.CENTER);
}
private void refreshLevelPane() {
if (levelNumSpinner == null) {
return;
}
int newNum = (int) levelNumSpinner.getValue();
if (newNum != currentNum) {
currentNum = newNum;
this.remove(levelPane);
this.initLevelPane();
}
refreshPane();
}
private void refreshPane() {
this.validate();
this.repaint();
this.revalidate();
}
public void populate(List<ColumnField> categoryList) {
int len = categoryList.size();
levelNumSpinner.setValue(len);
refreshLevelPane();
for (int i = 0; i < len; i++) {
ColumnField columnField = categoryList.get(i);
T component = levelComponentList.get(i);
populateField(component, columnField);
}
}
public void update(List<ColumnField> categoryList) {
categoryList.clear();
for (T comboBox : levelComponentList) {
ColumnField temp = new ColumnField();
categoryList.add(temp);
updateField(comboBox, temp);
}
}
}

10
designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java

@ -5,10 +5,18 @@ import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.extended.chart.UIComboBoxWithNone;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2019/4/12.
*/
public class MultiComboBoxPane extends AbstractMultiComponentPane<UIComboBox> {
private List currentBoxItems = new ArrayList();
public void setCurrentBoxItems(List currentBoxItems) {
this.currentBoxItems = currentBoxItems;
}
@Override
protected UIComboBox createFirstFieldComponent() {
@ -17,7 +25,7 @@ public class MultiComboBoxPane extends AbstractMultiComponentPane<UIComboBox> {
@Override
protected UIComboBox createOtherFieldComponent() {
return new UIComboBox();
return new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()]));
}
@Override

40
designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java

@ -0,0 +1,40 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.gui.icombobox.UIComboBox;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2019/6/18.
*/
public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner<UIComboBox> {
private List currentBoxList = new ArrayList();
@Override
protected void initComps() {
currentBoxList = new ArrayList();
super.initComps();
}
public void setCurrentBoxList(List currentBoxList) {
this.currentBoxList = currentBoxList;
}
@Override
protected UIComboBox createJComponent() {
return new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()]));
}
@Override
protected void populateField(UIComboBox component, ColumnField field) {
AbstractDataSetFieldsPane.populateField(component, field);
}
@Override
protected void updateField(UIComboBox component, ColumnField field) {
AbstractDataSetFieldsPane.updateField(component, field);
}
}

25
designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java

@ -0,0 +1,25 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.formula.TinyFormulaPane;
/**
* Created by shine on 2019/6/19.
*/
public class MultiTinyFormulaPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner<TinyFormulaPane> {
@Override
protected TinyFormulaPane createJComponent() {
return new TinyFormulaPane();
}
@Override
protected void populateField(TinyFormulaPane component, ColumnField field) {
AbstractCellDataFieldsPane.populateField(component, field);
}
@Override
protected void updateField(TinyFormulaPane component, ColumnField field) {
AbstractCellDataFieldsPane.updateField(component, field);
}
}

6
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java

@ -39,6 +39,12 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
return initMultiCategoryPane();
}
@Override
public void refreshBoxListWithSelectTableData(List columnNameList) {
super.refreshBoxListWithSelectTableData(columnNameList);
multiCategoryPane.setCurrentBoxItems(columnNameList);
}
@Override
public void populateBean(MultiCategoryColumnFieldCollection multiCategoryColumnFieldCollection) {
List<ColumnField> categoryList = multiCategoryColumnFieldCollection.getCategoryList();

67
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java

@ -0,0 +1,67 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection;
import com.fr.design.chartx.component.MultiTinyFormulaPaneWithUISpinner;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import javax.swing.JPanel;
/**
* Created by shine on 2019/6/18.
*/
public class MultiPieCellDataFieldsPane extends AbstractCellDataFieldsPane<MultiPieColumnFieldCollection> {
private UITextField nameField;//指标名称
private MultiTinyFormulaPaneWithUISpinner levelPane;
private TinyFormulaPane value;
@Override
protected void initComponents() {
nameField = new UITextField();
levelPane = new MultiTinyFormulaPaneWithUISpinner();
value = new TinyFormulaPane();
super.initComponents();
}
@Override
protected JPanel createNorthPane() {
return levelPane;
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
};
}
@Override
protected TinyFormulaPane[] formulaPanes() {
return new TinyFormulaPane[]{
value
};
}
@Override
public void populateBean(MultiPieColumnFieldCollection ob) {
nameField.setText(ob.getTargetName());
levelPane.populate(ob.getLevels());
populateField(value, ob.getValue());
}
@Override
public MultiPieColumnFieldCollection updateBean() {
MultiPieColumnFieldCollection result = new MultiPieColumnFieldCollection();
result.setTargetName(nameField.getText());
levelPane.update(result.getLevels());
updateField(value, result.getValue());
return result;
}
}

94
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java

@ -0,0 +1,94 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection;
import com.fr.design.chartx.component.MultiComboBoxPaneWithUISpinner;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import javax.swing.JPanel;
import java.awt.Component;
import java.util.List;
/**
* Created by shine on 2019/6/18.
*/
public class MultiPieDataSetFieldsPane extends AbstractDataSetFieldsPane<MultiPieColumnFieldCollection> {
private UITextField nameField;
private MultiComboBoxPaneWithUISpinner levelComboBoxPane;
private UIComboBox value;
private CalculateComboBox function;
@Override
protected void initComponents() {
nameField = new UITextField();
levelComboBoxPane = new MultiComboBoxPaneWithUISpinner();
value = new UIComboBox();
function = new CalculateComboBox();
super.initComponents();
}
@Override
protected JPanel createNorthPane() {
return levelComboBoxPane;
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Summary_Method")
};
}
@Override
protected Component[] fieldComponents() {
return new UIComboBox[]{
value,
function
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
List<UIComboBox> list = levelComboBoxPane.getComponentList();
int len = list.size();
UIComboBox[] result = new UIComboBox[len + 1];
for (int i = 0; i < len; i++) {
result[i] = list.get(i);
}
result[len] = value;
return result;
}
@Override
public void refreshBoxListWithSelectTableData(List columnNameList) {
super.refreshBoxListWithSelectTableData(columnNameList);
levelComboBoxPane.setCurrentBoxList(columnNameList);
}
@Override
public void populateBean(MultiPieColumnFieldCollection ob) {
levelComboBoxPane.populate(ob.getLevels());
populateFunctionField(value, function, ob.getValue());
}
@Override
public MultiPieColumnFieldCollection updateBean() {
MultiPieColumnFieldCollection result = new MultiPieColumnFieldCollection();
levelComboBoxPane.update(result.getLevels());
updateFunctionField(value, function, result.getValue());
return result;
}
}

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -2,10 +2,10 @@ package com.fr.design.mainframe.chart.gui;
import com.fr.base.BaseUtils;
import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.SwitchState;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
@ -135,9 +135,9 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (editingCollection != null) {
//点击添加按钮,则会触发切换状态
Chart chart = editingCollection.getChangeStateNewChart();
ChartProvider chart = editingCollection.getChangeStateNewChart();
try {
Chart newChart = (Chart) chart.clone();
ChartProvider newChart = (ChartProvider) chart.clone();
editingCollection.addNamedChart(name, newChart);
} catch (CloneNotSupportedException e1) {
FineLoggerFactory.getLogger().error("Error in Clone");

41
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -41,30 +41,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
private ChartTypeButtonPane buttonPane;
private ChartEditPane editPane;
private ChartCollection editingCollection;
private PaneState paneState = new PaneState();
private class PaneState{
//记录面板所处状态
private SwitchState paneState = SwitchState.DEFAULT;
//记录当前面板是谁在使用切换状态
private String chartID = StringUtils.EMPTY;
public SwitchState getPaneState() {
return paneState;
}
public void setPaneState(SwitchState paneState) {
this.paneState = paneState;
}
public String getChartID() {
return chartID;
}
public void setChartID(String chartID) {
this.chartID = chartID;
}
}
@Override
protected JPanel createContentPane() {
@ -337,22 +313,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void relayoutChartTypePane(ChartCollection collection){
if (needRelayout(collection)) {
chartTypeComBox.relayout(collection);
//设置面板切换状态
updatePaneState(collection);
}
}
private void updatePaneState(ChartCollection collection) {
paneState.setChartID(collection.getRepresentChartID());
paneState.setPaneState(collection.getState());
}
// TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构
private boolean needRelayout(ChartCollection collection) {
/*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/
return true;
chartTypeComBox.relayout(collection);
}
/**

94
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java

@ -1,94 +0,0 @@
package com.fr.design.mainframe.chart.gui.other;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.fr.design.chart.ChartControlPane;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
public class ChartSwitchPane extends AbstractAttrNoScrollPane{
private UIButton changeButton;
private ChartCollection editingChartCollection;
private ChartEditPane currentChartEditPane;
public ChartSwitchPane() {
}
@Override
protected JPanel createContentPane() {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
changeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Switch"));
pane.add(changeButton, BorderLayout.NORTH);
changeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final ChartControlPane chartTypeManager = new ChartControlPane();
chartTypeManager.populate(editingChartCollection);
BasicDialog dlg = chartTypeManager.showWindow4ChartType(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionAdapter() {
public void doOk() {
chartTypeManager.update(editingChartCollection);//kunsnat: 确定刷新"chartSelectIndex"
if(currentChartEditPane != null) {
currentChartEditPane.populate(editingChartCollection);// 选中新Plot之后 刷新对应界面, 比如超级链接等, 然后才能update.
currentChartEditPane.gotoPane(PaneTitleConstants.CHART_TYPE_TITLE);
currentChartEditPane.gotoPane(PaneTitleConstants.CHART_OTHER_TITLE, PaneTitleConstants.CHART_OTHER_TITLE_CHANGE);
currentChartEditPane.fire();
}
}
});
dlg.setVisible(true);
}
});
return pane;
}
/**
* 注册 切换事件的改变 和超链不同.
* @param listener
*/
public void registerChartEditPane(ChartEditPane currentChartEditPane) {
this.currentChartEditPane = currentChartEditPane;
}
public void populateBean(ChartCollection c) {
this.editingChartCollection = c;
}
public void updateBean(ChartCollection c) {
}
/**
* 界面标题
* @param 返回标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Switch_Chart");
}
@Override
public String getIconPath() {
return null;
}
}

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -17,6 +17,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.charttypes.BarIndependentChart;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane;
import com.fr.design.gui.ilable.BoldFontTextLabel;
@ -616,7 +617,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
return typePane;
}
public Chart getDefaultChart() {
public ChartProvider getDefaultChart() {
return BarIndependentChart.barChartTypes[0];
}
}

13
designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java

@ -5,7 +5,6 @@ import com.fr.chart.base.ChartUtils;
import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.event.UIObserver;
@ -13,7 +12,6 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
@ -30,7 +28,8 @@ public class ChartPreStylePane extends BasicBeanPane<ChartColorMatching> {
private ChartPreFillStylePane fillStylePane;
private ChartComponent chartComponent;
private Bar2DPlot demoPlot;
public ChartPreStylePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -50,8 +49,9 @@ public class ChartPreStylePane extends BasicBeanPane<ChartColorMatching> {
this.add(boxPane, BorderLayout.CENTER);
ChartCollection cc = new ChartCollection();
cc.addChart(new Chart(new Bar2DPlot()));
demoPlot = new Bar2DPlot();
cc.addChart(new Chart(demoPlot));
chartComponent = new ChartComponent();
chartComponent.populate(cc);
chartComponent.setPreferredSize(new Dimension(400, 300));
@ -82,8 +82,7 @@ public class ChartPreStylePane extends BasicBeanPane<ChartColorMatching> {
private void refreshWhenStyleChange(ChartColorMatching preStyle) {
if(chartComponent != null) {
Plot plot = (Plot) chartComponent.getEditingChart().getBasePlot();
plot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle));
demoPlot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle));
chartComponent.reset();
}
}

3
designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java

@ -2,6 +2,7 @@ package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
@ -65,7 +66,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
}
@Override
public Chart getDefaultChart() {
public ChartProvider getDefaultChart() {
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0];
}

15
designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java

@ -2,14 +2,12 @@ package com.fr.van.chart.multilayer;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.MultiPieChartDataPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.multilayer.data.MultiPiePlotReportDataContentPane;
import com.fr.van.chart.multilayer.data.MultiPiePlotTableDataContentPane;
import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane;
import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
@ -29,13 +27,8 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){
return new MultiPiePlotTableDataContentPane(parent);
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){
return new MultiPiePlotReportDataContentPane(parent);
public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
return new MultiPieChartDataPane(listener);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){

9
designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java

@ -1,7 +1,7 @@
package com.fr.poly;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter;
import com.fr.base.chart.BaseChartNameID;
import com.fr.base.vcs.DesignerMode;
@ -64,9 +64,10 @@ public class PolyComponentsBar extends JToolBar {
);
this.add(serIcons[0]);
for (int i = 0; i < typeLen; i++) {
BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID());
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(typeName[i].getPlotID());
serIcons[i + 1] = new SerIcon(rowChart[0], InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath);
String chartID = typeName[i].getPlotID();
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID);
BaseChartCollection chartCollection = BaseChartGetter.getStaticChartCollection(chartID);
serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath);
this.add(serIcons[i + 1]);
}

24
designer-realize/src/main/java/com/fr/poly/PolyUtils.java

@ -4,9 +4,7 @@
package com.fr.poly;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BasePlot;
import com.fr.log.FineLoggerFactory;
import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ChartBlockCreator;
@ -15,7 +13,6 @@ import com.fr.poly.model.AddedData;
import com.fr.report.poly.PolyChartBlock;
import com.fr.report.poly.PolyECBlock;
import com.fr.report.poly.TemplateBlock;
import com.fr.stable.bridge.StableFactory;
import java.awt.Point;
import java.lang.reflect.Constructor;
@ -53,10 +50,8 @@ public class PolyUtils {
public static BlockCreator createCreator(Class clazz) {
return createCreator(blockGenerate(clazz));
}
public static BlockCreator createCreator(BaseChart chart) {
BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
cc.addChart(chart);
public static BlockCreator createCreator(BaseChartCollection cc) {
TemplateBlock block = new PolyChartBlock(cc);
return createCreator(block);
}
@ -66,20 +61,7 @@ public class PolyUtils {
try {
block = (TemplateBlock) clazz.newInstance();
} catch (Exception e) {
try {
BasePlot plot = (BasePlot)clazz.newInstance();
BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
BaseChart chart = (BaseChart)StableFactory.createXmlObject(BaseChart.XML_TAG);
chart.initChart(plot);
cc.addChart(chart);
block = new PolyChartBlock(cc);
} catch (InstantiationException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} catch (IllegalAccessException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
}
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return block;
}

133
designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java

@ -3,25 +3,15 @@
*/
package com.fr.poly.creator;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter;
import com.fr.base.chart.BaseChartNameID;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.poly.PolyConstants;
import com.fr.poly.PolyDesigner;
import com.fr.poly.PolyDesigner.SelectionType;
@ -31,13 +21,8 @@ import com.fr.report.poly.PolyChartBlock;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.border.Border;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -48,31 +33,10 @@ import java.awt.event.MouseEvent;
*/
// 图片的命名必须符合下面的代码规范(chart类别+序号的方式) 不然读取不到指定图片
public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChartBlock> {
private static final int BOUND_OFF = 21;
private static Border buttonBorder;
private static String[][] chartsNames;
private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames();
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
static {
buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);
chartsNames = new String[typeName.length][];
for (int i = 0; i < typeName.length; i++) {
BaseChart[] rowCharts = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID());
chartsNames[i] = new String[rowCharts.length];
for (int j = 0; j < rowCharts.length; j++) {
chartsNames[i][j] = rowCharts[j].getChartName();
}
}
}
private ChartButton[] chartButtons = null;
public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) {
super(designer, creator);
this.resolution = creator.resolution;
//shine:和产品商量后决定把最上面一排切换按钮去掉
// this.initNorthBarComponent();
}
@ -80,33 +44,6 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
this.resolution = resolution;
}
private void initNorthBarComponent() {
JPanel charttypeToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
this.add(BlockEditorLayout.TOP, charttypeToolbar);
BaseChart chart = editComponent.getEditingChart();
String selectedName = chart.getChartName();
int index = 0;
for (int i = 0; i < typeName.length; i++) {
String[] rowCharts = chartsNames[i];
for (int j = 0; j < rowCharts.length; j++) {
if (ComparatorUtils.equals(selectedName, rowCharts[j])) {
index = i;
break;
}
}
}
String plotID = typeName[index].getPlotID();
BaseChart[] charts = BaseChartGetter.getStaticChartTypes(plotID);
chartButtons = new ChartButton[charts.length];
for (int i = 0, l = charts.length; i < l; i++) {
chartButtons[i] = new ChartButton(charts[i], charts[i].getChartName(), typeName[index].getName(), i);
charttypeToolbar.add(chartButtons[i]);
}
}
/**
* 检查控件是否可用
*/
@ -192,76 +129,6 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
}
private class ChartButton extends JToggleButton {
private BaseChart chart;
public ChartButton(BaseChart chart, String text, String pathName, int index) {
this.chart = chart;
this.setToolTipText(text);
String path = "com/fr/design/images/poly/" + pathName + '/' + pathName + '-' + index + ".png";
Icon icon = null;
try {
icon = BaseUtils.readIcon(path);
} catch (Exception e) {
icon = BaseUtils.readIcon("com/fr/design/images/poly/normal.png");
}
this.setIcon(icon);
this.setBorder(null);
this.setMargin(null);
this.setOpaque(false);
this.setContentAreaFilled(false);
this.setFocusPainted(false);
this.setRequestFocusEnabled(false);
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) {
return;
}
BaseChart chart = null;
try {
chart = (BaseChart) ChartButton.this.chart.clone();
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return;
}
BaseChartCollection cc = creator.getValue().getChartCollection();
cc.switchPlot(chart.getBasePlot());
initEffective(cc);
creator.setValue(creator.getValue());
ChartBlockEditor.this.removeAll();
ChartBlockEditor.this.initComponets();
ChartBlockEditor.this.initNorthBarComponent();
ChartBlockEditor.this.addColumnRowListeners();
ChartBlockEditor.this.addBoundsListener();
ChartBlockEditor.this.initDataChangeListener();
ChartBlockEditor.this.doLayout();
ChartBlockEditor.this.repaint();
QuickEditorRegion.getInstance().populate(creator.getQuickEditor(designer));
LayoutUtils.layoutRootContainer(designer);
designer.fireTargetModified();
designer.repaint();
}
@Override
public void mouseEntered(MouseEvent e) {
ChartButton.this.setBorder(buttonBorder);
}
@Override
public void mouseExited(MouseEvent e) {
ChartButton.this.setBorder(null);
}
});
}
@Override
public Dimension getPreferredSize() {
return new Dimension(22, 22);
}
}
public MiddleChartComponent getEditChartComponent() {
return createEffective();
}

6
designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java

@ -4,7 +4,7 @@
package com.fr.poly.hanlder;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.DesignerContext;
import com.fr.grid.Grid;
@ -73,8 +73,8 @@ public class PolyDesignerDropTarget extends DropTargetAdapter {
if (obj instanceof Class) {
Class clazz = (Class) obj;
creator = PolyUtils.createCreator(clazz);
} else if (obj instanceof BaseChart) {
creator = PolyUtils.createCreator((BaseChart) obj);
} else if (obj instanceof BaseChartCollection) {
creator = PolyUtils.createCreator((BaseChartCollection) obj);
}
if (creator == null) {
return;

Loading…
Cancel
Save