Integrated practice screen with menu.

This commit is contained in:
top19 2020-04-29 17:28:40 +01:00
parent b17eedcaae
commit 329b6b61ad
2 changed files with 216 additions and 69 deletions

View file

@ -16,6 +16,7 @@ import javafx.fxml.Initializable;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage; import javafx.stage.Stage;
import uk.ac.aber.cs22120.group20.javafx.Application; import uk.ac.aber.cs22120.group20.javafx.Application;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry; import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
@ -41,12 +42,14 @@ import java.util.ResourceBundle;
* @see DictionaryEntry * @see DictionaryEntry
* @see Application * @see Application
*/ */
public class PracticeListController { public class PracticeListController extends SharedCodeController{
public static Stage primaryStage = null; public static Stage primaryStage = null;
@FXML @FXML
private ImageView alphaSort; private ImageView alphaSort;
@FXML @FXML
private ImageView langSort;
@FXML
private TextField searchBox; private TextField searchBox;
@FXML @FXML
private TableView<DictionaryEntry> table; private TableView<DictionaryEntry> table;
@ -69,6 +72,16 @@ public class PracticeListController {
* @see DictionaryEntry * @see DictionaryEntry
*/ */
public void initialize() { public void initialize() {
setup();
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/rating-50.png"));
currentPageText.setText("Practice List");
practiceListIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/rating-50.png"));
practiceListTest.setFill(Color.BLACK);
alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png"));
langSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-lang-50.png"));
// list.addAll(Application.dictionary); // list.addAll(Application.dictionary);
list.addAll(Application.practiseList); list.addAll(Application.practiseList);
// for (DictionaryEntry entry : Application.dictionary) { // for (DictionaryEntry entry : Application.dictionary) {

View file

@ -6,75 +6,209 @@
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.text.Font?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<VBox alignment="CENTER" prefHeight="512.0" prefWidth="432.0" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.PracticeListController"> <BorderPane xmlns="http://javafx.com/javafx"
<children> xmlns:fx="http://javafx.com/fxml"
<HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER"> fx:controller="uk.ac.aber.cs22120.group20.javafx.PracticeListController"
<children> fx:id="container"
<Label minWidth="-Infinity" text="Search:"> minWidth="450"
<font> minHeight="550"
<Font name="System Bold" size="13.0" /> >
</font></Label>
<TextField fx:id="searchBox" prefHeight="26.0" prefWidth="519.0" HBox.hgrow="ALWAYS" />
</children> <left>
</HBox>
<HBox alignment="BOTTOM_CENTER" fillHeight="false" prefHeight="14.0" prefWidth="392.0" VBox.vgrow="NEVER"> <StackPane fx:id="outerBar">
<children> <Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50"></Rectangle>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children> <VBox spacing="300">
<Label minWidth="-Infinity" text="English">
<font> <VBox alignment="TOP_CENTER" maxHeight="${outerBar.height}">
<Font name="System Bold" size="13.0" /> <StackPane onMouseClicked="#dictionaryIconClick">
</font></Label> <Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
</children> <HBox alignment="CENTER_RIGHT">
<Text fx:id="dictionaryText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
<ImageView fx:id="dictionaryIcon"></ImageView>
</HBox>
</StackPane>
<StackPane onMouseClicked="#practiceListIconClick">
<Rectangle fill="white" height="60" width="${sideBar.width}"></Rectangle>
<HBox alignment="CENTER_RIGHT">
<Text fx:id="practiceListTest" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
<ImageView fx:id="practiceListIcon"></ImageView>
</HBox>
</StackPane>
<StackPane onMouseClicked="#flashcardIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<HBox alignment="CENTER_RIGHT">
<Text fx:id="flashcardsText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
<ImageView fx:id="flashcardIcon"></ImageView>
</HBox>
</StackPane>
<StackPane onMouseClicked="#studyIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<HBox alignment="CENTER_RIGHT">
<Text fx:id="studyText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
<ImageView fx:id="studyIcon"></ImageView>
</HBox>
</StackPane>
</VBox>
<StackPane alignment="BOTTOM_CENTER" onMouseClicked="#addWordIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<HBox alignment="CENTER_RIGHT">
<Text fx:id="addDefinitionText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
<ImageView fx:id="addDefinitionIcon"></ImageView>
</HBox>
</StackPane>
</VBox>
</StackPane>
</left>
<top>
<StackPane fx:id="topBar">
<Rectangle fx:id="parentRectangle" fill="dimgray" width="${topBar.width}" height="50"></Rectangle>
<HBox alignment="CENTER_LEFT" prefWidth="${topBar.width}" spacing="7">
<StackPane onMouseClicked="#expandMenuClick">
<Rectangle fill="dimgray" width="55" height="50"></Rectangle>
<ImageView fx:id="expandMenuIcon"></ImageView>
</StackPane>
<ImageView fx:id="currentPageIcon"></ImageView>
<Text fx:id="currentPageText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
</font>
</Text>
</HBox> </HBox>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0">
<children> </StackPane>
<ImageView fx:id="alphaSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchAlphaSort" pickOnBounds="true" preserveRatio="true"> </top>
<image>
<Image url="@../../../../../assets/icons/black_icons/50px/sort-alpha-up-50.png" /> <center>
</image> <VBox alignment="CENTER" prefHeight="512.0" prefWidth="432.0" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<HBox.margin> <children>
<Insets right="5.0" /> <HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER">
</HBox.margin> <children>
</ImageView> <Label minWidth="-Infinity" text="Search:">
<ImageView fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchLangSort" pickOnBounds="true" preserveRatio="true"> <font>
<image> <Font name="System Bold" size="13.0" />
<Image url="@../../../../../assets/icons/black_icons/50px/sort-lang-50.png" /> </font></Label>
</image> <TextField fx:id="searchBox" prefHeight="26.0" prefWidth="519.0" HBox.hgrow="ALWAYS" />
<HBox.margin> </children>
<Insets left="5.0" /> </HBox>
</HBox.margin> <HBox alignment="BOTTOM_CENTER" fillHeight="false" prefHeight="14.0" prefWidth="392.0" VBox.vgrow="NEVER">
</ImageView> <children>
</children> <HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
</HBox> <children>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS"> <Label minWidth="-Infinity" text="English">
<children> <font>
<Label minWidth="-Infinity" text="Welsh"> <Font name="System Bold" size="13.0" />
<font> </font></Label>
<Font name="System Bold" size="13.0" /> </children>
</font></Label> </HBox>
</children> <HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0">
</HBox> <children>
</children> <ImageView fx:id="alphaSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchAlphaSort" pickOnBounds="true" preserveRatio="true">
</HBox>
<TableView fx:id="table" VBox.vgrow="ALWAYS"> <HBox.margin>
<columns> <Insets right="5.0" />
<TableColumn fx:id="english" prefWidth="196.0" text="English" /> </HBox.margin>
<TableColumn fx:id="welsh" prefWidth="195.0" text="Welsh" /> </ImageView>
</columns> <ImageView fx:id="langSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchLangSort" pickOnBounds="true" preserveRatio="true">
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> <HBox.margin>
</columnResizePolicy> <Insets left="5.0" />
</TableView> </HBox.margin>
<Button fx:id="primaryButton" onAction="#switchToFlashCard" text="Switch to FlashCard View" /> </ImageView>
</children> </children>
<padding> </HBox>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> <HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
</padding> <children>
</VBox> <Label minWidth="-Infinity" text="Welsh">
<font>
<Font name="System Bold" size="13.0" />
</font></Label>
</children>
</HBox>
</children>
</HBox>
<TableView fx:id="table" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="english" prefWidth="196.0" text="English" />
<TableColumn fx:id="welsh" prefWidth="195.0" text="Welsh" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<Button fx:id="primaryButton" onAction="#switchToFlashCard" text="Switch to FlashCard View" />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>
</center>
</BorderPane>