25,20 → 25,10 |
|
public interface Vue extends IsWidget { |
|
public void ajouterProtocole(String protocole); |
|
public void selectionnerProtocole(int index); |
|
public HasChangeHandlers getListeProtocoles(); |
|
public HasWidgets getZoneResultats(); |
|
public HasWidgets getZoneRecherche(); |
|
public String getNomProtocolSelectionne(); |
|
public int getIdProtocoleSelectionne(); |
|
public void ajouterVue(HasWidgets composite); |
|
} |
46,11 → 36,10 |
private Vue vue; |
|
private final ProtocoleService protocoleService = MockDatasource.getInstance(); |
private List<Protocole> protocoles; |
|
// TODO : passer ça en cache |
private String protocoleParDefaut = Protocole.ESTHETISME; |
|
|
|
/** |
* Constructeur |
* */ |
59,8 → 48,6 |
if (CacheClient.getInstance().getProtocoleCourant() == null) { |
CacheClient.getInstance().setProtocoleCourant(protocoleService.getProtocole(protocoleParDefaut)); |
} |
gererEvenements(); |
chargerProtocoles(); |
} |
|
public void go(HasWidgets composite) { |
67,40 → 54,8 |
vue.ajouterVue(composite); |
chargerMoteurRechercheAvancee(); |
} |
|
|
private void chargerProtocoles() { |
protocoles = protocoleService.getProtocoles(); |
for (Protocole protocole : protocoles) { |
vue.ajouterProtocole(protocole.getNom()); |
} |
vue.selectionnerProtocole(protocoles.indexOf(CacheClient.getInstance().getProtocoleCourant())); |
} |
|
public void gererEvenements() { |
|
vue.getListeProtocoles().addChangeHandler(new ChangeHandler() { |
|
@Override |
public void onChange(ChangeEvent event) { |
surChangementProtocole(); |
} |
}); |
|
} |
|
public void surChangementProtocole() { |
Protocole protocoleCourant = null; |
for (Protocole protocole : protocoles) { |
if (protocole.getId() == vue.getIdProtocoleSelectionne()) { |
protocoleCourant = protocole; |
} |
} |
|
CacheClient.getInstance().setProtocoleCourant(protocoleCourant); |
EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant); |
BusEvenementiel.getInstance().fireEvent(evenement); |
} |
|
public void chargerMoteurRechercheAvancee() { |
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(""), ModeRecherche.MODE_IMAGE) { |
public void lancerRecherche() { |