Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 14 Rev 23
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
  Mediator mediator=null;
34
 
34
 
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
   mediator.registerActionPanel(this);
-
 
41
  
-
 
42
   
40
   
43
	HorizontalPanel outer = new HorizontalPanel();
41
	HorizontalPanel outer = new HorizontalPanel();
44
	HorizontalPanel buttons = new HorizontalPanel();
42
	HorizontalPanel buttons = new HorizontalPanel();
45
	buttons.setSpacing(3);
43
	buttons.setSpacing(3);
46
 
44
 
47
	
45
	
48
	// Transmission d'elements
46
	// Transmission d'elements
49
	
47
	
50
	HTML transButton=new HTML("Transmettre Tela Botanica");
48
	HTML transButton=new HTML("Transmettre Tela Botanica");
51
	transButton.setStyleName("html_button_long");
49
	transButton.setStyleName("html_button_long");
52
	transButton.addClickListener(
50
	transButton.addClickListener(
53
	    	new ClickListener() {
51
	    	new ClickListener() {
54
	    		public void onClick(Widget sender) {
52
	    		public void onClick(Widget sender) {
55
	    			// TODO : une action dans le mediator
53
	    			// TODO : une action dans le mediator
56
	    			if (mediator.getConnected()) {
54
	    			if (mediator.getConnected()) {
57
	    				mediator.getInventoryItemList().transmitElement();
55
	    				mediator.getInventoryItemList().transmitElement();
58
	    			}
56
	    			}
59
	    			else  {
57
	    			else  {
60
	    				Window.alert("Identifiez-vous pour transmettre");
58
	    				Window.alert("Identifiez-vous pour transmettre");
61
	    			}
59
	    			}
62
	    		}
60
	    		}
63
	     	}
61
	     	}
64
	);		
62
	);		
65
	
63
	
66
	buttons.add(transButton);
64
	buttons.add(transButton);
67
	
65
	
68
	// Suppression d'elements
66
	// Suppression d'elements
69
	
67
	
70
	HTML delButton=new HTML("Suppression");
68
	HTML delButton=new HTML("Suppression");
71
	delButton.setStyleName("html_button");
69
	delButton.setStyleName("html_button");
72
	delButton.addClickListener(
70
	delButton.addClickListener(
73
	    	new ClickListener() {
71
	    	new ClickListener() {
74
	    		public void onClick(Widget sender) {
72
	    		public void onClick(Widget sender) {
75
	    			// TODO : une action dans le mediator
73
	    			// TODO : une action dans le mediator
76
	    			mediator.getInventoryItemList().deleteElement();
74
	    			mediator.getInventoryItemList().deleteElement();
77
	    		}
75
	    		}
78
	     	}
76
	     	}
79
	);		
77
	);		
80
	
78
	
81
	buttons.add(delButton);
79
	buttons.add(delButton);
82
 
80
 
83
	// Export de la totalité 
81
	// Export de la totalité 
84
	
82
	
85
	HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout&nbsp;exporter</a>");
83
	HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout&nbsp;exporter</a>");
86
	buttons.add(exportButton);
84
	buttons.add(exportButton);
87
	exportButton.setStyleName("html_button");
85
	exportButton.setStyleName("html_button");
88
 
86
 
89
 
87
 
90
	
88
	
91
	// Selections de l'affichage
89
	// Selections de l'affichage
92
	
90
	
93
	HorizontalPanel selections = new HorizontalPanel();
91
	HorizontalPanel selections = new HorizontalPanel();
94
	
92
	
95
	selections.setSpacing(3);
93
	selections.setSpacing(3);
96
	
94
	
97
 
95
 
98
	selections.add(new HTML("S&eacute;lection : "));
96
	selections.add(new HTML("S&eacute;lection : "));
99
	
97
	
100
	Label allLabel = new Label("Tous");
98
	Label allLabel = new Label("Tous");
101
	Label separatorLabel = new Label(",");
99
	Label separatorLabel = new Label(",");
102
	Label noneLabel = new Label("Aucun");
100
	Label noneLabel = new Label("Aucun");
103
	
101
	
104
	allLabel.setStyleName("selection_label");
102
	allLabel.setStyleName("selection_label");
105
	noneLabel.setStyleName("selection_label");
103
	noneLabel.setStyleName("selection_label");
106
	
104
	
107
	selections.add(allLabel);
105
	selections.add(allLabel);
108
	allLabel.addClickListener(
106
	allLabel.addClickListener(
109
		    	new ClickListener() {
107
		    	new ClickListener() {
110
		    		public void onClick(Widget sender) {
108
		    		public void onClick(Widget sender) {
111
		    			// TODO : une action dans le mediator
109
		    			// TODO : une action dans le mediator
112
		    			mediator.getInventoryItemList().selectAll();
110
		    			mediator.getInventoryItemList().selectAll();
113
		    		}
111
		    		}
114
		     	}
112
		     	}
115
	);		
113
	);		
116
	
114
	
117
	selections.add(separatorLabel);
115
	selections.add(separatorLabel);
118
	
116
	
119
	selections.add(noneLabel);
117
	selections.add(noneLabel);
120
	noneLabel.addClickListener(
118
	noneLabel.addClickListener(
121
		    	new ClickListener() {
119
		    	new ClickListener() {
122
		    		public void onClick(Widget sender) {
120
		    		public void onClick(Widget sender) {
123
		    			// TODO : une action dans le mediator
121
		    			// TODO : une action dans le mediator
124
		    			mediator.getInventoryItemList().deselectAll();
122
		    			mediator.getInventoryItemList().deselectAll();
125
		    		}
123
		    		}
126
		     	}
124
		     	}
127
	);		
125
	);		
128
	
126
	
129
 
127
 
130
	outer.add(buttons);
128
	outer.add(buttons);
131
	outer.add(selections);
129
	outer.add(selections);
132
 
130
 
133
	initWidget(outer);
131
	initWidget(outer);
134
	this.setStyleName("action-Panel");
132
	this.setStyleName("action-Panel");
135
   
133
   
136
    
134
    
137
  }
135
  }
138
}  
136
}