Minor changes preparing to merge in 3D

#story[1261]
main
Jessica Syder 8 years ago
parent 6a302841c0
commit 1ed7ccf146

@ -6,6 +6,7 @@ import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import visualiser.model.RaceConnection;
import java.io.IOException;
import java.net.Socket;
import java.net.URL;
@ -13,7 +14,7 @@ import java.util.ResourceBundle;
//TODO it appears this view/controller was replaced by Lobby.fxml. Remove?
/**
* Controls the connection that the VIsualiser can connect to.
* Controls the connection that the Visualiser can connect to.
*/
public class ConnectionController extends Controller {
@FXML AnchorPane connectionWrapper;

@ -1,7 +1,6 @@
package visualiser.Controllers;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
@ -49,7 +48,7 @@ public class KeyBindingsController extends Controller {
* Sets up table before populating it.
* Set up includes headings, CSS styling and modifying default properties.
*/
public void initializeTable(){
private void initializeTable(){
// set the headings for each column
lstKey.getItems().add("Key");
lstControl.getItems().add("Command");
@ -67,15 +66,15 @@ public class KeyBindingsController extends Controller {
// stop the columns from being selectable, so only the buttons are
lstKey.getSelectionModel().selectedItemProperty()
.addListener((observable, oldvalue, newValue) ->
.addListener((observable, oldValue, newValue) ->
Platform.runLater(() ->
lstKey.getSelectionModel().select(0)));
lstDescription.getSelectionModel().selectedItemProperty()
.addListener((observable, oldvalue, newValue) ->
.addListener((observable, oldValue, newValue) ->
Platform.runLater(() ->
lstDescription.getSelectionModel().select(0)));
lstControl.getSelectionModel().selectedItemProperty()
.addListener((observable, oldvalue, newValue) ->
.addListener((observable, oldValue, newValue) ->
Platform.runLater(() ->
lstControl.getSelectionModel().select(0)));
}
@ -83,7 +82,7 @@ public class KeyBindingsController extends Controller {
/**
* Populates the table with commands and their key binding details.
*/
public void populateTable(){
private void populateTable(){
// add each command to the table
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet()) {
// create button for command
@ -100,9 +99,9 @@ public class KeyBindingsController extends Controller {
/**
* Makes a copy of the {@link KeyFactory} that does not modify the original.
* @return new keyfactory to be modified
* @return new keyFactory to be modified
*/
public KeyFactory copyExistingFactory(){
private KeyFactory copyExistingFactory(){
newKeyFactory = new KeyFactory();
Map<String, ControlKey> oldKeyState = existingKeyFactory.getKeyState();
Map<String, ControlKey> newKeyState = new HashMap<>();
@ -118,18 +117,16 @@ public class KeyBindingsController extends Controller {
/**
* Creates a listener for when a user tries to close the current window.
*/
public void setClosedListener(){
private void setClosedListener(){
anchor.sceneProperty().addListener((obsS, oldS, newS) -> {
if (newS != null) {
newS.windowProperty().addListener((obsW, oldW, newW) -> {
if (newW != null) {
Stage stage = (Stage)newW;
// WE is processed by onExit method
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
if (we.getEventType() == WindowEvent.WINDOW_CLOSE_REQUEST) {
onExit(we);
}
stage.setOnCloseRequest(we -> {
if (we.getEventType() == WindowEvent.WINDOW_CLOSE_REQUEST) {
onExit(we);
}
});
}
@ -139,11 +136,11 @@ public class KeyBindingsController extends Controller {
}
/**
* Creates a listener for the base anchorpane for key presses.
* Creates a listener for the base anchorPane for key presses.
* It updates the current key bindings of the {@link KeyFactory} if
* required.
*/
public void setKeyListener(){
private void setKeyListener(){
anchor.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
// if esc, cancel current button click
if (event.getCode() == KeyCode.ESCAPE){
@ -218,10 +215,10 @@ public class KeyBindingsController extends Controller {
* commands are missing a key binding.
* @return True if valid, false if invalid
*/
public Boolean isFactoryValid(){
private Boolean isFactoryValid(){
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet
()) {
if (entry.getKey().toString()==entry.getValue().toString()){
if (entry.getKey().toString().equals(entry.getValue().toString())){
return false;
}
}
@ -234,7 +231,7 @@ public class KeyBindingsController extends Controller {
* @param we {@link WindowEvent} close request to be consumed if settings
* have not been successfully saved.
*/
public void onExit(WindowEvent we){
private void onExit(WindowEvent we){
// if modified KeyFactory hasn't been saved
if (changed){
loadNotification("Please cancel or save your changes before exiting" +
@ -248,7 +245,7 @@ public class KeyBindingsController extends Controller {
* @param message the message to be displayed to the user
* @param warning true if the message to be displayed is due to user error
*/
public void loadNotification(String message, Boolean warning){
private void loadNotification(String message, Boolean warning){
try {
NotificationController nc = (NotificationController)
loadPopupScene("notification.fxml",

@ -112,8 +112,6 @@ public class LobbyHostingController extends Controller {
alert.setHeaderText("You are about to quit the race");
Optional<ButtonType> result = alert.showAndWait();
if(result.get() == ButtonType.OK){
// getStage().close();
// App.app.loadTitleScreen();
loadTitleScreen();
}
}

@ -120,8 +120,6 @@ public class RaceViewController extends Controller {
loadTitleScreen();
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

Loading…
Cancel
Save