Commit 8f92af97 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Handled most checkstyle and spotbugs issues

parent d270623e
<FindBugsFilter>
<Match>
<Bug pattern="SA_LOCAL_SELF_COMPARISON" />
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
</FindBugsFilter>
......@@ -11,6 +11,10 @@
<artifactId>fxui</artifactId>
<properties>
<skipUiTests>false</skipUiTests>
</properties>
<dependencies>
<dependency>
<groupId>it1901.todolist</groupId>
......@@ -173,6 +177,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipUiTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
......
......@@ -6,6 +6,9 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* Standalone version of the app.
*/
public class TodoApp extends Application {
@Override
......
......@@ -14,11 +14,31 @@ import todolist.core.TodoList;
import todolist.core.TodoModel;
import todolist.json.TodoPersistence;
/**
* Top-level controller.
*/
public class TodoAppController {
private static final String todoListWithTwoItems =
"{\"lists\":[" + "{\"name\":\"todo\",\"items\":[{\"text\":\"item1\",\"checked\":false},"
+ "{\"text\":\"item2\",\"checked\":true,\"deadline\":\"2020-10-01T14:53:11\"}]}" + "]}";
private static final String todoListWithTwoItems = """
{
"lists" : [
{
"name": "todo",
"items": [
{
"text": "item1",
"checked":false
},
{
"text": "item2",
"checked": true,
"deadline": "2020-10-01T14:53:11"
}
]
}
]
}
""";
@FXML
String userTodoModelPath;
......
......@@ -6,6 +6,9 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* Variant of the app with document metaphor and File menu.
*/
public class TodoDocumentApp extends Application {
private TodoDocumentAppController controller;
......
......@@ -18,6 +18,9 @@ import java.util.List;
import javafx.fxml.FXML;
import todolist.core.TodoModel;
/**
* Controller for the document metaphor variant of the app.
*/
public class TodoDocumentAppController implements DocumentListener<TodoModel, File> {
private final TodoModelStorage todoModelStorage;
......
......@@ -10,6 +10,10 @@ import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import todolist.core.TodoItem;
/**
* ListCell for TodoItems.
* Supports editing the text and checking the item.
*/
public class TodoItemListCell extends ListCell<TodoItem> {
// for whole row
......
......@@ -15,6 +15,10 @@ import todolist.core.TodoItem;
import todolist.core.TodoList;
import todolist.core.TodoListListener;
/**
* Controller for a TodoList.
* Supports adding, editing and removing elements.
*/
public class TodoListController {
@FXML
......@@ -33,7 +37,7 @@ public class TodoListController {
private TodoList todoList = null;
public TodoList getTodoList() {
TodoList getTodoList() {
return todoList;
}
......
......@@ -8,6 +8,11 @@ import javafx.scene.control.ComboBox;
import todolist.core.AbstractTodoList;
import todolist.core.TodoList;
/**
* Controller for TodoModel objects.
* Supports adding new TodoList objects and
* selecting one for viewing and editing.
*/
public class TodoModelController {
private TodoModelAccess todoModelAccess;
......@@ -73,7 +78,7 @@ public class TodoModelController {
// retrieve actual list
todoList = todoModelAccess.getTodoList(todoList.getName());
}
todoListViewController.setTodoList(todoList instanceof TodoList ? (TodoList) todoList : null);
todoListViewController.setTodoList(todoList instanceof TodoList tl ? tl : null);
}
});
}
......
......@@ -12,6 +12,9 @@ import java.nio.charset.StandardCharsets;
import todolist.core.TodoModel;
import todolist.json.TodoPersistence;
/**
* DocumentStorage for TodoModel objects addressed by File.
*/
public class TodoModelStorage extends AbstractDocumentStorage<TodoModel, File> {
@Override
......
......@@ -6,6 +6,9 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* Variant of the app that connects to a REST service.
*/
public class TodoRemoteApp extends Application {
@Override
......
......@@ -118,6 +118,7 @@
<configuration>
<xmlOutput>false</xmlOutput>
<htmlOutput>true</htmlOutput>
<excludeFilterFile>config/spotbugs/exclude.xml</excludeFilterFile>
</configuration>
<executions>
<execution>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment