Added static field to retain ListView reference
This commit is contained in:
parent
39c0d4e52f
commit
317968e368
@ -78,6 +78,9 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private ToolBar NTtBToolBar;
|
private ToolBar NTtBToolBar;
|
||||||
|
|
||||||
|
public static ListView<LobbyListItem> lListView;
|
||||||
|
public static ListView<ClientListItem> cListView;
|
||||||
|
|
||||||
public static ClientModel client;
|
public static ClientModel client;
|
||||||
private static ChatApp chatApp;
|
private static ChatApp chatApp;
|
||||||
private ChatApp cApp;
|
private ChatApp cApp;
|
||||||
@ -116,6 +119,7 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
LeaveServerButton.setOnAction(event -> leaveServer());
|
LeaveServerButton.setOnAction(event -> leaveServer());
|
||||||
newGameButton.setOnAction(event -> newGame());
|
newGameButton.setOnAction(event -> newGame());
|
||||||
LobbyListView.setVisible(true);
|
LobbyListView.setVisible(true);
|
||||||
|
lListView = LobbyListView;
|
||||||
LOGGER.debug("Lobby in initialize" + LobbyListView);
|
LOGGER.debug("Lobby in initialize" + LobbyListView);
|
||||||
ClientListView.setVisible(true);
|
ClientListView.setVisible(true);
|
||||||
ClientListView.setItems(clients);
|
ClientListView.setItems(clients);
|
||||||
@ -124,7 +128,6 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
ClientListView.setItems(clients);
|
ClientListView.setItems(clients);
|
||||||
ClientListView.setCellFactory(param -> {
|
ClientListView.setCellFactory(param -> {
|
||||||
ListCell<ClientListItem> cell = new ListCell<>() {
|
ListCell<ClientListItem> cell = new ListCell<>() {
|
||||||
|
|
||||||
Label name = new Label();
|
Label name = new Label();
|
||||||
Label id = new Label();
|
Label id = new Label();
|
||||||
HBox nameAndId = new HBox(name, id);
|
HBox nameAndId = new HBox(name, id);
|
||||||
@ -202,7 +205,6 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
LOGGER.debug("In Initialize 2 LobbyListView" + LobbyListView);
|
LOGGER.debug("In Initialize 2 LobbyListView" + LobbyListView);
|
||||||
LobbyListView.setCellFactory(param -> {
|
LobbyListView.setCellFactory(param -> {
|
||||||
ListCell<LobbyListItem> cell = new ListCell<>() {
|
ListCell<LobbyListItem> cell = new ListCell<>() {
|
||||||
|
|
||||||
Label lobbyID = new Label();
|
Label lobbyID = new Label();
|
||||||
Label adminName = new Label();
|
Label adminName = new Label();
|
||||||
Label lobbyIsOpen = new Label();
|
Label lobbyIsOpen = new Label();
|
||||||
@ -364,7 +366,8 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
* @param adminName
|
* @param adminName
|
||||||
*/
|
*/
|
||||||
public void newLobby(String lobbyID, String adminName) {
|
public void newLobby(String lobbyID, String adminName) {
|
||||||
LOGGER.debug("In newLobby()0 LobbyListView" + LobbyListView);
|
LobbyListView = lListView;
|
||||||
|
LOGGER.debug("In newLobby()0 LobbyListView" + lListView);
|
||||||
LOGGER.debug("New lobby with ID " + lobbyID + " and admin " + adminName);
|
LOGGER.debug("New lobby with ID " + lobbyID + " and admin " + adminName);
|
||||||
SimpleStringProperty id = new SimpleStringProperty(lobbyID);
|
SimpleStringProperty id = new SimpleStringProperty(lobbyID);
|
||||||
SimpleStringProperty admin = new SimpleStringProperty((adminName));
|
SimpleStringProperty admin = new SimpleStringProperty((adminName));
|
||||||
@ -384,6 +387,7 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
lobbies.add(item);
|
lobbies.add(item);
|
||||||
|
LobbyListView.getItems().add(item);
|
||||||
LOGGER.debug("within newLobby() run() thread");
|
LOGGER.debug("within newLobby() run() thread");
|
||||||
LOGGER.debug(item.toString());
|
LOGGER.debug(item.toString());
|
||||||
LOGGER.debug("In newLobby() run() " + LobbyListView);
|
LOGGER.debug("In newLobby() run() " + LobbyListView);
|
||||||
|
|||||||
Reference in New Issue
Block a user