| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 
 | package com.ViArts.ViArtsWeb.client;
 
import java.util.Date;
 
import com.ViArts.ViArtsJpa.sessions.GestionMembers;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
 
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Application implements EntryPoint {
	final GestionMembers gestion = new GestionMembers();
	final ViArtsServiceAsync ViArtsService = (ViArtsServiceAsync) GWT
			.create(ViArtsService.class);
	final Button viArtsButton = new Button("Click ViArts");
	final Button viArtsButton1 = new Button("Click Again");
	final Button viArtsButton2 = new Button("Again Again");
	final Label label = new Label(	"Add a new member");
	final Label label1 = new Label("Add an other new member");
	final Label label2 = new Label("Add an other new member Again");
 
	/**
         * This is the entry point method.
         */
	public void onModuleLoad() {
		/****************************************************************************
                 * the instantiated service proxy to avoid creating it for subsequent calls.*
                 ****************************************************************************/
 
		  /**
                   * (1) Create the client proxy. Note that although you are creating the
                   * service interface proper, you cast the result to the asynchronous
                   * version of the interface. The cast is always safe because the 
                   * generated proxy implements the asynchronous interface automatically.
                   */
		final ViArtsServiceAsync ViArtsService = (ViArtsServiceAsync) GWT
				.create(ViArtsService.class);
 
		/**
                 * (2) Create an asynchronous callback to handle the result. 
                 */
		final AsyncCallback callback = new AsyncCallback() {
			public void onFailure(Throwable caught) {
				System.out.println("Operation failed :(");
			}
 
			@Override
			public void onSuccess(Object result) {
				// TODO Auto-generated method stub
				System.out.println("Operation succed :)");
			}
		};
		/******************************************************
                 *                              Instantiation finish                              *
                 ******************************************************/
 
		/**
                 * (3) Make the call. Control flow will continue immediately and later
                 * 'callback' will be invoked when the RPC completes.
                 * click the button to add a new member.
                 */
		viArtsButton.addClickHandler(new ClickHandler() {
 
			@Override
			public void onClick(ClickEvent event) {
				ViArtsService.addnewMember("robert@viart.com", "coulibaly", "robert",
						new Date(1985 / 04 / 28), "Melun", "France", "rcoulibaly",
						"homme", "peinture", "Superadmin",gestion, callback);
			}
		});
 
		viArtsButton1.addClickHandler(new ClickHandler() {
 
			@Override
			public void onClick(ClickEvent event) {
				ViArtsService.addnewMember("daouda@viart.com", "doucoure", "daouda",
						new Date(1985 / 04 / 28), "Villeneuve St Georges", "France", "ddaouda",
						"homme", "sculpture", "Superadmin",gestion, callback);
			}
		});
 
		viArtsButton2.addClickHandler(new ClickHandler() {
 
			@Override
			public void onClick(ClickEvent event) {
				ViArtsService.addnewMember("binh@viart.com", "dang", "binh",
						new Date(1985 / 04 / 28), "Paris", "France", "bdang",
						"homme", "design", "Superadmin",gestion, callback);
			}
		});
 
		RootPanel.get().add(label);
		RootPanel.get().add(viArtsButton);
		RootPanel.get().add(label1);
		RootPanel.get().add(viArtsButton1);
		RootPanel.get().add(label2);
		RootPanel.get().add(viArtsButton2);
	}
} |