Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

Ignore whitespace Rev 12 → Rev 13

/trunk/src/org/tela_botanica/client/ActionPanel.java
New file
0,0 → 1,116
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.tela_botanica.client;
 
 
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
 
/**
* Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
*/
 
public class ActionPanel extends Composite {
Mediator mediator=null;
 
 
public ActionPanel(final Mediator med) {
mediator=med;
mediator.registerActionPanel(this);
HorizontalPanel outer = new HorizontalPanel();
outer.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
// Suppression d'elements
HTML delButton=new HTML("Suppression");
delButton.setStyleName("html_button");
delButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().deleteElement();
}
}
);
outer.add(delButton);
 
// Export de la totalité
HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout exporter</a>");
outer.add(exportButton);
exportButton.setStyleName("html_button");
 
outer.setSpacing(5);
 
// Selections de l'affichage
HorizontalPanel selections = new HorizontalPanel();
selections.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
selections.setSpacing(3);
 
selections.add(new HTML("S&eacute;lection : "));
Label allLabel = new Label("Tous");
Label separatorLabel = new Label(",");
Label noneLabel = new Label("Aucun");
allLabel.setStyleName("selection_label");
noneLabel.setStyleName("selection_label");
selections.add(allLabel);
allLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().selectAll();
}
}
);
selections.add(separatorLabel);
selections.add(noneLabel);
noneLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().deselectAll();
}
}
);
 
outer.add(selections);
 
initWidget(outer);
this.setStyleName("action-Panel");
}
}