Skip to content
Snippets Groups Projects
Commit 48a27aa3 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Some fixes

parent 2c807471
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ package todolist.ui; ...@@ -3,6 +3,7 @@ package todolist.ui;
import fxutil.doc.AbstractDocumentStorage; import fxutil.doc.AbstractDocumentStorage;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
...@@ -33,4 +34,9 @@ public class TodoModelStorage extends AbstractDocumentStorage<TodoModel, File> { ...@@ -33,4 +34,9 @@ public class TodoModelStorage extends AbstractDocumentStorage<TodoModel, File> {
todoPersistence.writeTodoModel(todoModel, writer); todoPersistence.writeTodoModel(todoModel, writer);
} }
} }
@Override
protected InputStream toInputStream(final File location) throws IOException {
return toFileInputStream((File) location);
}
} }
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
<?import java.lang.String?> <?import java.lang.String?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoAppController"> <VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoAppController">
<fx:define> <fx:define>
<String fx:id="userTodoModelPath" fx:value="todomodel.json"/> <String fx:id="userTodoModelPath" fx:value="todomodel.json"/>
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.control.MenuBar?> <?import javafx.scene.control.MenuBar?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<BorderPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoDocumentAppController"> <BorderPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoDocumentAppController">
<fx:define> <fx:define>
<String fx:id="userAppConfigPath" fx:value="todo-config.toml"/> <String fx:id="userAppConfigPath" fx:value="todo-config.toml"/>
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
<FontAwesomeIconView glyphName="PLUS" size="18px" glyphStyle="-fx-fill: green" /> <FontAwesomeIconView glyphName="PLUS" size="18px" glyphStyle="-fx-fill: green" />
</graphic> </graphic>
<tooltip> <tooltip>
<Tooltip text="New Item"/> <Tooltip text="New item"/>
</tooltip> </tooltip>
</Button> </Button>
<TextField fx:id="newTodoItemText" promptText="Skriv inn tekst her" onAction="#handleNewTodoItemAction"/> <TextField fx:id="newTodoItemText" promptText="Skriv inn tekst for nytt element" onAction="#handleNewTodoItemAction"/>
</HBox> </HBox>
<ListView fx:id="todoItemsView"> <ListView fx:id="todoItemsView">
</ListView> </ListView>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ListView?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoModelController"> <VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="todolist.ui.TodoModelController">
<HBox> <HBox>
......
{ {
"lists": [ "lists" : [ {
{
"name" : "todo", "name" : "todo",
"deadline" : "2020-10-01T14:53:11", "deadline" : "2020-10-01T14:53:11",
"items": [ "items" : [ {
{
"text" : "Item 1", "text" : "Item 1",
"checked" : true "checked" : true
}, }, {
{
"text" : "Item 2", "text" : "Item 2",
"checked" : false "checked" : false
} } ]
] } ]
}
]
} }
\ No newline at end of file
...@@ -116,16 +116,16 @@ public abstract class AbstractDocumentStorage<D, L> implements DocumentStorage<L ...@@ -116,16 +116,16 @@ public abstract class AbstractDocumentStorage<D, L> implements DocumentStorage<L
*/ */
protected abstract InputStream toInputStream(L location) throws IOException; protected abstract InputStream toInputStream(L location) throws IOException;
protected InputStream toInputStream(final File location) throws IOException { protected InputStream toFileInputStream(final File location) throws IOException {
return new FileInputStream(location); return new FileInputStream(location);
} }
protected InputStream toInputStream(final URL location) throws IOException { protected InputStream toUrlInputStream(final URL location) throws IOException {
return location.openStream(); return location.openStream();
} }
protected InputStream toInputStream(final URI location) throws IOException { protected InputStream toUrlInputStream(final URI location) throws IOException {
return toInputStream(location.toURL()); return toUrlInputStream(location.toURL());
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment