KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > datagrid > Datagrid


1 /*
2  * Created on 5 avr. 2004
3  *
4  * Copyright Improve SA 2004.
5  * All rights reserved.
6  */

7 package fr.improve.struts.taglib.layout.datagrid;
8
9 import java.io.Serializable JavaDoc;
10 import java.util.Collection JavaDoc;
11 import java.util.List JavaDoc;
12
13
14 /**
15  * The class Datagrid allows to easily manipulate a list of objects.
16  * The user simply set the object list, the class of the object,
17  * and get back the list of added, removed or modified objects.
18  *
19  * @author jnribette
20  */

21 public abstract class Datagrid implements Serializable JavaDoc {
22     // --------------- public interface -----------------------
23

24     /**
25      * Predefined state REMOVED.
26      */

27     public static final String JavaDoc REMOVED = "removed";
28     
29     /**
30      * Predefined state SELECTED.
31      */

32     public static final String JavaDoc SELECTED = "selected";
33     
34     /**
35      * Get a new datagrid.
36      */

37     public static Datagrid getInstance() {
38         return new DatagridImpl();
39     }
40     
41     /**
42      * Set the data of the datagrid.
43      */

44     public abstract void setData(List JavaDoc in_list);
45     
46     /**
47      * Set the class of the object in the datagrid.
48      * Used to create the new object.
49      * The class must have a public non argument constructor.
50      */

51     public abstract void setDataClass(Class JavaDoc in_class);
52     
53     /**
54      * Set the state of the object in the datagrid at the specified position.
55      * @param in_index the object position in the datagrid.
56      * @param in_state the object state
57      */

58     public abstract void setDataState(int in_index, String JavaDoc in_state);
59     
60     /**
61      * Return the data that have been deleted.
62      */

63     public abstract Collection JavaDoc getDeletedData();
64
65     /**
66      * Return the new data.
67      */

68     public abstract Collection JavaDoc getAddedData();
69     
70     /**
71      * Return the modified data.
72      */

73     public abstract Collection JavaDoc getModifiedData();
74     
75     /**
76      * Return the selected data.
77      */

78     public abstract Collection JavaDoc getSelectedData();
79     
80     /**
81      * Return the data having the specified state.
82      */

83     public abstract Collection JavaDoc getDataWithState(String JavaDoc in_state);
84     
85     /**
86      * Prepare the datagrid for an update.
87      */

88     public abstract void preUpdate();
89 }
90
Popular Tags