| 28 |
ddelon |
1 |
/**
|
|
|
2 |
David Delon david.delon@clapas.net 2007
|
|
|
3 |
|
|
|
4 |
*/
|
|
|
5 |
|
|
|
6 |
/*
|
|
|
7 |
* ActionView.java : affichage actions sur releves saisie ou affiches (suppression, export etc...)
|
|
|
8 |
*
|
|
|
9 |
* TODO : appel de fonction du mediator, au lieu de passer par les methode de la classe de gestion d'affichage des releves (voir les TODO dans le
|
|
|
10 |
* corps de ce programme)
|
|
|
11 |
*
|
|
|
12 |
* 1: Le programme affiche les boutons commandant les actions sur les releves et arme les actions correspondantes
|
|
|
13 |
* - Transmission d'elements (vers tela botanica)
|
|
|
14 |
* - Suppression d'elements selectionnes
|
|
|
15 |
* - Export vers tableur
|
|
|
16 |
* - Selection / Deselection des releves affiches
|
|
|
17 |
*/
|
|
|
18 |
|
|
|
19 |
package org.tela_botanica.client;
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
import net.mygwt.ui.client.Style;
|
| 29 |
ddelon |
23 |
import net.mygwt.ui.client.event.BaseEvent;
|
|
|
24 |
import net.mygwt.ui.client.event.SelectionListener;
|
|
|
25 |
import net.mygwt.ui.client.widget.Button;
|
| 28 |
ddelon |
26 |
import net.mygwt.ui.client.widget.WidgetContainer;
|
|
|
27 |
import net.mygwt.ui.client.widget.layout.BorderLayoutData;
|
|
|
28 |
|
|
|
29 |
import com.google.gwt.user.client.Window;
|
|
|
30 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
31 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
| 29 |
ddelon |
32 |
|
| 28 |
ddelon |
33 |
public class ActionView {
|
|
|
34 |
|
|
|
35 |
private Mediator mediator=null;
|
|
|
36 |
private HTML exportButton=null;
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
public ActionView(final Mediator med) {
|
|
|
40 |
|
|
|
41 |
mediator=med;
|
|
|
42 |
|
|
|
43 |
HorizontalPanel panel = new HorizontalPanel();
|
|
|
44 |
HorizontalPanel buttons = new HorizontalPanel();
|
|
|
45 |
buttons.setSpacing(3);
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
// Transmission d'elements
|
| 29 |
ddelon |
49 |
|
|
|
50 |
Button transButton= new Button("Transmettre Tela Botanica",
|
|
|
51 |
new SelectionListener() {
|
|
|
52 |
public void widgetSelected(BaseEvent be) {
|
| 28 |
ddelon |
53 |
if (mediator.getConnected()) {
|
|
|
54 |
mediator.getInventoryListView().transmitElement();
|
|
|
55 |
}
|
|
|
56 |
else {
|
|
|
57 |
Window.alert("Identifiez-vous pour transmettre");
|
|
|
58 |
}
|
|
|
59 |
}
|
|
|
60 |
}
|
|
|
61 |
);
|
|
|
62 |
|
|
|
63 |
buttons.add(transButton);
|
|
|
64 |
|
|
|
65 |
// Suppression d'elements
|
| 29 |
ddelon |
66 |
|
|
|
67 |
Button delButton = new Button("Suppression",
|
|
|
68 |
new SelectionListener() {
|
|
|
69 |
public void widgetSelected(BaseEvent be) {
|
| 28 |
ddelon |
70 |
// TODO : une action dans le mediator
|
|
|
71 |
mediator.getInventoryListView().deleteElement();
|
|
|
72 |
}
|
|
|
73 |
}
|
|
|
74 |
);
|
|
|
75 |
|
|
|
76 |
buttons.add(delButton);
|
|
|
77 |
|
|
|
78 |
// Export (renseigne lors de l'affichage des releves )
|
|
|
79 |
|
|
|
80 |
exportButton=new HTML();
|
|
|
81 |
buttons.add(exportButton);
|
|
|
82 |
|
|
|
83 |
panel.add(buttons);
|
|
|
84 |
|
|
|
85 |
WidgetContainer center=mediator.getCenterContainer();
|
|
|
86 |
BorderLayoutData centerData = new BorderLayoutData(Style.SOUTH, .05f, 100, 300);
|
|
|
87 |
center.add(panel,centerData);
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
public HTML getExportButton() {
|
|
|
94 |
return exportButton;
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
/* +--Fin du code ---------------------------------------------------------------------------------------+
|
|
|
101 |
* $Log$
|
| 29 |
ddelon |
102 |
* Revision 1.1 2008-01-02 21:26:05 ddelon
|
|
|
103 |
* mise en place mygwt
|
|
|
104 |
*
|
| 28 |
ddelon |
105 |
* Revision 1.5 2007-12-22 14:48:53 ddelon
|
|
|
106 |
* Documentation et refactorisation
|
|
|
107 |
*
|
|
|
108 |
* Revision 1.5 2007-09-17 19:25:34 ddelon
|
|
|
109 |
* Documentation
|
|
|
110 |
*
|
|
|
111 |
*
|
|
|
112 |
*/
|