diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-10-19 12:04:37 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-10-19 12:04:37 +0200 |
commit | 3ef71f681eeb1a832bbd0f95d01958617529bae7 (patch) | |
tree | 7ed5dae4696f24c1a527013ad42b6a5268558ead /src/main/kotlin/pl/treksoft/kvision/Showcase.kt | |
parent | daa6f55e70e85c15c55ef06fd2912d95ea4922fc (diff) | |
download | kvision-3ef71f681eeb1a832bbd0f95d01958617529bae7.tar.gz kvision-3ef71f681eeb1a832bbd0f95d01958617529bae7.tar.bz2 kvision-3ef71f681eeb1a832bbd0f95d01958617529bae7.zip |
Refactoring styled component
Form controls: input, password, checkbox
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/Showcase.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index ab88be28..bf0691e1 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -1,18 +1,15 @@ package pl.treksoft.kvision import pl.treksoft.kvision.basic.Label -import pl.treksoft.kvision.core.Container -import pl.treksoft.kvision.core.Img -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.css.BGATTACH -import pl.treksoft.kvision.css.BGREPEAT -import pl.treksoft.kvision.css.BGSIZE -import pl.treksoft.kvision.css.BORDERSTYLE -import pl.treksoft.kvision.css.Background -import pl.treksoft.kvision.css.Border -import pl.treksoft.kvision.css.COLOR +import pl.treksoft.kvision.core.* import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown +import pl.treksoft.kvision.form.CHECKBOXSTYLE +import pl.treksoft.kvision.form.CheckBox +import pl.treksoft.kvision.form.INPUTSIZE +import pl.treksoft.kvision.form.TEXTINPUTTYPE +import pl.treksoft.kvision.form.Text +import pl.treksoft.kvision.form.TextInput import pl.treksoft.kvision.html.* import pl.treksoft.kvision.html.TAG.DIV import pl.treksoft.kvision.html.TAG.H1 @@ -44,6 +41,37 @@ class Showcase : ApplicationBase() { link.add(Tag(TAG.P, "Cośtam")) root.add(link) + val textField = TextInput(placeholder = "Wprowadź hasło ...", value = "abc") + root.add(textField) + textField.setEventListener<TextInput> { + input = { e -> + println("i" + self.value) + } + change = { e -> + println("c" + self.value) + } + } + val passwordField = TextInput(TEXTINPUTTYPE.PASSWORD) + root.add(passwordField) + + val textField2 = TextInput(placeholder = "Disabled") + textField2.disabled = true + textField2.size = INPUTSIZE.LARGE + root.add(textField2) + + val checkbox = CheckBox(true, label = "Kliknij aby <b>przetestować</b>", rich = true, circled = true, + style = CHECKBOXSTYLE.DANGER) + root.add(checkbox) + checkbox.setEventListener<CheckBox> { + click = { e -> + println("click" + self.value) + } + change = { e -> println("change" + self.value) } + } + + val text = Text(placeholder = "Pole formularza", maxlength = 5, label = "To jest pole") + root.add(text) + val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) dd.setEventListener<DropDown> { @@ -206,6 +234,8 @@ class Showcase : ApplicationBase() { button.setEventListener<Button> { click = { _ -> println(self.text) + println(textField.value) + println(checkbox.value) grid4.colorHex = 0xff0000 dd3.text = "Zmiana" dd3.style = BUTTONSTYLE.WARNING |