|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.fr.solution.plugin.design.formula.compat; |
|
|
|
package com.fr.solution.plugin.design.formula.compat; |
|
|
|
|
|
|
|
|
|
|
|
import com.fanruan.api.function.FunctionKit; |
|
|
|
import com.fanruan.api.function.FunctionKit; |
|
|
|
|
|
|
|
import com.fanruan.api.log.LogKit; |
|
|
|
import com.fanruan.api.macro.EncodeConstants; |
|
|
|
import com.fanruan.api.macro.EncodeConstants; |
|
|
|
import com.fanruan.api.util.GeneralKit; |
|
|
|
import com.fanruan.api.util.GeneralKit; |
|
|
|
import com.fanruan.api.util.OperatingKit; |
|
|
|
import com.fanruan.api.util.OperatingKit; |
|
|
@ -17,7 +18,6 @@ import com.fr.function.MIN; |
|
|
|
import com.fr.function.RANGE; |
|
|
|
import com.fr.function.RANGE; |
|
|
|
import com.fr.function.SUM; |
|
|
|
import com.fr.function.SUM; |
|
|
|
import com.fr.function.TIME; |
|
|
|
import com.fr.function.TIME; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
|
|
|
|
import com.fr.plugin.ExtraClassManager; |
|
|
|
import com.fr.plugin.ExtraClassManager; |
|
|
|
import com.fr.stable.fun.FunctionDefContainer; |
|
|
|
import com.fr.stable.fun.FunctionDefContainer; |
|
|
|
import com.fr.stable.fun.mark.Mutable; |
|
|
|
import com.fr.stable.fun.mark.Mutable; |
|
|
@ -63,7 +63,8 @@ public final class FunctionConstants { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Don't let anyone instantiate this class. |
|
|
|
* Don't let anyone instantiate this class. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private FunctionConstants() {} |
|
|
|
private FunctionConstants() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void loadEmbededFunctions() { |
|
|
|
private static void loadEmbededFunctions() { |
|
|
|
String pkgName = "com.fr.function"; |
|
|
|
String pkgName = "com.fr.function"; |
|
|
@ -73,7 +74,7 @@ public final class FunctionConstants { |
|
|
|
try { |
|
|
|
try { |
|
|
|
urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); |
|
|
|
urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
LogKit.error(e.getMessage()); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
while (urlEnumeration.hasMoreElements()) { |
|
|
|
while (urlEnumeration.hasMoreElements()) { |
|
|
@ -86,9 +87,9 @@ public final class FunctionConstants { |
|
|
|
try { |
|
|
|
try { |
|
|
|
classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); |
|
|
|
classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); |
|
|
|
} catch (UnsupportedEncodingException e1) { |
|
|
|
} catch (UnsupportedEncodingException e1) { |
|
|
|
FRLogger.getLogger().error(e1.getMessage(), e1); |
|
|
|
LogKit.error(e1.getMessage(), e1); |
|
|
|
} |
|
|
|
} |
|
|
|
FRLogger.getLogger().info("ClassFilePath:" + classFilePath); |
|
|
|
LogKit.info("ClassFilePath:" + classFilePath); |
|
|
|
if (isCustomFormulaPath(classFilePath)) { |
|
|
|
if (isCustomFormulaPath(classFilePath)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
@ -107,7 +108,7 @@ public final class FunctionConstants { |
|
|
|
} catch (Exception ignore) { |
|
|
|
} catch (Exception ignore) { |
|
|
|
} catch (Throwable e) { |
|
|
|
} catch (Throwable e) { |
|
|
|
// 不要因为个别公式加载失败,而导致整个函数面板无法启动
|
|
|
|
// 不要因为个别公式加载失败,而导致整个函数面板无法启动
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
LogKit.error(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -127,6 +128,7 @@ public final class FunctionConstants { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 将函数分组插件中的函数添加到对应的列表中 |
|
|
|
* 将函数分组插件中的函数添加到对应的列表中 |
|
|
|
|
|
|
|
* |
|
|
|
* @param listModel |
|
|
|
* @param listModel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void addFunctionGroupFromPlugins(DefaultListModel listModel) { |
|
|
|
public static void addFunctionGroupFromPlugins(DefaultListModel listModel) { |
|
|
@ -141,6 +143,7 @@ public final class FunctionConstants { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建一个新的分组 |
|
|
|
* 创建一个新的分组 |
|
|
|
|
|
|
|
* |
|
|
|
* @param container |
|
|
|
* @param container |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -198,7 +201,7 @@ public final class FunctionConstants { |
|
|
|
classNameList.add(entryName.substring(classPath.length() + 1)); |
|
|
|
classNameList.add(entryName.substring(classPath.length() + 1)); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLogger.getLogger().error(e.getMessage(), e); |
|
|
|
LogKit.error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
File dir = new File(filePath); |
|
|
|
File dir = new File(filePath); |
|
|
|