Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / paging / FeaturePagingHelper.java @ 24496

History | View | Annotate | Download (4.22 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Gobernment (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {DiSiD Technologies}  {Add pagination to a FeatureCollection}
26
 */
27
package org.gvsig.fmap.dal.feature.paging;
28

    
29
import org.gvsig.fmap.dal.exceptions.DataException;
30
import org.gvsig.fmap.dal.feature.*;
31

    
32
/**
33
 * Helper interface to access the values of a FeatureCollection by position.
34
 *
35
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
36
 */
37
public interface FeaturePagingHelper {
38

    
39
    static final int DEFAULT_PAGE_SIZE = 100;
40

    
41
    /**
42
     * Returns the current maximum number of Features per page.
43
     *
44
     * @return the current maximum page size
45
     */
46
    int getMaxPageSize();
47

    
48
    /**
49
     * Sets the current maximum number of Features per page. As the page size
50
     * changes, the current page of data is reloaded.
51
     * 
52
     * @param pageSize
53
     *            the maximum number of Feature per page
54
     * @throws DataException
55
     *             if there is an error reloading the current page
56
     */
57
    void setMaxPageSize(int pageSize) throws DataException;
58

    
59
    /**
60
     * Returns the number of pages available in the collection, calculated with
61
     * the total number of elements and the maximum number of elements per page.
62
     *
63
     * @return the number of pages available
64
     */
65
    long getNumPages();
66

    
67
    /**
68
     * Returns the number of the currently loaded page of Features (zero based).
69
     *
70
     * @return the current page number
71
     */
72
    long getCurrentPage();
73

    
74
    /**
75
     * Sets the current page number, and loads the Features for that page.
76
     * 
77
     * @param page
78
     *            the page to load
79
     * @throws DataException
80
     *             if there is an error setting the current page
81
     */
82
    void setCurrentPage(long page) throws DataException;
83

    
84
    /**
85
     * Returns the number of elements of the entire Collection.
86
     * 
87
     * @return the number of elements
88
     * @throws DataException
89
     *             if there is an error getting the total number of Features
90
     */
91
    long getTotalSize() throws DataException;
92

    
93
    /**
94
     * Returns the Feature located at the index position.
95
     * 
96
     * @param index
97
     *            to locate the Feature in the Collection
98
     * @return the Feature located at the index position
99
     * @throws DataException
100
     *             if there is an error getting the Feature
101
     */
102
    Feature getFeatureAt(long index) throws DataException;
103

    
104
    /**
105
     * Returns all the values of the current loaded page.
106
     *
107
     * @return all the values of the current loaded page
108
     */
109
    Feature[] getCurrentPageFeatures();
110

    
111
    /**
112
     * Returns the FeatureSet used to fetch the data.
113
     * 
114
     * @return the FeatureSet
115
     */
116
    FeatureSet getFeatureSet();
117

    
118
    /**
119
     * Returns the FeatureStore used to fetch the data.
120
     *
121
     * @return the FeatureStore
122
     */
123
    FeatureStore getFeatureStore();
124

    
125
    /**
126
     * Returns the query used to load the Features.
127
     * 
128
     * @return the query used to load the Features
129
     */
130
    FeatureQuery getFeatureQuery();
131

    
132
    /**
133
     * Reloads the current page of data from the collection.
134
     * 
135
     * @throws DataException
136
     *             if there is an error reloading the current page
137
     */
138
    void reloadCurrentPage() throws DataException;
139

    
140
        /**
141
         * Reloads everything, using the current query.
142
         * 
143
         * @throws DataException
144
         */
145
    void reload() throws DataException;
146
}