This commit is contained in:
kab74 2020-05-01 14:18:30 +01:00
commit 232a629fe2
16 changed files with 59 additions and 25 deletions

View file

@ -28,7 +28,7 @@ import uk.ac.aber.cs221.group20.json.DictionaryEntry;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development.
* @see DictionaryEntry

View file

@ -23,7 +23,7 @@ import java.util.LinkedList;
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Marcin Jakob [maj83]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Oscar Pocock [osp1]
* @author Waylen Watts [ncw]
* @author Luke Wybar [law39]

View file

@ -38,7 +38,7 @@ import java.util.Comparator;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development.
* @see DictionaryEntry

View file

@ -1,3 +1,9 @@
/**
* @(#) FlashcardController.java 0,1 2020/05/07
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.javafx;
import javafx.animation.*;
@ -26,6 +32,7 @@ import uk.ac.aber.cs221.group20.json.DictionaryEntry;
* @see Application
* @see DictionaryEntry
* @see SharedCodeController
* @see RotateTransition
*/
public class FlashcardController extends SharedCodeController {
@ -35,7 +42,7 @@ public class FlashcardController extends SharedCodeController {
// /////////////////// //
int index = 0;
Node card;
Node card; // Node that will be flipped using RotateTransition.
@FXML
private Text counter;
@ -58,11 +65,13 @@ public class FlashcardController extends SharedCodeController {
/**
* Method that initializes 'flashcard.fxml' by setting up the icons and text. This method is called automatically whenever the flashcard scene starts.
*
* @see DictionaryEntry
* @see Image
*/
@FXML
private void initialize() {
// Call method from SharedCodeController to setup the menu screen.
setup();
setup(); // Call method from SharedCodeController to setup the menu screens images.
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"));
@ -76,8 +85,7 @@ public class FlashcardController extends SharedCodeController {
wordType.setText("Welsh");
}
updateCounter();
card = flashcard;
updateCounter(); // Update the on screen counter and setup the flashcards images.
flashcard.setImage(new Image("file:src/main/resources/assets/flashcard/FlashCard.png"));
leftArrow.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/left-50.png"));
rightArrow.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
@ -85,16 +93,19 @@ public class FlashcardController extends SharedCodeController {
/**
* Event that rotates the scenes flashcard using RotateTransition whenever the user clicks the flashcard.
*
* @see RotateTransition
*/
@FXML
private void handleFlashcardClick() {
RotateTransition rotator = RotateCard(card);
card = flashcard;
RotateTransition rotator = RotateCard(card); // Call method to create the RotateTransition.
rotator.play(); // Play the rotate transition.
}
/**
* Event that switches to the previous flashcard whenever the user clicks the 'leftArrow' icon.
*
* @see Application
* @see DictionaryEntry
*/
@ -117,6 +128,7 @@ public class FlashcardController extends SharedCodeController {
/**
* Event that switches to the next flashcard whenever the user clicks the 'right-arrow' icon.
*
* @see Application
* @see DictionaryEntry
*/
@ -140,6 +152,7 @@ public class FlashcardController extends SharedCodeController {
/**
* Method that updates the onscreen counter of the current flashcard.
*
* @see Application
* @see DictionaryEntry
*/
@ -149,6 +162,7 @@ public class FlashcardController extends SharedCodeController {
/**
* Method that creates a RotateTransition animation for flipping the flashcard 180 degrees.
*
* @param card FXML rectangle element that will be flipped.
* @return RotateTransition that will flip the rectangle 180 degrees.
* @see Application

View file

@ -27,7 +27,7 @@ import java.util.*;
* @author Luke Wybar [law39]
* @author Marcin Jakobik [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.4 Initial development
* @see Application

View file

@ -34,7 +34,7 @@ import java.util.Comparator;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development.
* @see DictionaryEntry

View file

@ -1,5 +1,10 @@
package uk.ac.aber.cs221.group20.javafx;
/**
* @(#) ScreenSwitch.java 0.1 2020/04/07
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
@ -12,7 +17,14 @@ import java.net.URL;
* Class that contains a sub-enumeration containing all scenes and FXML references
* Also controls the stage, for the purpose of switching to new scenes
*
* @author Luke Wybar (LAW39)
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1
* @see SceneType
*/
@ -58,11 +70,12 @@ public class ScreenSwitch extends SharedCodeController {
*/
private static Parent fxmlLoader(SceneType newScene){
Parent root = null;
// If an error occurs while loading, print out error message and stack trace on STDIO, then crash gracefully
try{
String fxmlName = newScene.getFXML();
root = FXMLLoader.load(new URL("file:src/main/resources/uk/ac/aber/cs221/group20/" + fxmlName));
}catch (IOException e){ // If an error occurs, print out error message on STDIO and crash gracefully
}catch (IOException e){
System.err.print("Loading the FXML file ");
System.err.print(newScene.getFXML());
System.err.println(" Failed!");
@ -82,7 +95,14 @@ public class ScreenSwitch extends SharedCodeController {
* Following the spirit of those already setup.
* This file must be located in the resources folder in the package uk.ac.aber.cs22120.group20.
*
* @author Luke Wybar (LAW39)
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1
* @see ScreenSwitch
*/

View file

@ -12,7 +12,7 @@ import uk.ac.aber.cs221.group20.json.DictionaryEntry;
* Abstract class that contains all the shared FXML elements between the
* different controller classes including the sliding menu and the test score counter, to reduce code
* duplication. This will be extended by all the controller classes.
* @Author top19
* @author Tom Perry [top19]
* @Version 0.1 Initial development.
* @see Application
* @see DictionaryEntry

View file

@ -29,7 +29,7 @@ import java.util.Collections;
* @author Luke Wybar [law39]
* @author Marcin Jakobik [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @see Application

View file

@ -25,7 +25,7 @@ import java.util.LinkedList;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development.
* @see DictionaryEntry

View file

@ -19,7 +19,7 @@ import java.util.*;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @see Question

View file

@ -13,7 +13,7 @@ import java.util.Arrays;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @see Question

View file

@ -17,7 +17,7 @@ import java.util.ArrayList;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
*/

View file

@ -13,7 +13,7 @@ import java.util.Random;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @see Question

View file

@ -10,7 +10,7 @@ import uk.ac.aber.cs221.group20.json.DictionaryEntry;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @see Question

View file

@ -23,7 +23,7 @@ import static uk.ac.aber.cs221.group20.json.DictionaryEntry.wordTypeEnum.verb;
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Tom Perry [top19]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question