Revision 1405 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/subform/FormSetButtonBar.java
FormSetButtonBar.java | ||
---|---|---|
62 | 62 |
public static final int ActionLast = 4; |
63 | 63 |
public static final int ActionSave = 5; |
64 | 64 |
public static final int ActionNew = 6; |
65 |
public static final int ActionDelete = 7; |
|
66 |
public static final int ActionSearch = 8; |
|
67 |
public static final int ActionClose = 9; |
|
68 |
public static final int ActionSetCurrentRecord = 10; |
|
65 |
public static final int ActionCancelNew = 7; |
|
66 |
public static final int ActionDelete = 8; |
|
67 |
public static final int ActionSearch = 9; |
|
68 |
public static final int ActionClose = 10; |
|
69 |
public static final int ActionSetCurrentRecord = 11; |
|
69 | 70 |
|
70 |
private static final int MAX_ACTIONS = 10;
|
|
71 |
private static final int MAX_ACTIONS = 11;
|
|
71 | 72 |
|
72 | 73 |
public Boolean activatedActions[] = new Boolean[MAX_ACTIONS]; |
73 | 74 |
|
... | ... | |
88 | 89 |
|
89 | 90 |
public boolean doActionNew(); |
90 | 91 |
|
92 |
public boolean doActionCancelNew(); |
|
93 |
|
|
91 | 94 |
public boolean doActionDelete(); |
92 | 95 |
|
93 | 96 |
public boolean doActionSearch(); |
... | ... | |
100 | 103 |
private JPanel contents = null; |
101 | 104 |
private Set listeners = null; |
102 | 105 |
private int current = 0; |
106 |
private String currentLabel = null; |
|
103 | 107 |
private int numrecords = 0; |
104 | 108 |
|
105 | 109 |
private JPanel othersButtons; |
... | ... | |
195 | 199 |
case ActionNew: |
196 | 200 |
listener.doActionNew(); |
197 | 201 |
break; |
202 |
case ActionCancelNew: |
|
203 |
listener.doActionCancelNew(); |
|
204 |
break; |
|
198 | 205 |
case ActionDelete: |
199 | 206 |
listener.doActionDelete(); |
200 | 207 |
break; |
... | ... | |
228 | 235 |
setEnabled(ActionLast, false); |
229 | 236 |
return; |
230 | 237 |
} |
231 |
this.records.setText((current + 1) + " / " + numrecords); |
|
238 |
if( this.currentLabel==null ) { |
|
239 |
this.records.setText((current + 1) + " / " + numrecords); |
|
240 |
} else { |
|
241 |
this.records.setText(this.currentLabel + " / " + numrecords); |
|
242 |
} |
|
232 | 243 |
if (current <= 0) { |
233 | 244 |
current = 0; |
234 | 245 |
setEnabled(ActionFirst, false); |
... | ... | |
303 | 314 |
|
304 | 315 |
contents.add(createButton(i18nManager.getTranslation("guardar"), "save.png", ActionSave)); |
305 | 316 |
contents.add(createButton(i18nManager.getTranslation("nuevo"), "new.png", ActionNew)); |
317 |
contents.add(createButton(i18nManager.getTranslation("cancelar nuevo"), "cancelnew.png", ActionCancelNew)); |
|
306 | 318 |
contents.add(createButton(i18nManager.getTranslation("borrar"), "delete.png", ActionDelete)); |
307 | 319 |
contents.add(createButton(i18nManager.getTranslation("search"), "search.png", ActionSearch)); |
308 | 320 |
|
... | ... | |
373 | 385 |
} |
374 | 386 |
} |
375 | 387 |
|
388 |
public void setVisible(int action, boolean visible) { |
|
389 |
JButton button = this.buttons[action]; |
|
390 |
if (visible) { |
|
391 |
button.setVisible(true); |
|
392 |
} else { |
|
393 |
button.setVisible(false); |
|
394 |
} |
|
395 |
} |
|
396 |
|
|
376 | 397 |
public void setCurrent(int current) { |
377 | 398 |
this.current = current; |
378 | 399 |
updateRecords(); |
379 | 400 |
} |
380 | 401 |
|
402 |
public void setCurrentLabel(String label) { |
|
403 |
this.currentLabel = label; |
|
404 |
updateRecords(); |
|
405 |
} |
|
406 |
|
|
381 | 407 |
public void setNumrecords(int numrecords) { |
382 | 408 |
this.numrecords = numrecords; |
383 | 409 |
updateRecords(); |
Also available in: Unified diff