Resolve "Split up FXML files and add communications between them (maybe add design)"
This commit is contained in:
+12
-4
@@ -1,14 +1,14 @@
|
||||
package it1901.groups2021.gr2141.core.domainlogic;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import it1901.groups2021.gr2141.core.models.CardContent;
|
||||
import it1901.groups2021.gr2141.core.models.CardDeck;
|
||||
import it1901.groups2021.gr2141.core.state.Observable;
|
||||
|
||||
public class FlashCardProvider {
|
||||
public class FlashCardProvider extends Observable<FlashCardProvider> {
|
||||
|
||||
private static final Preferences prefs = Preferences.userRoot().node(FlashCardProvider.class.getName());
|
||||
|
||||
@@ -27,7 +27,10 @@ public class FlashCardProvider {
|
||||
this.showOrderIsFlippedMode = prefs.getBoolean("showOrderIsFlippedMode", false);
|
||||
this.cardOrderIsRandomMode = prefs.getBoolean("cardOrderIsRandomMode",false);
|
||||
this.firstLastWrapAroundMode = prefs.getBoolean("firstLastWrapAroundMode", true);
|
||||
}
|
||||
|
||||
private void updateSubscribers() {
|
||||
super.updateSubscribers(this);
|
||||
}
|
||||
|
||||
public CardDeck getCardDeck() {
|
||||
@@ -36,6 +39,7 @@ public class FlashCardProvider {
|
||||
|
||||
public void setCardDeck(CardDeck deck) {
|
||||
this.deck = deck;
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
public int getCardIndex() {
|
||||
@@ -75,8 +79,7 @@ public class FlashCardProvider {
|
||||
this.cardIndex %= this.deck.getNumberOfCards();
|
||||
|
||||
cardShowsFront = true;
|
||||
|
||||
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
// used for later iterations
|
||||
@@ -110,10 +113,12 @@ public class FlashCardProvider {
|
||||
int nextCard = randomGenerator.nextInt(deck.getNumberOfCards() - 1);
|
||||
nextCard = nextCard + ((nextCard >= cardIndex) ? 1 : 0);
|
||||
return nextCard;
|
||||
|
||||
}
|
||||
|
||||
public void flipCard() {
|
||||
this.cardShowsFront = !this.cardShowsFront;
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
public boolean getShowOrderIsFlippedMode() {
|
||||
@@ -131,16 +136,19 @@ public class FlashCardProvider {
|
||||
public void toggleShowOrderIsFlippedMode() {
|
||||
this.showOrderIsFlippedMode = !this.showOrderIsFlippedMode;
|
||||
prefs.putBoolean("showOrderIsFlippedMode", this.showOrderIsFlippedMode);
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
public void toggleCardOrderIsRandomMode() {
|
||||
this.cardOrderIsRandomMode = !this.cardOrderIsRandomMode;
|
||||
prefs.putBoolean("cardOrderIsRandomMode", this.cardOrderIsRandomMode);
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
public void toggleFirstLastWrapAroundMode() {
|
||||
this.firstLastWrapAroundMode = !this.firstLastWrapAroundMode;
|
||||
prefs.putBoolean("firstLastWrapAroundMode", this.firstLastWrapAroundMode);
|
||||
updateSubscribers();
|
||||
}
|
||||
|
||||
public void clearPreferences() {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package it1901.groups2021.gr2141.core.state;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class Observable<T> {
|
||||
private Collection<Consumer<T>> subscribers = new ArrayList<>();
|
||||
|
||||
public void subscribe(Consumer<T> function) throws IllegalArgumentException {
|
||||
this.subscribers.add(function);
|
||||
}
|
||||
|
||||
public void updateSubscribers(T newValue) {
|
||||
this.subscribers.forEach((s) -> s.accept(newValue));
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import javafx.scene.image.Image;
|
||||
*/
|
||||
public class Flashy extends Application {
|
||||
|
||||
public static final FlashyModel applicationState = new FlashyModel();
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@@ -1,148 +1,10 @@
|
||||
package it1901.groups2021.gr2141.ui;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import it1901.groups2021.gr2141.core.models.CardDeck;
|
||||
import it1901.groups2021.gr2141.core.models.Flashcard;
|
||||
import it1901.groups2021.gr2141.core.storage.CardDeckStorage;
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
||||
/**
|
||||
* Root controller of the application UI.
|
||||
*/
|
||||
public class FlashyAppController implements Initializable {
|
||||
|
||||
@FXML
|
||||
private TextField writeFront;
|
||||
|
||||
@FXML
|
||||
private TextField writeBack;
|
||||
|
||||
@FXML
|
||||
private Label showCard;
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleFirstLastWrapAroundMode;
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleRandomMode;
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleShowOtherSide;
|
||||
|
||||
private FlashCardProvider flashCardProvider = new FlashCardProvider();
|
||||
|
||||
/**
|
||||
* Initializes the card deck.
|
||||
*
|
||||
* @param url
|
||||
* @param resourceBundle
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
try {
|
||||
flashCardProvider.setCardDeck(CardDeckStorage.readDeck(0));
|
||||
} catch (Exception e) {
|
||||
flashCardProvider.setCardDeck(new CardDeck(List.of(Flashcard.of("Welcome to Flashy", "E N J O Y !"))));
|
||||
}
|
||||
setToggleButtonValues();
|
||||
showCurrentCardContent();
|
||||
}
|
||||
|
||||
private void setToggleButtonValues() {
|
||||
btnToggleRandomMode.setSelected(flashCardProvider.getCardOrderIsRandomMode());
|
||||
btnToggleShowOtherSide.setSelected(flashCardProvider.getShowOrderIsFlippedMode());
|
||||
btnToggleFirstLastWrapAroundMode.setSelected(flashCardProvider.getFirstLastWrapAroundMode());
|
||||
}
|
||||
|
||||
public void showCurrentCardContent() {
|
||||
var content = flashCardProvider.getCard();
|
||||
showCard.setText(listToString(content.getLines()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the card content to String.
|
||||
*
|
||||
* @param lines
|
||||
*/
|
||||
private static String listToString(List<String> lines) {
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
// package it1901.groups2021.gr2141.ui;
|
||||
|
||||
|
||||
@FXML
|
||||
public void handleFlipCardMouse(MouseEvent event) {
|
||||
flashCardProvider.flipCard();
|
||||
showCurrentCardContent();
|
||||
}
|
||||
// /**
|
||||
// * Root controller of the application UI.
|
||||
// */
|
||||
// public class FlashyAppController implements Initializable {
|
||||
|
||||
@FXML
|
||||
public void handleFlipCardButton(ActionEvent event) {
|
||||
flashCardProvider.flipCard();
|
||||
showCurrentCardContent();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleTurnToNextCard(ActionEvent event) {
|
||||
flashCardProvider.turnToNextCard(flashCardProvider.getCardIndex());
|
||||
showCurrentCardContent();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleTurnToPreviousCard(ActionEvent event) {
|
||||
flashCardProvider.turnToPreviousCard(flashCardProvider.getCardIndex());
|
||||
showCurrentCardContent();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleShowOtherSide(ActionEvent event) {
|
||||
flashCardProvider.toggleShowOrderIsFlippedMode();
|
||||
showCurrentCardContent();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleCardOrderIsRandom(ActionEvent event) {
|
||||
flashCardProvider.toggleCardOrderIsRandomMode();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleFirstLastWrapAroundMode(ActionEvent event) {
|
||||
flashCardProvider.toggleFirstLastWrapAroundMode();
|
||||
}
|
||||
|
||||
private void clearTextFields() {
|
||||
writeFront.clear();
|
||||
writeBack.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a card and saves the card
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@FXML
|
||||
public void handleCreateFlashCard(ActionEvent event) {
|
||||
if (writeFront.getText().isEmpty() || writeBack.getText().isEmpty())
|
||||
return;
|
||||
|
||||
flashCardProvider.getCardDeck().add(Flashcard.of(writeFront.getText(), writeBack.getText()));
|
||||
clearTextFields();
|
||||
|
||||
try {
|
||||
CardDeckStorage.writeDeck(flashCardProvider.getCardDeck(), 0);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to write carddeck to file");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package it1901.groups2021.gr2141.ui;
|
||||
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
|
||||
public class FlashyModel {
|
||||
|
||||
private FlashCardProvider flashCardProvider;
|
||||
|
||||
public FlashyModel() {
|
||||
this.flashCardProvider = new FlashCardProvider();
|
||||
}
|
||||
|
||||
public FlashCardProvider getFlashCardProvider() {
|
||||
return this.flashCardProvider;
|
||||
}
|
||||
|
||||
public void setFlashCardProvider(FlashCardProvider flashCardProvider) {
|
||||
if (flashCardProvider == null) {
|
||||
throw new IllegalArgumentException("FlashCardProvider can not be null");
|
||||
}
|
||||
this.flashCardProvider = flashCardProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package it1901.groups2021.gr2141.ui.controllers;
|
||||
|
||||
import java.util.List;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
import it1901.groups2021.gr2141.core.models.CardDeck;
|
||||
import it1901.groups2021.gr2141.core.models.Flashcard;
|
||||
import it1901.groups2021.gr2141.core.storage.CardDeckStorage;
|
||||
import it1901.groups2021.gr2141.ui.Flashy;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
||||
|
||||
/**
|
||||
* CardArea controller of the application UI.
|
||||
*/
|
||||
public class FlashyCardAreaController implements Initializable {
|
||||
|
||||
@FXML
|
||||
private Label showCard;
|
||||
|
||||
/**
|
||||
* Initializes the card deck.
|
||||
*
|
||||
* @param url
|
||||
* @param resourceBundle
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
try {
|
||||
getFlashcardProvider().setCardDeck(CardDeckStorage.readDeck(0));
|
||||
} catch (Exception e) {
|
||||
getFlashcardProvider().setCardDeck(new CardDeck(List.of(Flashcard.of("Welcome to Flashy", "E N J O Y !"))));
|
||||
}
|
||||
|
||||
showCurrentCardContent();
|
||||
getFlashcardProvider().subscribe((newFlashCardModel) -> showCurrentCardContent());
|
||||
}
|
||||
|
||||
private FlashCardProvider getFlashcardProvider() {
|
||||
return Flashy.applicationState.getFlashCardProvider();
|
||||
}
|
||||
|
||||
public void showCurrentCardContent() {
|
||||
var content = getFlashcardProvider().getCard();
|
||||
showCard.setText(listToString(content.getLines()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the card content to String.
|
||||
*
|
||||
* @param lines
|
||||
*/
|
||||
private static String listToString(List<String> lines) {
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleFlipCardMouse(MouseEvent event) {
|
||||
getFlashcardProvider().flipCard();
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package it1901.groups2021.gr2141.ui.controllers;
|
||||
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
import it1901.groups2021.gr2141.ui.Flashy;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
public class FlashyCardNavigationController {
|
||||
|
||||
|
||||
private FlashCardProvider getFlashcardProvider() {
|
||||
return Flashy.applicationState.getFlashCardProvider();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleFlipCardButton(ActionEvent event) {
|
||||
getFlashcardProvider().flipCard();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleTurnToNextCard(ActionEvent event) {
|
||||
getFlashcardProvider().turnToNextCard(getFlashcardProvider().getCardIndex());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleTurnToPreviousCard(ActionEvent event) {
|
||||
getFlashcardProvider().turnToPreviousCard(getFlashcardProvider().getCardIndex());
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package it1901.groups2021.gr2141.ui.controllers;
|
||||
|
||||
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
import it1901.groups2021.gr2141.core.models.Flashcard;
|
||||
import it1901.groups2021.gr2141.core.storage.CardDeckStorage;
|
||||
import it1901.groups2021.gr2141.ui.Flashy;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* Menu controller of the application UI.
|
||||
*/
|
||||
public class FlashyMenuController {
|
||||
|
||||
@FXML
|
||||
private TextField writeFront;
|
||||
|
||||
@FXML
|
||||
private TextField writeBack;
|
||||
|
||||
|
||||
private FlashCardProvider getFlashcardProvider() {
|
||||
return Flashy.applicationState.getFlashCardProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a card and saves the card
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@FXML
|
||||
public void handleCreateFlashCard(ActionEvent event) {
|
||||
if (writeFront.getText().isEmpty() || writeBack.getText().isEmpty())
|
||||
return;
|
||||
|
||||
getFlashcardProvider().getCardDeck().add(Flashcard.of(writeFront.getText(), writeBack.getText()));
|
||||
clearTextFields();
|
||||
|
||||
try {
|
||||
CardDeckStorage.writeDeck(getFlashcardProvider().getCardDeck(), 0);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to write carddeck to file");
|
||||
}
|
||||
}
|
||||
|
||||
private void clearTextFields() {
|
||||
writeFront.clear();
|
||||
writeBack.clear();
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package it1901.groups2021.gr2141.ui.controllers;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import it1901.groups2021.gr2141.core.domainlogic.FlashCardProvider;
|
||||
import it1901.groups2021.gr2141.ui.Flashy;
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* Navbar controller of the application UI.
|
||||
*/
|
||||
public class FlashyNavbarController implements Initializable {
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleFirstLastWrapAroundMode;
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleRandomMode;
|
||||
|
||||
@FXML
|
||||
private ToggleButton btnToggleShowOtherSide;
|
||||
|
||||
/**
|
||||
* Initializes the card deck.
|
||||
*
|
||||
* @param url
|
||||
* @param resourceBundle
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
setToggleButtonValues();
|
||||
}
|
||||
|
||||
private FlashCardProvider getFlashcardProvider() {
|
||||
return Flashy.applicationState.getFlashCardProvider();
|
||||
}
|
||||
|
||||
private void setToggleButtonValues() {
|
||||
btnToggleRandomMode.setSelected(getFlashcardProvider().getCardOrderIsRandomMode());
|
||||
btnToggleShowOtherSide.setSelected(getFlashcardProvider().getShowOrderIsFlippedMode());
|
||||
btnToggleFirstLastWrapAroundMode.setSelected(getFlashcardProvider().getFirstLastWrapAroundMode());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleShowOtherSide(ActionEvent event) {
|
||||
getFlashcardProvider().toggleShowOrderIsFlippedMode();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleCardOrderIsRandom(ActionEvent event) {
|
||||
getFlashcardProvider().toggleCardOrderIsRandomMode();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleToggleFirstLastWrapAroundMode(ActionEvent event) {
|
||||
getFlashcardProvider().toggleFirstLastWrapAroundMode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,99 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.materialicons.MaterialIconView?>
|
||||
|
||||
<BorderPane prefWidth="980" prefHeight="500" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="it1901.groups2021.gr2141.ui.FlashyAppController" fx:id="root">
|
||||
<BorderPane
|
||||
prefWidth="980" prefHeight="500"
|
||||
xmlns="http://javafx.com/javafx/8.0.65"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:id="root">
|
||||
|
||||
<!-- Navbar -->
|
||||
<top>
|
||||
<HBox fx:id="navbar" prefHeight="35.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" alignment="CENTER">
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnHamburger">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="hamburger" glyphName="MENU" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<Region HBox.hgrow="ALWAYS" />
|
||||
<Label alignment="CENTER" fx:id="header" text="FLASHY" />
|
||||
<Region HBox.hgrow="ALWAYS" />
|
||||
<HBox>
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnFavourites">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="favourites" glyphName="STAR_BORDER" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<ToggleButton fx:id="btnToggleFirstLastWrapAroundMode" onAction="#handleToggleFirstLastWrapAroundMode">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleFirstLastWrapAroundMode" glyphName="REPEAT" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="btnToggleRandomMode" onAction="#handleToggleCardOrderIsRandom">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleRandomMode" glyphName="SHUFFLE" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="btnToggleShowOtherSide" onAction="#handleToggleShowOtherSide">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleShowOtherSide" glyphName="SWAP_HORIZ" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</HBox>
|
||||
<fx:include source="components/Navbar.fxml" fx:id="navbar"/>
|
||||
</top>
|
||||
|
||||
<!-- Menu -->
|
||||
<center>
|
||||
<SplitPane dividerPositions="0.25" orientation="HORIZONTAL">
|
||||
<VBox prefHeight="35.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:id="menu">
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnFavouriteCards" text="Favourites" maxWidth="1.7976931348623157E308" prefHeight="40">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="favouriteCards" glyphName="STAR" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<Label fx:id="typeFront" text="Type the front" />
|
||||
<TextField fx:id="writeFront" layoutX="115.0" layoutY="28.0" />
|
||||
<Label fx:id="typeBack" text="Type the back" />
|
||||
<TextField fx:id="writeBack" layoutX="115.0" layoutY="28.0" />
|
||||
<Button fx:id="btnCreateFlashCard" onAction="#handleCreateFlashCard">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="createFLashCard" glyphName="ADD_CIRCLE_OUTLINE" size="18px"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
</VBox>
|
||||
<SplitPane
|
||||
dividerPositions="0.25"
|
||||
orientation="HORIZONTAL">
|
||||
|
||||
<!-- Menu -->
|
||||
<fx:include source="components/Menu.fxml" fx:id="menu"/>
|
||||
|
||||
<!-- CardArea-->
|
||||
<VBox prefHeight="35.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" alignment="CENTER" fx:id="flashcontainer">
|
||||
<children>
|
||||
<Region HBox.hgrow="ALWAYS" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label alignment="CENTER" fx:id="showCard" onMouseClicked="#handleFlipCardMouse" />
|
||||
<HBox alignment="CENTER">
|
||||
<Button fx:id="flip" text="Flip the card!" onAction="#handleFlipCardButton" prefHeight="20" prefWidth="150" />
|
||||
<Button fx:id="lastCard" text="Previous card" onAction="#handleTurnToPreviousCard" />
|
||||
<Button fx:id="nextCard" text="Next card" onAction="#handleTurnToNextCard" />
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
<fx:include source="components/CardArea.fxml" fx:id="cardArea"/>
|
||||
|
||||
</SplitPane>
|
||||
</center>
|
||||
|
||||
</BorderPane>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
|
||||
<VBox
|
||||
prefHeight="35.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.65"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
alignment="CENTER"
|
||||
fx:controller="it1901.groups2021.gr2141.ui.controllers.FlashyCardAreaController">
|
||||
|
||||
<children>
|
||||
<Region HBox.hgrow="ALWAYS" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label alignment="CENTER" fx:id="showCard" onMouseClicked="#handleFlipCardMouse" />
|
||||
<!-- Card Navigation -->
|
||||
<fx:include source="CardNavigation.fxml" fx:id="cardNavigation"/>
|
||||
</children>
|
||||
</VBox>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<HBox
|
||||
xmlns="http://javafx.com/javafx/8.0.65"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
alignment="CENTER"
|
||||
fx:controller="it1901.groups2021.gr2141.ui.controllers.FlashyCardNavigationController">
|
||||
<Button fx:id="flip" text="Flip the card!" onAction="#handleFlipCardButton" prefHeight="20" prefWidth="150" />
|
||||
<Button fx:id="lastCard" text="Previous card" onAction="#handleTurnToPreviousCard" />
|
||||
<Button fx:id="nextCard" text="Next card" onAction="#handleTurnToNextCard" />
|
||||
</HBox>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.materialicons.MaterialIconView?>
|
||||
|
||||
<VBox
|
||||
prefHeight="35.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.65"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="it1901.groups2021.gr2141.ui.controllers.FlashyMenuController">
|
||||
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnFavouriteCards" text="Favourites" maxWidth="1.7976931348623157E308" prefHeight="40">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="favouriteCards" glyphName="STAR" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<Label fx:id="typeFront" text="Type the front" />
|
||||
<TextField fx:id="writeFront" layoutX="115.0" layoutY="28.0" />
|
||||
<Label fx:id="typeBack" text="Type the back" />
|
||||
<TextField fx:id="writeBack" layoutX="115.0" layoutY="28.0" />
|
||||
<Button fx:id="btnCreateFlashCard" onAction="#handleCreateFlashCard">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="createFlashCard" glyphName="ADD_CIRCLE_OUTLINE" size="18px"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
</VBox>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.materialicons.MaterialIconView?>
|
||||
|
||||
<HBox
|
||||
prefHeight="35.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.65"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
alignment="CENTER"
|
||||
fx:controller="it1901.groups2021.gr2141.ui.controllers.FlashyNavbarController">
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnHamburger">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="hamburger" glyphName="MENU" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<Region HBox.hgrow="ALWAYS" />
|
||||
<Label alignment="CENTER" fx:id="header" text="FLASHY" />
|
||||
<Region HBox.hgrow="ALWAYS" />
|
||||
<HBox>
|
||||
<children>
|
||||
<!-- Used for later iterations
|
||||
<ToggleButton fx:id="btnFavourites">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="favourites" glyphName="STAR_BORDER" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
-->
|
||||
<ToggleButton fx:id="btnToggleFirstLastWrapAroundMode" onAction="#handleToggleFirstLastWrapAroundMode">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleFirstLastWrapAroundMode" glyphName="REPEAT" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="btnToggleRandomMode" onAction="#handleToggleCardOrderIsRandom">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleRandomMode" glyphName="SHUFFLE" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
<ToggleButton fx:id="btnToggleShowOtherSide" onAction="#handleToggleShowOtherSide">
|
||||
<graphic>
|
||||
<MaterialIconView fx:id="toggleShowOtherSide" glyphName="SWAP_HORIZ" size="18px"/>
|
||||
</graphic>
|
||||
</ToggleButton>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</HBox>
|
||||
@@ -20,8 +20,6 @@
|
||||
-fx-font-family: "Roboto";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* --------------------------------- Navbar --------------------------------- */
|
||||
|
||||
#navbar {
|
||||
@@ -67,18 +65,14 @@
|
||||
|
||||
#menu .button:pressed {
|
||||
-fx-background-color: -main-black-color;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------- FlashCard --------------------------------- */
|
||||
|
||||
#flashcontainer {
|
||||
#cardArea {
|
||||
-fx-background-color: -main-grey-color;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#showCard {
|
||||
-fx-background-color: -main-purple-menu-accent-frame-color;
|
||||
-fx-text-fill: -main-fg-color;
|
||||
|
||||
Reference in New Issue
Block a user