aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/html
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-25 01:04:24 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-25 01:04:24 +0100
commit9a1effcf29b27cc2e60b927c2d737b6cad0289b7 (patch)
treecd47309106493f869a7d7d5e9a43dcc99969dd4c /src/main/kotlin/pl/treksoft/kvision/html
parentc64b2c4b1f0c4e0e0d94d202715db4aaa47d9c65 (diff)
downloadkvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.tar.gz
kvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.tar.bz2
kvision-9a1effcf29b27cc2e60b927c2d737b6cad0289b7.zip
Change enum classes names for better readability.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Button.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Div.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Image.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/List.kt20
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt6
5 files changed, 23 insertions, 23 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
index e6f53737..84f7c309 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
@@ -32,7 +32,7 @@ import pl.treksoft.kvision.core.Widget
/**
* Button styles.
*/
-enum class BUTTONSTYLE(internal val className: String) {
+enum class ButtonStyle(internal val className: String) {
DEFAULT("btn-default"),
PRIMARY("btn-primary"),
SUCCESS("btn-success"),
@@ -45,7 +45,7 @@ enum class BUTTONSTYLE(internal val className: String) {
/**
* Button sizes.
*/
-enum class BUTTONSIZE(internal val className: String) {
+enum class ButtonSize(internal val className: String) {
LARGE("btn-lg"),
SMALL("btn-sm"),
XSMALL("btn-xs")
@@ -62,7 +62,7 @@ enum class BUTTONSIZE(internal val className: String) {
* @param classes a set of CSS class names
*/
open class Button(
- text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
+ text: String, icon: String? = null, style: ButtonStyle = ButtonStyle.DEFAULT,
disabled: Boolean = false, classes: Set<String> = setOf()
) : Widget(classes) {
@@ -89,7 +89,7 @@ open class Button(
/**
* Button size.
*/
- var size: BUTTONSIZE? by refreshOnUpdate()
+ var size: ButtonSize? by refreshOnUpdate()
/**
* Determines if the button takes all the space horizontally.
*/
@@ -139,7 +139,7 @@ open class Button(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.button(
- text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
+ text: String, icon: String? = null, style: ButtonStyle = ButtonStyle.DEFAULT,
disabled: Boolean = false, classes: Set<String> = setOf(), init: (Button.() -> Unit)? = null
): Button {
val button = Button(text, icon, style, disabled, classes).apply { init?.invoke(this) }
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt
index ccfb3592..f71799ac 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt
@@ -33,7 +33,7 @@ import pl.treksoft.kvision.core.Container
open class Div(
text: String,
rich: Boolean = false,
- align: ALIGN? = null,
+ align: Align? = null,
classes: Set<String> = setOf(),
init: (Tag.() -> Unit)? = null
) :
@@ -47,7 +47,7 @@ open class Div(
fun Container.div(
text: String,
rich: Boolean = false,
- align: ALIGN? = null,
+ align: Align? = null,
classes: Set<String> = setOf(),
init: (Div.() -> Unit)? = null
): Div {
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
index ac7829e8..61733fb3 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
@@ -31,7 +31,7 @@ import pl.treksoft.kvision.core.Widget
/**
* Image shapes.
*/
-enum class IMAGESHAPE(internal val className: String) {
+enum class ImageShape(internal val className: String) {
ROUNDED("img-rounded"),
CIRCLE("img-circle"),
THUMBNAIL("img-thumbnail")
@@ -49,7 +49,7 @@ enum class IMAGESHAPE(internal val className: String) {
* @param classes a set of CSS class names
*/
open class Image(
- src: ResString, alt: String? = null, responsive: Boolean = false, shape: IMAGESHAPE? = null,
+ src: ResString, alt: String? = null, responsive: Boolean = false, shape: ImageShape? = null,
centered: Boolean = false, classes: Set<String> = setOf()
) : Widget(classes) {
/**
@@ -107,7 +107,7 @@ open class Image(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.image(
- src: ResString, alt: String? = null, responsive: Boolean = false, shape: IMAGESHAPE? = null,
+ src: ResString, alt: String? = null, responsive: Boolean = false, shape: ImageShape? = null,
centered: Boolean = false, classes: Set<String> = setOf(), init: (Image.() -> Unit)? = null
): Image {
val image = Image(src, alt, responsive, shape, centered, classes).apply { init?.invoke(this) }
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/List.kt b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
index 185d2eea..fb49cd62 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
@@ -32,7 +32,7 @@ import pl.treksoft.kvision.panel.SimplePanel
/**
* HTML list types.
*/
-enum class LISTTYPE(internal val tagName: String) {
+enum class ListType(internal val tagName: String) {
UL("ul"),
OL("ol"),
UNSTYLED("ul"),
@@ -55,7 +55,7 @@ enum class LISTTYPE(internal val tagName: String) {
* @param init an initializer extension function
*/
open class ListTag(
- type: LISTTYPE, elements: List<String>? = null, rich: Boolean = false,
+ type: ListType, elements: List<String>? = null, rich: Boolean = false,
classes: Set<String> = setOf(), init: (ListTag.() -> Unit)? = null
) : SimplePanel(classes) {
/**
@@ -78,10 +78,10 @@ open class ListTag(
override fun render(): VNode {
val childrenElements = when (type) {
- LISTTYPE.UL, LISTTYPE.OL, LISTTYPE.UNSTYLED, LISTTYPE.INLINE -> elements?.map { el ->
+ ListType.UL, ListType.OL, ListType.UNSTYLED, ListType.INLINE -> elements?.map { el ->
element("li", el, rich)
}
- LISTTYPE.DL, LISTTYPE.DL_HORIZ -> elements?.mapIndexed { index, el ->
+ ListType.DL, ListType.DL_HORIZ -> elements?.mapIndexed { index, el ->
element(if (index % 2 == 0) "dt" else "dd", el, rich)
}
}?.toTypedArray()
@@ -95,14 +95,14 @@ open class ListTag(
override fun childrenVNodes(): Array<VNode> {
val childrenElements = children.filter { it.visible }
val res = when (type) {
- LISTTYPE.UL, LISTTYPE.OL, LISTTYPE.UNSTYLED, LISTTYPE.INLINE -> childrenElements.map { v ->
+ ListType.UL, ListType.OL, ListType.UNSTYLED, ListType.INLINE -> childrenElements.map { v ->
if (v is Tag && v.type == TAG.LI) {
v.renderVNode()
} else {
h("li", arrayOf(v.renderVNode()))
}
}
- LISTTYPE.DL, LISTTYPE.DL_HORIZ -> childrenElements.mapIndexed { index, v ->
+ ListType.DL, ListType.DL_HORIZ -> childrenElements.mapIndexed { index, v ->
if (v is Tag && v.type == TAG.LI) {
v.renderVNode()
} else {
@@ -125,9 +125,9 @@ open class ListTag(
val cl = super.getSnClass().toMutableList()
@Suppress("NON_EXHAUSTIVE_WHEN")
when (type) {
- LISTTYPE.UNSTYLED -> cl.add("list-unstyled" to true)
- LISTTYPE.INLINE -> cl.add("list-inline" to true)
- LISTTYPE.DL_HORIZ -> cl.add("dl-horizontal" to true)
+ ListType.UNSTYLED -> cl.add("list-unstyled" to true)
+ ListType.INLINE -> cl.add("list-inline" to true)
+ ListType.DL_HORIZ -> cl.add("dl-horizontal" to true)
}
return cl
}
@@ -139,7 +139,7 @@ open class ListTag(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.listTag(
- type: LISTTYPE, elements: List<String>? = null, rich: Boolean = false,
+ type: ListType, elements: List<String>? = null, rich: Boolean = false,
classes: Set<String> = setOf(), init: (ListTag.() -> Unit)? = null
): ListTag {
val listTag = ListTag(type, elements, rich, classes, init)
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index a3b7f231..33ef2cb7 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -71,7 +71,7 @@ enum class TAG(internal val tagName: String) {
/**
* CSS align attributes.
*/
-enum class ALIGN(val className: String) {
+enum class Align(val className: String) {
LEFT("text-left"),
CENTER("text-center"),
RIGHT("text-right"),
@@ -91,7 +91,7 @@ enum class ALIGN(val className: String) {
* @param init an initializer extension function
*/
open class Tag(
- type: TAG, text: String? = null, rich: Boolean = false, align: ALIGN? = null,
+ type: TAG, text: String? = null, rich: Boolean = false, align: Align? = null,
classes: Set<String> = setOf(), init: (Tag.() -> Unit)? = null
) : SimplePanel(classes) {
@@ -144,7 +144,7 @@ open class Tag(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.tag(
- type: TAG, text: String? = null, rich: Boolean = false, align: ALIGN? = null,
+ type: TAG, text: String? = null, rich: Boolean = false, align: Align? = null,
classes: Set<String> = setOf(), init: (Tag.() -> Unit)? = null
): Tag {
val tag = Tag(type, text, rich, align, classes, init)