Browse Source

CHART-9141 se.cellCC && floatCC 调用图表统一接口 删除BaseChart 各resultProcessor 初步的流程走通

research/10.0
zheng 6 years ago
parent
commit
bbe4791fae
  1. 11
      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. 12
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  4. 4
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  5. 6
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  6. 7
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  7. 5
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  8. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  9. 41
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  10. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  11. 9
      designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java
  12. 3
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java
  13. 9
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java
  14. 22
      designer-realize/src/main/java/com/fr/poly/PolyUtils.java
  15. 133
      designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java
  16. 6
      designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java

11
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.XChart;
import com.fr.stable.core.PropertyChangeListener;
import javax.swing.JComponent;
/**
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-7-10 上午09:19:36
@ -19,7 +18,7 @@ public abstract class MiddleChartComponent extends JComponent {
public abstract void reset();
public abstract BaseChart getEditingChart();
public abstract XChart getEditingChart();
public abstract void addStopEditingListener(PropertyChangeListener list);
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.XChart;
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);
XChart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) {
continue;
}

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.XChart;
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());
XChart[] 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());
XChart[] 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.XChart;
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 XChart 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.XChart;
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());
XChart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0];
widget.addChart((XChart) 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.XChart;
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();
XChart chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
if (chart != null) {
try {
cc.addChart((Chart) chart.clone());
cc.addChart((XChart) chart.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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.XChart;
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();
XChart chart = editingCollection.getChangeStateNewChart();
try {
Chart newChart = (Chart) chart.clone();
XChart newChart = (XChart) 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);
}
/**

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.XChart;
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 XChart getDefaultChart() {
return BarIndependentChart.barChartTypes[0];
}
}

9
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,6 +28,7 @@ public class ChartPreStylePane extends BasicBeanPane<ChartColorMatching> {
private ChartPreFillStylePane fillStylePane;
private ChartComponent chartComponent;
private Bar2DPlot demoPlot;
public ChartPreStylePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -50,7 +49,8 @@ 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);
@ -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.XChart;
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 XChart getDefaultChart() {
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0];
}

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]);
}

22
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;
@ -54,9 +51,7 @@ public class PolyUtils {
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