@ -1,6 +1,10 @@
package com.fr.design.chart.series.SeriesCondition ;
import com.fr.chart.chartattr.Chart ;
import com.fr.chart.chartattr.ChartCommonCondition ;
import com.fr.chart.chartattr.Plot ;
import com.fr.chart.chartglyph.ConditionAttr ;
import com.fr.chart.chartglyph.ConditionCollection ;
import com.fr.data.DSColumnWithSummaryMethod ;
import com.fr.data.util.function.AbstractDataFunction ;
import com.fr.design.chart.ChartDataHelper ;
@ -9,8 +13,11 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.gui.icombobox.UIComboBox ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.plugin.chart.attr.plot.VanChartPlot ;
import com.fr.plugin.chart.custom.VanChartCustomPlot ;
import com.fr.plugin.chart.custom.type.CustomPlotType ;
import java.awt.Dimension ;
import java.util.List ;
import javax.swing.DefaultComboBoxModel ;
public class ColSelectedWithSummaryMethodEditor extends Editor < DSColumnWithSummaryMethod > {
@ -88,4 +95,24 @@ public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSumma
return object instanceof DSColumnWithSummaryMethod ;
}
public static void update ( int index , Plot plot ) {
if ( plot instanceof VanChartCustomPlot ) {
List < VanChartPlot > list = ( ( VanChartCustomPlot ) plot ) . getCustomPlotList ( ) ;
VanChartPlot vanChartPlot = list . get ( index ) ;
ConditionCollection conditionCollection = vanChartPlot . getConditionCollection ( ) ;
ConditionAttr [ ] conditionAttrs = conditionCollection . getAllConditionAttrList ( ) ;
for ( ConditionAttr conditionAttr : conditionAttrs ) {
if ( conditionAttr . getCondition ( ) instanceof ChartCommonCondition ) {
ChartCommonCondition chartCommonCondition = ( ChartCommonCondition ) conditionAttr . getCondition ( ) ;
if ( chartCommonCondition . getCompare ( ) . getValue ( ) instanceof DSColumnWithSummaryMethod ) {
DSColumnWithSummaryMethod dsColumnWithSummaryMethod = ( DSColumnWithSummaryMethod ) chartCommonCondition . getCompare ( ) . getValue ( ) ;
columnNameComboBoxModel . setSelectedItem ( dsColumnWithSummaryMethod . getFieldName ( ) ) ;
summaryMethodComboBoxModel . setSelectedItem ( ChartCommonCondition . FORMAT_MAP . get ( String . valueOf ( dsColumnWithSummaryMethod . getDataFunction ( ) . getFormula ( ) ) ) ) ;
return ;
}
}
}
}
}
}