You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Fr...@alcatel-lucent.fr on 2007/05/03 14:02:48 UTC

[Trinidad] Trinidad + Tomahawk (schedule component) + Facelets: Rendering problem ???

I'm using :
        Trinidad 1.0.0-incubating
        Facelets 1.1.6
        Tomahawk 1.1.5
        MyFaces 1.1.5

I want to display the schedule component from Tomahawk.

If i don't use facelets, the schedule is displayed correctly.

When i add facelets support, the schedule is partialy rendered (it seems 
no css is read...). 
The column for month or days are displayed but no colors are rendered as 
without the facelets.. The mouse listener is not working as well.

Is it a bug ? it seems a .css include pb...

My web.xml seems correctly configured with:

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
         version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";>
  <description>Empty web.xml file for Web Application</description>
  <!-- FaceletViewHandler configuration -->
  <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/tomahawk.taglib.xml</param-value>
    </context-param>
  <context-param>
 
<param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
  </context-param>
  <!-- Use documents saved as *.xhtml for Facelets -->
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <!-- Use client-side state saving.  In Trinidad, it is an
       optimized, token-based mechanism that is almost always a
       better choice than the standard JSF server-side state saving. -->
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    <!--param-value>server</param-value-->
  </context-param>
  <!-- Trinidad by default uses an optimized client-side state saving
       mechanism. To disable that, uncomment the following -->
  <!--context-param>
 <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD</param-name>
    <param-value>all</param-value>
  </context-param-->
  <!-- Trinidad also supports an optimized strategy for caching some
   view state at an application level, which significantly improves
   scalability.  However, it makes it harder to develop (updates to
   pages will not be noticed until the server is restarted), and in
   some rare cases cannot be used for some pages (see Trinidad
   documentation for more information) -->
  <context-param>
 
<param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
    <param-value>false</param-value>
  </context-param>
  <!-- If this parameter is enabled, Trinidad will automatically
       check the modification date of your JSPs, and discard saved
       state when they change;  this makes development easier,
       but adds overhead that should be avoided when your application
       is deployed -->
  <context-param>
 
<param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
    <param-value>true</param-value>
  </context-param>
  <!-- Enables Change Persistence at a session scope.  By default,
       Change Persistence is entirely disabled. The ChangeManager is
       an API, which can persist component modifications (like,
       is a showDetail or tree expanded or collapsed). For providing
       a custom Change Persistence implementation inherit from the 
       Trinidad API's ChangeManager class. As the value you have 
       to use the fullqualified class name. -->
  <context-param>
 <param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
    <param-value>session</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.trinidad.resource.DEBUG</param-name>
    <param-value>false</param-value>
  </context-param>
  <filter>
    <filter-name>MyFacesExtensionsFilter</filter-name>
 
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>20m</param-value>
    </init-param>
  </filter>
  <!-- extension mapping for adding <script/>, <link/>, and other resource 

tags to JSF-pages  -->
  <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <!-- servlet-name must match the name of your 
javax.faces.webapp.FacesServlet entry -->
    <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>
  <!-- extension mapping for serving page-independent resources 
(javascript, stylesheets, images, etc.)  -->
  <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>*.xhtml</url-pattern>
  </filter-mapping>
  <filter>
    <filter-name>trinidad</filter-name>
 
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>trinidad</filter-name>
    <servlet-name>faces</servlet-name>
  </filter-mapping>
  <!-- Faces Servlet -->
  <servlet>
    <servlet-name>faces</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <!-- resource loader servlet -->
  <servlet>
    <servlet-name>resources</servlet-name>
 
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
  </servlet>
  <!-- Faces Servlet Mappings -->
  <servlet-mapping>
    <servlet-name>faces</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>35</session-timeout>
  </session-config>
  <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
  </mime-mapping>
</web-app>

My tomahawk.taglib.xml contains

 <tag>
        <tag-name>schedule</tag-name>
        <component>
            <component-type>org.apache.myfaces.Schedule</component-type>
            <renderer-type>org.apache.myfaces.Schedule</renderer-type>
 <handler-class>trinidad10.ScheduleComponentHandler</handler-class>
        </component>
    </tag>

and the ScheduleComponentHandler is:

package trinidad10;

import com.sun.facelets.FaceletContext;
import com.sun.facelets.tag.MetaRuleset;
import com.sun.facelets.tag.MethodRule;


import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.html.HtmlComponentHandler;

import javax.faces.component.UIComponent;

import org.apache.myfaces.custom.schedule.ScheduleMouseEvent;


public class ScheduleComponentHandler extends HtmlComponentHandler {
    private static final String RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME 
= 
        "renderZeroLengthEntries";
    private static final String MOUSE_LISTENER_METHOD_ATTRIBUTE_NAME = 
        "mouseListener";
    private static final String EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME = 
        "expandToFitEntries";

    public ScheduleComponentHandler(ComponentConfig tagConfig) {
        super(tagConfig);
    }

    protected MetaRuleset createMetaRuleset(Class type) {
        MetaRuleset m = super.createMetaRuleset(type);
        m.addRule(new MethodRule(MOUSE_LISTENER_METHOD_ATTRIBUTE_NAME, 
null, 
                                 new Class[] { ScheduleMouseEvent.class 
}));
        return m;
    }

    @Override
    protected void onComponentCreated(FaceletContext context, 
                                      UIComponent component, 
                                      UIComponent parent) {
        if (getAttribute(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME) != 
null) {
 component.getAttributes().put(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME, 
 
getAttribute(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME).getObject(context));
        }
        if (getAttribute(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME) != null) {
 component.getAttributes().put(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME, 
 getAttribute(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME).getObject(context));
        }
    }
}

Re: [Trinidad] Trinidad + Tomahawk (schedule component) + Facelets: Rendering problem ???

Posted by Wesley Niemegeerts <ni...@goca.be>.

Thanks Jurgen,

Love the component!  Nice job!

By the way, in the holiday examples ... "poeperkesdag" was da nie halfweg
januari? :-)

Thanks for the fix!



Jurgen Lust-2 wrote:
> 
> The fact that the schedule is not rendered properly with facelets is a
> bug. I am currently working on a refactoring of the component in order
> to fix this. It's about 90% complete at the moment, so expect a commit
> soon...
> 
> Jurgen
> 
> Op donderdag 10-05-2007 om 00:54 uur [tijdzone -0700], schreef Wesley
> Niemegeerts:
>> I got the mouseListener events running....
>> 
>> follow this 
>> http://www.nabble.com/Schedule-component,-mouseListener-is-not-triggered-At-all-t2213732.html
>> thread 
>> 
>> But the schedule is still rendered wrong... :-(
>> 
>> Anybody ?
>> 
>> 
>> Wesley Niemegeerts wrote:
>> > 
>> > I'm having the same problem...  Did you find a solution?
>> > 
>> > Also the action event seems to work but the mouseListener doesn't...
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
> 
> -- 
> ____________________________________________________
> Jurgen Lust
> email: jlust@apache.org
> blog: http://jroller.com/page/jurgenlust
> ____________________________________________________
> 
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--Trinidad-%2B-Tomahawk-%28schedule-component%29-%2B-Facelets%3A-Rendering-problem-----tf3686033.html#a10410529
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] Trinidad + Tomahawk (schedule component) + Facelets: Rendering problem ???

Posted by Jurgen Lust <Ju...@gmail.com>.
The fact that the schedule is not rendered properly with facelets is a
bug. I am currently working on a refactoring of the component in order
to fix this. It's about 90% complete at the moment, so expect a commit
soon...

Jurgen

Op donderdag 10-05-2007 om 00:54 uur [tijdzone -0700], schreef Wesley
Niemegeerts:
> I got the mouseListener events running....
> 
> follow this 
> http://www.nabble.com/Schedule-component,-mouseListener-is-not-triggered-At-all-t2213732.html
> thread 
> 
> But the schedule is still rendered wrong... :-(
> 
> Anybody ?
> 
> 
> Wesley Niemegeerts wrote:
> > 
> > I'm having the same problem...  Did you find a solution?
> > 
> > Also the action event seems to work but the mouseListener doesn't...
> > 
> > 
> > 
> > 
> > 
> > 

-- 
____________________________________________________
Jurgen Lust
email: jlust@apache.org
blog: http://jroller.com/page/jurgenlust
____________________________________________________

Re: [Trinidad] Trinidad + Tomahawk (schedule component) + Facelets: Rendering problem ???

Posted by Wesley Niemegeerts <ni...@goca.be>.
I got the mouseListener events running....

follow this 
http://www.nabble.com/Schedule-component,-mouseListener-is-not-triggered-At-all-t2213732.html
thread 

But the schedule is still rendered wrong... :-(

Anybody ?


Wesley Niemegeerts wrote:
> 
> I'm having the same problem...  Did you find a solution?
> 
> Also the action event seems to work but the mouseListener doesn't...
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--Trinidad-%2B-Tomahawk-%28schedule-component%29-%2B-Facelets%3A-Rendering-problem-----tf3686033.html#a10408789
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] Trinidad + Tomahawk (schedule component) + Facelets: Rendering problem ???

Posted by Wesley Niemegeerts <ni...@goca.be>.
I'm having the same problem...  Did you find a solution?

Also the action event seems to work but the mouseListener doesn't...





-- 
View this message in context: http://www.nabble.com/-Trinidad--Trinidad-%2B-Tomahawk-%28schedule-component%29-%2B-Facelets%3A-Rendering-problem-----tf3686033.html#a10408151
Sent from the MyFaces - Users mailing list archive at Nabble.com.