Header Resource component
-------------------------

         Key: JS2-311
         URL: http://issues.apache.org/jira/browse/JS2-311
     Project: Jetspeed 2
        Type: New Feature
  Components: Other  
    Versions: 2.0-dev/cvs    
 Environment: Linux, J2SE
    Reporter: Shinsuke SUGAYA
 Assigned to: Shinsuke SUGAYA 


===============
Header Resource
===============

  Overviews:
  ----------

   Header Resource component allows user to add tags, such as <link> and
   <script> tag into <head> tag. Currently, Jetspeed2 puts only decorators
   stylesheet tag into <head> tag. But, using Header Resource Component,
   user can put user-defined stylesheet and javascript file from portal or
   portlet.


  Design:
  -------

   i) Process to add tags to HeaderResource component

                      --------------------------- 
                      |JetspeedPortletServices..|
                      --------------------------- 
                                 |
                                 V
               -------------------------------------------- 
               |o.a.j.headerresource.HeaderResourceFactory|
               -------------------------------------------- 
                                 | getHeaderResouce(RequestContext 
requestContext)
                                 V
                  ------------------------------------- 
                  |o.a.j.headerresource.HeaderResource|
                  ------------------------------------- 
                                 A Add tag into Set for HeaderResource
                                 | addHeaderInfo(), addJavaScript(), 
addStyleSheet()
                       Tag (<link> and <script>)
              


   ii) Process to get tags from HeaderResource component

                      --------------------------- 
                      |JetspeedPortletServices..|
                      --------------------------- 
                                 |
                                 V
               -------------------------------------------- 
               |o.a.j.headerresource.HeaderResourceFactory|
               -------------------------------------------- 
                                 | getHeaderResouce(RequestContext 
requestContext)
                                 V
                  ------------------------------------- 
                  |o.a.j.headerresource.HeaderResource|
                  ------------------------------------- 
                                 | toString()
                                 V
                       Template file(ex. decorator-tom.vm)


  Task Lists:
  -----------

   Added Interfaces
   ----------------

   o org.apache.jetspeed.headerresource.HeaderResource

     public abstract HeaderResource getHeaderResouce(RequestContext 
requestContext);
     public abstract HeaderResource getHeaderResouce(PortletRequest request);

   o org.apache.jetspeed.headerresource.HeaderResourceFactory

     public abstract String toString();
     public abstract void addHeaderInfo(String elementName, Map attributes);
     public abstract void addJavaScript(String path, boolean defer);
     public abstract void addJavaScript(String path);
     public abstract void addStyleSheet(String path);


   Added Classes
   -------------

    
components/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
    
components/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java

    - HeaderResourceImpl class creates LinkedHashSet and put it into
      RequestContext#setAttribute(). LinkedHashSet has tags info to put
      them into <head> tag.


  Usage
  -----

   In Portal
   ---------
    Example:

      HeaderResourceFactory headerResourceFactory
           = 
(HeaderResourceFactory)Jetspeed.getComponentManager().getComponent(HeaderResourceFactory.class);
      HeaderResource headerResource = 
headerResourceFactory.getHeaderResouce(requestContext);

      headerResource.addStyleSheet("content/css/styles.css");

   In Portlet
   ----------
    Example:

      HeaderResourceFactory headerResourceFactory
        = 
getPortletContext().getAttribute(CommonPortletServices.CPS_HEADER_RESOURCE_FACTORY);
      HeaderResource headerResource = 
headerResourceFactory.getHeaderResouce(request);

      headerResource.addJavascript("script.js");




-- 
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