Skip to content
Snippets Groups Projects
Commit 0ee8c59d authored by Kaj Koivunen's avatar Kaj Koivunen :coffee:
Browse files

XMLParser käyttöön & drawer tabiä

parent d65a6394
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ class Sense {
var glosses: MutableList<String> = mutableListOf()
}
class XMLParser {
class DictionaryParser {
companion object {
private val xmlInputFactory: XMLInputFactory = XMLInputFactory.newInstance()
......@@ -69,7 +69,7 @@ class XMLParser {
var character: Character? = null
var rmgroup: RMGroup? = null
XMLParserDSL.parse(path) {
XMLParser.parse(path) {
element("character") {
start { character = Character() }
end {
......
......@@ -61,7 +61,7 @@ class WebViewCallback {
* Tab class for displaying dictionaries
*/
class DictionaryTab : View("Kanji Dictionary") {
private val ret = XMLParser.parseKanjidic2("C:\\repos\\kanjisho\\kanjidic2.xml")
private val ret = DictionaryParser.parseKanjidic2("C:\\repos\\kanjisho\\kanjidic2.xml")
private val tree = BST<Character>(ret)
override val root = vbox {
......
package guru.kake.ronove
import javafx.beans.property.ReadOnlyObjectProperty
import tornadofx.*
/**
......@@ -8,6 +9,7 @@ import tornadofx.*
class Ronove: App(MainView::class, RonoveStylesheet::class) {
/** Current project data */
var project = Project()
var cellSelection: ReadOnlyObjectProperty<Line>? = null
}
fun main(args: Array<String>) {
......
......@@ -14,16 +14,16 @@ annotation class DSL
*
*/
@DSL
class XMLParserDSL private constructor(path: String) {
class XMLParser private constructor(path: String) {
companion object {
fun parse(path: String, loop: XMLParserDSL.() -> Unit) = XMLParserDSL(path).init(loop)
fun parse(path: String, loop: XMLParser.() -> Unit) = XMLParser(path).init(loop)
}
private val factory: XMLInputFactory = XMLInputFactory.newInstance()
private val reader: XMLEventReader = factory.createXMLEventReader(FileInputStream(path))
private var event: XMLEvent? = null
fun init(loop: XMLParserDSL.() -> Unit) {
fun init(loop: XMLParser.() -> Unit) {
while (reader.hasNext()) {
event = reader.nextEvent()
loop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment