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

Lisää dokumentaatiota luokille

parent af820f84
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,9 @@ import javafx.stage.StageStyle
import tornadofx.*
import kotlin.system.exitProcess
/**
* The main window of the program
*/
class MainView : View("Ronove") {
override val root = borderpane {
top = menubar {
......@@ -60,7 +63,8 @@ class MainView : View("Ronove") {
init {
primaryStage.icons.add(Image("/ronove128.png"))
SplashScreen((app as Ronove).project).openModal(stageStyle = StageStyle.UTILITY, block = true, modality = Modality.APPLICATION_MODAL, owner = primaryStage)
SplashScreen((app as Ronove).project).openModal(stageStyle = StageStyle.UTILITY, block = true,
modality = Modality.APPLICATION_MODAL, owner = primaryStage)
}
}
package guru.kake.ronove
class Project() {
/**
* Class for holding the data of the entire translation project, which consists of pages consisting of lines.
*/
class Project {
var pages: MutableList<Page> = mutableListOf(Page(listOf(Line())))
}
class Page {
/**
* Class for holding the data of a single translation page
*/
class Page(lines: Collection<Line>) {
var lines: MutableList<Line> = mutableListOf()
constructor(lines: Collection<Line>) {
init {
this.lines = lines.toMutableList()
}
fun getColumn() : List<String> = buildList<String> { for (line in lines) add(line.original) }
fun getColumn() : List<String> = buildList { for (line in lines) add(line.original) }
fun translatePage() {
println(getColumn())
......@@ -28,6 +34,9 @@ class Page {
}
}
/**
* Class for holding the data of a single line of translation
*/
data class Line(
var original: String = "",
var machineTranslation: String = "",
......
......@@ -3,7 +3,9 @@ package guru.kake.ronove
import javafx.geometry.Pos
import tornadofx.*
/**
* Holds the CSS styles for the program
*/
class RonoveStylesheet: Stylesheet() {
companion object {
val vcenter by cssclass()
......
......@@ -3,6 +3,10 @@ package guru.kake.ronove
import tornadofx.*
import kotlin.system.exitProcess
/**
* The splash screen show on program startup, allowing the user to create a new project or load an existing one
* @param project the Project object the data of a new empty project or the chosen loaded project will be stored into
*/
class SplashScreen(project: Project) : View("Ronove") {
override val root = borderpane {
center = form {
......
......@@ -3,17 +3,20 @@ package guru.kake.ronove
import javafx.application.Platform
import javafx.beans.property.SimpleIntegerProperty
import javafx.event.EventHandler
import javafx.scene.Node
import javafx.scene.control.*
import javafx.scene.input.KeyEvent
import tornadofx.*
/**
* The central view of the main window used to shew the table of the translation data
*/
class TranslationPageView : View() {
private val project = (app as Ronove).project
init {
PageJumpMenu.pageView = this
}
private lateinit var tv: TableView<Line>
private lateinit var pageJumps: PageJumpMenu
var currentPage = SimpleIntegerProperty(0)
......@@ -52,10 +55,17 @@ class TranslationPageView : View() {
bottom = pageJumps.root
}
/**
* Change the page to edit and load the page to the view
* @param page Page to change to
*/
fun changePage(page: Int) {
currentPage.value = page
}
/**
* Loads the currently selected page to the table view
*/
private fun refresh() {
tv.items = project.pages[currentPage.value].lines.asObservable()
}
......@@ -66,14 +76,20 @@ class TranslationPageView : View() {
}
}
/**
* Fragment of the main window implementing the page switcher at the bottom
*/
class PageJumpMenu : Fragment() {
companion object {
lateinit var pageView: TranslationPageView
}
/**
* Refresh the page switcher, updating the selected page and number of pages
*/
fun refresh() = replaceWith<PageJumpMenu>()
private inline fun changePage(page: Int) = pageView.changePage(page)
private fun changePage(page: Int) = pageView.changePage(page)
override val root = hbox {
addClass(RonoveStylesheet.vcenter)
......
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