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

Some fixes

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