KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > albel > tags > table > test > TestHandler


1 /*
2  * TestHandler.java
3  *
4  * Created on Ketvirtadienis, 2004, Rugsėjo 9, 10.23
5  */

6
7 package albel.tags.table.test;
8
9 /**
10  *
11  * @author alblau
12  */

13 import java.util.*;
14 public class TestHandler implements albel.tags.table.model.IRowHandler
15 {
16     
17     private ArrayList list=null;
18     /** Creates a new instance of TestHandler */
19     public TestHandler()
20     {
21     }
22     
23     public void handleUpdate(albel.tags.table.model.Table t, albel.tags.table.model.Cell[] cells) throws albel.tags.table.model.TableTagException
24     {
25         TestBean tb=(TestBean)t.getSourceBean(t.getTableState().getSelectedRow());
26         for(int i=0;i<cells.length;i++)
27         {
28             albel.tags.table.model.Cell c=cells[i];
29             try
30             {
31                 t.setCell(c);
32                 /*org.apache.commons.beanutils.BeanUtils.
33                     setProperty(tb, c.getColumn().getProperty(), c.getValue());*/

34             }
35             catch (Exception JavaDoc e)
36             {
37                 throw new albel.tags.table.model.TableTagException(e);
38             }
39         }
40     }
41     public java.util.List JavaDoc handleLoad() throws albel.tags.table.model.TableTagException
42     {
43         if(list==null)
44         {
45             list=new ArrayList();
46             TestBean b1=new TestBean();
47             b1.setName("Name1");
48             b1.setCount(5);
49             TestBean b2=new TestBean();
50             b2.setName("Name2");
51             b2.setCount(7);
52             list.add(b1);
53             list.add(b2);
54         }
55         return list;
56     }
57     public void handleCreate(albel.tags.table.model.Table t,albel.tags.table.model.Cell cells[])
58     throws albel.tags.table.model.TableTagException
59     {
60         t.insertCells(cells);
61     }
62     
63         public void handleDelete(albel.tags.table.model.Row row) throws albel.tags.table.model.TableTagException {
64             row.getTable().deleteRow(row);
65         }
66         
67 }
68
Popular Tags