package com.corejsf;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;

import javax.inject.Named; 
   // lub import javax.faces.bean.ManagedBean;
import javax.enterprise.context.SessionScoped; 
   // lub import javax.faces.bean.SessionScoped;

@Named // lub @ManagedBean
@SessionScoped
public class TableData implements Serializable {
   private ArrayList<Name> names = new ArrayList<Name>(Arrays.asList(
      new Name("Anna", "Kowalska"),
      new Name("Jan", "Winnicki"),
      new Name("Mariusz", "Rachwa³"),
      new Name("Jan", "Waligóra")
   ));
        
   public ArrayList<Name> getNames() {
      return names;
   }
   
   public String deleteRow(Name nameToDelete) {
      names.remove(nameToDelete);
      return null;
   }
}