comparison src/main/resources/org/ssdt_ohio/gradle/userdoc/templates/classDocName.html @ 15:e3c55e83c9a4

USASR-1307: start custom class/property displays
author Dave Smith <smith@nwoca.org>
date Fri, 17 Jan 2014 18:16:29 +0000
parents 9de72de14ab3
children 8400a7db1330
comparison
equal deleted inserted replaced
14:9de72de14ab3 15:e3c55e83c9a4
3 <!-- **************************************************************** --> 3 <!-- **************************************************************** -->
4 <!-- * PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * --> 4 <!-- * PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * -->
5 <!-- * i.e. only iterate & print data where possible. Thanks, Jez. * --> 5 <!-- * i.e. only iterate & print data where possible. Thanks, Jez. * -->
6 <!-- **************************************************************** --> 6 <!-- **************************************************************** -->
7 <% 7 <%
8
9
10 classDoc = new org.ssdt_ohio.gradle.doc.tools.UserClassDocProxy().wrap(classDoc)
11
8 def title = classDoc.name() + (props.docTitle ? " (${props.docTitle})" : "") 12 def title = classDoc.name() + (props.docTitle ? " (${props.docTitle})" : "")
9 def isVisible = { it.isPublic() || (it.isProtected() && props.protectedScope == 'true') || (!it.isProtected() && !it.isPrivate() && props.packageScope == 'true') || props.privateScope == 'true' } 13 def isVisible = { it.isPublic() || (it.isProtected() && props.protectedScope == 'true') || (!it.isProtected() && !it.isPrivate() && props.packageScope == 'true') || props.privateScope == 'true' }
10 def isVisibleExt = { t -> java.lang.reflect.Modifier.isPublic(t.modifiers) || java.lang.reflect.Modifier.isProtected(t.modifiers) } 14 def isVisibleExt = { t -> java.lang.reflect.Modifier.isPublic(t.modifiers) || java.lang.reflect.Modifier.isProtected(t.modifiers) }
11 def visibleFields = classDoc.fields().findAll(isVisible) 15 def visibleFields = classDoc.fields().findAll(isVisible)
12 def visibleProperties = classDoc.properties() // props visible be defn 16 def visibleProperties = classDoc.properties() // props visible be defn
20 boolean fieldSummaryShown = hasFields 24 boolean fieldSummaryShown = hasFields
21 boolean hasEnumConstants = classDoc.enumConstants() 25 boolean hasEnumConstants = classDoc.enumConstants()
22 def dolink = { t, boolean b -> 26 def dolink = { t, boolean b ->
23 boolean isArray = false 27 boolean isArray = false
24 if (!t || t instanceof String) { 28 if (!t || t instanceof String) {
25 return classDoc.getDocUrl(t, b) 29 return (classDoc.getDocUrl(t, b) -'java.util.' - 'java.lang.')
26 } 30 }
27 if (t instanceof org.codehaus.groovy.tools.groovydoc.ArrayClassDocWrapper) { 31 if (t instanceof org.codehaus.groovy.tools.groovydoc.ArrayClassDocWrapper) {
28 t = t.delegate 32 t = t.delegate
29 isArray = true 33 isArray = true
30 } 34 }
31 if (t instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) { 35 if (t instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
32 if (t.fullPathName == 'def') return classDoc.getDocUrl("java.lang.Object def", b) 36 if (t.fullPathName == 'def') return classDoc.getDocUrl("java.lang.Object def", b)
33 return "<a href='" + classDoc.relativeRootPath + t.fullPathName + ".html'>" + (b ? t.qualifiedTypeName() : t.name()) + "</a>" + (isArray ? "[]" : "") 37 return "<a href='" + classDoc.relativeRootPath + t.fullPathName + ".html'>" + ( (b ? t.qualifiedTypeName() : t.name() ) - "java.lang." - "java.util." ) + "</a>" + (isArray ? "[]" : "")
34 } 38 }
35 return classDoc.getDocUrl(t.qualifiedTypeName(), b) + (isArray ? "[]" : "") 39 return ( classDoc.getDocUrl(t.qualifiedTypeName(), b) - 'java.util.' - 'java.lang.' ) + (isArray ? "[]" : "")
36 } 40 }
37 def linkfull = { t -> dolink(t, true) } 41 def linkfull = { t -> dolink(t, true) }
38 def linkable = { t -> dolink(t, false) } 42 def linkable = { t -> dolink(t, false) }
39 def modifiersWithIgnore = { t, boolean ignorePublic -> 43 def modifiersWithIgnore = { t, boolean ignorePublic ->
40 (t.isPrivate()?"private&nbsp;":"") + 44 (t.isPrivate()?"private&nbsp;":"") +
50 (t.isProtected()?"protected&nbsp;":"") + 54 (t.isProtected()?"protected&nbsp;":"") +
51 (t.isStatic()?"static&nbsp;":"") 55 (t.isStatic()?"static&nbsp;":"")
52 } 56 }
53 def annotations = { t, sepChar -> 57 def annotations = { t, sepChar ->
54 t.annotations() ? t.annotations().collect { 58 t.annotations() ? t.annotations().collect {
55 // it.isTypeAvailable() ? '@'+linkable(it.type().name())+(it.description()-('@'+it.type().name())): it.description() 59 // it.isTypeAvailable() ? '@'+linkable(it.type().name())+(it.description()-('@'+it.type().name())): it.description()
56 it.description() 60 it.description()
57 }.join(sepChar) + sepChar : '' 61 }.join(sepChar) + sepChar : ''
58 } 62 }
59 def elementTypes = [ 63 def elementTypes = [
60 "required":"true", 64 "required":"true",
61 "optional":"false" 65 "optional":"false"
62 ] 66 ]
63 def isRequired = { f, v -> def req = f.constantValueExpression() == null; req.toString() == v } 67 def isRequired = { f, v ->
68 def req = f.constantValueExpression() == null; req.toString() == v
69 }
64 def upcase = { n -> n[0].toUpperCase() + n[1..-1] } 70 def upcase = { n -> n[0].toUpperCase() + n[1..-1] }
65 def paramsOf = { n, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, ' ')) + linkable(param.isTypeAvailable()?param.type():param.typeName()) + (param.vararg()?'... ':' ') + param.name() + (param.defaultValue() ? " = " + param.defaultValue():"") }.join(", ") } 71 def paramsOf = { n, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, ' ')) + linkable(param.isTypeAvailable()?param.type():param.typeName()) + (param.vararg()?'... ':' ') + param.name() + (param.defaultValue() ? " = " + param.defaultValue():"") }.join(", ") }
66 def nameFromParams = { n -> n.name() + '(' + n.parameters().collect{ param -> param.isTypeAvailable()?param.type().qualifiedTypeName():param.typeName() }.join(', ') + ')' } 72 def nameFromParams = { n -> n.name() + '(' + n.parameters().collect{ param -> param.isTypeAvailable()?param.type().qualifiedTypeName():param.typeName() }.join(', ') + ')' }
67 def nameFromJavaParams = { n -> n.name + '(' + n.parameterTypes.collect{ param -> param.name }.join(', ') + ')' } 73 def nameFromJavaParams = { n -> n.name + '(' + n.parameterTypes.collect{ param -> param.name }.join(', ') + ')' }
68 %> 74 %>