1

I want to use HtmlDataTable's navigateToRow() and findRow() method to select a particular row from a datatable. I followed this link http://component-showcase.icesoft.org/component-showcase/showcase.iface ==>Table==>Find Row option. I am binding the datatable to a backing bean . I get following error "The method findRow(String, String[], int, String, boolean) is undefined for the type HtmlDataTable" at the lines where I use findRow() and navigateToRow() methods. How to solve this error.

This is my jspx page

<?xml version="1.0" encoding="utf-8" ?>
<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ice="http://www.icesoft.com/icefaces/component">
    <jsp:directive.page contentType="text/html;charset=utf-8" />
    <f:view>
        <ice:loadBundle basename="com.unvired.ump.resources.Messages"
            var="msgs"></ice:loadBundle>
        <ice:outputDeclaration doctypeRoot="HTML"
            doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
            doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />
        <html>
<head>
<title><ice:outputText value="#{styleBean.style}" escape="false" />
    <ice:outputStyle href="./css/master_css.css" /><ice:outputStyle
        href="./css/rime.css" /> <ice:outputStyle href="./css/selection.css" />
</title>
</head>
<body>
    <ice:form id="ADMIN_COCKPIT_FORM">
        <ice:panelTabSet id="heartBeatTab"
            selectedIndex="#{heartBeatHandler.focusIndex}" tabPlacement="Top"
            tabChangeListener="#{heartBeatHandler.processTabChange}">
            <ice:panelTab rendered="true" label="#{msgs['heartBeat.syst_info']}"
                icon="images/menu/recent.gif">
                <!-- Refresh entire page -->
                <ice:panelGroup styleClass="exampleBox dataScrollingContainer">
                    <h:panelGrid columns="2">
                        <h:outputText value="Search Query:" />
                        <h:inputText value="#{sampleRowSelector.searchQuery}" />

                        <h:outputText value="Case Sensitive:" />
                        <h:selectBooleanCheckbox value="#{sampleRowSelector.caseSensitive}" />

                        <h:outputText value="Columns To Search:" />
                        <h:selectManyCheckbox value="#{sampleRowSelector.selectedColumns}">
                            <f:selectItems value="#{sampleRowSelector.COLUMNS}" />
                        </h:selectManyCheckbox>

                        <h:outputText value="Search Type:" />
                        <h:selectOneRadio value="#{sampleRowSelector.selectedSearchMode}">
                            <f:selectItems value="#{sampleRowSelector.SEARCH_MODES}" />
                        </h:selectOneRadio>

                        <h:outputText value="Effect To Use:" />
                        <h:selectOneRadio value="#{sampleRowSelector.selectedEffectType}">
                            <f:selectItems value="#{sampleRowSelector.EFFECT_TYPES}" />
                        </h:selectOneRadio>
                    </h:panelGrid>
                </ice:panelGroup>
                <ice:panelGroup style="padding-left:1%;">
                    <ice:panelGroup>
                        <ice:panelGroup style="padding-top:2%;">
                            <ice:dataTable id="logicalSystems"
                                        value="#{sampleRowSelector.logicalSystems}" var="item"
                                        style="width:650px" rows="7" binding="#{sampleRowSelector.iceTable}" ><!-- binding="#{sampleRowSelector.iceTable}" -->
                                        <ice:column>                                            
                                            <f:facet name="header">
                                                <ice:commandSortHeader
                                                    columnName="#{msgs['system_property.name']}"
                                                    arrow="true">
                                                    <ice:outputText value="#{msgs['system_property.name']}" />
                                                </ice:commandSortHeader>
                                            </f:facet>
                                            <ice:outputText value="#{item.sysName}" />
                                        </ice:column>
                                        <ice:column>
                                            <f:facet name="header">
                                                <ice:commandSortHeader
                                                    columnName="#{msgs['backend.logical_system.descr']}"
                                                    arrow="true">
                                                    <ice:outputText
                                                        value="#{msgs['backend.logical_system.descr']}"/>
                                                </ice:commandSortHeader>
                                            </f:facet>
                                            <ice:outputText value="#{item.description}" />
                                        </ice:column>
                                        <ice:column>
                                            <f:facet name="header">
                                                <ice:commandSortHeader
                                                    columnName="#{msgs['system_property.sys_type']}"
                                                    arrow="true">
                                                    <ice:outputText
                                                        value="#{msgs['system_property.sys_type']}" />
                                                </ice:commandSortHeader>
                                            </f:facet>
                                            <ice:outputText value="#{item.sysType.description}" />
                                        </ice:column>                                       
                                    </ice:dataTable>
                        </ice:panelGroup>
                    </ice:panelGroup>
                </ice:panelGroup>
            </ice:panelTab>
        </ice:panelTabSet>
    </ice:form>
</body>
        </html>
    </f:view>
</jsp:root>

This is My handler class

import com.unvired.ump.ac.util.SessionObject;
import com.unvired.ump.api.pojo.LogicalSystem;
import com.unvired.ump.core.session.EntityOperationsBean;
import com.unvired.ump.hibernate.facades.UMPServiceLocator;
import com.icesoft.faces.component.ext.HtmlDataTable;
import com.icesoft.faces.context.effects.Pulsate;
import java.io.Serializable;


import javax.faces.model.SelectItem;

public class SampleRowSelector implements Serializable
{

    private EntityOperationsBean entitylocal      = (EntityOperationsBean) UMPServiceLocator.getBean(EntityOperationsBean.class);
    private LogicalSystem[]               logicalSystems;
    private boolean                       isLogicalSystemTableReload       = false;
    private HtmlDataTable iceTable;
    private String searchQuery;


    private String selectedEffectType = "default";
    private String selectedSearchMode = "contains";
    private String[] selectedColumns = new String[]{"systemName", "description", "systemType"};
    private int lastFoundIndex = -1;
    private boolean caseSensitive;
    private boolean noResultsFound = false;


    public final SelectItem[] SEARCH_MODES = {new SelectItem("startsWith", "Starts With"),
            new SelectItem("endsWith", "Ends With"),
            new SelectItem("contains", "Contains"),
            new SelectItem("exact", "Exact Match")};

    public final SelectItem[] COLUMNS = {
            new SelectItem("systemName", "System Name"),
            new SelectItem("description", "Description"),
            new SelectItem("systemType", "System Type")};

    public final SelectItem[] EFFECT_TYPES = {new SelectItem("none", "None"),
            new SelectItem("default", "Default (Highlight)"),
            new SelectItem("pulsate", "Pulsate")};


    public SelectItem[] getSEARCH_MODES() {
        return SEARCH_MODES;
    }
    public SelectItem[] getCOLUMNS() {
        return COLUMNS;
    }

    public SelectItem[] getEFFECT_TYPES() {
        return EFFECT_TYPES;
    }

    public LogicalSystem[] getLogicalSystems()
    {
        try{

            logicalSystems = entitylocal.getAllSystems(SessionObject.getCompanyInSession());
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return logicalSystems;
    }

    public boolean isLogicalSystemTableReload()
    {
        return isLogicalSystemTableReload;
    }

    public void setLogicalSystemTableReload(boolean isLogicalSystemTableReload)
    {
        this.isLogicalSystemTableReload = isLogicalSystemTableReload;
    }

    public void setLogicalSystems(LogicalSystem[] logicalSystems)
    {
        this.logicalSystems = logicalSystems;
    }

    public HtmlDataTable getIceTable()
    {
        return iceTable;
    }

    public void setIceTable(HtmlDataTable iceTable)
    {
        this.iceTable = iceTable;
    }

    public String getSearchQuery()
    {
        return searchQuery;
    }

    public void setSearchQuery(String searchQuery)
    {
        this.searchQuery = searchQuery;
    }

    public String getSelectedEffectType()
    {
        return selectedEffectType;
    }

    public void setSelectedEffectType(String selectedEffectType)
    {
        this.selectedEffectType = selectedEffectType;
    }

    public String getSelectedSearchMode()
    {
        return selectedSearchMode;
    }

    public void setSelectedSearchMode(String selectedSearchMode)
    {
        this.selectedSearchMode = selectedSearchMode;
    }

    public String[] getSelectedColumns()
    {
        return selectedColumns;
    }

    public void setSelectedColumns(String[] selectedColumns)
    {
        this.selectedColumns = selectedColumns;
    }

    public boolean isCaseSensitive()
    {
        return caseSensitive;
    }

    public void setCaseSensitive(boolean caseSensitive)
    {
        this.caseSensitive = caseSensitive;
    }

    public boolean isNoResultsFound()
    {
        return noResultsFound;
    }

    public void setNoResultsFound(boolean noResultsFound)
    {
        this.noResultsFound = noResultsFound;
    }

    public void find(javax.faces.event.ActionEvent e) {
        lastFoundIndex = iceTable.findRow(searchQuery, selectedColumns, lastFoundIndex + 1, selectedSearchMode, caseSensitive);

        if (lastFoundIndex != -1) {
            noResultsFound = false;
            if (selectedEffectType.equals("default"))
                iceTable.navigateToRow(lastFoundIndex);
            else if (selectedEffectType.equals("pulsate"))
                iceTable.navigateToRow(lastFoundIndex, new Pulsate());
            else if (selectedEffectType.equals("none"))
                iceTable.navigateToRow(lastFoundIndex, null);
        } else {
            noResultsFound = true;
        }
    }
}
4

0 回答 0