KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > component > model > ArrayDataHandler


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.component.model;
6 /**
7  * Jun 30, 2004
8  * @author: Tuan Nguyen
9  * @email: tuan08@users.sourceforge.net
10  * @version: $Id: ListDataHandler.java,v 1.6 2004/11/03 04:24:53 tuan08 Exp $
11  */

12 abstract public class ArrayDataHandler implements DataHandler {
13   protected Object JavaDoc[] datas_;
14   protected int currentRow_;
15   
16   public ArrayDataHandler() {
17
18   }
19
20   public ArrayDataHandler setDatas(Object JavaDoc[] datas) {
21     datas_ = datas;
22     return this;
23   }
24
25   public void begin() {
26     currentRow_ = -1;
27   }
28
29   public void end() {
30   }
31
32   public boolean nextRow() {
33     currentRow_++;
34     if (datas_ != null) {
35       if (currentRow_ < datas_.length) {
36         setCurrentObject(datas_[currentRow_]);
37         return true;
38       }
39     }
40     return false;
41   }
42
43   public int getCurrentRow() { return currentRow_; }
44
45   public Object JavaDoc getCurrentObject() { return datas_[currentRow_]; }
46
47   public String JavaDoc getCurrentObjectId() { return null; }
48
49   public Object JavaDoc getObject(int index) { return datas_[index]; }
50   
51   public Object JavaDoc[] getDatas() { return datas_ ; }
52 }
Popular Tags