Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 23 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23 Rev 25
1
/*
1
/*
2
 * Copyright 2006 Google Inc.
2
 * Copyright 2006 Google Inc.
3
 * 
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
 * use this file except in compliance with the License. You may obtain a copy of
5
 * use this file except in compliance with the License. You may obtain a copy of
6
 * the License at
6
 * the License at
7
 * 
7
 * 
8
 * http://www.apache.org/licenses/LICENSE-2.0
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 * 
9
 * 
10
 * Unless required by applicable law or agreed to in writing, software
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
 * License for the specific language governing permissions and limitations under
13
 * License for the specific language governing permissions and limitations under
14
 * the License.
14
 * the License.
15
 */
15
 */
16
package org.tela_botanica.client;
16
package org.tela_botanica.client;
17
 
17
 
18
 
18
 
19
import com.google.gwt.user.client.Window;
19
import com.google.gwt.user.client.Window;
20
import com.google.gwt.user.client.ui.ClickListener;
20
import com.google.gwt.user.client.ui.ClickListener;
21
import com.google.gwt.user.client.ui.Composite;
21
import com.google.gwt.user.client.ui.Composite;
22
import com.google.gwt.user.client.ui.HTML;
22
import com.google.gwt.user.client.ui.HTML;
23
import com.google.gwt.user.client.ui.HorizontalPanel;
23
import com.google.gwt.user.client.ui.HorizontalPanel;
24
import com.google.gwt.user.client.ui.Label;
24
import com.google.gwt.user.client.ui.Label;
25
import com.google.gwt.user.client.ui.Widget;
25
import com.google.gwt.user.client.ui.Widget;
26
 
26
 
27
/**
27
/**
28
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
28
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
29
 */
29
 */
30
 
30
 
31
public class ActionPanel extends Composite   {
31
public class ActionPanel extends Composite   {
32
	
32
	
33
  Mediator mediator=null;
-
 
-
 
33
  private Mediator mediator=null;
34
 
34
  private HTML exportButton=null;
35
  
35
  
36
 
36
 
37
  public ActionPanel(final Mediator med) {
37
  public ActionPanel(final Mediator med) {
38
	 
38
	 
39
   mediator=med;
39
   mediator=med;
-
 
40
   
-
 
41
   mediator.registerActionPanel(this);
40
   
42
   
41
	HorizontalPanel outer = new HorizontalPanel();
43
	HorizontalPanel outer = new HorizontalPanel();
42
	HorizontalPanel buttons = new HorizontalPanel();
44
	HorizontalPanel buttons = new HorizontalPanel();
43
	buttons.setSpacing(3);
45
	buttons.setSpacing(3);
44
 
46
 
45
	
47
	
46
	// Transmission d'elements
48
	// Transmission d'elements
47
	
49
	
48
	HTML transButton=new HTML("Transmettre Tela Botanica");
50
	HTML transButton=new HTML("Transmettre Tela Botanica");
49
	transButton.setStyleName("html_button_long");
51
	transButton.setStyleName("html_button_long");
50
	transButton.addClickListener(
52
	transButton.addClickListener(
51
	    	new ClickListener() {
53
	    	new ClickListener() {
52
	    		public void onClick(Widget sender) {
54
	    		public void onClick(Widget sender) {
53
	    			// TODO : une action dans le mediator
55
	    			// TODO : une action dans le mediator
54
	    			if (mediator.getConnected()) {
56
	    			if (mediator.getConnected()) {
55
	    				mediator.getInventoryItemList().transmitElement();
57
	    				mediator.getInventoryItemList().transmitElement();
56
	    			}
58
	    			}
57
	    			else  {
59
	    			else  {
58
	    				Window.alert("Identifiez-vous pour transmettre");
60
	    				Window.alert("Identifiez-vous pour transmettre");
59
	    			}
61
	    			}
60
	    		}
62
	    		}
61
	     	}
63
	     	}
62
	);		
64
	);		
63
	
65
	
64
	buttons.add(transButton);
66
	buttons.add(transButton);
65
	
67
	
66
	// Suppression d'elements
68
	// Suppression d'elements
67
	
69
	
68
	HTML delButton=new HTML("Suppression");
70
	HTML delButton=new HTML("Suppression");
69
	delButton.setStyleName("html_button");
71
	delButton.setStyleName("html_button");
70
	delButton.addClickListener(
72
	delButton.addClickListener(
71
	    	new ClickListener() {
73
	    	new ClickListener() {
72
	    		public void onClick(Widget sender) {
74
	    		public void onClick(Widget sender) {
73
	    			// TODO : une action dans le mediator
75
	    			// TODO : une action dans le mediator
74
	    			mediator.getInventoryItemList().deleteElement();
76
	    			mediator.getInventoryItemList().deleteElement();
75
	    		}
77
	    		}
76
	     	}
78
	     	}
77
	);		
79
	);		
78
	
80
	
79
	buttons.add(delButton);
81
	buttons.add(delButton);
80
 
82
 
81
	// Export de la totalité 
83
	// Export de la totalité 
82
	
84
	
-
 
85
	exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" 
-
 
86
	+  mediator.getUser() + 
83
	HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout&nbsp;exporter</a>");
87
	"\">"+"Export&nbsp;tableur</a>");
84
	buttons.add(exportButton);
88
	buttons.add(exportButton);
85
	exportButton.setStyleName("html_button");
89
	exportButton.setStyleName("html_button");
86
 
90
 
87
 
-
 
88
	
91
 
89
	// Selections de l'affichage
92
	// Selections de l'affichage
90
	
93
	
91
	HorizontalPanel selections = new HorizontalPanel();
94
	HorizontalPanel selections = new HorizontalPanel();
92
	
95
	
93
	selections.setSpacing(3);
96
	selections.setSpacing(3);
94
	
97
	
95
 
98
 
96
	selections.add(new HTML("S&eacute;lection : "));
99
	selections.add(new HTML("S&eacute;lection : "));
97
	
100
	
98
	Label allLabel = new Label("Tous");
101
	Label allLabel = new Label("Tous");
99
	Label separatorLabel = new Label(",");
102
	Label separatorLabel = new Label(",");
100
	Label noneLabel = new Label("Aucun");
103
	Label noneLabel = new Label("Aucun");
101
	
104
	
102
	allLabel.setStyleName("selection_label");
105
	allLabel.setStyleName("selection_label");
103
	noneLabel.setStyleName("selection_label");
106
	noneLabel.setStyleName("selection_label");
104
	
107
	
105
	selections.add(allLabel);
108
	selections.add(allLabel);
106
	allLabel.addClickListener(
109
	allLabel.addClickListener(
107
		    	new ClickListener() {
110
		    	new ClickListener() {
108
		    		public void onClick(Widget sender) {
111
		    		public void onClick(Widget sender) {
109
		    			// TODO : une action dans le mediator
112
		    			// TODO : une action dans le mediator
110
		    			mediator.getInventoryItemList().selectAll();
113
		    			mediator.getInventoryItemList().selectAll();
111
		    		}
114
		    		}
112
		     	}
115
		     	}
113
	);		
116
	);		
114
	
117
	
115
	selections.add(separatorLabel);
118
	selections.add(separatorLabel);
116
	
119
	
117
	selections.add(noneLabel);
120
	selections.add(noneLabel);
118
	noneLabel.addClickListener(
121
	noneLabel.addClickListener(
119
		    	new ClickListener() {
122
		    	new ClickListener() {
120
		    		public void onClick(Widget sender) {
123
		    		public void onClick(Widget sender) {
121
		    			// TODO : une action dans le mediator
124
		    			// TODO : une action dans le mediator
122
		    			mediator.getInventoryItemList().deselectAll();
125
		    			mediator.getInventoryItemList().deselectAll();
123
		    		}
126
		    		}
124
		     	}
127
		     	}
125
	);		
128
	);		
126
	
129
	
127
 
130
 
128
	outer.add(buttons);
131
	outer.add(buttons);
129
	outer.add(selections);
132
	outer.add(selections);
130
 
133
 
131
	initWidget(outer);
134
	initWidget(outer);
132
	this.setStyleName("action-Panel");
135
	this.setStyleName("action-Panel");
133
   
136
   
134
    
137
    
135
  }
138
  }
-
 
139
 
-
 
140
 
-
 
141
public HTML getExportButton() {
-
 
142
	return exportButton;
-
 
143
}
136
}  
144
}  
137
145