Spent a lot of time trying to get Andrew's (very clever) automatic type resolution to widgets working, but without good success, so I've backed out a lot of code. It may still be the right approach, but will take much more work to get working.
This commit is contained in:
parent
7b1f458583
commit
dff905227d
2 changed files with 61 additions and 23 deletions
|
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.25 $
|
||||
$Date: 2008-05-13 10:36:46 $
|
||||
$Revision: 1.26 $
|
||||
$Date: 2008-05-15 16:29:24 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.25 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
|
@ -128,7 +128,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.25 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
|
@ -148,6 +148,7 @@ using Castle.MonoRail.Framework.Helpers;
|
|||
using Cygnet.Exceptions;
|
||||
using Cygnet.Web.Helpers;
|
||||
using Cygnet.Web.Controllers;
|
||||
using Cygnet.Web.SmartControls;
|
||||
using NHibernate;
|
||||
using NHibernate.Expression;
|
||||
using Castle.MonoRail.Framework;
|
||||
|
|
@ -164,13 +165,38 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
///
|
||||
/// DO NOT EDIT THIS FILE!
|
||||
/// </summary>
|
||||
[ Layout("<xsl:value-of select="$layout-name"/>"),
|
||||
Rescue("<xsl:value-of select="$rescue-name"/>"),
|
||||
ControllerDetails("<xsl:value-of select="@name"/>",
|
||||
Area = "<xsl:value-of select="$area-name"/>")]
|
||||
public partial class <xsl:value-of select="@name"/>Controller : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> {
|
||||
[
|
||||
Layout("<xsl:value-of select="$layout-name"/>"),
|
||||
Rescue("<xsl:value-of select="$rescue-name"/>"),
|
||||
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
|
||||
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')"/>Controller : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> {
|
||||
|
||||
<xsl:if test="adl:form">
|
||||
/* The SmartFormHelper stuff in generated controller classes does not yet work. There is some
|
||||
* hope that in future it will offer definite benefits and in the mean time it is doing no harm.
|
||||
* However if you are looking for bugs look elsewhere - this is not currently used */
|
||||
protected class <xsl:value-of select="concat( @name, 'FieldHelper')"/> : SmartFormHelper {
|
||||
public <xsl:value-of select="concat( @name, 'FieldHelper')"/>() {
|
||||
<xsl:for-each select="descendant::adl:property[@type='entity']">
|
||||
<xsl:variable name="entityname" select="@entity"/>
|
||||
<xsl:variable name="entity" select="//adl:entity[@name=$entityname]"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$entity/@foreign='true'">
|
||||
/* Entity <xsl:value-of select="$entityname"/> is foreign..? */
|
||||
<xsl:variable name="foreignkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
|
||||
Register<<xsl:value-of select="concat( $entityns, '.', $entityname)"/>>( "",
|
||||
new TypeMenuControl<<xsl:value-of select="concat( $entityns, '.', $entityname)"/>>( "<xsl:value-of select="$foreignkey"/>","<xsl:value-of select="$foreignkey"/>"));
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
Register<<xsl:value-of select="concat( $entityns, '.', $entityname)"/>>( "", EntityMenuControl<<xsl:value-of select="concat( $entityns, '.', $entityname)"/>>.Instance);
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
}
|
||||
}
|
||||
|
||||
<xsl:if test="adl:form">
|
||||
<!-- unless there's at least one form, we won't generate a 'store' method -->
|
||||
/// <summary>
|
||||
/// Store the record represented by the parameters passed in an HTTP service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue