[Springnet-commits] Spring.Net/doc/reference/src web.xml, 1.26, 1.27
Brought to you by:
aseovic,
markpollack
From: Erich E. <oak...@us...> - 2007-12-06 08:53:41
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28001 Modified Files: web.xml Log Message: added databindingpanel doc Index: web.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/web.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** web.xml 15 Nov 2007 20:25:11 -0000 1.26 --- web.xml 6 Dec 2007 08:53:35 -0000 1.27 *************** *** 118,122 **** uses many best practices for Spring.NET web applications, so please do refer to it as you are reading this (reference) material (see <xref ! linkend="springair" />).</para> </sect1> --- 118,122 ---- uses many best practices for Spring.NET web applications, so please do refer to it as you are reading this (reference) material (see <xref ! linkend="springair"/>).</para> </sect1> *************** *** 204,213 **** <resource uri="~/Config/Test/Dao.xml"/> --> ! <!-- PRODUCTION CONFIGURATION --> <resource uri="~/Config/Production/Services.xml"/> <resource uri="~/Config/Production/Dao.xml"/> ! </context> </spring> --- 204,213 ---- <resource uri="~/Config/Test/Dao.xml"/> --> ! <!-- PRODUCTION CONFIGURATION --> <resource uri="~/Config/Production/Services.xml"/> <resource uri="~/Config/Production/Dao.xml"/> ! </context> </spring> *************** *** 337,341 **** </sectionGroup> </configSections> ! <spring> <context type="Spring.Context.Support.WebApplicationContext, Spring.Web"> --- 337,341 ---- </sectionGroup> </configSections> ! <spring> <context type="Spring.Context.Support.WebApplicationContext, Spring.Web"> *************** *** 349,353 **** <property name="Results"> <!-- ... --> ! </property> </object> <object id="myServiceDefinedLocally" type="MyCompany.MyProject.Services.MyServiceImpl, MyAssembly"/> --- 349,353 ---- <property name="Results"> <!-- ... --> ! </property> </object> <object id="myServiceDefinedLocally" type="MyCompany.MyProject.Services.MyServiceImpl, MyAssembly"/> *************** *** 416,420 **** <property name="Authenticator" ref="authenticationService"/> </object> ! <object type="Default.aspx" parent="basePage"/> --- 416,420 ---- <property name="Authenticator" ref="authenticationService"/> </object> ! <object type="Default.aspx" parent="basePage"/> *************** *** 625,628 **** --- 625,660 ---- configuration specific to your implementation.</para> </sect2> + + <sect2> + <title>Customizing control dependency injection</title> + + <para>There might be situations where it is necessary to customize + Spring.Web's dependency injection processing. In particular when using + GridViews, which create a large number of child controls, dependency + injection can slow down your page. To overcome this problem, you may + tell Spring to handle the dependency injection process yourself by + implementing the interface ISupportsWebDependencyInjection as shown + below:</para> + + <programlisting>[C#] + class MyControl : Control, ISupportsWebDependencyInjection + { + private IApplicationContext _defaultApplicationContext; + + public IApplicationContext DefaultApplicationContext + { + get { return _defaultApplicationContext; } + set { _defaultApplicationContext = value; } + } + + override protected AddedControl( Control control, int index ) + { + // handle DI for children ourselves - + // defaults to a call to InjectDependenciesRecursive + WebUtils.InjectDependenciesRecursive( _defaultApplicationContext, control ); + base.AddedControl( control, index ); + } + }</programlisting> + </sect2> </sect1> *************** *** 725,733 **** <body> ! <spring:Content id="leftSidebarContent" contentPlaceholderId="leftSidebar" runat="server"> <!-- left sidebar content --> </spring:Content> ! ! <spring:Content id="mainContent" contentPlaceholderId="main" runat="server"> <!-- main area content --> </spring:Content> --- 757,765 ---- <body> ! <spring:Content id="leftSidebarContent" contentPlaceholderId="leftSidebar" runat="server"> <!-- left sidebar content --> </spring:Content> ! ! <spring:Content id="mainContent" contentPlaceholderId="main" runat="server"> <!-- main area content --> </spring:Content> *************** *** 775,779 **** <property name="MasterPageFile" value="~/MasterLayout.ascx"/> </object> ! <object type="Child.aspx" parent="basePage"> <!-- inject other objects that page needs --> --- 807,811 ---- <property name="MasterPageFile" value="~/MasterLayout.ascx"/> </object> ! <object type="Child.aspx" parent="basePage"> <!-- inject other objects that page needs --> *************** *** 966,970 **** [Serializable] ! public enum TripMode { OneWay, --- 998,1002 ---- [Serializable] ! public enum TripMode { OneWay, *************** *** 982,986 **** together:<programlisting>public class TripForm : Spring.Web.UI.Page { ! // model private Trip trip; public Trip Trip --- 1014,1018 ---- together:<programlisting>public class TripForm : Spring.Web.UI.Page { ! // model private Trip trip; public Trip Trip *************** *** 1016,1020 **** } ! // data binding rules protected override void InitializeDataBindings() { --- 1048,1052 ---- } ! // data binding rules protected override void InitializeDataBindings() { *************** *** 1026,1030 **** } ! // event handler for findFlights button, uses injected 'bookingAgent' // service and model 'trip' object to find flights private void SearchForFlights(object sender, EventArgs e) --- 1058,1062 ---- } ! // event handler for findFlights button, uses injected 'bookingAgent' // service and model 'trip' object to find flights private void SearchForFlights(object sender, EventArgs e) *************** *** 1130,1137 **** void BindSourceToTarget(object source, object target, ValidationErrors validationErrors); void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables); ! void BindTargetToSource(object source, object target, ValidationErrors validationErrors); void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables); ! void SetErrorMessage(string messageId, params string[] errorProviders); }</programlisting>As their names imply, <literal>BindSourceToTarget</literal> --- 1162,1169 ---- void BindSourceToTarget(object source, object target, ValidationErrors validationErrors); void BindSourceToTarget(object source, object target, ValidationErrors validationErrors, IDictionary variables); ! void BindTargetToSource(object source, object target, ValidationErrors validationErrors); void BindTargetToSource(object source, object target, ValidationErrors validationErrors, IDictionary variables); ! void SetErrorMessage(string messageId, params string[] errorProviders); }</programlisting>As their names imply, <literal>BindSourceToTarget</literal> *************** *** 1245,1254 **** [Serializable] ! public class Airport { // fields private string code; private string name; ! // properties public string Code --- 1277,1286 ---- [Serializable] ! public class Airport { // fields private string code; private string name; ! // properties public string Code *************** *** 1301,1305 **** BindingManager.AddBinding("@(airportDao).GetAirport(leavingFromAirportCode.SelectedValue)", "Trip.StartingFrom.Airport", BindingDirection.SourceToTarget); BindingManager.AddBinding("leavingFromAirportCode.SelectedValue", "Trip.StartingFrom.Airport.Code", BindingDirection.TargetToSource); ! BindingManager.AddBinding("@(airportDao).GetAirport(goingToAirportCode.SelectedValue)", "Trip.ReturningFrom.Airport", BindingDirection.SourceToTarget); BindingManager.AddBinding("goingToAirportCode.SelectedValue", "Trip.ReturningFrom.Airport.Code", BindingDirection.TargetToSource); --- 1333,1337 ---- BindingManager.AddBinding("@(airportDao).GetAirport(leavingFromAirportCode.SelectedValue)", "Trip.StartingFrom.Airport", BindingDirection.SourceToTarget); BindingManager.AddBinding("leavingFromAirportCode.SelectedValue", "Trip.StartingFrom.Airport.Code", BindingDirection.TargetToSource); ! BindingManager.AddBinding("@(airportDao).GetAirport(goingToAirportCode.SelectedValue)", "Trip.ReturningFrom.Airport", BindingDirection.SourceToTarget); BindingManager.AddBinding("goingToAirportCode.SelectedValue", "Trip.ReturningFrom.Airport.Code", BindingDirection.TargetToSource); *************** *** 1382,1385 **** --- 1414,1500 ---- </sect3> </sect2> + + <sect2> + <title>Using DataBindingPanel</title> + + <para>To simplify use of Spring's Data Binding feature on web pages and + controls, Spring.Web provides a special DataBindingPanel container + control. A DataBindingPanel does not render any html code itself, but + allows for specifiying additional, data binding related attributes to + its child controls:</para> + + <para><programlisting><%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="DataBinding_EasyEmployeeInfo_Default" %> + <%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> + <html> + <body> + <spring:DataBindingPanel ID="ctlDataBindingPanel" runat="server"> + <table cellpadding="3" cellspacing="3" border="0"> + <tr> + <td>Employee ID:</td> + <td> + <asp:TextBox ID="txtId" runat="server" BindingTarget="Employee.Id" /> + </td> + </tr> + <tr> + <td>First Name:</td> + <td><asp:TextBox ID="txtFirstName" runat="server" BindingTarget="Employee.FirstName" /></td> + </tr> + </table> + </spring.DataBindingPanel> + </body> + </html></programlisting></para> + + <para>Using DataBindingPanel the binding information can be specified + directly on the control declaration. The following attributes are + recognized by a DataBindingPanel:</para> + + <itemizedlist> + <listitem> + <para>BindingTarget</para> + + <para>corresponds to the target expression used in + IBindingContainer.AddBinding()</para> + </listitem> + + <listitem> + <para>BindingSource</para> + + <para>corresponds to the source expression used in + IBindingContainer.AddBinding(). For standard controls you don't need + to specify the source expression. If you are binding to some custom + control, of course you must specifiy this attribute.</para> + </listitem> + + <listitem> + <para>BindingDirection</para> + + <para>one of the values of the BindingDirection enumeration</para> + </listitem> + + <listitem> + <para>BindingFormatter</para> + + <para>if you need a custom formatter, you can specifiy the object + name of a formatter here. The formatter instance will be obtained by + a call to IApplicationContext.GetObject() each time it is + needed.</para> + </listitem> + + <listitem> + <para>BindingType</para> + + <para>In case you need a completely customized binding, specify its + type here. Note that a custom binding type must implement the + following constructor signature:</para> + + <para><literal>ctor(string source,string target, BindingDirection, + IFormatter)</literal></para> + </listitem> + </itemizedlist> + + <note> + The Visual Studio Web Form Editor will of course complain about binding attributes because it doesn't know them. You can safely ignore those warnings. + </note> + </sect2> </sect1> *************** *** 1427,1431 **** <programlisting><%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> ! <%@ Page language="c#" Codebehind="UserRegistration.aspx.cs" AutoEventWireup="false" Inherits="ArtFair.Web.UI.Forms.UserRegistration" %> <html> --- 1542,1546 ---- <programlisting><%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> ! <%@ Page language="c#" Codebehind="UserRegistration.aspx.cs" AutoEventWireup="false" Inherits="ArtFair.Web.UI.Forms.UserRegistration" %> <html> *************** *** 1647,1651 **** page. For example, think of the header columns for outgoing and return flights tables within the SpringAir application (see <xref ! linkend="springair" />).</para> <para>In these situations, one should use a pull-style mechanism for --- 1762,1766 ---- page. For example, think of the header columns for outgoing and return flights tables within the SpringAir application (see <xref ! linkend="springair"/>).</para> <para>In these situations, one should use a pull-style mechanism for *************** *** 1719,1723 **** <literal><spring:LocalizedImage></literal> as shown below.</para> ! <programlisting><%@ Page language="c#" Codebehind="StandardTemplate.aspx.cs" AutoEventWireup="false" Inherits="SpringAir.Web.StandardTemplate" %> <%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> --- 1834,1838 ---- <literal><spring:LocalizedImage></literal> as shown below.</para> ! <programlisting><%@ Page language="c#" Codebehind="StandardTemplate.aspx.cs" AutoEventWireup="false" Inherits="SpringAir.Web.StandardTemplate" %> <%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> *************** *** 1753,1757 **** <value>MyApp.Web.Resources.Strings, MyApp.Web</value> </list> ! </property> </object></programlisting> --- 1868,1872 ---- <value>MyApp.Web.Resources.Strings, MyApp.Web</value> </list> ! </property> </object></programlisting> *************** *** 1955,1959 **** <entry key="cancel" value-ref="loginPageResult"/> </dictionary> ! </property> </object> --- 2070,2074 ---- <entry key="cancel" value-ref="loginPageResult"/> </dictionary> ! </property> </object> *************** *** 2004,2008 **** <entry key="cancel" value-ref="homePageResult"/> </dictionary> ! </property> </object> </programlisting> --- 2119,2123 ---- <entry key="cancel" value-ref="homePageResult"/> </dictionary> ! </property> </object> </programlisting> *************** *** 2086,2090 **** is shown below.</para> ! <programlisting><%@ Page language="c#" Codebehind="StandardTemplate.aspx.cs" AutoEventWireup="false" Inherits="SpringAir.Web.StandardTemplate" %> <%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> --- 2201,2205 ---- is shown below.</para> ! <programlisting><%@ Page language="c#" Codebehind="StandardTemplate.aspx.cs" AutoEventWireup="false" Inherits="SpringAir.Web.StandardTemplate" %> <%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %> *************** *** 2158,2165 **** <description> Convenience base page definition for all the pages. ! Pages that reference this definition as their parent (see the examples below) will automatically inherit following properties.... ! </description> <property name="CssRoot" value="Web/CSS"/> --- 2273,2280 ---- <description> Convenience base page definition for all the pages. ! Pages that reference this definition as their parent (see the examples below) will automatically inherit following properties.... ! </description> <property name="CssRoot" value="Web/CSS"/> |