1 Reply Latest reply on Sep 16, 2009 9:45 AM by johndoe123

    Subclassing rich:column

      Hi,

      I want to subclass rich:column in order to enhance it a bit and keep my markup DRY.

      Unfortunatelly, only the header is rendered, but not the rows. Also, if I enclose a h:outputText inside my column Tag now, the values of the rows for that column are rendered, but within the tbody section and without any enclosing and tags.

      What am I doing wrong? Please help!

      This is my approach:

      package de.tmg.akg.web.components;
      
      import java.io.IOException;
      
      import javax.el.ValueExpression;
      import javax.faces.component.html.HtmlOutputText;
      import javax.faces.context.FacesContext;
      
      import org.richfaces.component.html.HtmlColumn;
      
      public class MyColumn extends HtmlColumn
      {
       private String columnHeader;
       private String display;
       private HtmlOutputText content;
      
       public TmgColumn()
       {
       content = new HtmlOutputText();
       }
      
       @Override
       public String getFamily()
       {
       return "MyFamily";
       }
      
       public void encodeBegin(FacesContext context) throws IOException
       {
       super.encodeBegin(context);
       }
      
       public void encodeEnd(FacesContext context) throws IOException
       {
       super.encodeEnd(context);
       }
      
       public void encodeChildren(FacesContext context) throws IOException
       {
       super.encodeChildren(context);
       }
      
      
       /**
       * @return the display
       */
       public String getDisplay()
       {
       return display;
       }
      
       /**
       * @param display the display to set
       */
       public void setDisplay(String display)
       {
       this.display = display;
       if(content == null)
       {
       content = new HtmlOutputText();
       this.getChildren().add(content);
       }
       content.setValue(this.getValueExpression("display"));
       }
      }
      


        • 1. Re: Subclassing rich:column

          Hi,

          I want to subclass rich:column in order to enhance it a bit and keep my markup DRY.

          Unfortunatelly, only the header is rendered, but not the rows. Also, if I enclose a h:outputText inside my column Tag now, the values of the rows for that column are rendered, but within the tbody section and without any enclosing td and tr tags.

          What am I doing wrong? Please help!

          This is my approach:

          package de.tmg.akg.web.components;
          
          import java.io.IOException;
          
          import javax.el.ValueExpression;
          import javax.faces.component.html.HtmlOutputText;
          import javax.faces.context.FacesContext;
          
          import org.richfaces.component.html.HtmlColumn;
          
          public class MyColumn extends HtmlColumn
          {
           private String columnHeader;
           private String display;
           private HtmlOutputText content;
          
           public TmgColumn()
           {
           content = new HtmlOutputText();
           }
          
           @Override
           public String getFamily()
           {
           return "MyFamily";
           }
          
           public void encodeBegin(FacesContext context) throws IOException
           {
           super.encodeBegin(context);
           }
          
           public void encodeEnd(FacesContext context) throws IOException
           {
           super.encodeEnd(context);
           }
          
           public void encodeChildren(FacesContext context) throws IOException
           {
           super.encodeChildren(context);
           }
          
          
           /**
           * @return the display
           */
           public String getDisplay()
           {
           return display;
           }
          
           /**
           * @param display the display to set
           */
           public void setDisplay(String display)
           {
           this.display = display;
           if(content == null)
           {
           content = new HtmlOutputText();
           this.getChildren().add(content);
           }
           content.setValue(this.getValueExpression("display"));
           }
          }
          


          I repeat: This forum needs an edit function! How could I possibly know writing html tags will damage the post?