public void userLogged(String serPrefs) { Gson gs = new Gson(); prefs = gs.fromJson(serPrefs, Preferences.class); clientThread.setUser(prefs.getUser()); Platform.runLater( new Runnable() { @Override public void run() { loginStage.hide(); loginStage.close(); /* clientController.welcomeLabel.setText("Bentornato, "+prefs.getUser().getNickname()); clientController.launchToMessagging(); clientController.regLabel.setVisible(false); clientController.loginButton.setText("LOGOUT"); clientController.registerButton.setVisible(false); clientController.registerButton.setDisable(true); */ isClientLogged = true; clientController.loginButton.setDisable(true); clientController.registerButton.setDisable(true); clientController.clientConnectButton.setVisible(false); clientController.welcomeLabel.setFont(robo); clientController.welcomeLabel.setText( "Bentornato, " + prefs.getUser().getNickname() + "!"); clientController.scuolaBox.setSelected(prefs.isScuola()); clientController.makingBox.setSelected(prefs.isMaking()); clientController.religioneBox.setSelected(prefs.isReligione()); clientController.promozione_territorioBox.setSelected(prefs.isPromozione_territorio()); clientController.donazione_sangueBox.setSelected(prefs.isDonazione_sangue()); clientController.anzianiBox.setSelected(prefs.isAnziani()); clientController.tasseBox.setSelected(prefs.isTasse()); } }); }
public void sendReport(String msg) { Reporting report = new Reporting(msg, prefs.getUser()); Gson gson = new Gson(); String repo = gson.toJson(report); clientThread.sendReport(repo); System.out.println("IL report: " + report.getUser().getNickname() + " " + report.getMsg()); }
public void updatePrefences( boolean scuola, boolean making, boolean religione, boolean promozione_territorio, boolean donazione_sangue, boolean anziani, boolean tasse) { prefs = new Preferences( scuola, making, religione, promozione_territorio, donazione_sangue, anziani, tasse); prefs.setUser(clientThread.getUser()); // System.err.println("UTENTE: // "+prefs.getUser().getUsername()+prefs.getUser().getSurname());//TODO: non ho username etc Gson gson = new Gson(); String json = gson.toJson(prefs); clientThread.updatePrefs(json); }