return new SimpleDumpData(closure?"<Closure>":"<UDF>");
// arguments
FunctionArgument[] args = udf.getFunctionArguments();
DumpTable atts = closure?new DumpTable("udf","#ff00ff","#ffccff","#000000"):new DumpTable("udf","#cc66ff","#ffccff","#000000");
atts.appendRow(new DumpRow(63,new DumpData[]{new SimpleDumpData("label"),new SimpleDumpData("name"),new SimpleDumpData("required"),new SimpleDumpData("type"),new SimpleDumpData("default"),new SimpleDumpData("hint")}));
for(int i=0;i<args.length;i++) {
FunctionArgument arg=args[i];
DumpData def;
try {
Object oa=null;
try {
oa = UDFUtil.getDefaultValue(pageContext, (UDFPlus)udf, i, null);//udf.getDefaultValue(pageContext,i,null);
} catch (PageException e1) {
}
if(oa==null)oa="null";
def=new SimpleDumpData(Caster.toString(oa));
} catch (PageException e) {
def=new SimpleDumpData("");
}
atts.appendRow(new DumpRow(0,new DumpData[]{
new SimpleDumpData(arg.getDisplayName()),
new SimpleDumpData(arg.getName().getString()),
new SimpleDumpData(arg.isRequired()),
new SimpleDumpData(arg.getTypeAsString()),
def,
new SimpleDumpData(arg.getHint())}));
//atts.setRow(0,arg.getHint());
}
DumpTable func = closure?new DumpTable("#ff00ff","#ffccff","#000000"):new DumpTable("#cc66ff","#ffccff","#000000");
if(closure) func.setTitle("Closure");
else {
String f="Function ";
try {
f=StringUtil.ucFirst(ComponentUtil.toStringAccess(udf.getAccess()).toLowerCase())+" "+f;
}
catch (ExpressionException e) {}
f+=udf.getFunctionName();
if(udf instanceof UDFGSProperty) f+=" (generated)";
func.setTitle(f);
}
if(udf instanceof UDFPlus)func.setComment("source:"+((UDFPlus)udf).getPageSource().getDisplayPath());
if(!StringUtil.isEmpty(udf.getDescription()))func.setComment(udf.getDescription());
func.appendRow(1,new SimpleDumpData("arguments"),atts);
func.appendRow(1,new SimpleDumpData("return type"),new SimpleDumpData(udf.getReturnTypeAsString()));
boolean hasLabel=!StringUtil.isEmpty(udf.getDisplayName());//displayName!=null && !displayName.equals("");
boolean hasHint=!StringUtil.isEmpty(udf.getHint());//hint!=null && !hint.equals("");
if(hasLabel || hasHint) {
DumpTable box = new DumpTable("#ffffff","#cccccc","#000000");
box.setTitle(hasLabel?udf.getDisplayName():udf.getFunctionName());
if(hasHint)box.appendRow(0,new SimpleDumpData(udf.getHint()));
box.appendRow(0,func);
return box;
}
return func;
}