Revision 37577 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/command/CommandStackDialog.java
CommandStackDialog.java | ||
---|---|---|
74 | 74 |
initSlider(); |
75 | 75 |
currentValue = commandTableModel.getPos(); |
76 | 76 |
refreshControls(); |
77 |
refreshScroll();
|
|
77 |
refreshSliderSize();
|
|
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
/** |
... | ... | |
188 | 188 |
public void commandRepaint() { |
189 | 189 |
setValue(commandTableModel.getPos()+1,true); |
190 | 190 |
refreshControls(); |
191 |
refreshScroll();
|
|
191 |
refreshSliderSize();
|
|
192 | 192 |
} |
193 |
private void refreshScroll(){ |
|
194 |
Dimension size=new Dimension(commandSlider.getPreferredSize().width,((commandTableModel.getRowCount())*getTable().getRowHeight())); |
|
195 |
JScrollBar verticalScrollBar=getJScrollPane().getVerticalScrollBar();//ove(size.width,size.height); |
|
196 |
verticalScrollBar.setValue(commandTableModel.getPos()*getTable().getRowHeight()); |
|
197 |
commandSlider.setPreferredSize(size); |
|
198 |
commandSlider.setSize(size); |
|
199 |
validateTree(); |
|
200 |
} |
|
193 |
|
|
194 |
/** |
|
195 |
* Refreshes all the mutable controls in this component. |
|
196 |
*/ |
|
197 |
private void refreshControls() { |
|
198 |
int normalizedValue = (int) (((commandTableModel.getRowCount()-currentValue) / (float) commandTableModel.getRowCount())*100); |
|
199 |
refreshSlider(normalizedValue); |
|
200 |
commandTable.repaint(); |
|
201 |
} |
|
202 |
/** |
|
203 |
* Sets the slider to the correct (scaled) position. |
|
204 |
* @param normalizedValue |
|
205 |
*/ |
|
206 |
private void refreshSlider(int normalizedValue) { |
|
207 |
if (!refreshing){ |
|
208 |
refreshing = true; |
|
209 |
getJSlider().setValue(normalizedValue); |
|
210 |
refreshing = false; |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
private void refreshSliderSize(){ |
|
215 |
if (!refreshing){ |
|
216 |
Dimension size=new Dimension(commandSlider.getPreferredSize().width,((commandTableModel.getRowCount())*getTable().getRowHeight())); |
|
217 |
JScrollBar verticalScrollBar=getJScrollPane().getVerticalScrollBar();//ove(size.width,size.height); |
|
218 |
verticalScrollBar.setValue(commandTableModel.getPos()*getTable().getRowHeight()); |
|
219 |
commandSlider.setPreferredSize(size); |
|
220 |
commandSlider.setSize(size); |
|
221 |
validateTree(); |
|
222 |
} |
|
223 |
} |
|
224 |
|
|
201 | 225 |
|
202 | 226 |
/** |
203 | 227 |
* This method initializes jSlider |
... | ... | |
223 | 247 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
224 | 248 |
int value = (int) (getJSlider().getValue() * commandTableModel.getRowCount() * 0.01); |
225 | 249 |
if (!refreshing) { |
250 |
refreshing = true; |
|
226 | 251 |
commandTableModel.setPos(commandTableModel.getRowCount()-1-value); |
227 |
//System.out.println("setPos = "+(cr.getCommandCount()-1-value));
|
|
252 |
refreshing = false;
|
|
228 | 253 |
} |
229 | 254 |
} |
230 | 255 |
}); |
... | ... | |
252 | 277 |
getTable().clearSelection(); |
253 | 278 |
} |
254 | 279 |
} |
255 |
/** |
|
256 |
* Refreshes all the mutable controls in this component. |
|
257 |
*/ |
|
258 |
private void refreshControls() { |
|
259 |
int normalizedValue = (int) (((commandTableModel.getRowCount()-currentValue) / (float) commandTableModel.getRowCount())*100); |
|
260 |
refreshSlider(normalizedValue); |
|
261 |
commandTable.repaint(); |
|
262 |
} |
|
263 |
/** |
|
264 |
* Sets the slider to the correct (scaled) position. |
|
265 |
* @param normalizedValue |
|
266 |
*/ |
|
267 |
private void refreshSlider(int normalizedValue) { |
|
268 |
refreshing = true; |
|
269 |
getJSlider().setValue(normalizedValue); |
|
270 |
refreshing = false; |
|
271 |
} |
|
272 | 280 |
|
273 | 281 |
/** |
274 | 282 |
* This method initializes jPanel1 |
... | ... | |
283 | 291 |
return sliderPanel; |
284 | 292 |
} |
285 | 293 |
|
286 |
|
|
287 |
|
|
288 | 294 |
/** |
289 | 295 |
* This method initializes pCenter |
290 | 296 |
* |
... | ... | |
326 | 332 |
return; |
327 | 333 |
} |
328 | 334 |
} |
329 |
commandRepaint();
|
|
335 |
commandRepaint();
|
|
330 | 336 |
} |
331 | 337 |
|
332 | 338 |
public Object getWindowProfile() { |
Also available in: Unified diff