myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henry Eduardo Iguaro" <henry.edua...@gmail.com>
Subject Re: Custom Renderer fororg.apache.myfaces.trinidad.component.core.output.CoreMessage doesn'twork?...
Date Wed, 20 Feb 2008 22:15:38 GMT
Hi Matthias,

The solution you provide for my problem worked, but... i have to mix
tr:message tags rendered with the core Trinidad renderer and the custom
ones, thats why i create my custom tag, so i could separate the use of one
renderer from another

Here, this is the code of the BalloonMessageTag custom tag class

public class BalloonMessageTag extends UIXMessageTag
{

    /**
     * Construct an instance of the CoreMessageTag.
     */
    public BalloonMessageTag()
    {
    }

    public String getComponentType()
    {
    return "org.apache.myfaces.trinidad.CoreMessage";
    }

    public String getRendererType()
    {
    return "gob.sudeban.util.jsf.custom.renderers.MessageBalloonRenderer";
    }

    // The rest is a copy of the CoreMessageTag class
}

But it still get the error output i posted before...

For now, i'm going to add an atribute to change the renderer dinamically

What can i do to implement the custom tag without the error?


2008/2/21, Henry Eduardo Iguaro <henry.eduardo@gmail.com>:
>
> Thanks a lot!
>
> 2008/2/21, Matthias Wessendorf <matzew@apache.org>:
> >
> > Hi,
> >
> > I answered your *old* post already.
> >
> > Here is a little bit more on that:
> >
> >
> > http://matthiaswessendorf.wordpress.com/2008/02/20/extending-trinidads-default-renderers/
> >
> > -Matthias
> >
> > On Feb 20, 2008 12:04 AM, HENRY IGUARO <henry.iguaro@sudeban.gob.ve>
> > wrote:
> > >
> > >
> > >
> > > hi, i'm creating a custom renderer for a
> > >  org.apache.myfaces.trinidad.component.core.output.CoreMessagecomponent
> > >  (aka, a <tr:message /> component), the custom renderer uses
> > javascript
> > >  to simulate a small balloon message box. After searching in the
> > source
> > >  code, i've found that the default renderer for the CoreMessage is the
> > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.MessageRenderer
> > ,
> > > so i created a copy of it and renamed to my renderer class name, this
> > way i
> > > could test the tag handling before plugin mine own renderer
> > >
> > >  This is the code that registers the renderer in my faces-config.xml
> > >  file.
> > >
> > >  <render-kit>
> > >          <render-kit-class>
> > >  org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit
> > >          </render-kit-class>
> > >          <renderer>
> > >                  <component-family>
> > >                          org.apache.myfaces.trinidad.Message
> > >                  </component-family>
> > >                  <renderer-type>
> > >                          org.apache.myfaces.trinidad.CoreMessage
> > >                  </renderer-type>
> > >                  <renderer-class>
> > >  gob.sudeban.util.jsf.custom.renderers.MessageBalloonRenderer
> > >                  </renderer-class>
> > >          </renderer>
> > >  </render-kit>
> > >
> > >  This is the component tag from my tld file:
> > >          <tag>
> > >              <name>balloon-message</name>
> > >  <tag-class>gob.sudeban.util.jsf.custom.tags.BalloonMessageTag
> > </tag-class>
> > >                  ...
> > >
> > >  The same atributes for the message tag from the tr.tld file in
> > >  trinidad-impl-1.0.6.jar
> > >                  ...
> > >          </tag>
> > >
> > >
> > >  The class gob.sudeban.util.jsf.custom.tags.BalloonMessageTag is also
> > a
> > >  renamed copy of
> > >  org.apache.myfaces.trinidadinternal.taglib.core.output.CoreMessageTag
> > >
> > >  This is the jsp file i use to test the component:
> > >
> > >  <?xml version="1.0" encoding="UTF-8" ?>
> > >  <%@ page language="java" contentType="text/html; charset=UTF-8"
> > >  pageEncoding="UTF-8"%>
> > >  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> > >  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> > >  <%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
> > >  <%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"
> > %>
> > >  <%@ taglib uri="http://sudeban.gob.ve/jsf/component/tags"
> > >  prefix="sudeban" %>
> > >
> > >  <f:view>
> > >
> > >  <trh:head>
> > >  </trh:head>
> > >
> > >  <trh:body>
> > >          <tr:form>
> > >                  <tr:panelFormLayout >
> > >                          <sudeban:balloon-message message="This is a
> > > message" />
> > >                  </tr:panelFormLayout>
> > >          </tr:form>
> > >  </trh:body>
> > >
> > >  When i test the component i get the following:
> > >
> > >  (HtmlRenderKitImpl.java:79) Unsupported
> > component-family/renderer-type:
> > >
> > > org.apache.myfaces.trinidad.Message
> > /gob.sudeban.util.jsf.custom.renderers.MessageBalloonRenderer
> > >  19-feb-2008 16:30:22
> > >  org.apache.myfaces.trinidadinternal.renderkit.RenderKitBasegetRenderer
> > >  WARNING: Renderer
> > >  'gob.sudeban.util.jsf.custom.renderers.MessageBalloonRenderer' not
> > found
> > >  for component family 'org.apache.myfaces.trinidad.Message'
> > >  19-feb-2008 16:30:22
> > >  org.apache.myfaces.trinidad.component.UIXComponentBase_getRendererImpl
> > >  WARNING: Could not find renderer for CoreMessage[UIXFacesBeanImpl,
> > >  id=_idJsp4] rendererType =
> > >  gob.sudeban.util.jsf.custom.renderers.MessageBalloonRenderer
> > >  (UIComponentTag.java:500) Exited encodeEnd for client-Id: _idJsp1
> > >  19-feb-2008 16:30:22
> > >  org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit
> > >  encodeFinally
> > >  WARNING: No RenderingContext available
> > >  19-feb-2008 16:30:22
> > >  org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit
> > >  encodeFinally
> > >  WARNING: No RenderingContext available
> > >
> > >  And anything get rendered...
> > >
> > >  What am i doing wrong? It's possible to register another render for a
> > >  core component like this?
> > >
> > >  Any help would be appreciated
> > >
> > >  (PS: Please excuse my english)
> > >
> >
> >
> >
> > --
> > Matthias Wessendorf
> >
> > further stuff:
> > blog: http://matthiaswessendorf.wordpress.com/
> > sessions: http://www.slideshare.net/mwessendorf
> > mail: matzew-at-apache-dot-org
> >
>
>
>
> --
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GCS/O G++@ s-:+>:+ a25 tv+ d++> t+ C+++>+ U++>+++ P+ L++>+++ W+++ E----
> w++$ 5 X R-@ b+>++ D+ e>++ o? O? h--@ r+ y++ K? M PS+
> ------END GEEK CODE BLOCK------




-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/O G++@ s-:+>:+ a25 tv+ d++> t+ C+++>+ U++>+++ P+ L++>+++ W+++ E---- w++$
5 X R-@ b+>++ D+ e>++ o? O? h--@ r+ y++ K? M PS+
------END GEEK CODE BLOCK------

Mime
View raw message