This commit is contained in:
Henry Dugmore 2020-04-30 09:25:53 +01:00
commit 4d768483bd
14 changed files with 888 additions and 273 deletions

View file

@ -8,6 +8,8 @@ import javafx.scene.control.TextField;
import java.io.IOException; import java.io.IOException;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry; import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
@ -15,7 +17,7 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
* Add Word Controller * Add Word Controller
*/ */
public class AddWordController { public class AddWordController extends SharedCodeController {
@FXML @FXML
private TextField welsh; private TextField welsh;
@ -34,6 +36,12 @@ public class AddWordController {
@FXML @FXML
private void initialize() { private void initialize() {
setup();
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/add-50.png"));
currentPageText.setText("Add");
addDefinitionIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/add-50.png"));
addDefinitionText.setFill(Color.BLACK);
wordType.getItems().addAll("Masculine noun", "Feminine noun", "Verb", "Other"); wordType.getItems().addAll("Masculine noun", "Feminine noun", "Verb", "Other");
wordType.setValue("Type"); wordType.setValue("Type");
@ -118,11 +126,6 @@ public class AddWordController {
// } // }
@FXML
private void switchToPrimary() throws IOException {
Application.setRoot("Primary");
}
// add character methods for characters ch, dd, ff, ng, ll, ph, rh, th // add character methods for characters ch, dd, ff, ng, ll, ph, rh, th
public void addCharch(ActionEvent actionEvent) { public void addCharch(ActionEvent actionEvent) {
welsh.appendText("ch"); welsh.appendText("ch");

View file

@ -19,6 +19,7 @@ import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
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;
@ -45,12 +46,14 @@ import java.util.ResourceBundle;
* @see Application * @see Application
*/ */
//public class DictionaryController implements Initializable { //public class DictionaryController implements Initializable {
public class DictionaryController { public class DictionaryController 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;
@ -113,15 +116,6 @@ public class DictionaryController {
} }
} }
/**
* Switches to the primary scene.
*
* @throws IOException
*/
@FXML
private void switchToPracticeList() throws IOException {
ScreenSwitch.swap(ScreenSwitch.SceneEnum.practiceListScene);
}
/** /**
* Initializes the table of dictionary entries. * Initializes the table of dictionary entries.
@ -135,6 +129,13 @@ public class DictionaryController {
* @see DictionaryEntry * @see DictionaryEntry
*/ */
public void initialize() { public void initialize() {
setup();
currentPageIcon.setImage(new Image(getClass().getResourceAsStream("/assets/icons/white_icons/50px/read-50.png")));
currentPageText.setText("Dictionary");
dictionaryIcon.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/read-50.png")));
dictionaryText.setFill(Color.BLACK);
list.addAll(Application.dictionary); list.addAll(Application.dictionary);
table.setRowFactory(tv -> { table.setRowFactory(tv -> {

View file

@ -5,6 +5,7 @@ import javafx.fxml.FXML;
import javafx.scene.Node; import javafx.scene.Node;
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.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.scene.transform.Rotate; import javafx.scene.transform.Rotate;
@ -30,7 +31,7 @@ import java.io.IOException;
* @see SharedCodeController * @see SharedCodeController
*/ */
public class FlashcardController { public class FlashcardController extends SharedCodeController {
// /////////////////// // // /////////////////// //
// Instance Variables. // // Instance Variables. //
@ -49,9 +50,9 @@ public class FlashcardController {
private Text testWord; private Text testWord;
@FXML @FXML
private ImageView left_arrow; private ImageView leftArrow;
@FXML @FXML
private ImageView right_arrow; private ImageView rightArrow;
// //////// // // //////// //
// Methods. // // Methods. //
@ -63,14 +64,21 @@ public class FlashcardController {
*/ */
@FXML @FXML
private void initialize() { private void initialize() {
// Call method from SharedCodeController to setup the menu screen.
setup();
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/flashcard-50.png"));
currentPageText.setText("Flashcard");
flashcardIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/flashcard-50.png"));
flashcardsText.setFill(Color.BLACK);
testWord.setText(Application.practiseList.getFirst().getWelsh()); testWord.setText(Application.practiseList.getFirst().getWelsh());
wordType.setText("Welsh"); wordType.setText("Welsh");
updateCounter(); updateCounter();
card = flashcard; card = flashcard;
left_arrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/left-50.png"))); leftArrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/left-50.png")));
right_arrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/right-50.png"))); rightArrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/right-50.png")));
} }
/** /**
@ -162,9 +170,5 @@ public class FlashcardController {
} }
@FXML
private void switchToAddWord() throws IOException {
AssessmentGenerator.generateAssessment(Application.practiseList);
}
} }

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) {
@ -220,15 +233,7 @@ public class PracticeListController {
} }
} }
/**
* Switches to the primary scene.
*
* @throws IOException
*/
@FXML
private void switchToFlashCard() throws IOException {
ScreenSwitch.swap(ScreenSwitch.SceneEnum.flashcardScene);
}
} }

View file

@ -6,6 +6,7 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import uk.ac.aber.cs22120.group20.selfassessment.AssessmentGenerator;
/** /**
* Abstract class that contains all the shared FXML elements between the * Abstract class that contains all the shared FXML elements between the
@ -123,8 +124,7 @@ abstract public class SharedCodeController {
@FXML @FXML
private void studyIconClick() { private void studyIconClick() {
AssessmentGenerator.generateAssessment(Application.practiseList);
ScreenSwitch.swap(ScreenSwitch.SceneEnum.translationScene);
} }
@FXML @FXML

View file

@ -57,7 +57,7 @@ public class DictionaryEntry {
} }
public void setEnglish(String english) { public void setEnglish(String english) {
this.english = english; this.english = english.trim();
} }
public String getWelsh() { public String getWelsh() {
@ -65,7 +65,7 @@ public class DictionaryEntry {
} }
public void setWelsh(String welsh) { public void setWelsh(String welsh) {
this.welsh = welsh; this.welsh = welsh.trim();
} }
public String getWordType() { public String getWordType() {
@ -73,7 +73,7 @@ public class DictionaryEntry {
} }
public void setWordType(String wordType) { public void setWordType(String wordType) {
this.wordType = wordType; this.wordType = wordType.trim();
} }
public Boolean isPracticeWord() { public Boolean isPracticeWord() {

View file

@ -20,7 +20,7 @@ import java.util.*;
* @See * @See
*/ */
public class AssessmentGenerator { public class AssessmentGenerator {
static boolean isEnglish; public static boolean isEnglish;
static LinkedList<Question> listOfAssessment = new LinkedList<>(); static LinkedList<Question> listOfAssessment = new LinkedList<>();
static int currentAssessment = 0; static int currentAssessment = 0;
@ -182,16 +182,12 @@ public class AssessmentGenerator {
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
currentAssessment = 0;
Question.resetScore();
if (result.isEmpty() || result.get() == noBtn) { if (result.isEmpty() || result.get() == noBtn) {
currentAssessment=0;
Question.resetScore();
ScreenSwitch.swap(ScreenSwitch.SceneEnum.dictionaryScene); ScreenSwitch.swap(ScreenSwitch.SceneEnum.dictionaryScene);
} else { } else {
currentAssessment = 0;
Question.resetScore();
generateAssessment(Application.practiseList); generateAssessment(Application.practiseList);
} }
} }

View file

@ -0,0 +1,57 @@
package uk.ac.aber.cs22120.group20.test;
import org.junit.Before;
import org.junit.jupiter.api.Test;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import uk.ac.aber.cs22120.group20.selfassessment.AssessmentGenerator;
import uk.ac.aber.cs22120.group20.selfassessment.Question;
import uk.ac.aber.cs22120.group20.selfassessment.TranslationController;
import java.util.LinkedList;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*;
public class TranslationControllerTest {
LinkedList<DictionaryEntry> practiceList;
DictionaryEntry word1 = new DictionaryEntry("english1", "welsh1", "verb");
DictionaryEntry word2 = new DictionaryEntry("english2", "welsh2", "verb");
DictionaryEntry word3 = new DictionaryEntry("english3", "welsh3", "verb");
Random rand = new Random();
int chosenWord;
TranslationController controllerToTest = new TranslationController();
@Before
public void fillList(){
practiceList.add(word1);
practiceList.add(word2);
practiceList.add(word3);
chosenWord = rand.nextInt(practiceList.size());
TranslationController.answer = practiceList.get(chosenWord);
if(AssessmentGenerator.isEnglish){
controllerToTest.wordToTranslate.setText(TranslationController.answer.getEnglish());
}
else{
controllerToTest.wordToTranslate.setText(TranslationController.answer.getWelsh());
}
}
@Test
public void testText(){
if(AssessmentGenerator.isEnglish){
assertEquals(practiceList.get(chosenWord).getEnglish(),TranslationController.answer.getEnglish());
}
else{
}
}
}

View file

@ -4,11 +4,125 @@
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="506.0" prefWidth="702.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.AddWordController"> <?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.AddWordController"
fx:id="container"
stylesheets=""
minWidth="500"
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="dimgray" 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="white" 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>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="506.0" prefWidth="702.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@ -35,7 +149,6 @@
<Button mnemonicParsing="false" onAction="#addButtonClick" prefHeight="25.0" prefWidth="274.0" text="Add Word" GridPane.columnIndex="3" GridPane.rowIndex="4" /> <Button mnemonicParsing="false" onAction="#addButtonClick" prefHeight="25.0" prefWidth="274.0" text="Add Word" GridPane.columnIndex="3" GridPane.rowIndex="4" />
<TextField fx:id="english" GridPane.columnIndex="1" GridPane.rowIndex="3" /> <TextField fx:id="english" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<TextField fx:id="welsh" GridPane.columnIndex="5" GridPane.rowIndex="3" /> <TextField fx:id="welsh" GridPane.columnIndex="5" GridPane.rowIndex="3" />
<Button mnemonicParsing="false" onAction="#switchToPrimary" prefHeight="25.0" prefWidth="107.0" text="Switch Scene" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<GridPane prefHeight="55.0" prefWidth="258.0" GridPane.columnIndex="3" GridPane.rowIndex="5"> <GridPane prefHeight="55.0" prefWidth="258.0" GridPane.columnIndex="3" GridPane.rowIndex="5">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@ -63,3 +176,34 @@
</GridPane> </GridPane>
</children> </children>
</GridPane> </GridPane>
</center>
</BorderPane>

View file

@ -12,7 +12,125 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?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.DictionaryController"> <?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.DictionaryController"
fx:id="container"
stylesheets=""
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="white" 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="dimgray" 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 +154,12 @@
<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>
@ -72,9 +185,38 @@
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy> </columnResizePolicy>
</TableView> </TableView>
<Button fx:id="primaryButton" onAction="#switchToPracticeList" text="Switch to Practice List" />
</children> </children>
<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>

View file

@ -1,24 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.*?>
<?import javafx.scene.control.Button?> <?import javafx.scene.layout.*?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.text.*?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?> <?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<VBox alignment="center" spacing="10" stylesheets="@styles.css" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.FlashcardController"> <?import javafx.scene.control.Button?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.FlashcardController"
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="dimgray" 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="white" 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" spacing="10" minHeight="500" prefHeight="512" prefWidth="432" >
<padding> <padding>
<Insets bottom="10" left="25" right="25" top="25" /> <Insets top="25" right="25" bottom="10" left="25"/>
</padding> </padding>
<children> <children>
<StackPane onMouseClicked="#handleFlashcardClick"> <StackPane alignment="CENTER" onMouseClicked="#handleFlashcardClick" VBox.vgrow="NEVER" minWidth="350">
<children> <children>
<Rectangle fx:id="flashcard" arcHeight="80" arcWidth="80" fill="white" height="360" stroke="black" width="550" /> <Rectangle fx:id="flashcard" width="550" height="360" fill="white" arcHeight="80" arcWidth="80"
<Text fx:id="testWord" textAlignment="CENTER"> stroke="black"/>
<Text textAlignment="CENTER" fx:id="testWord">
<font> <font>
<Font size="55"/> <Font size="55"/>
</font> </font>
@ -27,19 +137,39 @@
<VBox alignment="BOTTOM_CENTER"> <VBox alignment="BOTTOM_CENTER">
<Text fx:id="wordType" fill="dimgray"> <Text fx:id="wordType" fill="dimgray">
<font> <font>
<Font size="20" /> <Font size="20"></Font>
</font> </font>
</Text> </Text>
</VBox> </VBox>
</children> </children>
</StackPane> </StackPane>
<HBox alignment="BASELINE_CENTER" spacing="190"> <HBox spacing="190" alignment="BASELINE_CENTER">
<children> <children>
<ImageView fx:id="left_arrow" onMouseClicked="#handlePreviousCard" visible="true" /> <ImageView fx:id="leftArrow" onMouseClicked="#handlePreviousCard"></ImageView>
<Text fx:id="counter"><font> <Font size="20" /></font></Text> <Text fx:id="counter"><font> <Font size = "20"></Font></font></Text>
<ImageView fx:id="right_arrow" onMouseClicked="#handleNextCard" /> <ImageView fx:id="rightArrow" onMouseClicked="#handleNextCard"></ImageView>
</children> </children>
</HBox> </HBox>
<Button mnemonicParsing="false" onAction="#switchToAddWord" text="Add Word Screen" />
</children> </children>
</VBox> </VBox>
</center>
</BorderPane>

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>
@ -72,9 +180,34 @@
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy> </columnResizePolicy>
</TableView> </TableView>
<Button fx:id="primaryButton" onAction="#switchToFlashCard" text="Switch to FlashCard View" />
</children> </children>
<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>