[ http://issues.apache.org/jira/browse/TAPESTRY-1035?page=all ]

Jesse Kuhnert updated TAPESTRY-1035:
------------------------------------

    Fix Version/s: 4.1.2

> Allow common stylesheets/favicon/geoinfo/doctype settings across 
> pages/requests
> -------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1035
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1035
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 4.1.1
>         Environment: Any
>            Reporter: Henrik Vendelbo
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> I have been using my own custom Shell component for a while now, and have 
> come up with an improvement along the lines of the AjaxDelegate.
> On most sites you would want a common setup for :
> doctype
> stylesheet
> stylesheets
> You might even want to implement a skinnable concept and vary the stylesheets 
> depending on the user.
> How about new parameter IShellDefaults getShellDefaults().
>   <parameter 
>       name="shellDefaults">
>     <description>
>     If specified, the defaults can provide a common layout and encoding for 
> the site overall or by user preference.
>     </description>
>   </parameter>
>   
>   public abstract IShellDefaults getShellDefaults();
> interface IShellDefault {
>     String getDoctype(IRequestCycle cycle);
>     boolean getRenderContentType(IRequestCycle cycle);
>     Object getBaseStylesheets(IRequestCycle cycle); // Always used before 
> getStylesheet() or those specified in Shell tag
>     Object getStylesheets(IRequestCycle cycle); // Used if none are specified 
> in the Shell tag
>     IAsset getFavicon(IRequestCycle cycle);
>     IDelegate getDelegate(); // Can be used for additional meta tags/links  
> }
> I expect the changes to be something like this(favicon excluded)
> ---------
> IShellDefaults defs = getShellDefaults();
> boolean renderCT = getRenderContentType();
> if (defs != null)
>             renderCT &= defs.getRenderContentType(cycle);
> if (renderCT)
>             writeMetaTag(writer, "http-equiv", "Content-Type", 
> writer.getContentType());
> if (defs != null) {
>    IRender delegate = defs.getDelegate(cycle);
>    if (delegate != null)
>           delegate.render(writer, cycle);
> }
> if (defs != null) {
>            Iterator i = (Iterator) 
> getValueConverter().coerceValue(defs.getBaseStylesheets(cycle),Iterator.class);
>             while (i.hasNext())
>             {
>                 stylesheet = (IAsset) i.next();
>                 writeStylesheetLink(writer, cycle, stylesheet);
>             }
> }
> if (defs != null && getStylesheet()==null && getStylesheets()==null) {
>            Iterator i = (Iterator) 
> getValueConverter().coerceValue(defs.getStylesheets(cycle),Iterator.class);
>             while (i.hasNext())
>             {
>                 stylesheet = (IAsset) i.next();
>                 writeStylesheetLink(writer, cycle, stylesheet);
>             }
> }          
> IAsset stylesheet = getStylesheet();
>             
> if (stylesheet != null)
>                 writeStylesheetLink(writer, cycle, stylesheet);
>             
> Iterator i = (Iterator) getValueConverter().coerceValue(getStylesheets(), 
> Iterator.class);
>             
> while (i.hasNext())
> {
>     stylesheet = (IAsset) i.next();
>     writeStylesheetLink(writer, cycle, stylesheet);
> }
> ....
>     private void writeDocType(IMarkupWriter writer, IRequestCycle cycle)
>     {
>         String doctype = getDoctype();
>         if (! HiveMind.isNonBlank(doctype) && getShellDefaults() != null)
>            doctype = getShellDefaults().getDoctype(cycle);
>         if (HiveMind.isNonBlank(doctype))

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to