View Javadoc
1   /*
2    * Copyright (C) 2003-2011 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.ecm.webui.core;
18  
19  import java.util.List;
20  
21  import org.exoplatform.webui.config.annotation.ComponentConfig;
22  import org.exoplatform.webui.core.UIComponent;
23  import org.exoplatform.webui.core.UIGrid;
24  
25  /**
26   * Created by The eXo Platform SAS
27   * Author : Dang Viet Ha
28   *          hadv@exoplatform.com
29   * 30-05-2011  
30   */
31  @ComponentConfig(template = "classpath:groovy/ecm/webui/core/UIGrid.gtmpl")
32  public abstract class UIPagingGrid extends UIGrid {
33    /** The page iterator */
34    protected UIECMPageIterator uiPageIterator_;
35  
36    public UIPagingGrid() throws Exception
37    {
38       uiPageIterator_ = createUIComponent(UIECMPageIterator.class, null, null);
39       uiPageIterator_.setParent(this);
40    }
41    
42    public abstract void refresh(int currentPage) throws Exception;
43    
44    public UIECMPageIterator getUIPageIterator()
45    {
46       return uiPageIterator_;
47    }
48  
49  
50    public List<?> getBeans() throws Exception
51    {
52       return uiPageIterator_.getCurrentPageData();
53    }
54  
55    public UIComponent findComponentById(String lookupId)
56    {
57       if (uiPageIterator_.getId().equals(lookupId))
58       {
59          return uiPageIterator_;
60       }
61       return super.findComponentById(lookupId);
62    }
63  }