You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/06/13 14:36:46 UTC

Renderer for CustomMessageTag - help needed

I am going mad with a custom Renderer !

I created a custom tag that extends HtmlMessageTag.

My CustomMessageRenderer shpuld be sued for this tag.

The normal HtmlMessageTag should be rendered as before.

 

Problem: I don't get the CustomMessageRenderer mapped to my tag.

Could anybody have a look and give me a hint?

 

facesConfig.xml:

<component>

 
<component-type>com.recommind.faces.messages.CustomMessage</component-ty
pe>

 
<component-class>com.recommind.faces.messages.CustomMessage</component-c
lass>

</component>

 

<render-kit>

<render-kit-id>HTML_BASIC</render-kit-id>

            <renderer>

 
<component-family>recommind.faces.Message</component-family>

 
<renderer-type>com.recommind.faces.messages.CustomMessage</renderer-type
>

 
<renderer-class>com.recommind.faces.messages.CustomMessageRenderer</rend
erer-class>

            </renderer>                   

</render-kit>

 

Following classes are in package com.recommind.faces.messages:

public class CustomMessage extends HtmlMessage{

            public static final String COMPONENT_TYPE =
"com.recommind.faces.messages.CustomMessage";

            private String customMessage;

            (... getters and setters, saveState and restoreState ... )

}

 

public class CustomMessageTag extends HtmlMessageTag{

  private String customMessage;

  public String getRendererType() {

     return "com.recommind.faces.messages.CustomMessage";

  }

            

  public String getComponentType(){

       return CustomMessage.COMPONENT_TYPE;

  }

  (... getters and setters ... )

}

 

public class CustomMessageRenderer extends HtmlMessageRenderer{

  protected void renderSingleFacesMessage ( ...) {

   ...  

   }

}

 

Thanks,

Michael


Re: Renderer for CustomMessageTag - help needed

Posted by Bruno Aranda <br...@gmail.com>.
> project. If someone know a link let me know it.

Sure! There is a brand new archetype to generate a jsf custom
component library. Follow the steps in the wiki [1]. It has not been
released yet, but the only thing it implies is that you have to get it
from the subversion repository and build it with maven. See the wiki
for details.
After creating a project with the archetype, you will have the ideal
structure to just start coding your new library. It includes already a
simple component, so you can see how it is coded and configured. You
can create the jar with maven and include it whenever you need :)

Happy coding!

Bruno

[1] http://wiki.apache.org/myfaces/MyFaces_Archetypes_for_Maven (look
for the JSF Components Archetype)

On 6/13/06, urswagner@bluemail.ch <ur...@bluemail.ch> wrote:
>
> I made already some simple component. Unfortunately my try to make a single
> tag library including the components failed. I have to include the jar files
> into the war library. I would also be glad for a template tag library template
> project. If someone know a link let me know it.
>
>
> >-- Original-Nachricht --
> >Reply-To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >Date: Tue, 13 Jun 2006 18:44:20 +0100
> >From: "Bruno Aranda" <br...@gmail.com>
> >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >Subject: Re: Renderer for CustomMessageTag - help needed
> >
> >
> >I do not know what is the family for your component, but in the
> >configuration I see this line:
> >
> ><component-family>recommind.faces.Message</component-family>
> >
> >The "com." part is missing. Is this intended?
> >
> >Regards,
> >
> >Bruno
> >
> >On 6/13/06, Michael Heinen <mh...@recommind.com> wrote:
> >>
> >>
> >>
> >>
> >> I am going mad with a custom Renderer !
> >>
> >> I created a custom tag that extends HtmlMessageTag.
> >>
> >> My CustomMessageRenderer shpuld be sued for this tag.
> >>
> >> The normal HtmlMessageTag should be rendered as before.
> >>
> >>
> >>
> >> Problem: I don't get the CustomMessageRenderer mapped to my tag.
> >>
> >> Could anybody have a look and give me a hint?
> >>
> >>
> >>
> >> facesConfig.xml:
> >>
> >> <component>
> >>
> >>
> >> <component-type>com.recommind.faces.messages.CustomMessage</component-type>
> >>
> >>
> >> <component-class>com.recommind.faces.messages.CustomMessage</component-class>
> >>
> >> </component>
> >>
> >>
> >>
> >> <render-kit>
> >>
> >> <render-kit-id>HTML_BASIC</render-kit-id>
> >>
> >>             <renderer>
> >>
> >>
> >> <component-family>recommind.faces.Message</component-family>
> >>
> >>
> >> <renderer-type>com.recommind.faces.messages.CustomMessage</renderer-type>
> >>
> >>
> >> <renderer-class>com.recommind.faces.messages.CustomMessageRenderer</renderer-class>
> >>
> >>             </renderer>
> >>
> >> </render-kit>
> >>
> >>
> >>
> >> Following classes are in package com.recommind.faces.messages:
> >>
> >> public class CustomMessage extends HtmlMessage{
> >>
> >>             public static final String COMPONENT_TYPE =
> >> "com.recommind.faces.messages.CustomMessage";
> >>
> >>             private String customMessage;
> >>
> >>             (... getters and setters, saveState and restoreState ... )
> >>
> >> }
> >>
> >>
> >>
> >> public class CustomMessageTag extends HtmlMessageTag{
> >>
> >>   private String customMessage;
> >>
> >>   public String getRendererType() {
> >>
> >>      return "com.recommind.faces.messages.CustomMessage";
> >>
> >>   }
> >>
> >>
> >>
> >>   public String getComponentType(){
> >>
> >>        return CustomMessage.COMPONENT_TYPE;
> >>
> >>   }
> >>
> >>   (... getters and setters ... )
> >>
> >> }
> >>
> >>
> >>
> >> public class CustomMessageRenderer extends HtmlMessageRenderer{
> >>
> >>   protected void renderSingleFacesMessage ( ...) {
> >>
> >>    ?
> >>
> >>    }
> >>
> >> }
> >>
> >>
> >>
> >> Thanks,
> >>
> >> Michael
>
>

Re: Renderer for CustomMessageTag - help needed

Posted by ur...@bluemail.ch.
I made already some simple component. Unfortunately my try to make a single
tag library including the components failed. I have to include the jar files
into the war library. I would also be glad for a template tag library template
project. If someone know a link let me know it.


>-- Original-Nachricht --
>Reply-To: "MyFaces Discussion" <us...@myfaces.apache.org>
>Date: Tue, 13 Jun 2006 18:44:20 +0100
>From: "Bruno Aranda" <br...@gmail.com>
>To: "MyFaces Discussion" <us...@myfaces.apache.org>
>Subject: Re: Renderer for CustomMessageTag - help needed
>
>
>I do not know what is the family for your component, but in the
>configuration I see this line:
>
><component-family>recommind.faces.Message</component-family>
>
>The "com." part is missing. Is this intended?
>
>Regards,
>
>Bruno
>
>On 6/13/06, Michael Heinen <mh...@recommind.com> wrote:
>>
>>
>>
>>
>> I am going mad with a custom Renderer !
>>
>> I created a custom tag that extends HtmlMessageTag.
>>
>> My CustomMessageRenderer shpuld be sued for this tag.
>>
>> The normal HtmlMessageTag should be rendered as before.
>>
>>
>>
>> Problem: I don't get the CustomMessageRenderer mapped to my tag.
>>
>> Could anybody have a look and give me a hint?
>>
>>
>>
>> facesConfig.xml:
>>
>> <component>
>>
>>
>> <component-type>com.recommind.faces.messages.CustomMessage</component-type>
>>
>>
>> <component-class>com.recommind.faces.messages.CustomMessage</component-class>
>>
>> </component>
>>
>>
>>
>> <render-kit>
>>
>> <render-kit-id>HTML_BASIC</render-kit-id>
>>
>>             <renderer>
>>
>>
>> <component-family>recommind.faces.Message</component-family>
>>
>>
>> <renderer-type>com.recommind.faces.messages.CustomMessage</renderer-type>
>>
>>
>> <renderer-class>com.recommind.faces.messages.CustomMessageRenderer</renderer-class>
>>
>>             </renderer>
>>
>> </render-kit>
>>
>>
>>
>> Following classes are in package com.recommind.faces.messages:
>>
>> public class CustomMessage extends HtmlMessage{
>>
>>             public static final String COMPONENT_TYPE =
>> "com.recommind.faces.messages.CustomMessage";
>>
>>             private String customMessage;
>>
>>             (... getters and setters, saveState and restoreState ... )
>>
>> }
>>
>>
>>
>> public class CustomMessageTag extends HtmlMessageTag{
>>
>>   private String customMessage;
>>
>>   public String getRendererType() {
>>
>>      return "com.recommind.faces.messages.CustomMessage";
>>
>>   }
>>
>>
>>
>>   public String getComponentType(){
>>
>>        return CustomMessage.COMPONENT_TYPE;
>>
>>   }
>>
>>   (... getters and setters ... )
>>
>> }
>>
>>
>>
>> public class CustomMessageRenderer extends HtmlMessageRenderer{
>>
>>   protected void renderSingleFacesMessage ( ...) {
>>
>>    ?
>>
>>    }
>>
>> }
>>
>>
>>
>> Thanks,
>>
>> Michael


Re: Renderer for CustomMessageTag - help needed

Posted by Bruno Aranda <br...@gmail.com>.
I do not know what is the family for your component, but in the
configuration I see this line:

<component-family>recommind.faces.Message</component-family>

The "com." part is missing. Is this intended?

Regards,

Bruno

On 6/13/06, Michael Heinen <mh...@recommind.com> wrote:
>
>
>
>
> I am going mad with a custom Renderer !
>
> I created a custom tag that extends HtmlMessageTag.
>
> My CustomMessageRenderer shpuld be sued for this tag.
>
> The normal HtmlMessageTag should be rendered as before.
>
>
>
> Problem: I don't get the CustomMessageRenderer mapped to my tag.
>
> Could anybody have a look and give me a hint?
>
>
>
> facesConfig.xml:
>
> <component>
>
>
> <component-type>com.recommind.faces.messages.CustomMessage</component-type>
>
>
> <component-class>com.recommind.faces.messages.CustomMessage</component-class>
>
> </component>
>
>
>
> <render-kit>
>
> <render-kit-id>HTML_BASIC</render-kit-id>
>
>             <renderer>
>
>
> <component-family>recommind.faces.Message</component-family>
>
>
> <renderer-type>com.recommind.faces.messages.CustomMessage</renderer-type>
>
>
> <renderer-class>com.recommind.faces.messages.CustomMessageRenderer</renderer-class>
>
>             </renderer>
>
> </render-kit>
>
>
>
> Following classes are in package com.recommind.faces.messages:
>
> public class CustomMessage extends HtmlMessage{
>
>             public static final String COMPONENT_TYPE =
> "com.recommind.faces.messages.CustomMessage";
>
>             private String customMessage;
>
>             (... getters and setters, saveState and restoreState ... )
>
> }
>
>
>
> public class CustomMessageTag extends HtmlMessageTag{
>
>   private String customMessage;
>
>   public String getRendererType() {
>
>      return "com.recommind.faces.messages.CustomMessage";
>
>   }
>
>
>
>   public String getComponentType(){
>
>        return CustomMessage.COMPONENT_TYPE;
>
>   }
>
>   (... getters and setters ... )
>
> }
>
>
>
> public class CustomMessageRenderer extends HtmlMessageRenderer{
>
>   protected void renderSingleFacesMessage ( ...) {
>
>    …
>
>    }
>
> }
>
>
>
> Thanks,
>
> Michael