Search in sources :

Example 1 with InputWindow

use of fr.univlorraine.ecandidat.views.windows.InputWindow in project esup-ecandidat by EsupPortail.

the class FormulaireController method testConnexionLS.

/**
 * Teste la connexion à LimeSurvey
 */
public void testConnexionLS() {
    final InputWindow inputWindow = new InputWindow(applicationContext.getMessage("version.ls.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("version.ls.title", null, UI.getCurrent().getLocale()), false, 15);
    inputWindow.addBtnOkListener(text -> {
        if (text instanceof String && !text.isEmpty()) {
            if (text != null) {
                try {
                    final Integer idForm = Integer.valueOf(text);
                    final List<SurveyReponse> listeReponse = getListeReponseDedoublonneCandidat(limeSurveyRest.exportResponse(idForm, "fr"));
                    final StringBuilder sb = new StringBuilder();
                    sb.append("<b>" + applicationContext.getMessage("version.ls.resultTxt", new Object[] { listeReponse.size() }, UI.getCurrent().getLocale()) + "</b>");
                    sb.append("<br><br>");
                    listeReponse.forEach(e -> {
                        sb.append("<b>NumDossier : " + e.getNumDossier() + ", date : " + e.getDatestamp() + "</b><br>");
                        if (e.getMapReponses() != null) {
                            for (final Entry<String, Object> entry : e.getMapReponses().entrySet()) {
                                sb.append(entry.getKey() + " : " + entry.getValue() + "<br>");
                            }
                        }
                        sb.append("<br>");
                    });
                    UI.getCurrent().addWindow(new InfoWindow(applicationContext.getMessage("version.ls.result", null, UI.getCurrent().getLocale()), sb.toString(), 500, 40));
                } catch (final Exception e) {
                    Notification.show(applicationContext.getMessage("version.ls.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                }
            }
        }
    });
    UI.getCurrent().addWindow(inputWindow);
}
Also used : SurveyReponse(fr.univlorraine.ecandidat.controllers.rest.SurveyReponse) InputWindow(fr.univlorraine.ecandidat.views.windows.InputWindow) InfoWindow(fr.univlorraine.ecandidat.views.windows.InfoWindow)

Example 2 with InputWindow

use of fr.univlorraine.ecandidat.views.windows.InputWindow in project esup-ecandidat by EsupPortail.

the class SiScolController method testWSSiScolConnnexion.

/**
 * Teste la connexion au WS Apogée
 */
public void testWSSiScolConnnexion() {
    final InputWindow inputWindow = new InputWindow(applicationContext.getMessage("version.ws.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("version.ws.title", null, UI.getCurrent().getLocale()), false, 15);
    inputWindow.addBtnOkListener(text -> {
        if (text instanceof String && !text.isEmpty()) {
            if (text != null) {
                try {
                    WSIndividu ind;
                    if (demoController.getDemoMode()) {
                        ind = demoController.recupInfoEtudiant("0000000000");
                    } else {
                        ind = siScolService.getIndividu(text, null, null);
                    }
                    String ret = "Pas d'info";
                    if (ind != null) {
                        ret = "<u>Individu</u> : <br>" + ind + "<br><br><u>Adresse</u> : <br>" + ind.getAdresse() + "<br><br><u>Bac</u> : <br>" + ind.getBac() + "<br><br><u>Cursus interne</u> : <br>" + ind.getListCursusInterne();
                    }
                    UI.getCurrent().addWindow(new InfoWindow(applicationContext.getMessage("version.ws.result", null, UI.getCurrent().getLocale()), ret, 500, 70));
                } catch (final Exception e) {
                    Notification.show(applicationContext.getMessage("version.ws.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                }
            }
        }
    });
    UI.getCurrent().addWindow(inputWindow);
}
Also used : WSIndividu(fr.univlorraine.ecandidat.entities.siscol.WSIndividu) InputWindow(fr.univlorraine.ecandidat.views.windows.InputWindow) InfoWindow(fr.univlorraine.ecandidat.views.windows.InfoWindow) SiScolException(fr.univlorraine.ecandidat.services.siscol.SiScolException)

Example 3 with InputWindow

use of fr.univlorraine.ecandidat.views.windows.InputWindow in project esup-ecandidat by EsupPortail.

the class UiController method sendMessage.

/**
 * Permet la saisie et l'envoi d'un message à tous les clients connectés
 */
public void sendMessage() {
    InputWindow inputWindow = new InputWindow(applicationContext.getMessage("admin.sendMessage.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("admin.sendMessage.title", null, UI.getCurrent().getLocale()), true, 255);
    inputWindow.addBtnOkListener(text -> {
        if (text instanceof String && !text.isEmpty()) {
            Notification notification = new Notification(applicationContext.getMessage("admin.sendMessage.notificationCaption", new Object[] { text }, UI.getCurrent().getLocale()), null, Type.TRAY_NOTIFICATION, true);
            notification.setDelayMsec(-1);
            notification.setDescription("\n" + applicationContext.getMessage("admin.sendMessage.notificationDescription", null, UI.getCurrent().getLocale()));
            notification.setPosition(Position.TOP_CENTER);
            sendNotification(notification);
        }
    });
    UI.getCurrent().addWindow(inputWindow);
}
Also used : InputWindow(fr.univlorraine.ecandidat.views.windows.InputWindow) Notification(com.vaadin.ui.Notification)

Aggregations

InputWindow (fr.univlorraine.ecandidat.views.windows.InputWindow)3 InfoWindow (fr.univlorraine.ecandidat.views.windows.InfoWindow)2 Notification (com.vaadin.ui.Notification)1 SurveyReponse (fr.univlorraine.ecandidat.controllers.rest.SurveyReponse)1 WSIndividu (fr.univlorraine.ecandidat.entities.siscol.WSIndividu)1 SiScolException (fr.univlorraine.ecandidat.services.siscol.SiScolException)1