Skip to content
Snippets Groups Projects
Commit ae388abc authored by Théo Pirkl's avatar Théo Pirkl :nail_care:
Browse files

Done stuff

parent 46ac3e09
No related branches found
No related tags found
3 merge requests!21*poof* final version,!16Gui transport,!11Gui transport
package ch.hepia.events;
import ch.hepia.api.transport.Section;
import ch.hepia.models.User;
import ch.hepia.openTranportAPI.Section;
import java.util.ArrayList;
import java.util.List;
......
package ch.hepia.events;
import ch.hepia.api.transport.Section;
import ch.hepia.models.User;
import ch.hepia.openTranportAPI.Section;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.io.Serializable;
/**
* Represents an event where a user has left a journey.
......
......@@ -8,10 +8,7 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import org.json.JSONArray;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ResourceBundle;
public class MainWindowController implements Initializable {
......@@ -37,15 +34,17 @@ public class MainWindowController implements Initializable {
originComboBox.valueProperty().addListener(
(observable, oldValue, newValue) -> {
if (!newValue.isEmpty() && newValue.length() > 3){
originComboBox.getItems().clear();
try {
JSONArray a = transportApi.getStations(newValue);
System.out.println(a);
for (int i = 0; i < a.length(); i++){
originComboBox.getItems().add(a.getJSONObject(i).getString("name"));
}
} catch (Exception e) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Information");
alert.setHeaderText("Nous avons interrogé les transports communs Suisses...");
alert.setContentText("Aucun arrêt ne correspond à ce nom !");
alert.show();
AlertUtils.dialog(
Alert.AlertType.ERROR, "Erreur",
"Une erreur est survenue.",
"Impossible de contacter les services de transport Suisses.");
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment