1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-11-13 07:33:44 +01:00

Initial commit

This commit is contained in:
Carlos Galindo 2016-06-12 00:20:11 +02:00
commit a39aaca33e
Signed by: kauron
GPG key ID: 83E68706DEE119A3
25 changed files with 973 additions and 0 deletions

32
.idea/compiler.xml Normal file
View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="jstudy" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="jstudy" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View file

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

6
.idea/encodings.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.code.gson:gson:2.6.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.6.2/gson-2.6.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.6.2/gson-2.6.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/jfoenix/jfoenix/0.0.0-SNAPSHOT/jfoenix-0.0.0-20160426.062710-13.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/jfoenix/jfoenix/0.0.0-SNAPSHOT/jfoenix-0.0.0-20160426.062710-13-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/jfoenix/jfoenix/0.0.0-SNAPSHOT/jfoenix-0.0.0-20160426.062710-13-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: junit:junit:3.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-sources.jar!/" />
</SOURCES>
</library>
</component>

42
.idea/misc.xml Normal file
View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

10
.idea/modules.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/jstudy.iml" filepath="$PROJECT_DIR$/jstudy.iml" />
<module fileurl="file://$PROJECT_DIR$/src/main/main.iml" filepath="$PROJECT_DIR$/src/main/main.iml" />
<module fileurl="file://$PROJECT_DIR$/src/test/test.iml" filepath="$PROJECT_DIR$/src/test/test.iml" />
</modules>
</component>
</project>

16
jstudy.iml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
<orderEntry type="library" name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT" level="project" />
</component>
</module>

74
pom.xml Normal file
View file

@ -0,0 +1,74 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.kauron.jstudy</groupId>
<artifactId>jstudy</artifactId>
<packaging>jar</packaging>
<version>0.2</version>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>Maven Snapshots</id>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories>
<name>jstudy</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>0.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>es.kauron.jstudy.Main</mainClass>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,23 @@
package es.kauron.jstudy;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(Main.class.getResource("view/main.fxml"));
primaryStage.setTitle("JStudy");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View file

@ -0,0 +1,113 @@
package es.kauron.jstudy.controller;
import es.kauron.jstudy.Main;
import es.kauron.jstudy.model.TestItem;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.*;
public class Controller implements Initializable {
@FXML
private TabPane tabPane;
@FXML
private BorderPane root;
@FXML
private ToolBar toolbar;
@FXML
private MenuItem saveMenu;
@FXML
private CheckMenuItem caseMenu;
@FXML
private RadioMenuItem allMenu, selectedMenu;
private BooleanProperty table = new SimpleBooleanProperty(false);
private Map<Tab, TableController> tabMap = new HashMap<>();
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
tabPane.getSelectionModel().selectedItemProperty().addListener((change, o, n) -> {
if (n.getContent().getId() != null) {
table.set(true);
root.getTop().autosize();
}
});
saveMenu.disableProperty().bind(table.not());
}
@FXML
private void onNewAction(ActionEvent event) {
TextInputDialog dialog = new TextInputDialog("Name");
dialog.showAndWait();
tabPane.getTabs().add(createTableTab(dialog.getResult(), new ArrayList<>()));
tabPane.getSelectionModel().selectLast();
}
@FXML
private void onLoadAction(ActionEvent event) {
FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JStudy file", "*.jsdb"));
File file = chooser.showOpenDialog(root.getScene().getWindow());
if (file == null) return;
List<TestItem> aux = TestItem.loadFrom(file);
if (aux != null) {
tabPane.getTabs().add(createTableTab(file.getName().substring(0, file.getName().lastIndexOf('.')), aux));
tabPane.getSelectionModel().selectLast();
}
}
@FXML
private void onSaveAction(ActionEvent event) {
FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JStudy file", "*.jsdb"));
File file = chooser.showSaveDialog(root.getScene().getWindow());
if (file == null) return;
TestItem.saveTo(file, tabMap.get(tabPane.getSelectionModel().getSelectedItem()).getData());
}
private Tab createTableTab(String name, List<TestItem> list) {
try {
Tab tab = new Tab(name);
tab.setId("table" + tab.hashCode());
FXMLLoader loader = new FXMLLoader(Main.class.getResource("view/table.fxml"));
Parent tableRoot = loader.load();
((TableController) loader.getController()).setData(list, this);
tabMap.put(tab, loader.getController());
tab.setContent(tableRoot);
return tab;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
void newTest(List<TestItem> list) {
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("view/test.fxml"));
Parent root = loader.load();
((TestController) loader.getController()).setList(new ArrayList<>(list));
tabPane.getTabs().add(new Tab("Test: " + tabPane.getSelectionModel().getSelectedItem().getText(), root));
tabPane.getSelectionModel().selectLast();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,63 @@
package es.kauron.jstudy.controller;
import es.kauron.jstudy.model.TestItem;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle;
public class EditController implements Initializable {
@FXML
private TextField questionText, answerText;
private ObservableList<TestItem> list;
private int index;
private TestItem item;
@Override
public void initialize(URL url, ResourceBundle rb) {
}
protected void setList(ObservableList list) {
setList(list, -1);
}
protected void setList(ObservableList<TestItem> list, int index) {
this.list = list; // Save attributes correctly
this.index = index;
// Copy current values to textViews
// and initialize item to hold the current object in edition
if (index < 0) item = new TestItem("","");
else {
questionText.setText(list.get(index).getQuestion());
answerText.setText(list.get(index).getAnswer());
item = new TestItem(list.get(index));
}
item.questionProperty().bind(questionText.textProperty());
item.answerProperty().bind(answerText.textProperty());
}
@FXML
private void onSaveAction(ActionEvent event) {
if (index < 0) {
if (!item.isValid())
return;
list.add(item);
} else {
list.set(index, item);
}
onCancelAction(event);
}
@FXML
private void onCancelAction(ActionEvent event) {
((Stage) ((Node) event.getSource())
.getScene().getWindow())
.close();
}
}

View file

@ -0,0 +1,121 @@
package es.kauron.jstudy.controller;
import es.kauron.jstudy.Main;
import es.kauron.jstudy.model.TestItem;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
public class TableController implements Initializable {
@FXML
private TableView<TestItem> table;
@FXML
private TableColumn<TestItem, String> answerCol, questionCol;
@FXML
private Button editButton, duplicateButton, swapButton, testSelectionButton, deleteButton;
private ObservableList<TestItem> data;
private Controller parent;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
answerCol.setCellValueFactory(e -> e.getValue().answerProperty());
questionCol.setCellValueFactory(e -> e.getValue().questionProperty());
editButton.disableProperty().bind(table.getSelectionModel().selectedIndexProperty().lessThan(0));
swapButton.disableProperty().bind(table.getSelectionModel().selectedIndexProperty().lessThan(0));
deleteButton.disableProperty().bind(table.getSelectionModel().selectedIndexProperty().lessThan(0));
duplicateButton.disableProperty().bind(table.getSelectionModel().selectedIndexProperty().lessThan(0));
testSelectionButton.disableProperty().bind(table.getSelectionModel().selectedIndexProperty().lessThan(0));
}
void setData(List<TestItem> list, Controller controller) {
this.data = FXCollections.observableArrayList(list);
this.parent = controller;
table.setItems(data);
}
List<TestItem> getData() {return data;}
@FXML
private void onAddAction(ActionEvent event) {
try {
FXMLLoader cargador = new FXMLLoader(Main.class.getResource("view/edit.fxml"));
Parent pRoot = cargador.load();
((EditController) cargador.getController()).setList(data);
Stage stage = new Stage();
stage.setTitle("New entry");
stage.setScene(new Scene(pRoot));
stage.initModality(Modality.APPLICATION_MODAL);
stage.showAndWait();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private void onEditAction(ActionEvent event) {
ObservableList<Integer> list = table.getSelectionModel().getSelectedIndices();
if (list.size() != 1) return;
int index = list.get(0);
try {
FXMLLoader cargador = new FXMLLoader(Main.class.getResource("view/edit.fxml"));
Parent root = cargador.load();
((EditController) cargador.getController()).setList(table.getItems(), index);
Stage stage = new Stage();
stage.setTitle("Editing entry...");
stage.setScene(new Scene(root));
stage.initModality(Modality.APPLICATION_MODAL);
stage.showAndWait();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private void onSwapAction(ActionEvent event) {
for (TestItem item : table.getSelectionModel().getSelectedItems()) {
String question = item.getQuestion();
item.questionProperty().set(item.getAnswer());
item.answerProperty().set(question);
}
}
@FXML
private void onDuplicateAction(ActionEvent event) {
table.getItems().addAll(table.getSelectionModel().getSelectedItems());
}
@FXML
private void onDeleteAction(ActionEvent event) {
table.getItems().removeAll(table.getSelectionModel().getSelectedItems());
}
@FXML
private void onTestSelectionAction(ActionEvent event) {
parent.newTest(table.getSelectionModel().getSelectedItems());
}
@FXML
private void onTestAction(ActionEvent event) {
parent.newTest(data);
}
}

View file

@ -0,0 +1,68 @@
package es.kauron.jstudy.controller;
import com.jfoenix.controls.JFXTextField;
import es.kauron.jstudy.model.TestItem;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
public class TestController implements Initializable {
@FXML
private Label question, prevQuestion, prevAnswer, correctAnswer, progressLabel, correctLabel;
@FXML
private JFXTextField answer;
@FXML
private ProgressBar progress;
private List<TestItem> list;
private int total, current;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
}
void setList(List<TestItem> list) {
this.list = list;
total = list.size();
progress.setProgress(0);
progressLabel.setText("0/" + total);
onSkipAction(null);
}
@FXML
private void onNextAction(ActionEvent event) {
prevQuestion.setText(list.get(current).getQuestion());
prevAnswer.setText(answer.getText());
correctAnswer.setText(list.get(current).getAnswer());
boolean right = list.get(current).getAnswer().equals(answer.getText());
correctAnswer.setVisible(!right);
correctLabel.setVisible(!right);
list.remove(current);
progress.setProgress(progress.getProgress() + 1.0/total);
progressLabel.setText((int) (progress.getProgress() * total) + "/" + total);
onSkipAction(event);
}
@FXML
private void onSkipAction(ActionEvent event) {
if (list.size() == 0) {
answer.setText("");
answer.setDisable(true);
question.setText("That's it!");
} else {
answer.setText("");
current = (int) (Math.random() * list.size());
question.setText(list.get(current).getQuestion());
answer.requestFocus();
}
}
}

View file

@ -0,0 +1,83 @@
package es.kauron.jstudy.model;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import java.io.*;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;
public class TestItem {
private StringProperty question, answer;
public TestItem(SimpleStringProperty question, SimpleStringProperty answer) {
this.question = question;
this.answer = answer;
}
public TestItem(TestItem item) {
this(item.getQuestion(), item.getAnswer());
}
public TestItem(String question, String answer) {
this(new SimpleStringProperty(question), new SimpleStringProperty(answer));
}
public String getQuestion() {
return question.get();
}
public StringProperty questionProperty() {
return question;
}
public String getAnswer() {
return answer.get();
}
public StringProperty answerProperty() {
return answer;
}
public boolean isValid() {
return !question.get().isEmpty() && !answer.get().isEmpty();
}
public boolean checkAnswer(String answer, boolean sensible) {
return sensible ? getAnswer().equals(answer) : getAnswer().equalsIgnoreCase(answer);
}
public static void saveTo(File file, List<TestItem> data) {
try {
OutputStreamWriter writer = new FileWriter(file);
for (TestItem item : data) {
writer.write(item.getQuestion() + "::" + item.getAnswer() + "\n");
}
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static List<TestItem> loadFrom(File file) {
List<TestItem> list = new ArrayList<>();
try {
Scanner in = new Scanner(file);
while (in.hasNextLine()) {
String line = in.nextLine();
int index = line.indexOf("::");
String question = line.substring(0, index);
String answer = line.substring(index + 2);
list.add(new TestItem(question, answer));
System.err.println(question + " :: " + answer);
}
} catch (FileNotFoundException | InputMismatchException e) {
e.printStackTrace();
}
return list;
}
}

14
src/main/main.iml Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.6.2" level="project" />
<orderEntry type="library" name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT" level="project" />
</component>
</module>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox spacing="5.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.EditController">
<children>
<HBox alignment="CENTER_LEFT" spacing="5.0">
<children>
<Label prefWidth="60.0" text="Question" />
<TextField fx:id="questionText" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" layoutX="10.0" layoutY="10.0" spacing="5.0">
<children>
<Label prefWidth="60.0" text="Answer" />
<TextField fx:id="answerText" />
</children>
</HBox>
<HBox alignment="CENTER_RIGHT" spacing="5.0">
<children>
<Button cancelButton="true" mnemonicParsing="false" onAction="#onCancelAction" text="Cancel" />
<Button defaultButton="true" mnemonicParsing="false" onAction="#onSaveAction" text="Save" />
</children>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
</HBox>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>

View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckMenuItem?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.RadioMenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.Controller">
<center>
<TabPane fx:id="tabPane" BorderPane.alignment="CENTER">
<tabs>
<Tab closable="false" text="Welcome">
<content>
<VBox alignment="CENTER" spacing="15.0">
<children>
<Button mnemonicParsing="false" onAction="#onNewAction" prefWidth="100.0" text="New table" />
<Button mnemonicParsing="false" onAction="#onLoadAction" prefWidth="100.0" text="Load file" />
</children>
</VBox>
</content>
</Tab>
</tabs>
</TabPane>
</center>
<top>
<MenuBar>
<menus>
<Menu text="_File">
<items>
<MenuItem onAction="#onNewAction" text="_New">
<accelerator>
<KeyCodeCombination alt="UP" code="N" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
</accelerator>
</MenuItem>
<MenuItem onAction="#onLoadAction" text="_Open">
<accelerator>
<KeyCodeCombination alt="UP" code="O" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
</accelerator>
</MenuItem>
<MenuItem fx:id="saveMenu" onAction="#onSaveAction" text="_Save">
<accelerator>
<KeyCodeCombination alt="UP" code="S" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
</accelerator>
</MenuItem>
</items>
</Menu>
<Menu text="_Options">
<items>
<CheckMenuItem fx:id="caseMenu" selected="true" text="_Case sensible" />
<SeparatorMenuItem mnemonicParsing="false" />
<RadioMenuItem fx:id="allMenu" selected="true" text="_All elements">
<toggleGroup>
<ToggleGroup fx:id="menuSelection" />
</toggleGroup>
</RadioMenuItem>
<RadioMenuItem fx:id="selectedMenu" text="_Only selected elements" toggleGroup="$menuSelection" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
</BorderPane>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<HBox xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.TableController">
<children>
<TableView fx:id="table" HBox.hgrow="ALWAYS">
<columns>
<TableColumn fx:id="questionCol" prefWidth="75.0" text="Question" />
<TableColumn fx:id="answerCol" prefWidth="75.0" text="Answer" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<VBox spacing="5.0">
<children>
<Button defaultButton="true" onAction="#onAddAction" prefWidth="105.0" text="_Add" />
<Button fx:id="editButton" onAction="#onEditAction" prefWidth="105.0" text="_Edit" />
<Button fx:id="swapButton" layoutX="10.0" layoutY="76.0" onAction="#onSwapAction" prefWidth="105.0" text="S_wap" />
<Button fx:id="duplicateButton" layoutX="10.0" layoutY="76.0" onAction="#onDuplicateAction" prefWidth="105.0" text="D_uplicate" />
<Button fx:id="deleteButton" onAction="#onDeleteAction" prefWidth="105.0" text="_Delete" />
<VBox alignment="BOTTOM_CENTER" spacing="5.0" VBox.vgrow="ALWAYS">
<children>
<Button fx:id="testSelectionButton" onAction="#onTestSelectionAction" prefWidth="105.0" text="Test _selection" />
<Button layoutX="10.0" layoutY="273.0" onAction="#onTestAction" prefWidth="105.0" text="_Test all" />
</children>
</VBox>
</children>
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</VBox>
</children>
</HBox>

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox minHeight="280.0" minWidth="360.0" spacing="10.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.TestController">
<children>
<ProgressBar fx:id="progress" maxWidth="1.7976931348623157E308" progress="0.0" VBox.vgrow="ALWAYS" />
<Label fx:id="progressLabel" alignment="CENTER" contentDisplay="TOP" maxWidth="1.7976931348623157E308" text="1/40">
<VBox.margin>
<Insets top="-8.0" />
</VBox.margin>
</Label>
<Label fx:id="question" text="Question">
<font>
<Font size="30.0" />
</font>
</Label>
<JFXTextField fx:id="answer" labelFloat="true" promptText="Answer">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
</JFXTextField>
<HBox alignment="CENTER_RIGHT" spacing="10.0">
<children>
<Button cancelButton="true" mnemonicParsing="false" onAction="#onSkipAction" prefWidth="70.0" text="Skip" />
<Button defaultButton="true" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" onAction="#onNextAction" prefWidth="70.0" text="Next" />
</children>
</HBox>
<HBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
<children>
<GridPane hgap="10.0" HBox.hgrow="NEVER">
<columnConstraints>
<ColumnConstraints fillWidth="false" halignment="RIGHT" hgrow="NEVER" />
<ColumnConstraints fillWidth="false" hgrow="NEVER" maxWidth="1.7976931348623157E308" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Previous question" />
<Label fx:id="prevQuestion" text="question" GridPane.columnIndex="1" />
<Label text="Previous answer" GridPane.rowIndex="1" />
<Label fx:id="prevAnswer" text="answer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label fx:id="correctLabel" text="Correct answer" GridPane.rowIndex="2" />
<Label fx:id="correctAnswer" text="correct answer" GridPane.columnIndex="1" GridPane.rowIndex="2" />
</children>
</GridPane>
</children>
</HBox>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>

View file

@ -0,0 +1,38 @@
package es.kauron.jstudy;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

12
src/test/test.iml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: junit:junit:3.8.1" level="project" />
</component>
</module>

1
test.jsdb Normal file
View file

@ -0,0 +1 @@
thsi::that

1
test2.jsdb Normal file
View file

@ -0,0 +1 @@
this::that thing