|
|
@ -8,61 +8,65 @@ import com.fr.data.util.function.MinFunction; |
|
|
|
import com.fr.data.util.function.NoneFunction; |
|
|
|
import com.fr.data.util.function.NoneFunction; |
|
|
|
import com.fr.data.util.function.SumFunction; |
|
|
|
import com.fr.data.util.function.SumFunction; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.base.FirstFunction; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 公式选择. |
|
|
|
* 公式选择. |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
* |
|
|
|
* @version 创建时间:2013-1-8 上午09:52:15 |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
|
|
|
|
* @version 创建时间:2013-1-8 上午09:52:15 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class CalculateComboBox extends UIComboBox{ |
|
|
|
public class CalculateComboBox extends UIComboBox { |
|
|
|
|
|
|
|
|
|
|
|
public static final String[] CALCULATE_ARRAY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), |
|
|
|
public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), |
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), |
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), |
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; |
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), |
|
|
|
public static final Class[] CLASS_ARRAY = {NoneFunction.class, SumFunction.class, AverageFunction.class, |
|
|
|
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; |
|
|
|
MaxFunction.class, MinFunction.class, CountFunction.class}; |
|
|
|
public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class, |
|
|
|
|
|
|
|
MaxFunction.class, MinFunction.class, CountFunction.class}; |
|
|
|
public CalculateComboBox() { |
|
|
|
|
|
|
|
super(CALCULATE_ARRAY); |
|
|
|
public CalculateComboBox() { |
|
|
|
setSelectedIndex(0); |
|
|
|
super(CALCULATE_ARRAY); |
|
|
|
} |
|
|
|
setSelectedIndex(2); |
|
|
|
|
|
|
|
} |
|
|
|
public void reset() { |
|
|
|
|
|
|
|
this.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None")); |
|
|
|
public void reset() { |
|
|
|
} |
|
|
|
this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 更新公式选择. |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 更新公式选择. |
|
|
|
public void populateBean(AbstractDataFunction function) { |
|
|
|
*/ |
|
|
|
for(int i = 0; i < CLASS_ARRAY.length; i++) { |
|
|
|
public void populateBean(AbstractDataFunction function) { |
|
|
|
if(function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { |
|
|
|
for (int i = 0; i < CLASS_ARRAY.length; i++) { |
|
|
|
setSelectedIndex(i); |
|
|
|
if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { |
|
|
|
break; |
|
|
|
setSelectedIndex(i); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 返回当前选择的公式 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 返回当前选择的公式 |
|
|
|
public AbstractDataFunction updateBean() { |
|
|
|
*/ |
|
|
|
try { |
|
|
|
public AbstractDataFunction updateBean() { |
|
|
|
int selectIndex = getSelectedIndex(); |
|
|
|
try { |
|
|
|
if(selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { |
|
|
|
int selectIndex = getSelectedIndex(); |
|
|
|
return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance(); |
|
|
|
if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { |
|
|
|
} |
|
|
|
return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance(); |
|
|
|
} catch (InstantiationException e) { |
|
|
|
} |
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
} catch (InstantiationException e) { |
|
|
|
return null; |
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
return null; |
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
return null; |
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |