Search in sources :

Example 1 with ObservableListWrapper

use of com.sun.javafx.collections.ObservableListWrapper in project PretendYoureXyzzyReborn by devgianlu.

the class MainUI method refreshGamesList.

@FXML
public void refreshGamesList() {
    JsonObject resp;
    try {
        resp = client.sendMessageBlocking(client.createRequest(Operations.LIST_GAMES));
    } catch (InterruptedException | PyxException ex) {
        UIClient.notifyException(ex);
        return;
    }
    JsonArray gamesArray = resp.getAsJsonArray(Fields.GAMES_LIST.toString());
    ObservableList<CGame> games = new ObservableListWrapper<>(Utils.toList(gamesArray, CGame.class));
    gamesList.setItems(games);
}
Also used : JsonArray(com.google.gson.JsonArray) CGame(com.gianlu.pyxreborn.Models.Client.CGame) ObservableListWrapper(com.sun.javafx.collections.ObservableListWrapper) JsonObject(com.google.gson.JsonObject) PyxException(com.gianlu.pyxreborn.Exceptions.PyxException) FXML(javafx.fxml.FXML)

Example 2 with ObservableListWrapper

use of com.sun.javafx.collections.ObservableListWrapper in project PretendYoureXyzzyReborn by devgianlu.

the class MainUI method refreshUsersList.

@FXML
public void refreshUsersList() {
    JsonObject resp;
    try {
        resp = client.sendMessageBlocking(client.createRequest(Operations.LIST_USERS));
    } catch (InterruptedException | PyxException ex) {
        UIClient.notifyException(ex);
        return;
    }
    JsonArray usersArray = resp.getAsJsonArray(Fields.USERS_LIST.toString());
    ObservableList<CUser> users = new ObservableListWrapper<>(Utils.toList(usersArray, CUser.class));
    usersList.setItems(users);
}
Also used : JsonArray(com.google.gson.JsonArray) CUser(com.gianlu.pyxreborn.Models.Client.CUser) ObservableListWrapper(com.sun.javafx.collections.ObservableListWrapper) JsonObject(com.google.gson.JsonObject) PyxException(com.gianlu.pyxreborn.Exceptions.PyxException) FXML(javafx.fxml.FXML)

Aggregations

PyxException (com.gianlu.pyxreborn.Exceptions.PyxException)2 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 ObservableListWrapper (com.sun.javafx.collections.ObservableListWrapper)2 FXML (javafx.fxml.FXML)2 CGame (com.gianlu.pyxreborn.Models.Client.CGame)1 CUser (com.gianlu.pyxreborn.Models.Client.CUser)1