|
|
@ -13,6 +13,7 @@ import com.fr.function.SUM; |
|
|
|
import com.fr.function.TIME; |
|
|
|
import com.fr.function.TIME; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.plugin.ExtraClassManager; |
|
|
|
import com.fr.plugin.ExtraClassManager; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.OperatingSystem; |
|
|
|
import com.fr.stable.OperatingSystem; |
|
|
@ -34,13 +35,75 @@ import java.util.zip.ZipFile; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
|
|
|
|
|
|
|
|
public abstract class FunctionConstants { |
|
|
|
public final class FunctionConstants { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static FunctionGroup PLUGIN = getPluginFunctionGroup(); |
|
|
|
|
|
|
|
public static FunctionGroup CUSTOM = getCustomFunctionGroup(); |
|
|
|
|
|
|
|
static NameAndFunctionList COMMON = getCommonFunctionList(); |
|
|
|
|
|
|
|
static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); |
|
|
|
|
|
|
|
public static FunctionGroup ALL = getAllFunctionGroup(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
|
|
|
loadEmbededFunctions(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Don't let anyone instantiate this class. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private FunctionConstants() {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void loadEmbededFunctions() { |
|
|
|
|
|
|
|
String pkgName = "com.fr.function"; |
|
|
|
|
|
|
|
Class<Function> iface = Function.class; |
|
|
|
|
|
|
|
ClassLoader classloader = iface.getClassLoader(); |
|
|
|
|
|
|
|
Enumeration<URL> urlEnumeration = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
while (urlEnumeration.hasMoreElements()) { |
|
|
|
|
|
|
|
URL url = urlEnumeration.nextElement(); |
|
|
|
|
|
|
|
String classFilePath = url.getFile(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 |
|
|
|
|
|
|
|
* 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); |
|
|
|
|
|
|
|
} catch (UnsupportedEncodingException e1) { |
|
|
|
|
|
|
|
FRContext.getLogger().error(e1.getMessage(), e1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
FRContext.getLogger().info("ClassFilePath:" + classFilePath); |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* alex:如果是jar包中的class文件 |
|
|
|
|
|
|
|
* file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
for (String fileName : findClassNamesUnderFilePath(classFilePath)) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Class<?> cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); |
|
|
|
|
|
|
|
if (StableUtils.classInstanceOf(cls, iface)) { |
|
|
|
|
|
|
|
Function inst; |
|
|
|
|
|
|
|
inst = (Function)cls.newInstance(); |
|
|
|
|
|
|
|
for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { |
|
|
|
|
|
|
|
if (EMBFUNCTION.test(inst)) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 将函数分组插件中的函数添加到对应的列表中 |
|
|
|
* 将函数分组插件中的函数添加到对应的列表中 |
|
|
|
* @param listModel |
|
|
|
* @param listModel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ |
|
|
|
static void addFunctionGroupFromPlugins(DefaultListModel listModel){ |
|
|
|
//hugh:自定义函数分组
|
|
|
|
//hugh:自定义函数分组
|
|
|
|
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); |
|
|
|
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); |
|
|
|
if(!containers.isEmpty()){ |
|
|
|
if(!containers.isEmpty()){ |
|
|
@ -75,98 +138,6 @@ public abstract class FunctionConstants { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static FunctionGroup PLUGIN = new FunctionGroup() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getGroupName() { |
|
|
|
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
|
|
|
|
FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); |
|
|
|
|
|
|
|
int count = fs.length; |
|
|
|
|
|
|
|
FunctionDefNAD[] nads = new FunctionDefNAD[count]; |
|
|
|
|
|
|
|
for (int i = 0; i < count; i ++) { |
|
|
|
|
|
|
|
nads[i] = new FunctionDefNAD(fs[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nads; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static FunctionGroup CUSTOM = new FunctionGroup() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getGroupName() { |
|
|
|
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
|
|
|
|
FunctionConfig funtionManager = FunctionConfig.getInstance(); |
|
|
|
|
|
|
|
if (funtionManager != null) { |
|
|
|
|
|
|
|
int functionDefCount = funtionManager.getFunctionDefCount(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; |
|
|
|
|
|
|
|
for (int i = 0; i < functionDefCount; i++) { |
|
|
|
|
|
|
|
nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nads; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new NameAndDescription[0]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static NameAndFunctionList COMMON = new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { |
|
|
|
|
|
|
|
new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static FunctionGroup ALL = new FunctionGroup() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getGroupName() { |
|
|
|
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
|
|
|
|
List<NameAndDescription> all = new ArrayList<NameAndDescription>(); |
|
|
|
|
|
|
|
for (int i = 0; i < EMBFUNCTIONS.length; i++) { |
|
|
|
|
|
|
|
all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Collections.addAll(all, PLUGIN.getDescriptions()); |
|
|
|
|
|
|
|
Collections.addAll(all, CUSTOM.getDescriptions()); |
|
|
|
|
|
|
|
//hugh:自定义函数分组
|
|
|
|
|
|
|
|
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); |
|
|
|
|
|
|
|
if(!containers.isEmpty()){ |
|
|
|
|
|
|
|
for(Mutable container : containers){ |
|
|
|
|
|
|
|
Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
java.util.Collections.sort(all, NameAndDescriptionComparator); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return all.toArray(new NameAndDescription[all.size()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Comparator<NameAndDescription> NameAndDescriptionComparator = new Comparator<NameAndDescription>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compare(NameAndDescription o1, NameAndDescription o2) { |
|
|
|
|
|
|
|
return ComparatorUtils.compare(o1.getName(), o2.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String[] findClassNamesUnderFilePath(String filePath) { |
|
|
|
private static String[] findClassNamesUnderFilePath(String filePath) { |
|
|
|
java.util.List<String> classNameList = new ArrayList<String>(); |
|
|
|
java.util.List<String> classNameList = new ArrayList<String>(); |
|
|
@ -174,7 +145,7 @@ public abstract class FunctionConstants { |
|
|
|
* alex:如果是jar包中的class文件 |
|
|
|
* alex:如果是jar包中的class文件 |
|
|
|
* file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function |
|
|
|
* file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (filePath.indexOf("!/") >= 0) { |
|
|
|
if (filePath.contains("!/")) { |
|
|
|
String[] arr = filePath.split("!/"); |
|
|
|
String[] arr = filePath.split("!/"); |
|
|
|
String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符
|
|
|
|
String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符
|
|
|
|
String classPath = arr[1]; |
|
|
|
String classPath = arr[1]; |
|
|
@ -197,7 +168,7 @@ public abstract class FunctionConstants { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String entryName = entry.getName(); |
|
|
|
String entryName = entry.getName(); |
|
|
|
if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) { |
|
|
|
if (!entryName.contains(classPath) || !entryName.endsWith(".class")) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -208,57 +179,117 @@ public abstract class FunctionConstants { |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
File dir = new File(filePath); |
|
|
|
File dir = new File(filePath); |
|
|
|
|
|
|
|
File[] files = dir.listFiles(); |
|
|
|
for (File f : dir.listFiles()) { |
|
|
|
if (files != null) { |
|
|
|
String fileName = f.getName(); |
|
|
|
for (File f : files) { |
|
|
|
if (fileName.endsWith(".class")) { |
|
|
|
String fileName = f.getName(); |
|
|
|
classNameList.add(fileName); |
|
|
|
if (fileName.endsWith(".class")) { |
|
|
|
|
|
|
|
classNameList.add(fileName); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return classNameList.toArray(new String[classNameList.size()]); |
|
|
|
return classNameList.toArray(new String[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// alex:读取com.fr.script.function包下面所有的Function类
|
|
|
|
private static FunctionGroup getPluginFunctionGroup() { |
|
|
|
static { |
|
|
|
return new FunctionGroup() { |
|
|
|
String pkgName = "com.fr.function"; |
|
|
|
@Override |
|
|
|
Class<Function> iface = Function.class; |
|
|
|
public String getGroupName() { |
|
|
|
ClassLoader classloader = iface.getClassLoader(); |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); |
|
|
|
URL url = classloader.getResource(pkgName.replace('.', '/')); |
|
|
|
} |
|
|
|
String classFilePath = url.getFile(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
* alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 |
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
* 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 |
|
|
|
FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); |
|
|
|
*/ |
|
|
|
int count = fs.length; |
|
|
|
try { |
|
|
|
FunctionDefNAD[] nads = new FunctionDefNAD[count]; |
|
|
|
classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); |
|
|
|
for (int i = 0; i < count; i ++) { |
|
|
|
} catch (UnsupportedEncodingException e1) { |
|
|
|
nads[i] = new FunctionDefNAD(fs[i]); |
|
|
|
FRContext.getLogger().error(e1.getMessage(), e1); |
|
|
|
} |
|
|
|
} |
|
|
|
return nads; |
|
|
|
FRContext.getLogger().info("ClassFilePath:" + classFilePath); |
|
|
|
} |
|
|
|
/* |
|
|
|
}; |
|
|
|
* alex:如果是jar包中的class文件 |
|
|
|
} |
|
|
|
* file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function |
|
|
|
|
|
|
|
*/ |
|
|
|
private static FunctionGroup getCustomFunctionGroup() { |
|
|
|
for (String fileName : findClassNamesUnderFilePath(classFilePath)) { |
|
|
|
return new FunctionGroup() { |
|
|
|
try { |
|
|
|
@Override |
|
|
|
Class<?> cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); |
|
|
|
public String getGroupName() { |
|
|
|
if (StableUtils.classInstanceOf(cls, iface)) { |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); |
|
|
|
Function inst; |
|
|
|
} |
|
|
|
inst = (Function)cls.newInstance(); |
|
|
|
|
|
|
|
for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { |
|
|
|
@Override |
|
|
|
if (EMBFUNCTIONS[fi].test(inst)) { |
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
break; |
|
|
|
FunctionConfig funtionManager = FunctionConfig.getInstance(); |
|
|
|
} |
|
|
|
if (funtionManager != null) { |
|
|
|
|
|
|
|
int functionDefCount = funtionManager.getFunctionDefCount(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; |
|
|
|
|
|
|
|
for (int i = 0; i < functionDefCount; i++) { |
|
|
|
|
|
|
|
nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nads; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (ClassNotFoundException e) { |
|
|
|
|
|
|
|
} catch (InstantiationException e) { |
|
|
|
return new NameAndDescription[0]; |
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static NameAndFunctionList getCommonFunctionList() { |
|
|
|
|
|
|
|
return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { |
|
|
|
|
|
|
|
new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static NameAndTypeAndFunctionList[] getEmbededFunctionListArray() { |
|
|
|
|
|
|
|
return new NameAndTypeAndFunctionList[] { |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), |
|
|
|
|
|
|
|
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static FunctionGroup getAllFunctionGroup() { |
|
|
|
|
|
|
|
return new FunctionGroup() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getGroupName() { |
|
|
|
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public NameAndDescription[] getDescriptions() { |
|
|
|
|
|
|
|
List<NameAndDescription> all = new ArrayList<NameAndDescription>(); |
|
|
|
|
|
|
|
for (int i = 0; i < EMBFUNCTIONS.length; i++) { |
|
|
|
|
|
|
|
all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Collections.addAll(all, PLUGIN.getDescriptions()); |
|
|
|
|
|
|
|
Collections.addAll(all, CUSTOM.getDescriptions()); |
|
|
|
|
|
|
|
//hugh:自定义函数分组
|
|
|
|
|
|
|
|
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); |
|
|
|
|
|
|
|
if(!containers.isEmpty()){ |
|
|
|
|
|
|
|
for(Mutable container : containers){ |
|
|
|
|
|
|
|
Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Collections.sort(all, new Comparator<NameAndDescription>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compare(NameAndDescription o1, NameAndDescription o2) { |
|
|
|
|
|
|
|
return ComparatorUtils.compare(o1.getName(), o2.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return all.toArray(new NameAndDescription[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|