views:

71

answers:

0

Hey there,

I tried to extend RichFaces' rich:messages component by making it appear like a popup box and adding a close button to it. Thus, I only need to change the renderer of the component. I managed to get it work programmatically, but I couldn't use my new tag in the xhtml files. It won't render it. Besides, I use Eclipse and an error is shown at the message.xml file that the given DTD is not well formed which is strange because it's exactly the one used by Richfaces CDK.

I include my config files, maybe some of you might have an idea what's wrong with them.

mytag.taglib.xml:

> <facelet-taglib> 
> <namespace>http://myurl.com/custcomp&lt;/namespace&gt;  <tag>  
> <tag-name>popmessages</tag-name>  
> <source>tags/message.xml</source>  
> </tag>
> 
> </facelet-taglib>

message.xml (almost exact copy, I only changed the class names)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"
"http://labs.jboss.com/jbossrichfaces/component-config.dtd"&gt;

<components>
 <component>
  <name>com.myproject.PopMessages</name>
  <family>com.myproject.PopMessages</family>
     <classname>
            com.myproject.HtmlPopMessages
        </classname>
        <superclass>com.myprojects.UIRichMessagesPop</superclass>

     <description>
      <![CDATA[Richmessages component in popup style]]>
     </description>
  <facet>
     <name>errorMarker</name>
     <description>Redefines the content for the marker if there is message with a severity class of "ERROR"</description>
  </facet>
  <facet>
     <name>fatalMarker</name>
     <description>Redefines the content for the marker if there is message with a severity class of "FATAL"</description>
  </facet>
  <facet>
     <name>infoMarker</name>
     <description>Redefines the content for the marker if there is message with a severity class of "INFO"</description>
  </facet>
  <facet>
     <name>warnMarker</name>
     <description>Redefines the content for the marker if there is message with a severity class of "WARN"</description>
  </facet>

     <renderer generate="false" override="true">
   <name>org.richfaces.RichMessagesRenderer</name>
   <classname>com.myproject.HtmlRichMessagesRenderer</classname>
   <superclass>org.richfaces.renderkit.RichMessageBaseRenderer</superclass> 
  </renderer>

  <tag>
   <name>popmessages</name>
   <classname>com.myproject.PopMessages</classname>
   <superclass>
    org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
   </superclass>
  </tag>

  <property attachedstate="true" hidden="true">
   <name>passedLabel</name>
   <classname>java.lang.String</classname>
   <description>
    Attribute should define the label to be displayed when no message appears
   </description>
  </property>
  <property>
   <name>level</name>
   <classname>java.lang.String</classname>
   <description>
    Defines a comma-separated list of messages categories to display.  Default value is &quot;ALL&quot;.
   </description>

  </property>
  <property>
   <name>minLevel</name>
   <classname>java.lang.String</classname>
   <description>
    Defines a minimum level of messages categories to display.
   </description>

  </property>
  <property>
   <name>for</name>
   <classname>java.lang.String</classname>
   <description>
    Client identifier of the component for which to display messages
   </description>

  </property> 
  <property>
   <name>layout</name>
   <classname>java.lang.String</classname>
   <description>
    The type of layout markup to use when rendering error messages.  Possible values are "table" (an HTML table), "list" (an HTML list) and iterator. If not specified, the default value is &quot;list&quot;.
   </description>
   <defaultvalue>"list"</defaultvalue>
  </property>

  <property>
   <name>globalOnly</name>
   <classname>boolean</classname>
   <description>
    Flag indicating that only global messages (that is, messages not associated with any client identifier) are to be displayed. Default value is "false"
   </description>
   <defaultvalue>false</defaultvalue>
  </property>

  <property>
   <name>showDetail</name>
   <classname>boolean</classname>
   <description>
    Flag indicating whether the detailed information of displayed messages should be included.  Default value is "false"
   </description>
   <defaultvalue>false</defaultvalue>
  </property> 

  <property>
   <name>showSummary</name>
   <classname>boolean</classname>
   <description> Flag indicating whether the summary portion of displayed
   messages should be included. Default value is "true" </description>
   <defaultvalue>true</defaultvalue>
  </property>
  <property>
   <name>title</name>
   <classname>java.lang.String</classname>
   <description>
    Advisory title information about markup elements generated for this component
   </description>
  </property>  

  <property>
   <name>tooltip</name>
   <classname>boolean</classname>
   <description>
    Flag indicating whether the detail portion of the message should be displayed as a tooltip. Default value is &quot;false&quot;.
   </description>
   <defaultvalue>false</defaultvalue>
  </property> 

  <property>
   <name>errorClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages with a severity class of &quot;ERROR&quot;
   </description>
  </property>  

  <property>
   <name>fatalClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages with a severity class of &quot;FATAL&quot;
   </description>
  </property> 

  <property>
   <name>infoClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages with a severity class of &quot;INFO&quot;
   </description>
  </property>  

  <property>
   <name>styleClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the component. Corresponds to the HTML &apos;class&apos; attribute.
   </description>
  </property> 

  <property>
   <name>style</name>
   <classname>java.lang.String</classname>
   <description>
    CSS style rules to be applied to the component
   </description>
  </property> 
  <property>
   <name>warnClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages with a severity class of &quot;WARN&quot;
   </description>
  </property>  

  <property>
   <name>errorMarkerClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages marker with a severity class of &quot;ERROR&quot;
   </description>
  </property>

  <property>
   <name>warnClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages with a severity class of &quot;WARN&quot;
   </description>
  </property>  

  <property>
   <name>fatalMarkerClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages markers with a severity class of &quot;FATAL&quot;
   </description>
  </property>   

  <property>
   <name>infoMarkerClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages markers with a severity class of &quot;INFO&quot;
   </description>
  </property>   

  <property>
   <name>warnMarkerClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages markers with a severity class of &quot;WARN&quot;
   </description>
  </property>   

  <property>
   <name>markerClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages markers
   </description>
  </property>   

  <property>
   <name>markerStyle</name>
   <classname>java.lang.String</classname>
   <description>
    CSS style rules to be applied to the messages markers
   </description>
  </property>

  <property>
   <name>errorLabelClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages labels with a severity class of &quot;ERROR&quot;
   </description>
  </property>

  <property>
   <name>fatalLabelClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages labels with a severity class of &quot;FATAL&quot;
   </description>
  </property>

  <property>
   <name>infoLabelClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages labels with a severity class of &quot;INFO&quot;
   </description>
  </property>

  <property>
   <name>warnLabelClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages labels with a severity class of &quot;WARN&quot;
   </description>
  </property>

  <property>
   <name>labelClass</name>
   <classname>java.lang.String</classname>
   <description>
    Assigns one or more space-separated CSS class names to the messages labels
   </description>
  </property>

  <property attachedstate="true" hidden="true">
   <name>binding</name>
   <classname>javax.faces.component.UIComponent</classname>
   <description>
    The attribute takes a value-binding expression for a component property of a backing bean
   </description>
  </property>
     &ui_component_attributes;
  &ajax_output_attributes;
  <property hidden="true">
   <name>keepTransient</name>
   <classname>boolean</classname>
  </property>     

    </component> 

</components>

faces-config.xml:

 <component>
     <component-type>com.myproject.PopMessages</component-type>
     <component-class>javax.faces.component.UIMessages</component-class>
 </component>

 <render-kit> 
  <renderer>
   <component-family>com.myproject.PopMessages</component-family>
   <renderer-type>com.myproject.HtmlRichMessagesRenderer</renderer-type>
      <renderer-class>com.myproject.HtmlRichMessagesRenderer</renderer-class>     
    </renderer>
 </render-kit>

web.xml:

  <context-param>
    <param-name>facelets.LIBRARIES</param-name>
    <param-value>/WEB-INF/edudoo.tld</param-value>
  </context-param>

Any help would be appreciated!

Cheers, balázs