[Fat-develop] FAT/src/FAT.Web Controls.cs,NONE,1.1 IControls.cs,NONE,1.1 TestFixtureHelpLinkControl.
Brought to you by:
exortech
|
From: <dmc...@us...> - 2004-03-14 11:03:54
|
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31168/src/FAT.Web Modified Files: Default.aspx Default.aspx.cs DefaultPageModel.cs FAT.Web.csproj FixtureSpecifierControl.cs IPage.cs Page.cs TestFixtureHelpControl.cs Added Files: Controls.cs IControls.cs TestFixtureHelpLinkControl.cs Log Message: Refactored test fixture help image link out of Default.aspx in to the new TestFixtrureHelpLinkControl. --- NEW FILE: Controls.cs --- using System; using System.Web.UI; namespace FAT.Web { public class Controls : IControls { private ControlCollection controlCollection; public Controls(ControlCollection controlCollection) { this.controlCollection = controlCollection; } public void Add(Control control) { controlCollection.Add(control); } } } --- NEW FILE: IControls.cs --- using System; using System.Web.UI; namespace FAT.Web { public interface IControls { void Add(Control control); } } --- NEW FILE: TestFixtureHelpLinkControl.cs --- using System; using System.Web.UI; using System.Web.UI.WebControls; namespace FAT.Web { public class TestFixtureHelpLinkControl : Control { private HyperLink helpLink; private string fixturesDropDownListID; public TestFixtureHelpLinkControl(string fixturesDropDownListID) { this.fixturesDropDownListID = fixturesDropDownListID; } protected HyperLink HelpLink { get { EnsureChildControls(); return helpLink; } } protected override void CreateChildControls() { helpLink = new HyperLink(); helpLink.Attributes["OnClick"] = "openTestFixtureHelpWindow()"; HelpLink.ImageUrl = "images/QuestionMark.jpg"; Controls.Add(helpLink); Page.RegisterClientSideScriptBlock("TestFixtureHelpLinkJavaScript", GetJavascript()); } private string GetJavascript() { return @" <script> function openTestFixtureHelpWindow() { window.open(" + GetTestFixtureHelpWindowURLJavascript() + @", 'Bob', 'width=400,height=400,resizable=yes,location=no'); } function getSelectedFixture() { return " + GetFixturesDropDownListJavascript() + @".options[" + GetFixturesDropDownListJavascript() + @".selectedIndex].text; } </script>"; } private string GetTestFixtureHelpWindowURLJavascript() { return "'" + typeof(TestFixtureHelp).Name + ".aspx?" + TestFixtureHelpControl.FIXTURE_PARAMETER_NAME + "=' + getSelectedFixture()"; } private const string formName = "CreateTest"; // where to get this name dependency from? private string GetFixturesDropDownListJavascript() { return "document." + formName + "." + fixturesDropDownListID; } protected new virtual IPage Page { get {return new Page(base.Page);} } protected new virtual IControls Controls { get {return new Controls(base.Controls);} } } } Index: Default.aspx =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Default.aspx 6 Mar 2004 13:40:17 -0000 1.7 --- Default.aspx 14 Mar 2004 10:54:53 -0000 1.8 *************** *** 6,18 **** <title>FAT Functional Acceptance Testing Framework</title> <link media="screen" href="FAT.css" type="text/css" rel="stylesheet"> - <script> - function openTestfixtureHelpWindow() { - window.open('TestFixtureHelp.aspx' + '?fixture=' + getSelectedFixture(), 'Bob', 'width=400,height=400,resizable=yes,location=no'); - } - - function getSelectedFixture() { - return document.CreateTest.fixture_implementedFixturesDropDownList.options[document.CreateTest.fixture_implementedFixturesDropDownList.selectedIndex].text; - } - </script> </HEAD> <body> --- 6,9 ---- *************** *** 31,46 **** </tr> <tr> ! <td> ! <table cellpadding="0" cellspacing="0"> ! <tr> ! <td><asp:Label id="fixtureLabel" Runat="server">Fixture: </asp:Label></td> ! <td> ! <asp:HyperLink OnClick="openTestfixtureHelpWindow()" runat="server" id="HyperLink1"> ! <asp:Image ImageAlign="Right" ImageUrl="images/QuestionMark.jpg" runat="server" /> ! </asp:HyperLink> ! </td> ! </tr> ! </table> ! </td> <td><FAT:FixtureSpecifierControl runat="server" id="fixture" /></td> <td><asp:Label id="fixtureWarning" Runat="server">*</asp:Label></td> --- 22,26 ---- </tr> <tr> ! <td><asp:Label id="fixtureLabel" Runat="server">Fixture: </asp:Label></td> <td><FAT:FixtureSpecifierControl runat="server" id="fixture" /></td> <td><asp:Label id="fixtureWarning" Runat="server">*</asp:Label></td> Index: Default.aspx.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Default.aspx.cs 6 Mar 2004 13:40:17 -0000 1.7 --- Default.aspx.cs 14 Mar 2004 10:54:54 -0000 1.8 *************** *** 25,29 **** protected PlaceHolder results; protected ImageButton fixtureHelpImageButton; - protected System.Web.UI.WebControls.HyperLink HyperLink1; private DefaultPageModel model = new DefaultPageModel(); --- 25,28 ---- Index: DefaultPageModel.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/DefaultPageModel.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DefaultPageModel.cs 29 Feb 2004 14:59:52 -0000 1.8 --- DefaultPageModel.cs 14 Mar 2004 10:54:54 -0000 1.9 *************** *** 95,99 **** { TableCell cell = new TableCell(); - HyperLink image = new HyperLink(); image.NavigateUrl = htmlWithAbsoluteUrlsUrl; --- 95,98 ---- Index: FAT.Web.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/FAT.Web.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FAT.Web.csproj 6 Mar 2004 13:40:17 -0000 1.8 --- FAT.Web.csproj 14 Mar 2004 10:54:54 -0000 1.9 *************** *** 98,101 **** --- 98,106 ---- /> <File + RelPath = "Controls.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Default.aspx" SubType = "Form" *************** *** 148,151 **** --- 153,161 ---- /> <File + RelPath = "IControls.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "IPage.cs" SubType = "Code" *************** *** 189,192 **** --- 199,207 ---- /> <File + RelPath = "TestFixtureHelpLinkControl.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TestTreeView.cs" SubType = "Code" Index: FixtureSpecifierControl.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/FixtureSpecifierControl.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FixtureSpecifierControl.cs 29 Feb 2004 19:03:38 -0000 1.2 --- FixtureSpecifierControl.cs 14 Mar 2004 10:54:54 -0000 1.3 *************** *** 33,36 **** --- 33,38 ---- } + private const string implementedFixturesDropDownListID = "implementedFixturesDropDownList"; + protected override void CreateChildControls() { *************** *** 42,47 **** AddLabelToRow(row, "Existing Fixture: "); implementedFixturesDropDownList = new DropDownList(); ! implementedFixturesDropDownList.ID = "implementedFixturesDropDownList"; row.Cells.Add(CreateTableCell(implementedFixturesDropDownList)); --- 44,53 ---- AddLabelToRow(row, "Existing Fixture: "); + row.Cells.Add(CreateTableCell(new TestFixtureHelpLinkControl(UniqueID + "_" + implementedFixturesDropDownListID))); + + AddLabelToRow(row, " "); + implementedFixturesDropDownList = new DropDownList(); ! implementedFixturesDropDownList.ID = implementedFixturesDropDownListID; row.Cells.Add(CreateTableCell(implementedFixturesDropDownList)); Index: IPage.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/IPage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IPage.cs 6 Mar 2004 13:40:17 -0000 1.2 --- IPage.cs 14 Mar 2004 10:54:54 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- bool IsPostBack {get;} IRequest Request {get;} + void RegisterClientSideScriptBlock(string key, string script); } } Index: Page.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Page.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Page.cs 6 Mar 2004 13:40:17 -0000 1.2 --- Page.cs 14 Mar 2004 10:54:54 -0000 1.3 *************** *** 13,16 **** --- 13,18 ---- public bool IsPostBack {get {return page.IsPostBack;}} public IRequest Request {get {return new Request(page.Request); }} + public void RegisterClientSideScriptBlock(string key, string script) {page.RegisterClientScriptBlock(key, script);} + //public string Form { get {return page.Form;} } } } Index: TestFixtureHelpControl.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/TestFixtureHelpControl.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestFixtureHelpControl.cs 6 Mar 2004 13:40:17 -0000 1.1 --- TestFixtureHelpControl.cs 14 Mar 2004 10:54:54 -0000 1.2 *************** *** 8,11 **** --- 8,13 ---- public class TestFixtureHelpControl : Control { + public const string FIXTURE_PARAMETER_NAME = "fixture"; + private ITestFixtureLoader loader; private ITestFixtureHtmlFormatter formatter; *************** *** 24,28 **** protected override void CreateChildControls() { ! string fixture = (string)Page.Request["fixture"]; Type type = loader.GetType(fixture); help = formatter.Format(type, fixture); --- 26,30 ---- protected override void CreateChildControls() { ! string fixture = (string)Page.Request[FIXTURE_PARAMETER_NAME]; Type type = loader.GetType(fixture); help = formatter.Format(type, fixture); |