package org.lilie.services.ria.admin.ihm.modules.admin.arbre.view;
import org.lilie.services.ria.admin.api.services.dto.ArbreEtablissementDto;
+import org.lilie.services.ria.admin.ihm.modules.admin.arbre.controller.ModifCompteArbreCommand;
import org.lilie.services.ria.admin.ihm.modules.admin.arbre.model.EtablissementProxy;
import org.lilie.services.ria.admin.ihm.modules.admin.arbre.view.components.EtablissementView;
import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.controller.SelectionChangedCommand;
+import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.model.AnnuaireProxy;
import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.view.components.LyceeInfoView;
import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.view.components.autresService.GrrView;
import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.view.components.autresService.StatistiquesView;
import org.lilie.services.ria.admin.ihm.modules.admin.fenetre.view.mediator.Vue2Mediator;
import org.lilie.services.ria.admin.ihm.modules.login.AbstractLoginModuleManager;
import org.lilie.socle.fmk.ria.ihm.mvc.tabs.TabViewMediator;
+import org.lilie.socle.fmk.ria.ihm.utils.Log;
import org.lilie.socle.fmk.ria.ihm.workbench.view.WorkbenchMediator;
import org.puremvc.java.multicore.interfaces.INotification;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
/**
* Mediator de l'etablissement vue
* @author MLAM
public static final String FORM_SUPPRIMER_AUTRE = EtablissementMediator.class
.getName() + "FORM_SUPPRIMER_AUTRE";
+
+
+
/**
* changedSelection
* @param result resultat
* @return array de string
*/
public String[] listNotificationInterests() {
- return new String[] { EtablissementProxy.PAGING_DATA_CHANGED};
+ return new String[] { EtablissementProxy.PAGING_DATA_CHANGED, EtablissementProxy.COMPTEUR_ELEVE,
+ EtablissementProxy.COMPTEUR_ENSEIGNANT, EtablissementProxy.COMPTEUR_PARENT,
+ EtablissementProxy.COMPTEUR_PERSONNEL,
+ EtablissementProxy.COMPTEUR_AUTRE, EtablissementProxy.COMPTEUR_CLASSE,
+ EtablissementProxy.COMPTEUR_SUPPRIMER, EtablissementProxy.COMPTEUR_COMPTE_ACTIF,
+ EtablissementProxy.COMPTEUR_GROUPE_ETENDU, EtablissementProxy.COMPTEUR_GROUPE_LOCAUX
+
+ };
}
/**
* @param notification notif
*/
public void handleNotification(INotification notification) {
+
String note = notification.getName();
if (EtablissementProxy.PAGING_DATA_CHANGED.equals(note)) {
ArbreEtablissementDto dto = (ArbreEtablissementDto) notification.getBody();
WorkbenchMediator workbenchMediator = (WorkbenchMediator) getFacade()
.retrieveMediator(WorkbenchMediator.class.getName());
workbenchMediator.setLoadingMaskWest(false);
-
workbenchMediator.getView().getWest().show();
Vue2Mediator vue2Mediator = (Vue2Mediator) getFacade()
.retrieveMediator(Vue2Mediator.class.getName());
if (dto.getSelectionPage() != null && dto.getSelectionPage().length() > 0) {
classeStr = dto.getSelectionPage();
}
-// classeStr = classeStr.substring(classeStr.lastIndexOf(".") + 1);
-// if (classeStr.lastIndexOf(".") > 0) {
-// classeStr = classeStr.substring(classeStr.lastIndexOf("."), classeStr.length());
-// }
getView().setSelection(classeStr);
if (vue2Mediator.getView().getClass().toString().endsWith(classeStr)) {
vue2Mediator.getView().show();
if (statsMediator != null && statsMediator.getView() != null) {
((StatistiquesView) statsMediator.getView()).clearPersonnelList();
}
-
+
sendNotification(AbstractLoginModuleManager.PROCESS_ADMIN_PRET, "", "");
+ } else if (EtablissementProxy.COMPTEUR_ELEVE.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreElevesParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_ELEVE, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreElevesParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_ENSEIGNANT.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreEnseignantsParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_ENSEIGNANT, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreEnseignantsParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_PERSONNEL.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombrePersonnelParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_PERSONNEL, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombrePersonnelParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_PARENT.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreParentsParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_PARENT, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreParentsParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_AUTRE.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreAutresParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_AUTRE, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreAutresParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_CLASSE.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreClassesEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_CLASSE, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreClassesEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_SUPPRIMER.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombrePersonnesSupprimeesParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_SUPPRIMER, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombrePersonnesSupprimeesParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_COMPTE_ACTIF.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreComptesActifsParEtablissement(etablissementIdStr, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_COMPTE_ACTIF, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreComptesActifsParEtablissement", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_GROUPE_LOCAUX.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreGroupeAdminParEtablissement(etablissementIdStr, true, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_GRP_LOCAUX, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreGroupeAdminParEtablissement locaux", caught, null);
+ }
+ });
+ } else if (EtablissementProxy.COMPTEUR_GROUPE_ETENDU.equals(note)) {
+ final String etablissementIdStr = (String) notification.getBody();
+ AnnuaireProxy annuaireProxy = new AnnuaireProxy();
+ annuaireProxy.getNombreGroupeAdminParEtablissement(etablissementIdStr, false, new AsyncCallback < Integer >() {
+ public void onSuccess(Integer result) {
+ sendNotification(ModifCompteArbreCommand.MODIFICATION_COMPTE_ARBRE_GRP_ETENDU, result, etablissementIdStr);
+ }
+ public void onFailure(Throwable caught) {
+ Log.error("EtablissementMediator getNombreGroupeAdminParEtablissement etendu", caught, null);
+ }
+ });
}
}