Revision 37605 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/command/CommandStackDialog.java
CommandStackDialog.java | ||
---|---|---|
41 | 41 |
private int currentValue = -1; |
42 | 42 |
private JPanel sliderPanel = null; |
43 | 43 |
protected boolean refreshing; |
44 |
private JPanel commandTablePanel = null;
|
|
44 |
private JPanel centerPanel = null;
|
|
45 | 45 |
private JScrollPane jScrollPane = null; |
46 |
private JPanel tablePanel = null; |
|
46 | 47 |
|
47 | 48 |
private static final ImageIcon imodify = PluginServices.getIconTheme() |
48 | 49 |
.get("edition-modify-command"); |
... | ... | |
84 | 85 |
*/ |
85 | 86 |
private void initialize() { |
86 | 87 |
this.setLayout(new BorderLayout()); |
87 |
this.setSize(328, 229); |
|
88 |
this.add(getJPanel(), java.awt.BorderLayout.NORTH); |
|
88 |
this.setSize(328, 229); |
|
89 | 89 |
this.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
90 | 90 |
} |
91 | 91 |
|
... | ... | |
154 | 154 |
* |
155 | 155 |
* @return javax.swing.JPanel |
156 | 156 |
*/ |
157 |
private JPanel getJPanel() {
|
|
157 |
private JPanel getTopPanel() {
|
|
158 | 158 |
if (topPanel == null) { |
159 |
topPanel = new JPanel(); |
|
159 |
topPanel = new JPanel();
|
|
160 | 160 |
} |
161 | 161 |
return topPanel; |
162 | 162 |
} |
... | ... | |
214 | 214 |
private void refreshSliderSize(){ |
215 | 215 |
if (!refreshing){ |
216 | 216 |
Dimension size = new Dimension(commandSlider.getPreferredSize().width, |
217 |
((commandTableModel.getRowCount())*getTable().getRowHeight()));
|
|
217 |
((commandTableModel.getRowCount() + 1) * getTable().getRowHeight()));
|
|
218 | 218 |
JScrollBar verticalScrollBar = getJScrollPane().getVerticalScrollBar(); |
219 | 219 |
verticalScrollBar.setValue(commandTableModel.getPos()*getTable().getRowHeight()); |
220 | 220 |
commandSlider.setPreferredSize(size); |
... | ... | |
231 | 231 |
*/ |
232 | 232 |
private JSlider getJSlider() { |
233 | 233 |
if (commandSlider == null) { |
234 |
commandSlider = new JSlider(JSlider.VERTICAL, 0, 100, 0);
|
|
234 |
commandSlider = new JSlider(JSlider.VERTICAL, 0, 100, 0); |
|
235 | 235 |
} |
236 | 236 |
return commandSlider; |
237 | 237 |
} |
... | ... | |
263 | 263 |
|
264 | 264 |
int value = getJSlider().getValue(); |
265 | 265 |
value = (int) ((value * 0.01) * commandTableModel.getRowCount()); |
266 |
//If the slider in in the 100% the previous row has to be selected |
|
267 |
if (value == commandTableModel.getRowCount()){ |
|
268 |
value--; |
|
269 |
} |
|
266 |
|
|
270 | 267 |
//The bottom part of the slider starts in 100: take the reverse value |
271 | 268 |
value = (commandTableModel.getRowCount() - 1) - value; |
272 | 269 |
|
... | ... | |
296 | 293 |
* |
297 | 294 |
* @return javax.swing.JPanel |
298 | 295 |
*/ |
299 |
private JPanel getJPanel1() {
|
|
296 |
private JPanel getSliderPanel() {
|
|
300 | 297 |
if (sliderPanel == null) { |
301 | 298 |
sliderPanel = new JPanel(); |
302 | 299 |
sliderPanel.add(getJSlider()); |
... | ... | |
309 | 306 |
* |
310 | 307 |
* @return javax.swing.JPanel |
311 | 308 |
*/ |
312 |
private JPanel getPCenter() {
|
|
313 |
if (commandTablePanel == null) {
|
|
314 |
commandTablePanel = new JPanel();
|
|
315 |
commandTablePanel.setLayout(new BorderLayout());
|
|
316 |
commandTablePanel.add(getTable(), java.awt.BorderLayout.CENTER);
|
|
317 |
commandTablePanel.add(getJPanel1(), java.awt.BorderLayout.WEST);
|
|
309 |
private JPanel getCenterPanel() {
|
|
310 |
if (centerPanel == null) {
|
|
311 |
centerPanel = new JPanel();
|
|
312 |
centerPanel.setLayout(new BorderLayout());
|
|
313 |
centerPanel.add(getTablePanel(), java.awt.BorderLayout.CENTER);
|
|
314 |
centerPanel.add(getSliderPanel(), java.awt.BorderLayout.WEST);
|
|
318 | 315 |
} |
319 |
return commandTablePanel;
|
|
316 |
return centerPanel;
|
|
320 | 317 |
} |
318 |
|
|
319 |
private JPanel getTablePanel() { |
|
320 |
if (tablePanel == null) { |
|
321 |
tablePanel = new JPanel(); |
|
322 |
tablePanel.setLayout(new BorderLayout()); |
|
323 |
tablePanel.add(getTable(), java.awt.BorderLayout.CENTER); |
|
324 |
tablePanel.add(getTopPanel(), java.awt.BorderLayout.NORTH); |
|
325 |
} |
|
326 |
return tablePanel; |
|
327 |
} |
|
321 | 328 |
|
322 | 329 |
/** |
323 | 330 |
* This method initializes jScrollPane |
... | ... | |
327 | 334 |
private JScrollPane getJScrollPane() { |
328 | 335 |
if (jScrollPane == null) { |
329 | 336 |
jScrollPane = new JScrollPane(); |
330 |
jScrollPane.setViewportView(getPCenter());
|
|
337 |
jScrollPane.setViewportView(getCenterPanel());
|
|
331 | 338 |
} |
332 | 339 |
return jScrollPane; |
333 | 340 |
} |
Also available in: Unified diff