Initial commit
This commit is contained in:
21
gui/api/pom.xml
Normal file
21
gui/api/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ch.gtache.fro.gui</groupId>
|
||||
<artifactId>gui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>gui-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ch.gtache.fro</groupId>
|
||||
<artifactId>fro-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
14
gui/api/src/main/java/ch/gtache/fro/gui/Controller.java
Normal file
14
gui/api/src/main/java/ch/gtache/fro/gui/Controller.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Represents a GUI controller
|
||||
*/
|
||||
public interface Controller {
|
||||
|
||||
/**
|
||||
* Returns the model for this controller
|
||||
*
|
||||
* @return The model
|
||||
*/
|
||||
Model model();
|
||||
}
|
||||
21
gui/api/src/main/java/ch/gtache/fro/gui/FetchController.java
Normal file
21
gui/api/src/main/java/ch/gtache/fro/gui/FetchController.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Controller for the fetch view
|
||||
*/
|
||||
public interface FetchController extends Controller {
|
||||
|
||||
/**
|
||||
* Fetches the data for the currently selected bird
|
||||
*
|
||||
*/
|
||||
void fetch();
|
||||
|
||||
/**
|
||||
* Fetches all the data
|
||||
*/
|
||||
void fetchAll();
|
||||
|
||||
@Override
|
||||
FetchModel model();
|
||||
}
|
||||
7
gui/api/src/main/java/ch/gtache/fro/gui/FetchModel.java
Normal file
7
gui/api/src/main/java/ch/gtache/fro/gui/FetchModel.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Model for the fetch view
|
||||
*/
|
||||
public interface FetchModel extends Model {
|
||||
}
|
||||
10
gui/api/src/main/java/ch/gtache/fro/gui/MainController.java
Normal file
10
gui/api/src/main/java/ch/gtache/fro/gui/MainController.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Controller for the main view
|
||||
*/
|
||||
public interface MainController extends Controller {
|
||||
|
||||
@Override
|
||||
MainModel model();
|
||||
}
|
||||
7
gui/api/src/main/java/ch/gtache/fro/gui/MainModel.java
Normal file
7
gui/api/src/main/java/ch/gtache/fro/gui/MainModel.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Model for the main view
|
||||
*/
|
||||
public interface MainModel extends Model {
|
||||
}
|
||||
7
gui/api/src/main/java/ch/gtache/fro/gui/Model.java
Normal file
7
gui/api/src/main/java/ch/gtache/fro/gui/Model.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Represents a GUI model
|
||||
*/
|
||||
public interface Model {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Controller for the settings view
|
||||
*/
|
||||
public interface SettingsController extends Controller {
|
||||
|
||||
@Override
|
||||
SettingsModel model();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ch.gtache.fro.gui;
|
||||
|
||||
/**
|
||||
* Model for the settings view
|
||||
*/
|
||||
public interface SettingsModel extends Model {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Controller;
|
||||
|
||||
/**
|
||||
* Controller for the practice view
|
||||
*/
|
||||
public interface PracticeController extends Controller {
|
||||
|
||||
@Override
|
||||
PracticeModel model();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
/**
|
||||
* Model for the practice view - exact guess
|
||||
*/
|
||||
public interface PracticeExactModel extends Model {
|
||||
|
||||
/**
|
||||
* Returns the user's current guess
|
||||
*
|
||||
* @return The user's current guess
|
||||
*/
|
||||
String guess();
|
||||
|
||||
/**
|
||||
* Sets the guess
|
||||
*
|
||||
* @param guess The guess
|
||||
*/
|
||||
void guess(String guess);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Controller;
|
||||
|
||||
/**
|
||||
* Controller for a guess practice view
|
||||
*/
|
||||
public interface PracticeGuessController extends Controller {
|
||||
|
||||
/**
|
||||
* Confirms the current guess
|
||||
*/
|
||||
void confirm();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
/**
|
||||
* Model for the practice view
|
||||
*/
|
||||
public interface PracticeModel extends Model {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.Bird;
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model for the practice view - multichoice guess
|
||||
*/
|
||||
public interface PracticeMultichoiceModel extends Model {
|
||||
|
||||
/**
|
||||
* Returns the suggestions
|
||||
*
|
||||
* @return The suggestions
|
||||
*/
|
||||
List<Bird> suggestions();
|
||||
|
||||
/**
|
||||
* Returns the selected suggestion
|
||||
*
|
||||
* @return The selected bird
|
||||
*/
|
||||
Bird selected();
|
||||
|
||||
/**
|
||||
* Sets the selected suggestion
|
||||
*
|
||||
* @param selected The selected bird
|
||||
*/
|
||||
void selected(Bird selected);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Controller for the practice view - exact picture
|
||||
*/
|
||||
public interface PracticePictureExactController extends PracticeGuessController {
|
||||
|
||||
|
||||
@Override
|
||||
PracticePictureExactModel model();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Model for the practice view - exact picture
|
||||
*/
|
||||
public interface PracticePictureExactModel extends PracticePictureModel, PracticeExactModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.Picture;
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
/**
|
||||
* Represents a model for a practice view with a picture
|
||||
*/
|
||||
public interface PracticePictureModel extends Model {
|
||||
|
||||
/**
|
||||
* Returns the picture to guess
|
||||
*
|
||||
* @return The picture
|
||||
*/
|
||||
Picture picture();
|
||||
|
||||
/**
|
||||
* Sets the picture
|
||||
*
|
||||
* @param picture The picture
|
||||
*/
|
||||
void picture(Picture picture);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Controller for the practice view - multichoice picture
|
||||
*/
|
||||
public interface PracticePictureMultichoiceController extends PracticeGuessController {
|
||||
|
||||
|
||||
@Override
|
||||
PracticePictureMultichoiceModel model();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Model for the practice view - multichoice picture
|
||||
*/
|
||||
public interface PracticePictureMultichoiceModel extends PracticePictureModel, PracticeMultichoiceModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Controller;
|
||||
|
||||
/**
|
||||
* Controller for the practice result view
|
||||
*/
|
||||
public interface PracticeResultController extends Controller {
|
||||
|
||||
@Override
|
||||
PracticeResultModel model();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
/**
|
||||
* Model for the practice result view
|
||||
*/
|
||||
public interface PracticeResultModel extends Model {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Controller;
|
||||
|
||||
/**
|
||||
* Controller for the practice settings view
|
||||
*/
|
||||
public interface PracticeSettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Starts a practice
|
||||
*/
|
||||
void startPractice();
|
||||
|
||||
@Override
|
||||
PracticeSettingsModel model();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.gui.Model;
|
||||
import ch.gtache.fro.practice.PracticeType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model for the practice settings view
|
||||
*/
|
||||
public interface PracticeSettingsModel extends Model {
|
||||
|
||||
/**
|
||||
* Returns the list of practice types
|
||||
*
|
||||
* @return The list of practice types
|
||||
*/
|
||||
List<PracticeType> practiceTypes();
|
||||
|
||||
/**
|
||||
* Returns the currently selected practice type
|
||||
*
|
||||
* @return The practice type
|
||||
*/
|
||||
PracticeType practiceType();
|
||||
|
||||
/**
|
||||
* Sets the practice type
|
||||
*
|
||||
* @param practiceType The practice type
|
||||
*/
|
||||
void practiceType(PracticeType practiceType);
|
||||
|
||||
/**
|
||||
* Returns true if the practice type has suggestions
|
||||
*
|
||||
* @return True if the practice type has suggestions
|
||||
*/
|
||||
boolean hasSuggestions();
|
||||
|
||||
/**
|
||||
* Returns the currently selected number of suggestions
|
||||
*
|
||||
* @return The number of suggestions
|
||||
*/
|
||||
int suggestionsNumber();
|
||||
|
||||
/**
|
||||
* Sets the number of suggestions
|
||||
*
|
||||
* @param suggestionsNumber The number of suggestions
|
||||
*/
|
||||
void suggestionsNumber(int suggestionsNumber);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Controller for the practice view - exact sound
|
||||
*/
|
||||
public interface PracticeSoundExactController extends PracticeGuessController {
|
||||
|
||||
|
||||
@Override
|
||||
PracticeSoundExactModel model();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Model for the practice view - exact sound
|
||||
*/
|
||||
public interface PracticeSoundExactModel extends PracticeSoundModel, PracticeExactModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.Sound;
|
||||
import ch.gtache.fro.gui.Model;
|
||||
|
||||
/**
|
||||
* Represents a model for a practice view with a sound
|
||||
*/
|
||||
public interface PracticeSoundModel extends Model {
|
||||
|
||||
/**
|
||||
* Returns the sound to guess
|
||||
*
|
||||
* @return The sound
|
||||
*/
|
||||
Sound sound();
|
||||
|
||||
/**
|
||||
* Sets the sound
|
||||
*
|
||||
* @param sound The sound
|
||||
*/
|
||||
void sound(Sound sound);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Controller for the practice view - multichoice sound
|
||||
*/
|
||||
public interface PracticeSoundMultichoiceController extends PracticeGuessController {
|
||||
|
||||
|
||||
@Override
|
||||
PracticeSoundMultichoiceModel model();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Model for the practice view - multichoice sound
|
||||
*/
|
||||
public interface PracticeSoundMultichoiceModel extends PracticeSoundModel, PracticeMultichoiceModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
/**
|
||||
* Controller for the practice view - multipicture choice sound
|
||||
*/
|
||||
public interface PracticeSoundMultichoicePictureController extends PracticeGuessController {
|
||||
|
||||
@Override
|
||||
PracticeSoundMultichoicePictureModel model();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package ch.gtache.fro.practice.gui;
|
||||
|
||||
import ch.gtache.fro.Picture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model for the practice view - multipicture choice sound
|
||||
*/
|
||||
public interface PracticeSoundMultichoicePictureModel extends PracticeSoundModel {
|
||||
|
||||
/**
|
||||
* Returns the suggestions
|
||||
*
|
||||
* @return The suggestions
|
||||
*/
|
||||
List<Picture> suggestions();
|
||||
|
||||
/**
|
||||
* Returns the selected suggestion
|
||||
*
|
||||
* @return The selected picture
|
||||
*/
|
||||
Picture selected();
|
||||
|
||||
/**
|
||||
* Sets the selected suggestion
|
||||
*
|
||||
* @param selected The selected picture
|
||||
*/
|
||||
void selected(Picture selected);
|
||||
}
|
||||
9
gui/api/src/main/java/module-info.java
Normal file
9
gui/api/src/main/java/module-info.java
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* GUI API module for the FRO project
|
||||
*/
|
||||
module ch.gtache.fro.gui.api {
|
||||
requires transitive ch.gtache.fro.api;
|
||||
|
||||
exports ch.gtache.fro.gui;
|
||||
exports ch.gtache.fro.practice.gui;
|
||||
}
|
||||
Reference in New Issue
Block a user