Revision 2917
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/base/FormSetButtonBar.java | ||
---|---|---|
25 | 25 |
import java.awt.Cursor; |
26 | 26 |
import java.awt.Dimension; |
27 | 27 |
import java.awt.FlowLayout; |
28 |
import java.awt.GridBagConstraints; |
|
29 |
import java.awt.GridBagLayout; |
|
28 | 30 |
import java.awt.event.ActionEvent; |
29 | 31 |
import java.awt.event.KeyEvent; |
30 | 32 |
import java.util.ArrayList; |
... | ... | |
41 | 43 |
import javax.swing.ImageIcon; |
42 | 44 |
import javax.swing.JButton; |
43 | 45 |
import javax.swing.JComponent; |
46 |
import javax.swing.JLabel; |
|
44 | 47 |
import javax.swing.JOptionPane; |
45 | 48 |
import javax.swing.JPanel; |
46 | 49 |
import javax.swing.SwingConstants; |
47 | 50 |
import org.apache.commons.lang3.StringUtils; |
48 | 51 |
|
49 | 52 |
import org.gvsig.tools.ToolsLocator; |
50 |
import org.gvsig.tools.dynform.JDynFormSet; |
|
51 | 53 |
import static org.gvsig.tools.dynform.JDynFormSet.ACTION_CANCEL_NEW; |
52 | 54 |
import static org.gvsig.tools.dynform.JDynFormSet.ACTION_CLOSE; |
53 | 55 |
import static org.gvsig.tools.dynform.JDynFormSet.ACTION_DELETE; |
... | ... | |
306 | 308 |
|
307 | 309 |
private void initComponents() { |
308 | 310 |
this.contents = new JPanel(); |
309 |
this.contents.setLayout(new FlowLayout(FlowLayout.LEADING, 4, 4)); |
|
311 |
this.contents.setLayout(new GridBagLayout()); |
|
312 |
GridBagConstraints c = new GridBagConstraints(); |
|
313 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
314 |
c.weightx = 0; |
|
315 |
c.ipady = 1; |
|
316 |
c.gridy = 0; |
|
317 |
c.gridy = 0; |
|
310 | 318 |
|
311 |
this.contents.add(getStandardButtonBar()); |
|
319 |
c.gridx = 0; |
|
320 |
this.contents.add(getStandardButtonBar(),c); |
|
312 | 321 |
|
313 | 322 |
this.othersButtons = new JPanel(); |
314 | 323 |
this.othersButtons.setLayout(new FlowLayout(FlowLayout.LEADING, 4, 4)); |
315 |
this.contents.add(this.othersButtons); |
|
316 |
|
|
317 | 324 |
for (Action action : this.otherActions) { |
318 | 325 |
this.othersButtons.add(new JButton(action)); |
319 | 326 |
} |
327 |
c.gridx = 1; |
|
328 |
this.contents.add(this.othersButtons,c); |
|
329 |
|
|
330 |
c.gridx = 2; |
|
320 | 331 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
321 |
this.contents.add(createButton(i18n.getTranslation("_Close"), "common-form-close", ACTION_CLOSE, KeyEvent.VK_UNDEFINED)); |
|
332 |
this.contents.add(createButton(i18n.getTranslation("_Close"), "common-form-close", ACTION_CLOSE, KeyEvent.VK_UNDEFINED),c); |
|
333 |
|
|
334 |
c.weightx = 1; |
|
335 |
c.gridx = 3; |
|
336 |
this.contents.add(new JLabel(),c); |
|
322 | 337 |
this.initButtons(); |
323 | 338 |
this.updateRecords(); |
324 | 339 |
} |
... | ... | |
326 | 341 |
private JPanel getStandardButtonBar() { |
327 | 342 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
328 | 343 |
JPanel theContents = new JPanel(); |
329 |
theContents.setLayout(new FlowLayout(FlowLayout.LEADING, 4, 4)); |
|
344 |
theContents.setLayout(new GridBagLayout()); |
|
345 |
GridBagConstraints c = new GridBagConstraints(); |
|
346 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
347 |
c.weightx = 0; |
|
348 |
c.ipadx = 2; |
|
349 |
c.ipady = 1; |
|
350 |
c.gridy = 0; |
|
330 | 351 |
|
352 |
|
|
331 | 353 |
JComponent firstButton = createButton(i18nManager.getTranslation("_first"), "common-form-first", ACTION_FIRST, KeyEvent.CTRL_MASK + KeyEvent.VK_PAGE_UP); |
332 |
theContents.add(firstButton);
|
|
333 |
theContents.add(createButton(i18nManager.getTranslation("_back"), "common-form-previous", ACTION_PREVIOUS, KeyEvent.VK_PAGE_UP));
|
|
354 |
c.gridx = 0; theContents.add(firstButton,c);
|
|
355 |
c.gridx = 1; theContents.add(createButton(i18nManager.getTranslation("_back"), "common-form-previous", ACTION_PREVIOUS, KeyEvent.VK_PAGE_UP),c);
|
|
334 | 356 |
|
335 | 357 |
this.records = new JButton(); |
336 | 358 |
this.records.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
... | ... | |
346 | 368 |
this.records.setPreferredSize(new Dimension(COUNTER_WIDTH, height)); |
347 | 369 |
this.records.setHorizontalAlignment(SwingConstants.CENTER); |
348 | 370 |
this.buttons[ID_ACTION_SET_CURRENT_RECORD] = this.records; |
349 |
theContents.add(this.records);
|
|
371 |
c.gridx = 2; theContents.add(this.records,c);
|
|
350 | 372 |
|
351 |
theContents.add(createButton(i18nManager.getTranslation("_next"), "common-form-next", ACTION_NEXT, KeyEvent.VK_PAGE_DOWN));
|
|
352 |
theContents.add(createButton(i18nManager.getTranslation("_last"), "common-form-last", ACTION_LAST, KeyEvent.CTRL_MASK + KeyEvent.VK_PAGE_DOWN));
|
|
373 |
c.gridx = 3; theContents.add(createButton(i18nManager.getTranslation("_next"), "common-form-next", ACTION_NEXT, KeyEvent.VK_PAGE_DOWN),c);
|
|
374 |
c.gridx = 4; theContents.add(createButton(i18nManager.getTranslation("_last"), "common-form-last", ACTION_LAST, KeyEvent.CTRL_MASK + KeyEvent.VK_PAGE_DOWN),c);
|
|
353 | 375 |
|
354 |
theContents.add(createButton(i18nManager.getTranslation("guardar"), "common-form-save", ACTION_SAVE, KeyEvent.CTRL_MASK + KeyEvent.VK_S));
|
|
355 |
theContents.add(createButton(i18nManager.getTranslation("nuevo"), "common-form-new", ACTION_NEW, KeyEvent.VK_F6));
|
|
356 |
theContents.add(createButton(i18nManager.getTranslation("cancelar nuevo"), "common-form-cancelnew", ACTION_CANCEL_NEW, KeyEvent.VK_F12));
|
|
357 |
theContents.add(createButton(i18nManager.getTranslation("borrar"), "common-form-delete", ACTION_DELETE, KeyEvent.SHIFT_MASK + KeyEvent.VK_F2));
|
|
358 |
theContents.add(createButton(i18nManager.getTranslation("search"), "common-form-search", ACTION_SEARCH, KeyEvent.CTRL_MASK + KeyEvent.VK_F));
|
|
376 |
c.gridx = 5; theContents.add(createButton(i18nManager.getTranslation("guardar"), "common-form-save", ACTION_SAVE, KeyEvent.CTRL_MASK + KeyEvent.VK_S),c);
|
|
377 |
c.gridx = 6; theContents.add(createButton(i18nManager.getTranslation("nuevo"), "common-form-new", ACTION_NEW, KeyEvent.VK_F6),c);
|
|
378 |
c.gridx = 7; theContents.add(createButton(i18nManager.getTranslation("cancelar nuevo"), "common-form-cancelnew", ACTION_CANCEL_NEW, KeyEvent.VK_F12),c);
|
|
379 |
c.gridx = 8; theContents.add(createButton(i18nManager.getTranslation("borrar"), "common-form-delete", ACTION_DELETE, KeyEvent.SHIFT_MASK + KeyEvent.VK_F2),c);
|
|
380 |
c.gridx = 9; theContents.add(createButton(i18nManager.getTranslation("search"), "common-form-search", ACTION_SEARCH, KeyEvent.CTRL_MASK + KeyEvent.VK_F),c);
|
|
359 | 381 |
|
360 | 382 |
return theContents; |
361 | 383 |
} |
Also available in: Unified diff