|
|
|
package com.fr.quickeditor;
|
|
|
|
|
|
|
|
import com.fr.base.chart.BaseChartCollection;
|
|
|
|
import com.fr.chart.chartattr.ChartCollection;
|
|
|
|
import com.fr.chart.chartattr.ThirdChart;
|
|
|
|
import com.fr.design.designer.TargetComponent;
|
|
|
|
import com.fr.design.gui.chart.BaseChartPropertyPane;
|
|
|
|
import com.fr.design.mainframe.ChartPropertyPane;
|
|
|
|
import com.fr.design.mainframe.ElementCasePane;
|
|
|
|
import com.fr.design.module.DesignModuleFactory;
|
|
|
|
import com.fr.design.selection.QuickEditor;
|
|
|
|
import com.fr.grid.selection.CellSelection;
|
|
|
|
import com.fr.grid.selection.FloatSelection;
|
|
|
|
import com.fr.grid.selection.Selection;
|
|
|
|
import com.fr.poly.PolyDesigner;
|
|
|
|
import com.fr.poly.creator.ChartBlockEditor;
|
|
|
|
import com.fr.report.cell.Elem;
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class ChartQuickEditor extends QuickEditor<TargetComponent>{
|
|
|
|
// kunsnat: editingPropertyPane初始化 避开设计器启动, 在用到的时候再初始化.
|
|
|
|
//private BaseChartPropertyPane editingPropertyPane = null;
|
|
|
|
private static boolean lastChartType =false;
|
|
|
|
public ChartQuickEditor() {
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
setBorder(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void refresh() {
|
|
|
|
BaseChartPropertyPane editingPropertyPane = null;
|
|
|
|
BaseChartCollection collection = null;
|
|
|
|
if(tc instanceof PolyDesigner) {
|
|
|
|
ChartBlockEditor chartBlockEditor = (ChartBlockEditor)((PolyDesigner)tc).getSelection().getEditor();
|
|
|
|
collection = chartBlockEditor.getValue().getChartCollection();
|
|
|
|
|
|
|
|
add(editingPropertyPane = DesignModuleFactory.getChartPropertyPane(), BorderLayout.CENTER);
|
|
|
|
editingPropertyPane.setSupportCellData(false);
|
|
|
|
} else {
|
|
|
|
Selection selection = ((ElementCasePane)tc).getSelection();
|
|
|
|
Elem element = null;
|
|
|
|
if(selection instanceof CellSelection) {
|
|
|
|
CellSelection cs = (CellSelection)selection;
|
|
|
|
element = ((ElementCasePane)tc).getEditingElementCase().getCellElement(cs.getColumn(), cs.getRow());
|
|
|
|
} else if(selection instanceof FloatSelection){
|
|
|
|
FloatSelection fs = (FloatSelection)selection;
|
|
|
|
element = ((ElementCasePane)tc).getEditingElementCase().getFloatElement(fs.getSelectedFloatName());
|
|
|
|
}
|
|
|
|
collection = (BaseChartCollection) element.getValue();
|
|
|
|
boolean chartType = false;
|
|
|
|
if (((ChartCollection) collection).getSelectedChart() instanceof ThirdChart) {
|
|
|
|
chartType = true;
|
|
|
|
}
|
|
|
|
if (chartType != lastChartType) {
|
|
|
|
ChartPropertyPane.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
add(editingPropertyPane = DesignModuleFactory.getChartPropertyPane(), BorderLayout.CENTER);
|
|
|
|
editingPropertyPane.addChartEditPane(((ChartCollection)collection).getSelectedChart().getPlot().getPlotID());
|
|
|
|
editingPropertyPane.setSupportCellData(true);
|
|
|
|
if (((ChartCollection) collection).getSelectedChart() instanceof ThirdChart) {
|
|
|
|
lastChartType = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
editingPropertyPane.populateChartPropertyPane(collection, tc);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|