mirror of
https://github.com/DanilaFe/abacus
synced 2025-12-28 03:31:08 +00:00
Move the JavaFX files written in Kotlin to the FX module.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.1.3'
|
||||
}
|
||||
apply plugin: 'application'
|
||||
|
||||
dependencies {
|
||||
|
||||
32
fx/src/main/kotlin/org/nwapw/abacus/fx/HistoryModel.kt
Normal file
32
fx/src/main/kotlin/org/nwapw/abacus/fx/HistoryModel.kt
Normal file
@@ -0,0 +1,32 @@
|
||||
package org.nwapw.abacus.fx
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty
|
||||
|
||||
/**
|
||||
* A model representing an input / output in the calculator.
|
||||
*
|
||||
* The HistoryModel class stores a record of a single user-provided input,
|
||||
* its parsed form as it was interpreted by the calculator, and the output
|
||||
* that was provided by the calculator. These are represented as properties
|
||||
* to allow easy access by JavaFX cells.
|
||||
*
|
||||
* @param input the user input
|
||||
* @param parsed the parsed version of the input.
|
||||
* @param output the output string.
|
||||
*/
|
||||
class HistoryModel(input: String, parsed: String, output: String){
|
||||
|
||||
/**
|
||||
* The property that holds the input.
|
||||
*/
|
||||
val inputProperty = SimpleStringProperty(input)
|
||||
/**
|
||||
* The property that holds the parsed input.
|
||||
*/
|
||||
val parsedProperty = SimpleStringProperty(parsed)
|
||||
/**
|
||||
* The property that holds the output.
|
||||
*/
|
||||
val outputProperty = SimpleStringProperty(output)
|
||||
|
||||
}
|
||||
31
fx/src/main/kotlin/org/nwapw/abacus/fx/ToggleablePlugin.kt
Normal file
31
fx/src/main/kotlin/org/nwapw/abacus/fx/ToggleablePlugin.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
package org.nwapw.abacus.fx
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty
|
||||
|
||||
/**
|
||||
* A model representing a plugin that can be disabled or enabled.
|
||||
*
|
||||
* ToggleablePlugin is a model that is used to present to the user the option
|
||||
* of disabling / enabling plugins. The class name in this plugin is stored if
|
||||
* its "enabledPropery" is false, essentially blacklisting the plugin.
|
||||
*
|
||||
* @param className the name of the class that this model concerns.
|
||||
* @param enabled whether or not the model should start enabled.
|
||||
*/
|
||||
class ToggleablePlugin (val className: String, enabled: Boolean) {
|
||||
|
||||
/**
|
||||
* The property used to interact with JavaFX components.
|
||||
*/
|
||||
val enabledProperty = SimpleBooleanProperty(enabled)
|
||||
|
||||
/**
|
||||
* Checks whether this plugin is currently enabled or not.
|
||||
*
|
||||
* @return true if it is enabled, false otherwise.
|
||||
*/
|
||||
fun isEnabled(): Boolean {
|
||||
return enabledProperty.value
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user