Revision 298 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/set/DynObjectSetModel.java
DynObjectSetModel.java | ||
---|---|---|
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
/** |
78 |
* Moves the current position to the first one, if it is not already there. |
|
79 |
*/ |
|
80 |
public void first() { |
|
81 |
if (currentPosition != 0) { |
|
82 |
currentPosition = 0; |
|
83 |
notifyObservers(); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Returns the {@link DynObject} at the current position. |
|
89 |
* |
|
90 |
* @return the current DynObject |
|
91 |
* @throws BaseException |
|
92 |
* if there is an error getting the DynObject |
|
93 |
*/ |
|
94 |
public DynObject getCurrentDynObject() throws BaseException { |
|
95 |
return helper.getDynObjectAt(currentPosition); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
78 | 99 |
* Returns the position of the current element. |
79 | 100 |
* |
80 | 101 |
* @return the current position |
... | ... | |
84 | 105 |
} |
85 | 106 |
|
86 | 107 |
/** |
108 |
* Returns the {@link DynObjectSet} used by this model. |
|
109 |
* |
|
110 |
* @return the DynObjectSet used by this model |
|
111 |
*/ |
|
112 |
public DynObjectSet getDynObjectSet() { |
|
113 |
return helper.getDynObjectSet(); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
87 | 117 |
* Returns the number of DynObjects. |
88 | 118 |
* |
89 | 119 |
* @return the number of DynObjects |
... | ... | |
111 | 141 |
} |
112 | 142 |
|
113 | 143 |
/** |
144 |
* Moves the current position to the last one, if it is not already there. |
|
145 |
*/ |
|
146 |
public void last() { |
|
147 |
long lastPosition = helper.getTotalSize() - 1; |
|
148 |
if (currentPosition != lastPosition) { |
|
149 |
currentPosition = lastPosition; |
|
150 |
notifyObservers(); |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
114 | 155 |
* Moves the current position to the next one, if it exists. |
115 | 156 |
*/ |
116 | 157 |
public void next() { |
... | ... | |
130 | 171 |
} |
131 | 172 |
} |
132 | 173 |
|
133 |
/** |
|
134 |
* Moves the current position to the first one, if it is not already there. |
|
135 |
*/ |
|
136 |
public void first() { |
|
137 |
if (currentPosition != 0) { |
|
138 |
currentPosition = 0; |
|
139 |
notifyObservers(); |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* Moves the current position to the last one, if it is not already there. |
|
145 |
*/ |
|
146 |
public void last() { |
|
147 |
long lastPosition = helper.getTotalSize() - 1; |
|
148 |
if (currentPosition != lastPosition) { |
|
149 |
currentPosition = lastPosition; |
|
150 |
notifyObservers(); |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* Returns the {@link DynObject} at the current position. |
|
156 |
* |
|
157 |
* @return the current DynObject |
|
158 |
* @throws BaseException |
|
159 |
* if there is an error getting the DynObject |
|
160 |
*/ |
|
161 |
public DynObject getCurrentDynObject() throws BaseException { |
|
162 |
return helper.getDynObjectAt(currentPosition); |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 |
* Returns the {@link DynObjectSet} used by this model. |
|
167 |
* |
|
168 |
* @return the DynObjectSet used by this model |
|
169 |
*/ |
|
170 |
public DynObjectSet getDynObjectSet() { |
|
171 |
return helper.getDynObjectSet(); |
|
172 |
} |
|
173 |
|
|
174 | 174 |
} |
Also available in: Unified diff