tornadofx / tornadofx / Controller

Controller

abstract class Controller : Component, ScopedInstance

Constructors

<init> Controller()

Inherited Properties

app val app: App
clipboard val clipboard: Clipboard
config open val config: ConfigProperties
configCharset open val configCharset: Charset
configPath open val configPath: Path

Path to component specific configuration settings. Defaults to javaClass.properties inside the configured configBasePath of the application (By default conf in the current directory).

hostServices val hostServices: HostServices
log val log: <ERROR CLASS>
messages var messages: ResourceBundle
params val params: Map<String, Any?>
paramsProperty val paramsProperty: SimpleObjectProperty<Map<String, Any?>>
primaryStage val primaryStage: Stage
properties val properties: <ERROR CLASS>
resources val resources: ResourceLookup
scope open val scope: Scope
subscribedEvents val subscribedEvents: ConcurrentHashMap<KClass<out FXEvent>, List<FXEventRegistration>>
workspace val workspace: Workspace

Inherited Functions

background fun <T> background(func: FXTask<*>.() -> T): Task<T>
di fun <T : Any> di(name: String? = null): ReadOnlyProperty<Component, T>
find fun <T : Component> find(vararg params: Pair<*, Any?>, op: T.() -> Unit = {}): T
fun <T : Component> find(params: Map<*, Any?>? = null, op: T.() -> Unit = {}): T
fun <T : Component> find(type: KClass<T>, params: Map<*, Any?>? = null, op: T.() -> Unit = {}): <ERROR CLASS>
fun <T : Component> find(type: KClass<T>, vararg params: Pair<*, Any?>, op: T.() -> Unit = {}): <ERROR CLASS>
fun <T : Component> find(componentType: Class<T>, params: Map<*, Any?>? = null, scope: Scope = this@Component.scope): T
fire fun <T : FXEvent> fire(event: T): Unit
fragment fun <T : Fragment> fragment(overrideScope: Scope = scope, vararg params: Pair<String, Any?>): ReadOnlyProperty<Component, T>
fun <T : Fragment> fragment(overrideScope: Scope = scope, params: Map<String, Any?>): ReadOnlyProperty<Component, T>
get fun <InjectableType, T> get(prop: KProperty1<InjectableType, T>): T where InjectableType : Component, InjectableType : ScopedInstance

Find the given property inside the given ScopedInstance. Useful for assigning a property from a View or Controller in any Component. Example:

inject fun <T> inject(overrideScope: Scope = scope, vararg params: Pair<String, Any?>): ReadOnlyProperty<Component, T> where T : Component, T : ScopedInstance
fun <T> inject(overrideScope: Scope = scope, params: Map<String, Any?>? = null): ReadOnlyProperty<Component, T> where T : Component, T : ScopedInstance
k fun <T : Any> k(javaClass: Class<T>): KClass<T>
nullableParam fun <T> nullableParam(defaultValue: T? = null): ReadOnlyProperty<Component, T>
param fun <T> param(defaultValue: T? = null): ReadOnlyProperty<Component, T>
preferences fun preferences(nodename: String? = null, op: Preferences.() -> Unit): Unit

Store and retrieve preferences.

runAsync fun <T, R> KClass<T>.runAsync(op: T.() -> R): Task<R> where T : Component, T : ScopedInstance

Perform the given operation on an ScopedInstance of the specified type asynchronousyly.

fun <InjectableType, ReturnType> KFunction1<InjectableType, ReturnType>.runAsync(doOnUi: (ReturnType) -> Unit = {}): Task<ReturnType> where InjectableType : Component, InjectableType : ScopedInstance
fun <InjectableType, P1, ReturnType> KFunction2<InjectableType, P1, ReturnType>.runAsync(p1: P1, doOnUi: (ReturnType) -> Unit = {}): <ERROR CLASS> where InjectableType : Component, InjectableType : ScopedInstance

Perform the given operation on an ScopedInstance class function member asynchronousyly.

fun <InjectableType, P1, P2, ReturnType> KFunction3<InjectableType, P1, P2, ReturnType>.runAsync(p1: P1, p2: P2, doOnUi: (ReturnType) -> Unit = {}): <ERROR CLASS> where InjectableType : Component, InjectableType : ScopedInstance
fun <InjectableType, P1, P2, P3, ReturnType> KFunction4<InjectableType, P1, P2, P3, ReturnType>.runAsync(p1: P1, p2: P2, p3: P3, doOnUi: (ReturnType) -> Unit = {}): <ERROR CLASS> where InjectableType : Component, InjectableType : ScopedInstance
fun <InjectableType, P1, P2, P3, P4, ReturnType> KFunction5<InjectableType, P1, P2, P3, P4, ReturnType>.runAsync(p1: P1, p2: P2, p3: P3, p4: P4, doOnUi: (ReturnType) -> Unit = {}): <ERROR CLASS> where InjectableType : Component, InjectableType : ScopedInstance
fun <T> runAsync(daemon: Boolean = false, status: TaskStatus? = find(scope), func: FXTask<*>.() -> T): Task<T>fun <T> runAsync(status: TaskStatus? = find(scope), func: FXTask<*>.() -> T): Task<T>

Runs task in background. If not set directly, looks for TaskStatus instance in current scope.

set fun <InjectableType, T> set(prop: KMutableProperty1<InjectableType, T>, value: T): Unit where InjectableType : Component, InjectableType : ScopedInstance
setInScope fun <T : ScopedInstance> setInScope(value: T, scope: Scope = this.scope): <ERROR CLASS>
subscribe fun <T : FXEvent> subscribe(times: Number? = null, action: EventContext.(T) -> Unit): EventRegistration
ui infix fun <T> Task<T>.ui(func: (T) -> Unit): <ERROR CLASS>
unsubscribe fun <T : FXEvent> unsubscribe(action: EventContext.(T) -> Unit): Unit

Extension Functions

getProperty fun <T> Any.getProperty(prop: KMutableProperty1<*, T>): ObjectProperty<T>
observable fun <T : Any> Any.observable(propName: String): ObjectProperty<T>

Inheritors

Rest open class Rest : Controller