A number of very minor fixes:

(1) when generating constructors, generate a reverence for the StylesHelper, as it is used in views we generate.
(2) when generating lists, don't layout columns whose contents are themselves lists.
This commit is contained in:
sb 2009-01-28 12:10:02 +00:00
parent 6ff5d773fa
commit ee4ae42fc4
2 changed files with 101 additions and 79 deletions

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes Transform ADL into (partial) controller classes
$Author: sb $ $Author: sb $
$Revision: 1.22 $ $Revision: 1.23 $
$Date: 2008-10-31 13:10:22 $ $Date: 2009-01-28 12:10:02 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -67,7 +67,7 @@
// //
// Automatically generated abstract super class for controllers for the // Automatically generated abstract super class for controllers for the
// <xsl:value-of select="/adl:application/@name"/> application; generated using // <xsl:value-of select="/adl:application/@name"/> application; generated using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/> // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.23 $', 10)"/>
// //
// <xsl:value-of select="/adl:application/@revision"/> // <xsl:value-of select="/adl:application/@revision"/>
// //
@ -135,7 +135,7 @@
// //
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s // Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
// Automatically generated from application description using // Automatically generated from application description using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/> // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.23 $', 10)"/>
// //
// This file is automatically generated; DO NOT EDIT IT. // This file is automatically generated; DO NOT EDIT IT.
// //
@ -180,6 +180,7 @@
Rescue("<xsl:value-of select="$rescue-name"/>"), Rescue("<xsl:value-of select="$rescue-name"/>"),
</xsl:if> </xsl:if>
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"), ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
Helper(typeof(StylesHelper), "StylesHelper"),
Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>") Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>")
] ]
public partial class <xsl:value-of select="concat( @name, 'Controller')"/> : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> { public partial class <xsl:value-of select="concat( @name, 'Controller')"/> : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> {

View file

@ -13,8 +13,8 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.16 $ $Revision: 1.17 $
$Date: 2008-10-31 14:35:06 $ $Date: 2009-01-28 12:10:02 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! --> Whitespace (or lack of it) is significant! -->
@ -124,7 +124,7 @@
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="maybe-delete"> <xsl:call-template name="maybe-delete">
<xsl:with-param name="entity" select="."/> <xsl:with-param name="entity" select="."/>
@ -161,7 +161,7 @@
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
<xsl:value-of select="/adl:application/@revision"/> <xsl:value-of select="/adl:application/@revision"/>
</xsl:comment> </xsl:comment>
@ -244,7 +244,7 @@
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
<xsl:value-of select="/adl:application/@revision"/> <xsl:value-of select="/adl:application/@revision"/>
</xsl:comment> </xsl:comment>
@ -366,7 +366,7 @@
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
<xsl:value-of select="/adl:application/@revision"/> <xsl:value-of select="/adl:application/@revision"/>
</xsl:comment> </xsl:comment>
@ -972,7 +972,7 @@
Auto generated Velocity list for <xsl:value-of select="@name"/>, Auto generated Velocity list for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
@ -1010,7 +1010,7 @@
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -1093,14 +1093,21 @@
<table> <table>
<tr> <tr>
<xsl:for-each select="$fields"> <xsl:for-each select="$fields">
<th> <xsl:choose>
<xsl:call-template name="showprompt"> <xsl:when test="@type='list'">
<xsl:with-param name="node" select="."/> <!-- suppress layout of columns which are themselves lists -->
<xsl:with-param name="fallback" select="@property"/> </xsl:when>
<xsl:with-param name="entity" select="$entity"/> <xsl:otherwise>
<xsl:with-param name="locale" select="$locale"/> <th>
</xsl:call-template> <xsl:call-template name="showprompt">
</th> <xsl:with-param name="node" select="."/>
<xsl:with-param name="fallback" select="@property"/>
<xsl:with-param name="entity" select="$entity"/>
<xsl:with-param name="locale" select="$locale"/>
</xsl:call-template>
</th>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="$entity/adl:form"> <xsl:for-each select="$entity/adl:form">
<th>-</th> <th>-</th>
@ -1109,42 +1116,49 @@
<xsl:if test="$can-search = 'true'"> <xsl:if test="$can-search = 'true'">
<tr class="search"> <tr class="search">
<xsl:for-each select="$fields"> <xsl:for-each select="$fields">
<td class="search"> <xsl:choose>
<xsl:variable name="pname" select="@property"/> <xsl:when test="@type='list'">
<xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/> <!-- suppress layout of columns which are themselves lists -->
<xsl:variable name="size"> </xsl:when>
<xsl:choose> <xsl:otherwise>
<xsl:when test="$property/@type='string'"> <td class="search">
<xsl:variable name="pname" select="@property"/>
<xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/>
<xsl:variable name="size">
<xsl:choose> <xsl:choose>
<xsl:when test="$property/@size &gt; 20">20</xsl:when> <xsl:when test="$property/@type='string'">
<xsl:otherwise> <xsl:choose>
<xsl:value-of select="$property/@size"/> <xsl:when test="$property/@size &gt; 20">20</xsl:when>
</xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$property/@size"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$property/@type='integer'">8</xsl:when>
<xsl:when test="$property/@type='real'">8</xsl:when>
<xsl:when test="$property/@type='money'">8</xsl:when>
<!-- xsl:when test="$property/@type='message'">20</xsl:when doesn't work yet -->
<xsl:when test="$property/@type='text'">20</xsl:when>
<!-- xsl:when test="$property/@type='enity'">20</xsl:when doesn't work yet -->
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:variable>
<xsl:when test="$property/@type='integer'">8</xsl:when> <xsl:if test="$size != 0">
<xsl:when test="$property/@type='real'">8</xsl:when> <input>
<xsl:when test="$property/@type='money'">8</xsl:when> <xsl:attribute name="name">
<!-- xsl:when test="$property/@type='message'">20</xsl:when doesn't work yet --> <xsl:value-of select="concat('search_',$property/@name)"/>
<xsl:when test="$property/@type='text'">20</xsl:when> </xsl:attribute>
<!-- xsl:when test="$property/@type='enity'">20</xsl:when doesn't work yet --> <xsl:attribute name="size">
<xsl:otherwise>0</xsl:otherwise> <xsl:value-of select="$size"/>
</xsl:choose> </xsl:attribute>
</xsl:variable> <xsl:attribute name="value">
<xsl:if test="$size != 0"> <xsl:value-of select="concat( '$!search_', $property/@name)"/>
<input> </xsl:attribute>
<xsl:attribute name="name"> </input>
<xsl:value-of select="concat('search_',$property/@name)"/> </xsl:if>
</xsl:attribute> </td>
<xsl:attribute name="size"> </xsl:otherwise>
<xsl:value-of select="$size"/> </xsl:choose>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="concat( '$!search_', $property/@name)"/>
</xsl:attribute>
</input>
</xsl:if>
</td>
</xsl:for-each> </xsl:for-each>
</tr> </tr>
</xsl:if> </xsl:if>
@ -1158,31 +1172,38 @@
<xsl:for-each select="$fields"> <xsl:for-each select="$fields">
<xsl:variable name="pname" select="@property"/> <xsl:variable name="pname" select="@property"/>
<xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/> <xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/>
<td> <xsl:choose>
<xsl:choose> <xsl:when test="@type='list'">
<xsl:when test="not( $property/@name)"> <!-- suppress layout of columns which are themselves lists -->
<!-- shouldn't happen. There is definitely a bug here, because it does happen - but it shouldn't --> </xsl:when>
</xsl:when> <xsl:otherwise>
<xsl:when test="$property/@type = 'date'"> <td>
#if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) <xsl:choose>
<xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>.ToString( 'd') <xsl:when test="not( $property/@name)">
#end <!-- shouldn't happen. There is definitely a bug here, because it does happen - but it shouldn't -->
</xsl:when> </xsl:when>
<xsl:when test="$property/@type='message'"> <xsl:when test="$property/@type = 'date'">
#if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
$t.Msg( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>.ToString( 'd')
#end #end
</xsl:when> </xsl:when>
<xsl:when test="$property/@type='entity'"> <xsl:when test="$property/@type='message'">
#if( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
<xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name, '.UserIdentifier')"/> $t.Msg( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
#end #end
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:when test="$property/@type='entity'">
<xsl:value-of select="concat( '$!', $entity/@name, '.', $property/@name)"/> #if( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
</xsl:otherwise> <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name, '.UserIdentifier')"/>
</xsl:choose> #end
</td> </xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( '$!', $entity/@name, '.', $property/@name)"/>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
<xsl:variable name="keys"> <xsl:variable name="keys">
<!-- assemble keys in a Velocity-friendly format, then splice it into <!-- assemble keys in a Velocity-friendly format, then splice it into