rework of result navigation support: sprnet-1040, sprnet-1052, sprnet-958, sprnet-567

added navigation demo to WebQuickStart
This commit is contained in:
eeichinger
2008-10-12 12:40:54 +00:00
parent 71331f7bb4
commit 99b8a6f9eb
41 changed files with 1869 additions and 384 deletions

View File

@@ -19,7 +19,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Spring.WebQuickStart.2005",
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "81"
VWDPort = "4724"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject

View File

@@ -68,6 +68,10 @@
compose advanced validation rules that leverage validation groups, conditional validation,
validator composition, as well as how to create and use your custom validators.
</p>
<h3><a href="Navigation/Default.aspx">Navigation Flow</a></h3>
<p>
Demoes configurable navigation flow capabilities.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,32 @@
<%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Navigation_Default" %>
<%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %>
<asp:Content runat="server" ContentPlaceHolderId="content">
<p>
Just like in the previous example, you should put a breakpoint
on the Debug.Write(Employee) statement in the event handler for the Save button,
so you can see how Employee object was populated by the framework.
</p>
<spring:DataBindingPanel runat="server">
<table cellpadding="3" cellspacing="3" border="0">
<spring:Panel VisibleIf="Context.Request['fromInvalidInput'] != null" runat="server">
<tr>
<td></td>
<td>
You need to enter a value greater than 21 to pass.
</td>
</tr>
</spring:Panel>
<tr>
<td>Your age:</td>
<td>
<asp:TextBox ID="txtAge" runat="server" BindingTarget="Age" />
</td>
</tr>
<tr>
<td><asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" /></td>
<td><asp:Button ID="btnContinue" runat="server" Text="Continue" OnClick="btnContinue_Click" /></td>
</tr>
</table>
</spring:DataBindingPanel>
</asp:Content>

View File

@@ -0,0 +1,38 @@
using System;
/// <summary>
/// Notice that your web page has to extend Spring.Web.UI.Page class
/// in order to enable data binding and many other features.
/// </summary>
public partial class Navigation_Default : Spring.Web.UI.Page
{
public int Age;
protected override void FrameworkInitialize()
{
this.MasterPageFile = "Master.master";
base.FrameworkInitialize();
}
protected void Page_Load( object sender, EventArgs e )
{ }
protected void btnContinue_Click( object sender, EventArgs e )
{
if (Age > 21)
{
SetResult( "ok" );
}
else
{
Args["input"] = txtAge.Text;
SetResult( "invalid_input" );
}
}
protected void btnReset_Click( object sender, EventArgs e )
{
SetResult( "start" );
}
}

View File

@@ -0,0 +1,22 @@
<%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="InvalidInput.aspx.cs" Inherits="Navigation_InvalidInput" %>
<%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %>
<asp:Content runat="server" contentPlaceHolderId="content">
<p>
The value you entered is invalid
</p>
<spring:DataBindingPanel runat="server">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Age you entered:</td>
<td>
<asp:Label ID="lblInput" runat="server" EnableViewState="false" BindingSource="Text" BindingTarget="Context.Items['input']" BindingDirection="TargetToSource" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><asp:Button ID="btnBack" runat="server" Text="Back" OnClick="btnBack_Click" /></td>
</tr>
</table>
</spring:DataBindingPanel>
</asp:Content>

View File

@@ -0,0 +1,21 @@
using System;
using System.Diagnostics;
/// <summary>
/// Notice that your web page has to extend Spring.Web.UI.Page class
/// in order to enable data binding and many other features.
/// </summary>
public partial class Navigation_InvalidInput : Spring.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string input = (string) this.Context.Items["input"];
}
protected void btnBack_Click(object sender, EventArgs e)
{
SetResult("start");
}
}

View File

@@ -0,0 +1,21 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Master.master.cs" Inherits="Navigation_Master" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Prefix!</title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<h2><a href="../Default.aspx">Welcome to Spring.NET Web Framework Quick Start Guide</a></h2>
<form id="form1" runat="server">
<div>
<h2>Navigation example</h2>
<asp:ContentPlaceHolder id="content" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Navigation_Master : Spring.Web.UI.MasterPage
{
protected void Page_Load( object sender, EventArgs e )
{
}
}

View File

@@ -0,0 +1,21 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ok.aspx.cs" Inherits="Navigation_Ok" %>
<asp:Content runat="server" contentPlaceHolderId="content">
<p>
Passcode you entered was ok
</p>
<spring:DataBindingPanel runat="server">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>The passcode is correct:</td>
<td>
<asp:Label ID="lblInput" runat="server" BindingSource="Text" BindingTarget="Request['age']" BindingDirection="TargetToSource" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><asp:Button ID="btnRestart" runat="server" Text="Back" OnClick="btnRestart_Click" /></td>
</tr>
</table>
</spring:DataBindingPanel>
</asp:Content>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Navigation_Ok : Spring.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e )
{
}
protected void btnRestart_Click(object sender, EventArgs e)
{
SetResult("start");
}
}

View File

@@ -0,0 +1,59 @@
<?xml version="1.0"?>
<configuration>
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object type="Master.master">
<property name="Results">
<dictionary>
<entry key="start" value="redirect:Default.aspx" />
</dictionary>
</property>
</object>
<object name="standardPage" abstract="true">
<property name="MasterPageFile" value="Master.master" />
</object>
<!-- use the filename of your Page for the 'type' attribute to configure DI for a Page -->
<object type="Default.aspx" parent="standardPage">
<property name="Title" value="Navigation Flow Sample - Start Page"/>
<property name="Results">
<dictionary>
<entry key="ok" value="redirect:Ok.aspx?age=%{Age}" />
<entry key="invalid_input" value="transfer:InvalidInput.aspx?input=%{Args['input']}" />
</dictionary>
</property>
</object>
<object type="InvalidInput.aspx" parent="standardPage">
<property name="Title" value="Navigation Flow Sample - Invalid Input Page"/>
<property name="Results">
<dictionary>
<!-- altough Master.master defines a 'start' result, you can always override it -->
<entry key="start" value="redirect:Default.aspx?fromInvalidInput=true" />
</dictionary>
</property>
</object>
<!--
Ok.aspx doesn't have an explicit results. Instead it relies on "bubbling" results up the hierarchy,
in our case up to Master.master (see above)
-->
<object type="Ok.aspx" parent="standardPage">
<property name="Title" value="Navigation Flow Sample - Done"/>
<property name="Results">
<dictionary>
</dictionary>
</property>
</object>
</objects>
</spring>
<system.web>
</system.web>
</configuration>