Author: husted Date: Mon Jun 20 13:40:58 2005 New Revision: 191556 URL: http://svn.apache.org/viewcvs?rev=191556&view=rev Log: OVR-5 * Update tests and prototype display to match client's notes.
Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs?rev=191556&r1=191555&r2=191556&view=diff ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs Mon Jun 20 13:40:58 2005 @@ -7,24 +7,43 @@ [TestFixture] public class DirectoryTest : WebFormTestCase { - - PanelTester pnlFind; - DropDownListTester lstSelect; - TextBoxTester txtFind; - ButtonTester cmdFind; - - PanelTester pnlList; - DataGridTester repList; - ButtonTester cmdAdd; + + PanelTester pnlFind; + DropDownListTester lstLastName; + DropDownListTester lstFirstName; + DropDownListTester lstExtension; + DropDownListTester lstUserName; + DropDownListTester lstHireDate; + DropDownListTester lstHours; + DropDownListTester lstEditor; + + ButtonTester cmdListAll; + ButtonTester cmdPrint; + + PanelTester pnlList; + DataGridTester repList; + ButtonTester cmdAdd; + + private DropDownListTester[] GetLists () + { + DropDownListTester[] lists = {lstLastName,lstFirstName,lstExtension,lstUserName,lstHireDate,lstHours,lstEditor}; + return lists; + } protected override void SetUp () { base.SetUp (); pnlFind = new PanelTester("pnlFind", CurrentWebForm); - lstSelect = new DropDownListTester("lstSelect", CurrentWebForm); - txtFind = new TextBoxTester("txtFind",CurrentWebForm); - cmdFind = new ButtonTester("cmdFind",CurrentWebForm); + lstLastName = new DropDownListTester("lstLastName",CurrentWebForm); + lstFirstName = new DropDownListTester("lstFirstName",CurrentWebForm); + lstExtension = new DropDownListTester("lstExtension",CurrentWebForm); + lstUserName = new DropDownListTester("lstUserName",CurrentWebForm); + lstHireDate = new DropDownListTester("lstHireDate",CurrentWebForm); + lstHours = new DropDownListTester("lstHours",CurrentWebForm); + lstEditor = new DropDownListTester("lstEditor",CurrentWebForm); + cmdListAll = new ButtonTester("cmdListAll",CurrentWebForm); + cmdPrint = new ButtonTester("cmdPrint",CurrentWebForm); pnlList = new PanelTester("pnlList",CurrentWebForm); repList = new DataGridTester("repList",CurrentWebForm); @@ -37,13 +56,15 @@ public void FindControls() { WebAssert.Visible(pnlFind); - WebAssert.Visible(lstSelect); - WebAssert.Visible(txtFind); - WebAssert.Visible(cmdFind); - + foreach (DropDownListTester list in GetLists()) + { + WebAssert.Visible (list); + } + WebAssert.Visible(cmdListAll); + WebAssert.Visible(cmdPrint); WebAssert.Visible(pnlList); WebAssert.Visible(repList); - WebAssert.Visible(cmdAdd); + WebAssert.NotVisible (cmdAdd);// Visible if Editor } } Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx?rev=191556&r1=191555&r2=191556&view=diff ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx Mon Jun 20 13:40:58 2005 @@ -1,4 +1,4 @@ -<%@ Page language="c#" Codebehind="Directory.aspx.cs" AutoEventWireup="false" Inherits="PhoneBook.Web.Forms.Directory" %> +<%@ Page language="c#" Codebehind="Directory.aspx.cs" AutoEventWireup="true" Inherits="PhoneBook.Web.Forms.Directory" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> @@ -14,14 +14,31 @@ <form id="frmDirectory" method="post" runat="server"> <!-- PROMPT --> - <p>To select entries, choose a filter or search for a Name or Extension.</p> + <p>Select a filter to display fewer entries.</p> <!-- FIND --> <asp:Panel ID="pnlFind" Runat="server"> <table><tr> - <td>Sort by: </td><td><asp:DropDownList ID="lstSelect"></asp:DropDownList> - <td>Search for:<asp:TextBox ID="txtFind" Runat="server"></asp:TextBox> <asp:Button ID="cmdFind" Runat="server"></asp:Button></td> - <td><asp:Button ID="cmdAdd" Runat="server"></asp:Button></td> + <td colspan="7" > + <asp:Button ID="cmdListAll" Runat="server"></asp:Button> + <asp:Button ID="cmdPrint" Runat="server"></asp:Button> + </td> + <tr> + <td>Last Name</td> + <td>First Name</td> + <td>Extension</td> + <td>User</td> + <td>Hire Date</td> + <td>Hours</td> + <td>Editor</td> + </tr><tr> + <td><asp:DropDownList ID="lstLastName" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstFirstName" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstExtension" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstUserName" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstHireDate" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstHours" Runat=server></asp:DropDownList></td> + <td><asp:DropDownList ID="lstEditor" Runat=server></asp:DropDownList></td> </tr></table> </asp:panel> @@ -41,6 +58,7 @@ <asp:BoundColumn DataField="hours" HeaderText="HOURS"></asp:BoundColumn> </Columns> </asp:DataGrid> + <p><asp:Button ID="cmdAdd" Runat="server"></asp:Button></p> </asp:Panel> </form> Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs?rev=191556&r1=191555&r2=191556&view=diff ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Mon Jun 20 13:40:58 2005 @@ -17,8 +17,9 @@ #region Messages - private const string msg_FIND_CMD = "FIND"; private const string msg_ADD_CMD = "ADD NEW"; + private const string msg_PRINT_CMD = "PRINT"; + private const string msg_LIST_ALL_CMD = "SHOW ALL"; #endregion @@ -36,35 +37,47 @@ #region Find protected Panel pnlFind; - protected DropDownList lstSelect; - protected TextBox txtFind; - protected Button cmdFind; + protected DropDownList lstLastName; + protected DropDownList lstFirstName; + protected DropDownList lstExtension; + protected DropDownList lstUserName; + protected DropDownList lstHireDate; + protected DropDownList lstHours; + protected DropDownList lstEditor; + protected Button cmdListAll; + protected Button cmdPrint; // pageload events - These methods populate controls to display - private void Find_Init () + private DropDownList[] GetLists () { - this.cmdFind.Click += new EventHandler (this.Find_Submit); - this.cmdFind.Text = msg_FIND_CMD; - this.cmdAdd.Click += new EventHandler (this.Add_Submit); - this.cmdAdd.Text = msg_ADD_CMD; + DropDownList[] lists = {lstLastName,lstFirstName,lstExtension,lstUserName,lstHireDate,lstHours,lstEditor}; + return lists; } - private void Find_Load () + private void Find_Init () { - pnlFind.Visible = true; + cmdListAll.Text = msg_LIST_ALL_CMD; + cmdPrint.Text = msg_PRINT_CMD; + + foreach (DropDownList filter in GetLists()) + { + filter.AutoPostBack = true; + } } + // postback events - These events respond to user input (to controls displayed by pageload methods) - protected void Find_Submit (object sender, EventArgs e) + protected void Find_Filter (object sender, EventArgs e) { + // TODO: See if filter changed. List_Load (); } #endregion - #region panel List + #region List protected Panel pnlList; protected DataGrid repList; @@ -74,7 +87,8 @@ private void List_Init () { - // Put user code to initialize the list here + this.cmdAdd.Text = msg_ADD_CMD; + this.cmdAdd.Visible = false; // TODO: True if user is editor } private void List_Load () @@ -102,55 +116,28 @@ protected void List_PageIndexChanged (object sender, DataGridPageChangedEventArgs e) { - Find_Submit(null,null); + Find_Filter(null,null); repList.CurrentPageIndex = e.NewPageIndex; repList.DataBind (); } - protected void Add_Submit (object sender, EventArgs e) - { - // TODO: ... - } - - #endregion - private void Page_Init() + protected void Page_Init() { Find_Init(); List_Init(); } - private void Page_Load(object sender, System.EventArgs e) + protected void Page_Load(object sender, System.EventArgs e) { - if (!IsPostBack) + if (IsPostBack) + { + Find_Filter(sender, e); + } { - Find_Load(); List_Load(); } } - - #region Web Form Designer generated code - override protected void OnInit(EventArgs e) - { - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - InitializeComponent(); - base.OnInit(e); - Page_Init(); - } - - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.Load += new System.EventHandler(this.Page_Load); - } - #endregion - } - } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]