updated race view that does not use a split pane

main
hba56 8 years ago
parent 87f3265640
commit 083eb5a4bc

@ -250,7 +250,7 @@ public class InGameLobbyController extends Controller {
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener); visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
RaceViewController rvc = (RaceViewController) RaceViewController rvc = (RaceViewController)
loadScene("raceView.fxml"); loadScene("newRaceView.fxml");
rvc.startRace(visualiserRaceEvent, controllerClient, rvc.startRace(visualiserRaceEvent, controllerClient,
isHost); isHost);
} catch (IOException e) { } catch (IOException e) {

@ -12,6 +12,7 @@ import javafx.scene.chart.LineChart;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.shape.MeshView; import javafx.scene.shape.MeshView;
@ -64,7 +65,7 @@ public class RaceViewController extends Controller {
// note: it says it's not used but it is! do not remove :) // note: it says it's not used but it is! do not remove :)
private @FXML ArrowController arrowController; private @FXML ArrowController arrowController;
private @FXML GridPane canvasBase; private @FXML GridPane canvasBase;
private @FXML SplitPane racePane; private @FXML AnchorPane newRacePane;
private @FXML StackPane arrowPane; private @FXML StackPane arrowPane;
private @FXML Label timer; private @FXML Label timer;
private @FXML Label FPS; private @FXML Label FPS;
@ -77,6 +78,7 @@ public class RaceViewController extends Controller {
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn; private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
private @FXML LineChart<Number, Number> sparklineChart; private @FXML LineChart<Number, Number> sparklineChart;
private @FXML Label tutorialText; private @FXML Label tutorialText;
private @FXML AnchorPane infoWrapper;
/** /**
* Displays a specified race. * Displays a specified race.
@ -125,7 +127,7 @@ public class RaceViewController extends Controller {
* Sets up the listener and actions that occur when a key is pressed. * Sets up the listener and actions that occur when a key is pressed.
*/ */
private void initKeypressHandler() { private void initKeypressHandler() {
racePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> { newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
String codeString = event.getCode().toString(); String codeString = event.getCode().toString();
// tab key // tab key
@ -255,7 +257,7 @@ public class RaceViewController extends Controller {
}); });
// Bind zooming to keypress (Z/X default) // Bind zooming to keypress (Z/X default)
racePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> { newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
ControlKey key = keyFactory.getKey(e.getCode().toString()); ControlKey key = keyFactory.getKey(e.getCode().toString());
if (key != null) { if (key != null) {
switch (key.toString()) { switch (key.toString()) {
@ -442,23 +444,7 @@ public class RaceViewController extends Controller {
* toggles if the info table is shown * toggles if the info table is shown
*/ */
private void toggleTable() { private void toggleTable() {
double tablePercent = 1 - (boatPlacingColumn.getPrefWidth() + infoWrapper.setVisible(infoTableShow);
boatTeamColumn.getPrefWidth() + boatMarkColumn.getPrefWidth()
+ boatSpeedColumn.getPrefWidth())/racePane.getWidth();
if (infoTableShow) {
racePane.setDividerPositions(tablePercent);
arrowPane.setScaleX(0.5);
arrowPane.setScaleY(0.5);
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*tablePercent);
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
} else {
racePane.setDividerPositions(1);
arrowPane.setScaleX(1);
arrowPane.setScaleY(1);
arrowPane.setTranslateX(0);
arrowPane.setTranslateY(0);
}
boatInfoTable.refresh(); boatInfoTable.refresh();
infoTableShow = !infoTableShow; infoTableShow = !infoTableShow;
} }

@ -1,12 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.Accordion?> <?import javafx.scene.control.Accordion?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?> <?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?> <?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Separator?> <?import javafx.scene.control.Separator?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TitledPane?> <?import javafx.scene.control.TitledPane?>
@ -19,106 +28,125 @@
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="364.0" prefWidth="522.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController"> <AnchorPane fx:id="newRacePane" prefHeight="431.0" prefWidth="610.0" visible="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
<children> <children>
<GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
<columnConstraints> <children>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" /> <AnchorPane>
</columnConstraints> <children>
<rowConstraints> <GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> <columnConstraints>
</rowConstraints> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</GridPane> </columnConstraints>
<Pane prefHeight="200.0" prefWidth="400.0" visible="false"> <rowConstraints>
<children> <RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<Accordion> </rowConstraints>
<panes> </GridPane>
<TitledPane animated="false" prefHeight="395.0" prefWidth="222.0" text="Annotation Control"> <Pane prefHeight="200.0" prefWidth="400.0" visible="false">
<content> <children>
<AnchorPane fx:id="annotationPane" minHeight="0.0" minWidth="0.0"> <Accordion>
<children> <panes>
<CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" /> <TitledPane animated="false" prefHeight="395.0" prefWidth="222.0" text="Annotation Control">
<CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" /> <content>
<CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" /> <AnchorPane fx:id="annotationPane" minHeight="0.0" minWidth="0.0">
<CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" /> <children>
<CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" /> <CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
<CheckBox fx:id="showEstTime" mnemonicParsing="false" selected="true" text="Show Est. Time to Next Mark" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" /> <CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
<CheckBox fx:id="showGuideline" mnemonicParsing="false" text="Show Guideline" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="150.0" /> <CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" />
<Separator layoutX="19.6" layoutY="175.6" prefHeight="0.0" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="175.0" /> <CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" />
<Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="175.0" /> <CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" />
<RadioButton fx:id="hideAnnoRBtn" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0"> <CheckBox fx:id="showEstTime" mnemonicParsing="false" selected="true" text="Show Est. Time to Next Mark" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" />
<toggleGroup> <CheckBox fx:id="showGuideline" mnemonicParsing="false" text="Show Guideline" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="150.0" />
<ToggleGroup fx:id="annoToggleGroup" /> <Separator layoutX="19.6" layoutY="175.6" prefHeight="0.0" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="175.0" />
</toggleGroup> <Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="175.0" />
</RadioButton> <RadioButton fx:id="hideAnnoRBtn" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0">
<RadioButton fx:id="showAnnoRBtn" mnemonicParsing="false" text="Visible" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="225.0" /> <toggleGroup>
<RadioButton fx:id="partialAnnoRBtn" mnemonicParsing="false" text="Partial" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="250.0" /> <ToggleGroup fx:id="annoToggleGroup" />
<RadioButton fx:id="importantAnnoRBtn" mnemonicParsing="false" text="Important" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="275.0" /> </toggleGroup>
<Button fx:id="saveAnno" layoutX="11.0" layoutY="126.0" mnemonicParsing="false" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="300.0" /> </RadioButton>
</children> <RadioButton fx:id="showAnnoRBtn" mnemonicParsing="false" text="Visible" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="225.0" />
</AnchorPane> <RadioButton fx:id="partialAnnoRBtn" mnemonicParsing="false" text="Partial" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="250.0" />
</content> <RadioButton fx:id="importantAnnoRBtn" mnemonicParsing="false" text="Important" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="275.0" />
</TitledPane> <Button fx:id="saveAnno" layoutX="11.0" layoutY="126.0" mnemonicParsing="false" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="300.0" />
<TitledPane animated="false" text="FPS Control"> </children>
<content> </AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> </content>
<children> </TitledPane>
<CheckBox fx:id="showFPS" layoutX="-14.0" layoutY="13.0" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" /> <TitledPane animated="false" text="FPS Control">
</children> <content>
</AnchorPane> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
</content> <children>
</TitledPane> <CheckBox fx:id="showFPS" layoutX="-14.0" layoutY="13.0" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
</panes> </children>
</Accordion> </AnchorPane>
</children> </content>
</Pane> </TitledPane>
<Label fx:id="timer" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0"> </panes>
<font> </Accordion>
<Font name="System Bold" size="15.0" /> </children>
</font> </Pane>
</Label> <Label fx:id="timer" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
<Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"> <font>
<font> <Font name="System Bold" size="15.0" />
<Font name="System Bold" size="15.0" /> </font>
</font> </Label>
</Label> <Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0">
<Label fx:id="timeZone" text="Label" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0"> <font>
<font> <Font name="System Bold" size="15.0" />
<Font name="System Bold" size="15.0" /> </font>
</font> </Label>
<padding> <Label fx:id="timeZone" text="Label" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
<Insets bottom="20.0" /> <font>
</padding> <Font name="System Bold" size="15.0" />
</Label> </font>
<StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <padding>
<children> <Insets bottom="20.0" />
<fx:include fx:id="arrow" source="arrow.fxml" /> </padding>
</children> </Label>
</StackPane> <StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" /> <children>
<AnchorPane layoutX="450.0" maxWidth="475.0" minHeight="0.0" minWidth="472.0" prefHeight="224.0" prefWidth="472.0" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="30.0" AnchorPane.topAnchor="70.0" GridPane.columnIndex="1"> <fx:include fx:id="arrow" source="arrow.fxml" />
<children> </children>
<TableView fx:id="boatInfoTable" layoutX="-2.0" minWidth="475.0" prefHeight="265.0" prefWidth="475.0" AnchorPane.bottomAnchor="164.0" AnchorPane.topAnchor="0.0"> </StackPane>
<columns> <Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" /> </children>
<TableColumn fx:id="boatTeamColumn" prefWidth="200.0" text="Team" /> </AnchorPane>
<TableColumn fx:id="boatMarkColumn" prefWidth="150.0" text="Mark" /> </children>
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" /> </StackPane>
</columns> <AnchorPane fx:id="infoWrapper" layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="20.0" GridPane.columnIndex="1">
</TableView> <children>
<AnchorPane layoutY="265.0" prefHeight="167.0" prefWidth="178.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> <GridPane layoutX="50.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <columnConstraints>
<LineChart fx:id="sparklineChart" layoutX="-211.0" layoutY="-186.0" mouseTransparent="true" prefHeight="167.0" prefWidth="178.0" titleSide="LEFT" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
<xAxis> </columnConstraints>
<NumberAxis side="BOTTOM" fx:id="xAxis" /> <rowConstraints>
</xAxis> <RowConstraints maxHeight="369.0" minHeight="10.0" prefHeight="228.0" vgrow="SOMETIMES" />
<yAxis> <RowConstraints maxHeight="250.0" minHeight="10.0" prefHeight="163.0" vgrow="SOMETIMES" />
<NumberAxis fx:id="yAxis" side="LEFT" /> </rowConstraints>
</yAxis> <children>
</LineChart> <TableView fx:id="boatInfoTable" layoutX="-2.0" maxWidth="475.0" minWidth="475.0" prefWidth="475.0" AnchorPane.bottomAnchor="126.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
</children> <columns>
</AnchorPane> <TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
</children> <TableColumn fx:id="boatTeamColumn" prefWidth="200.0" text="Team" />
</AnchorPane> <TableColumn fx:id="boatMarkColumn" prefWidth="150.0" text="Mark" />
</children> <TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
</columns>
</TableView>
<AnchorPane prefHeight="167.0" prefWidth="178.0" GridPane.rowIndex="1">
<children>
<LineChart fx:id="sparklineChart" layoutX="-211.0" layoutY="-186.0" mouseTransparent="true" prefHeight="167.0" prefWidth="178.0" titleSide="LEFT" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<xAxis>
<NumberAxis side="BOTTOM" fx:id="xAxis" />
</xAxis>
<yAxis>
<NumberAxis fx:id="yAxis" side="LEFT" />
</yAxis>
</LineChart>
</children>
</AnchorPane>
</children>
</GridPane>
</children>
</AnchorPane>
</children>
</AnchorPane> </AnchorPane>

Loading…
Cancel
Save