Jsf ICEfaces dataPaginator actionListener

Jsf ICEfaces dataPaginator actionListener,jsf,icefaces,Jsf,Icefaces,在ice:dataPaginator中,我们可以添加一个actionListener。使用该事件处理程序或其他方式,我们可以跟踪单击的分页按钮(锚定)吗 是的,actionListener方法接受一个ActionEvent参数,您可以对该参数调用getComponent()并将其强制转换为DataPaginator。使用此对象,可以使用getPageIndex()、getPageCount()和getPaginatorMaxPages()方法 所有这些都写在ice文件中: 编辑: public

ice:dataPaginator
中,我们可以添加一个
actionListener
。使用该事件处理程序或其他方式,我们可以跟踪单击的分页按钮(锚定)吗

是的,
actionListener
方法接受一个
ActionEvent
参数,您可以对该参数调用
getComponent()
并将其强制转换为DataPaginator。使用此对象,可以使用
getPageIndex()
getPageCount()
getPaginatorMaxPages()
方法

所有这些都写在ice文件中:

编辑:

public void actionListener(ActionEvent event) {
    setStatus("Data Paginator clicked.");

    if ((event.getComponent() != null) &&
        (event.getComponent() instanceof DataPaginator)) {
        DataPaginator clicked = (DataPaginator)event.getComponent();

        StringBuilder sb = new StringBuilder(80);
        sb.append("Data Paginator clicked. Current page is ");
        sb.append(clicked.getPageIndex());
        sb.append(" of ");
        sb.append(clicked.getPageCount());
        sb.append(" and a maximum of ");
        sb.append(clicked.getPaginatorMaxPages());
        sb.append(" pages will be displayed.");
        setStatus(sb.toString());
    }
}

是的,
actionListener
方法接受一个
ActionEvent
参数,您可以在该参数上调用
getComponent()
并将其强制转换为DataPaginator。使用此对象,可以使用
getPageIndex()
getPageCount()
getPaginatorMaxPages()
方法

所有这些都写在ice文件中:

编辑:

public void actionListener(ActionEvent event) {
    setStatus("Data Paginator clicked.");

    if ((event.getComponent() != null) &&
        (event.getComponent() instanceof DataPaginator)) {
        DataPaginator clicked = (DataPaginator)event.getComponent();

        StringBuilder sb = new StringBuilder(80);
        sb.append("Data Paginator clicked. Current page is ");
        sb.append(clicked.getPageIndex());
        sb.append(" of ");
        sb.append(clicked.getPageCount());
        sb.append(" and a maximum of ");
        sb.append(clicked.getPaginatorMaxPages());
        sb.append(" pages will be displayed.");
        setStatus(sb.toString());
    }
}