All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.jarch.faces.controller.SelectableDataModelImpl Maven / Gradle / Ivy

package br.com.jarch.faces.controller;

import br.com.jarch.core.model.IIdentity;
import org.primefaces.model.SelectableDataModel;

import javax.faces.model.ListDataModel;
import java.util.List;

public class SelectableDataModelImpl extends ListDataModel implements SelectableDataModel {

    public SelectableDataModelImpl(List data) {
        super(data);
    }

    @Override
    public E getRowData(String rowKey) {
        List list = (List) getWrappedData();

        for (E entity : list) {
            if (entity.getRowKey().equals(rowKey)) {
                return entity;
            }
        }

        return null;
    }

    @Override
    public String getRowKey(E item) {
        return item.getRowKey();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy