Affects Version/s: None
Fix Version/s: None
Today I've send the e-mail below to dev-list. In this e-mail I've said that I'd provide a patch for this proposal. Please realy understand this as a proposal only. I more or less provide the patch because I promissed it.
Reasons for the proposed change and copied text from todays e-mail:
I think it would better to have Control.provideHtmlImports(Set imports) instead of Control.getHtmlImports(). Controls would add the HTML head strings to the given Set. The Set should be a LinkedHashSet so that the order of the additions is kept.
I think this would have some advantages:
1.) IMO this would be more efficient. Only one Set to create and iterate. Only one StringBuffer etc
2.) If you have a control which uses ie scriptaculous. The control will have to add the prototype.js and scriptaculous.js. Now
another control might have already added the prototype.js. With the Set as parameter the control could add both libraries
separetely. Currently it would have to add them in one string resulting in two imports.
3.) For whatever reason - if a control wants indeed force its string to be added even if an equal String is already in, it
could wrap the String in a new Object which returns in toString the String. (Can't think of a usecase - but anyway)
4.) If there is ie a Page which has two Forms where Form A contains a RichTextArea and a DateField and Form B contains only a RichTextArea currently you will end up with two imports for the RichTextArea where only one is needed
5.) It would be easier for parent controls like Form or Table to implement getHtmlImports(). BTW Table does currently not go through its child-controls.
The patch keeps the getHtmlImports() on Form Field and Table the provideHtmlImports() delegates to this methods or the other way round. I also added to ClickUtils a method to join a Collection in one String and a method to collect all Strings from a Page.
As said the implementations work with LinkedHashSet to keep the order. The signature of the provideHtmlImports(Set) only demands a normal set so that the concrete implementation of the order keeping set can be changed.
As said please understand this as a discussion point. I just wanted to raise it here before a Control interface is realeased with a IMO suboptimal method. If you feel that it is too late. Please just close this issue.
|Field||Original Value||New Value|
|Attachment||patch-htmlImport.txt [ 10050 ]|
|Status||Open [ 1 ]||In Progress [ 3 ]|
|Status||In Progress [ 3 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Project Import||Fri Mar 20 14:11:32 PDT 2009 [ 1237583492744 ]|
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|3h 40m||1||Malcolm Edgar||14/Jan/06 04:17|
|1d 32m||1||Malcolm Edgar||15/Jan/06 04:50|
|3h 44m||1||Malcolm Edgar||15/Jan/06 08:35|