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,13 +6,125 @@
<?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"
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>
</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> <children>
<HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER"> <HBox alignment="CENTER_LEFT" prefHeight="11.0" prefWidth="392.0" VBox.vgrow="NEVER">
<children> <children>
@ -36,17 +148,13 @@
<HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="BOTTOM_CENTER" prefHeight="100.0" prefWidth="200.0">
<children> <children>
<ImageView fx:id="alphaSort" fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchAlphaSort" pickOnBounds="true" preserveRatio="true"> <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> <HBox.margin>
<Insets right="5.0" /> <Insets right="5.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<ImageView fitHeight="20.0" fitWidth="20.0" onMouseClicked="#switchLangSort" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="langSort" 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> <HBox.margin>
<Insets left="5.0" /> <Insets left="5.0" />
</HBox.margin> </HBox.margin>
@ -77,4 +185,30 @@
<padding> <padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding> </padding>
</VBox> </VBox>
</center>
</BorderPane>