You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alexandre Jaquet <a....@avintis.com> on 2006/07/05 16:44:07 UTC
writing is own HtmlDataTable
I need to write my own table component and I need your advice to start it.
Do I need to extend an existing class ?
Wich step I've to follow ?
thx for your advice
RE: writing is own HtmlDataTable
Posted by James Richards <ja...@northps.com>.
This particular project is on JDK 1.4.2 so it doesn't use generics but it does wrap a List behind a DataModel interface. The JBoss Seam examples are great for peering into standard JSF and they use MyFaces.
Thanks,
James
-----Original Message-----
From: Alexandre Jaquet [mailto:a.jaquet@avintis.com]
Sent: Thu 7/6/2006 2:00 AM
To: MyFaces Discussion
Subject: Re: writing is own HtmlDataTable
Great thanks James it's a good starting point, when you set the datas do
you set it as a list
List<Object> datas; ?
James Richards wrote:
>
> I had to make a custom extension of HtmlDataTable for a recent
> project. To do that I extended MyFaces HtmlDataTable:
>
> //...
> import org.apache.myfaces.component.html.ext.HtmlDataTable;
> import org.apache.myfaces.component.UserRoleAware;
> // ...
> public class CustomPaginationHtmlDataTable extends HtmlDataTable
> implements
> UserRoleAware {
> //...
> }
>
> I also created a tag for my custom table:
>
> import org.apache.myfaces.taglib.html.ext.HtmlDataTableTag;
>
> public class CustomPaginationHtmlDataTableTag extends HtmlDataTableTag {
> public String getComponentType()
> {
> return CustomPaginationHtmlDataTable.COMPONENT_TYPE;
> }
>
> public String getRendererType()
> {
> return "org.apache.myfaces.Table";
> }
> }
>
> I then added the custom table to an appropriate faces-config.xml:
>
> <faces-config>
> <component>
>
> <component-type>com.dbz.lms.faces.CustomPaginationHtmlDataTable</component-type>
>
> <component-class>com.dbz.lms.faces.component.CustomPaginationHtmlDataTable</component-class>
> </component>
> <!-- more components -->
> </faces-config>
>
> and added the custom tag to an appropriate taglib file:
>
> <tag>
> <name>customPaginationDataTable</name>
>
> <tagclass>com.dbz.lms.faces.taglib.CustomPaginationHtmlDataTableTag</tagclass>
> <bodycontent>JSP</bodycontent>
> <attribute>
> <name>id</name>
> <required>false</required>
> <rtexprvalue>false</rtexprvalue>
> </attribute>
> <!-- more attribute declarations... -->
> </tag>
>
> At that point, the tag is available for use beneath whatever namespace
> you have defined for your custom tag library. I'm sure there's more
> information on the wiki: http://wiki.apache.org/myfaces/
>
> Hope that helps,
>
> James
>
> -----Original Message-----
> From: Alexandre Jaquet [mailto:a.jaquet@avintis.com]
> Sent: Wed 7/5/2006 10:44 AM
> To: MyFaces Discussion
> Subject: writing is own HtmlDataTable
>
> I need to write my own table component and I need your advice to start it.
> Do I need to extend an existing class ?
> Wich step I've to follow ?
>
> thx for your advice
>
Re: writing is own HtmlDataTable
Posted by Alexandre Jaquet <a....@avintis.com>.
Great thanks James it's a good starting point, when you set the datas do
you set it as a list
List<Object> datas; ?
James Richards wrote:
>
> I had to make a custom extension of HtmlDataTable for a recent
> project. To do that I extended MyFaces HtmlDataTable:
>
> //...
> import org.apache.myfaces.component.html.ext.HtmlDataTable;
> import org.apache.myfaces.component.UserRoleAware;
> // ...
> public class CustomPaginationHtmlDataTable extends HtmlDataTable
> implements
> UserRoleAware {
> //...
> }
>
> I also created a tag for my custom table:
>
> import org.apache.myfaces.taglib.html.ext.HtmlDataTableTag;
>
> public class CustomPaginationHtmlDataTableTag extends HtmlDataTableTag {
> public String getComponentType()
> {
> return CustomPaginationHtmlDataTable.COMPONENT_TYPE;
> }
>
> public String getRendererType()
> {
> return "org.apache.myfaces.Table";
> }
> }
>
> I then added the custom table to an appropriate faces-config.xml:
>
> <faces-config>
> <component>
>
> <component-type>com.dbz.lms.faces.CustomPaginationHtmlDataTable</component-type>
>
> <component-class>com.dbz.lms.faces.component.CustomPaginationHtmlDataTable</component-class>
> </component>
> <!-- more components -->
> </faces-config>
>
> and added the custom tag to an appropriate taglib file:
>
> <tag>
> <name>customPaginationDataTable</name>
>
> <tagclass>com.dbz.lms.faces.taglib.CustomPaginationHtmlDataTableTag</tagclass>
> <bodycontent>JSP</bodycontent>
> <attribute>
> <name>id</name>
> <required>false</required>
> <rtexprvalue>false</rtexprvalue>
> </attribute>
> <!-- more attribute declarations... -->
> </tag>
>
> At that point, the tag is available for use beneath whatever namespace
> you have defined for your custom tag library. I'm sure there's more
> information on the wiki: http://wiki.apache.org/myfaces/
>
> Hope that helps,
>
> James
>
> -----Original Message-----
> From: Alexandre Jaquet [mailto:a.jaquet@avintis.com]
> Sent: Wed 7/5/2006 10:44 AM
> To: MyFaces Discussion
> Subject: writing is own HtmlDataTable
>
> I need to write my own table component and I need your advice to start it.
> Do I need to extend an existing class ?
> Wich step I've to follow ?
>
> thx for your advice
>
RE: writing is own HtmlDataTable
Posted by James Richards <ja...@northps.com>.
I had to make a custom extension of HtmlDataTable for a recent project. To do that I extended MyFaces HtmlDataTable:
//...
import org.apache.myfaces.component.html.ext.HtmlDataTable;
import org.apache.myfaces.component.UserRoleAware;
// ...
public class CustomPaginationHtmlDataTable extends HtmlDataTable implements
UserRoleAware {
//...
}
I also created a tag for my custom table:
import org.apache.myfaces.taglib.html.ext.HtmlDataTableTag;
public class CustomPaginationHtmlDataTableTag extends HtmlDataTableTag {
public String getComponentType()
{
return CustomPaginationHtmlDataTable.COMPONENT_TYPE;
}
public String getRendererType()
{
return "org.apache.myfaces.Table";
}
}
I then added the custom table to an appropriate faces-config.xml:
<faces-config>
<component>
<component-type>com.dbz.lms.faces.CustomPaginationHtmlDataTable</component-type>
<component-class>com.dbz.lms.faces.component.CustomPaginationHtmlDataTable</component-class>
</component>
<!-- more components -->
</faces-config>
and added the custom tag to an appropriate taglib file:
<tag>
<name>customPaginationDataTable</name>
<tagclass>com.dbz.lms.faces.taglib.CustomPaginationHtmlDataTableTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<!-- more attribute declarations... -->
</tag>
At that point, the tag is available for use beneath whatever namespace you have defined for your custom tag library. I'm sure there's more information on the wiki: http://wiki.apache.org/myfaces/
Hope that helps,
James
-----Original Message-----
From: Alexandre Jaquet [mailto:a.jaquet@avintis.com]
Sent: Wed 7/5/2006 10:44 AM
To: MyFaces Discussion
Subject: writing is own HtmlDataTable
I need to write my own table component and I need your advice to start it.
Do I need to extend an existing class ?
Wich step I've to follow ?
thx for your advice