Re: [Standalone Tiles] Tiles Refactoring Part 2
Joe Germuska wrote: > Thanks for speaking up! That said, the code we're talking about is in a different package (org.apache.tiles rather than org.apache.struts.tiles) so your project could maintain its dependency on the original Struts Tiles code and make a reasoned decision about how and when to change to depend on "standalone tiles." It is exactly what I am going to do, one day... In fact Dimensions uses only Tiles plugin, not Struts. > > That said, you also probably have some good insight into the issues involved in understanding the Tiles code -- perhaps you have some constructive suggestions (or even coding time) to contribute towards improving Standalone Tiles? At the moment only one suggestion (it does not involve refactoring though) but I will put it inside another thread. Sorry for not having coding time :-( but here at my work are investigating the use of standalone Tiles for our purposes. I'll let you know... Ciao Antonio Petrelli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Tiles] Resolving inheritances improvements
Hi list! As I promised here is my suggestion... In Dimensions I had to use a workaround for a missing feature. In order to resolve inheritances and overriding definitions between multiple definition files, i need to follow these steps: 1) Find the "leaf" definition file; 2) build the path from this leaf to the root; 3) current file = root file, complete definitions = empty; 4) load current file into definitions; 5) override current file definitions into the complete definitions (via the "extend" method 6) current file = next file in the path; 7) return to point 4 until end. 8) Resolve inheritances. As you can see I need to follow the path twice (from the leaf to the root and then from the root to the leaf). If you could put a method that add all the missing definitions (i.e. add all definitions that are not already present in a definitions set). This way I can follow the path only once (from leaf to root), eventually reusing already loaded definitions files. 1) Find the "leaf" definition file; 2) If it is already loaded, finish. 3) Create an empty definitions set; 4) put all missing definitions loaded into the definitions set; 5) find the parent definition file; 6) if it is already loaded, put all missing definitions (by cloning them) in the definitions set and go to 9; 7) if it is the root file, go to 9; 8) go to step 5; 9) resolve inheritances. As you can see, there will be a big caching of already loaded definitions files, only by adding two methods (addMissingDefinitions in XmlDefinitionsSet and "clone" in XmlDefinition). What do you think about it? Ciao Antonio Petrelli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Resolving inheritances improvements
Whooops a missing step! > >1) Find the "leaf" definition file; >2) If it is already loaded, finish. >3) Create an empty definitions set; >4) put all missing definitions loaded into the definitions set; >5) find the parent definition file; >6) if it is already loaded, put all missing definitions (by cloning them) >in the definitions set and go to 9; >7) if it is the root file, go to 9; 7.5) load the definitions file and put all missing definitions in the definitions set. >8) go to step 5; >9) resolve inheritances. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Resolving inheritances improvements
On Oct 7, 2005, at 4:00 AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: 1) Find the "leaf" definition file; 2) If it is already loaded, finish. 3) Create an empty definitions set; 4) put all missing definitions loaded into the definitions set; 5) find the parent definition file; 6) if it is already loaded, put all missing definitions (by cloning them) in the definitions set and go to 9; 7) if it is the root file, go to 9; 8) go to step 5; 9) resolve inheritances. As you can see, there will be a big caching of already loaded definitions files, only by adding two methods (addMissingDefinitions in XmlDefinitionsSet and "clone" in XmlDefinition). What do you think about it? If I understand you correctly Standalone Tiles may be doing that now by default. I'll have to take another look at it (maybe add another test case). Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Standalone Tiles] Tiles Refactoring Part 2
On Oct 6, 2005, at 3:20 PM, Cedric Dumoulin wrote: But be care, there is some not so often used API that are used by some companies. I hope these APIs will remain. I think of : - the possibility to provide another implementation for tiles factory (use of a DB ...) - the i18n mechanism to load alternative definition files - ... (I need to dig into the code to remember :-) ) Yes, I consider these core features and will not remove them. However some of the APIs have changed a bit. For example DefinitionsFactory was both a "factory" and a "container". I split those two concerns into separate components, DefinitionsFactory and ComponentDefinitions, respectively. I keep an eye on the struts dev list, and I try to follow all threads about Tiles. So, feel free to ask me more specific questions if you need, either on the list or directly. Very good. I'm glad you're still around. I may need your expertise along the way :-) Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r307214 - in /struts/sandbox/trunk/overdrive/Nexus: Core/Tables/ Extras/ Extras/Spring/ Test/bin/Debug/ Web/
Author: husted Date: Fri Oct 7 16:03:16 2005 New Revision: 307214 URL: http://svn.apache.org/viewcvs?rev=307214&view=rev Log: OVR-12 OVR-21 * Add FieldContext factory method, so that Tables can add a "lazy" context entry when strict is false. * Loosen protection on list_criteria so a composite control can access. * Add InitView method to ViewControl so that composite controls can wire contained controls. Added: struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/FieldTable.cs Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Core.dll struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Core.pdb struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Core.xml struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Extras.dll struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Extras.pdb struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Extras.xml struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Test.dll struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/Nexus.Test.pdb struts/sandbox/trunk/overdrive/Nexus/Web/FindControl.ascx.cs struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs?rev=307214&r1=307213&r2=307214&view=diff == --- struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs Fri Oct 7 16:03:16 2005 @@ -33,6 +33,13 @@ set { _Strict = value; } } + public virtual IFieldContext NewFieldContext(string id) + { + IFieldContext field = new FieldContext(); + field.ID = id; + return field; + } + public virtual IFieldContext AddFieldContext { set @@ -58,9 +65,19 @@ { if (id == null) throw new ArgumentNullException("id==null", "Nexus.Core.Tables.FieldTable.GetFieldContext"); IFieldContext fieldContext = Field[id] as IFieldContext; - bool problem = ((fieldContext == null) && (Strict)); - if (problem) - throw new ArgumentNullException(id, "Nexus.Core.Tables.FieldTable.GetFieldContext"); + bool missing = (fieldContext == null); + if (missing) + if (Strict) + throw new ArgumentNullException(id, "Nexus.Core.Tables.FieldTable.GetFieldContext"); + else + { + System.Object lockThis = new System.Object(); + lock(lockThis) + { + fieldContext = NewFieldContext(id); + AddFieldContext = fieldContext; + } + } return fieldContext; } Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs?rev=307214&r1=307213&r2=307214&view=diff == --- struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs Fri Oct 7 16:03:16 2005 @@ -19,6 +19,17 @@ bool Strict { set; get; } /// + /// Factory method to create a stub context + /// when field is required and Strict is false. + /// + /// + /// The IFieldContext instance should provide a default for Required. + /// + /// The fieldname + /// New default context for ID + IFieldContext NewFieldContext(string id); + + /// /// Add a field to the set. /// /// Modified: struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj?rev=307214&r1=307213&r2=307214&view=diff ==
svn commit: r307229 - in /struts/sandbox/trunk/overdrive/PhoneBook: Test/Forms/DirectoryTest.cs Test/Test.csproj Web/Controls/Finder.ascx.cs Web/Controls/Lister.ascx.cs Web/Forms/Directory.aspx.cs Web
Author: husted Date: Fri Oct 7 17:46:17 2005 New Revision: 307229 URL: http://svn.apache.org/viewcvs?rev=307229&view=rev Log: OVR-5 * Update for NUnitAsp 1.5.1 * Adjust namespace references Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx 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=307229&r1=307228&r2=307229&view=diff == --- struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs Fri Oct 7 17:46:17 2005 @@ -88,15 +88,15 @@ [Test] public void FindControls() { - WebAssert.Visible(pnlFind); + AssertVisibility(pnlFind,true); foreach (DropDownListTester list in GetLists()) { - WebAssert.Visible(list); + AssertVisibility(list,true); } - WebAssert.Visible(cmdListAll); - WebAssert.Visible(pnlList); - WebAssert.Visible(repList); - WebAssert.NotVisible(cmdAdd); // Visible if Editor + AssertVisibility(cmdListAll,true); + AssertVisibility(pnlList,true); + AssertVisibility(repList,true); + AssertVisibility(cmdAdd,true); // Visible if Editor } /// @@ -108,7 +108,8 @@ { foreach (DropDownListTester list in GetLists()) { - Assert.IsTrue(list.Items.Count > 0, list.HtmlId + ": Expected all filter lists to have items."); + bool ok = (list.Items.Count > 0); + AssertEquals(list.HtmlId + ": Expected all filter lists to have items",true,ok); } } Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj?rev=307229&r1=307228&r2=307229&view=diff == --- struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj Fri Oct 7 17:46:17 2005 @@ -91,11 +91,6 @@ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> -http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs?rev=307229&r1=307228&r2=307229&view=diff == --- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs Fri Oct 7 17:46:17 2005 @@ -1,7 +1,7 @@ using System; using System.Web.UI.WebControls; using Nexus.Core.Helpers; -using Nexus.Web.Controls; +using Nexus.Web; using PhoneBook.Core; using PhoneBook.Web.Forms; Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs?rev=307229&r1=307228&r2=307229&view=diff == --- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs Fri Oct 7 17:46:17 2005 @@ -2,7 +2,7 @@ using System.Collections; using System.Web.UI.WebControls; using Nexus.Core.Helpers; -using Nexus.Web.Controls; +using Nexus.Web; using PhoneBook.Core; namespace PhoneBook.Web.Controls 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=307229&r1=307228&r2=307229&view=diff == --- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Fri Oct 7 17:46:17 2005 @@ -3,7 +3,7 @@ using System.Web.UI.WebContr