|
|
@ -1,32 +1,38 @@ |
|
|
|
package com.fanruan.api.design.ui.component.chart; |
|
|
|
package com.fanruan.api.design.ui.component.chart; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fanruan.api.design.DesignKit; |
|
|
|
import com.fanruan.api.design.ui.component.UIComboBox; |
|
|
|
import com.fanruan.api.design.ui.component.UIComboBox; |
|
|
|
|
|
|
|
import com.fanruan.api.log.LogKit; |
|
|
|
|
|
|
|
import com.fr.common.annotations.Compatible; |
|
|
|
import com.fr.data.util.function.DataFunction; |
|
|
|
import com.fr.data.util.function.DataFunction; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Bjorn |
|
|
|
* @author Bjorn |
|
|
|
* @version 10.0 |
|
|
|
* @version 10.0 |
|
|
|
* Created by Bjorn on 2019-09-23 |
|
|
|
* Created by Bjorn on 2019-09-23 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class CalculateComboBox extends UIComboBox { |
|
|
|
public class CalculateComboBox extends UIComboBox<String> { |
|
|
|
|
|
|
|
|
|
|
|
private static String[] functionName = initItem(); |
|
|
|
private static String[] functionName; |
|
|
|
|
|
|
|
|
|
|
|
private static String[] initItem() { |
|
|
|
static { |
|
|
|
String[] functionLocaleNames = DataFunctionType.getFunctionLocaleNames(); |
|
|
|
String[] functionLocaleNames = DataFunctionType.getFunctionLocaleNames(); |
|
|
|
for (int i = 0; i < functionLocaleNames.length; i++) { |
|
|
|
for (int i = 0; i < functionLocaleNames.length; i++) { |
|
|
|
functionLocaleNames[i] = Toolkit.i18nText(functionLocaleNames[i]); |
|
|
|
functionLocaleNames[i] = DesignKit.i18nText(functionLocaleNames[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
return functionLocaleNames; |
|
|
|
functionName = functionLocaleNames; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CalculateComboBox() { |
|
|
|
public CalculateComboBox() { |
|
|
|
super(functionName); |
|
|
|
super(functionName); |
|
|
|
setSelectedIndex(0); |
|
|
|
setSelectedIndex(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重置公式下拉选选中的值为第0个 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Compatible |
|
|
|
public void reset() { |
|
|
|
public void reset() { |
|
|
|
this.setSelectedItem(0); |
|
|
|
this.setSelectedItem(0); |
|
|
|
} |
|
|
|
} |
|
|
@ -34,6 +40,7 @@ public class CalculateComboBox extends UIComboBox { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 通过公式对象,更新界面的公式选择 |
|
|
|
* 通过公式对象,更新界面的公式选择 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Compatible |
|
|
|
public void populateBean(DataFunction function) { |
|
|
|
public void populateBean(DataFunction function) { |
|
|
|
int index = DataFunctionType.getIndexByFunction(function); |
|
|
|
int index = DataFunctionType.getIndexByFunction(function); |
|
|
|
if (index > 0) { |
|
|
|
if (index > 0) { |
|
|
@ -44,15 +51,13 @@ public class CalculateComboBox extends UIComboBox { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据界面选择的公式,返回公式对象 |
|
|
|
* 根据界面选择的公式,返回公式对象 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Compatible |
|
|
|
public DataFunction updateBean() { |
|
|
|
public DataFunction updateBean() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
int selectIndex = getSelectedIndex(); |
|
|
|
int selectIndex = getSelectedIndex(); |
|
|
|
DataFunction functionByIndex = DataFunctionType.getFunctionByIndex(selectIndex); |
|
|
|
return DataFunctionType.getFunctionByIndex(selectIndex); |
|
|
|
return functionByIndex; |
|
|
|
} catch (InstantiationException | IllegalAccessException e) { |
|
|
|
} catch (InstantiationException e) { |
|
|
|
LogKit.error("Function Error"); |
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
|
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error("Function Error"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|