Subversion Repositories eFlore/Archives.cel-v1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13 ddelon 1
/*
2
 * Copyright 2006 Google Inc.
3
 *
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
6
 * the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
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
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
 * License for the specific language governing permissions and limitations under
14
 * the License.
15
 */
16
package org.tela_botanica.client;
17
 
18
 
19
import com.google.gwt.user.client.ui.ClickListener;
20
import com.google.gwt.user.client.ui.Composite;
21
import com.google.gwt.user.client.ui.HTML;
22
import com.google.gwt.user.client.ui.HorizontalPanel;
23
import com.google.gwt.user.client.ui.Label;
24
import com.google.gwt.user.client.ui.Widget;
25
 
26
/**
27
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
28
 */
29
 
30
public class ActionPanel extends Composite   {
31
 
32
  Mediator mediator=null;
33
 
34
 
35
 
36
  public ActionPanel(final Mediator med) {
37
 
38
   mediator=med;
39
   mediator.registerActionPanel(this);
40
 
41
 
42
	HorizontalPanel outer = new HorizontalPanel();
43
	outer.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
44
 
45
	// Suppression d'elements
46
 
47
	HTML delButton=new HTML("Suppression");
48
	delButton.setStyleName("html_button");
49
	delButton.addClickListener(
50
	    	new ClickListener() {
51
	    		public void onClick(Widget sender) {
52
	    			// TODO : une action dans le mediator
53
	    			mediator.getInventoryItemList().deleteElement();
54
	    		}
55
	     	}
56
	);
57
 
58
	outer.add(delButton);
59
 
60
	// Export de la totalité
61
 
62
	HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout exporter</a>");
63
	outer.add(exportButton);
64
	exportButton.setStyleName("html_button");
65
 
66
	outer.setSpacing(5);
67
 
68
 
69
	// Selections de l'affichage
70
 
71
	HorizontalPanel selections = new HorizontalPanel();
72
	selections.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
73
 
74
	selections.setSpacing(3);
75
 
76
 
77
	selections.add(new HTML("S&eacute;lection : "));
78
 
79
	Label allLabel = new Label("Tous");
80
	Label separatorLabel = new Label(",");
81
	Label noneLabel = new Label("Aucun");
82
 
83
	allLabel.setStyleName("selection_label");
84
	noneLabel.setStyleName("selection_label");
85
 
86
	selections.add(allLabel);
87
	allLabel.addClickListener(
88
		    	new ClickListener() {
89
		    		public void onClick(Widget sender) {
90
		    			// TODO : une action dans le mediator
91
		    			mediator.getInventoryItemList().selectAll();
92
		    		}
93
		     	}
94
	);
95
 
96
	selections.add(separatorLabel);
97
 
98
	selections.add(noneLabel);
99
	noneLabel.addClickListener(
100
		    	new ClickListener() {
101
		    		public void onClick(Widget sender) {
102
		    			// TODO : une action dans le mediator
103
		    			mediator.getInventoryItemList().deselectAll();
104
		    		}
105
		     	}
106
	);
107
 
108
 
109
	outer.add(selections);
110
 
111
	initWidget(outer);
112
	this.setStyleName("action-Panel");
113
 
114
 
115
  }
116
}