Utils for Apache Wicket development with Kotlin
-
Annotation based mounts
@MountPage("some/path") class MyPage: WebPage { ... } class MyApplication: WebApplication { override fun init() { // ... mountAnnotatedPages() } }
-
DSL-like components
class MyPage: Page { override fun onInitialize() { +SomeComponent("id") { // configure component ... } } }
-
Models for Lambdas and properties
modelOf { "getter" } modelOf( { getter() }, { setter(it) }) modelOf( MyObject::name ) modelOf( MyObject::birthdate, LocalDate::year ) -
PageParameters by delegates
data class MyParams( val pp: PageParameters ) { var name: String by pp }
-
Typesafe PageParameters
bookmarkablePageLink.apply { param(MyParams::name, "value") } component.setResponsePage(MyPage::class.java, myParams.copy()) { name = "value" }
-
Spring beans by delegate
class MyComponent() { val bean: BeanType by bean() val bean: BeanType by bean("name") }
-
easy CSS class handling
component.addCssClass("a", "b", classNameAsCssClass()) component.removeCssClass("c")