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.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import uk.ac.aber.cs22120.group20.javafx.Application;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
@ -41,12 +42,14 @@ import java.util.ResourceBundle;
* @see DictionaryEntry
* @see Application
*/
public class PracticeListController {
public class PracticeListController extends SharedCodeController{
public static Stage primaryStage = null;
@FXML
private ImageView alphaSort;
@FXML
private ImageView langSort;
@FXML
private TextField searchBox;
@FXML
private TableView<DictionaryEntry> table;
@ -69,6 +72,16 @@ public class PracticeListController {
* @see DictionaryEntry
*/
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.practiseList);
// for (DictionaryEntry entry : Application.dictionary) {

View file

@ -6,75 +6,209 @@
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?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">
<children>
<HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER">
<children>
<Label minWidth="-Infinity" text="Search:">
<font>
<Font name="System Bold" size="13.0" />
</font></Label>
<TextField fx:id="searchBox" prefHeight="26.0" prefWidth="519.0" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" fillHeight="false" prefHeight="14.0" prefWidth="392.0" VBox.vgrow="NEVER">
<children>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<Label minWidth="-Infinity" text="English">
<font>
<Font name="System Bold" size="13.0" />
</font></Label>
</children>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.PracticeListController"
fx:id="container"
minWidth="450"
minHeight="550"
>
<left>
<StackPane fx:id="outerBar">
<Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50"></Rectangle>
<VBox spacing="300">
<VBox alignment="TOP_CENTER" maxHeight="${outerBar.height}">
<StackPane onMouseClicked="#dictionaryIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<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 alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<ImageView fx:id="alphaSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchAlphaSort" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../../../../assets/icons/black_icons/50px/sort-alpha-up-50.png" />
</image>
<HBox.margin>
<Insets right="5.0" />
</HBox.margin>
</ImageView>
<ImageView fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchLangSort" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../../../../assets/icons/black_icons/50px/sort-lang-50.png" />
</image>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ImageView>
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<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>
</StackPane>
</top>
<center>
<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">
<children>
<HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER">
<children>
<Label minWidth="-Infinity" text="Search:">
<font>
<Font name="System Bold" size="13.0" />
</font></Label>
<TextField fx:id="searchBox" prefHeight="26.0" prefWidth="519.0" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" fillHeight="false" prefHeight="14.0" prefWidth="392.0" VBox.vgrow="NEVER">
<children>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<Label minWidth="-Infinity" text="English">
<font>
<Font name="System Bold" size="13.0" />
</font></Label>
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<ImageView fx:id="alphaSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchAlphaSort" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets right="5.0" />
</HBox.margin>
</ImageView>
<ImageView fx:id="langSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchLangSort" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ImageView>
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<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>