package ihm;

import implementation.client.Client;
import implementation.client.ObserverClient;

import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;

public class IHMPrincipal implements IHM {
	
	private Map<String, IHM> ihms;
	private Client client;
	
	public Map<String, IHM> getIhms() {
		return ihms;
	}
	
	public IHMPrincipal() throws RemoteException {
		ihms = new HashMap<String, IHM>();
		client = new Client();
		ihms.put("inscription",new IHMInscription(client, this));
		ihms.put("client", new IHMClient(client, this));
		ihms.put("nouvelObjet", new IHMNouvelObjetEnVente(client, this));
		ihms.get("inscription").changerVisibilite(true);
		ObserverClient obs = new ObserverClient();
		obs.setIhms(ihms.values());
		client.setObsClient(obs);
	}
	
	
	@Override
	public void notifier() {
	
		
	}

	@Override
	public void changerVisibilite(boolean b) {
		// TODO Auto-generated method stub
		
	}

	public void signal(String key) {
		switch (key) {
		case "inscription" :
			System.out.println("client :" + client.getNom());
			ihms.get("inscription").changerVisibilite(false);
			ihms.get("client").changerVisibilite(true);
			ihms.get("nouvelObjet").changerVisibilite(true);
			client.envoiInscription(client.getNom());
			break;

		default:
			break;
		}	
	}

	public static void main(String[] args) throws RemoteException {
		new IHMPrincipal();
	}
}

@@ -887,48 +887,8 @@
 ) %7B%0A
-%09%09// TODO Auto-generated method stub%0A%09%09%0A
 %09%7D%0A%0A

Clean commentaires