diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
4 files changed, 20 insertions, 102 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index e4e5dd47..3bb42d53 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -104,53 +104,27 @@ open class FlexPanel( /** * CSS flexbox direction. */ - var direction = direction - set(value) { - field = value - refreshSpacing() - refresh() - } + var direction by refreshOnUpdate(direction, { refreshSpacing(); refresh() }) /** * CSS flexbox wrap mode. */ - var wrap = wrap - set(value) { - field = value - refresh() - } + var wrap by refreshOnUpdate(wrap) /** * CSS flexbox content justification. */ - var justify = justify - set(value) { - field = value - refresh() - } + var justify by refreshOnUpdate(justify) /** * CSS flexbox items alignment. */ - var alignItems = alignItems - set(value) { - field = value - refresh() - } + var alignItems by refreshOnUpdate(alignItems) /** * CSS flexbox content alignment. */ - var alignContent = alignContent - set(value) { - field = value - refresh() - } + var alignContent by refreshOnUpdate(alignContent) /** * The spacing between columns/rows. */ - var spacing = spacing - set(value) { - field = value - refreshSpacing() - refresh() - } + var spacing by refreshOnUpdate(spacing, { refreshSpacing(); refresh() }) init { @Suppress("LeakingThis") diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt index 178c1e7f..10e956be 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt @@ -112,99 +112,51 @@ open class GridPanel( /** * CSS grid auto columns. */ - var autoColumns = autoColumns - set(value) { - field = value - refresh() - } + var autoColumns by refreshOnUpdate(autoColumns) /** * CSS grid auto rows. */ - var autoRows = autoRows - set(value) { - field = value - refresh() - } + var autoRows by refreshOnUpdate(autoRows) /** * CSS grid auto flow. */ - var autoFlow = autoFlow - set(value) { - field = value - refresh() - } + var autoFlow by refreshOnUpdate(autoFlow) /** * CSS grid columns template. */ - var templateColumns = templateColumns - set(value) { - field = value - refresh() - } + var templateColumns by refreshOnUpdate(templateColumns) /** * CSS grid rows template. */ - var templateRows = templateRows - set(value) { - field = value - refresh() - } + var templateRows by refreshOnUpdate(templateRows) /** * CSS grid areas template. */ - var templateAreas = templateAreas - set(value) { - field = value - refresh() - } + var templateAreas by refreshOnUpdate(templateAreas) /** * CSS grid column gap. */ - var columnGap = columnGap - set(value) { - field = value - refresh() - } + var columnGap by refreshOnUpdate(columnGap) /** * CSS grid row gap. */ - var rowGap = rowGap - set(value) { - field = value - refresh() - } + var rowGap by refreshOnUpdate(rowGap) /** * CSS grid items justification. */ - var justifyItems = justifyItems - set(value) { - field = value - refresh() - } + var justifyItems by refreshOnUpdate(justifyItems) /** * CSS grid items alignment. */ - var alignItems = alignItems - set(value) { - field = value - refresh() - } + var alignItems by refreshOnUpdate(alignItems) /** * CSS grid content justification. */ - var justifyContent = justifyContent - set(value) { - field = value - refresh() - } + var justifyContent by refreshOnUpdate(justifyContent) /** * CSS grid content alignment. */ - var alignContent = alignContent - set(value) { - field = value - refresh() - } + var alignContent by refreshOnUpdate(alignContent) init { @Suppress("LeakingThis") diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt index 4a82ed5b..a5b3d577 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt @@ -62,11 +62,7 @@ open class ResponsiveGridPanel( /** * Text align of grid cells. */ - var align = align - set(value) { - field = value - refreshRowContainers() - } + var align by refreshOnUpdate(align, { refreshRowContainers() }) internal val map = mutableMapOf<Int, MutableMap<Int, WidgetParam>>() private var auto: Boolean = true diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt index bac027fe..da41db9f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt @@ -44,11 +44,7 @@ open class StackPanel( /** * The index of active (visible) child. */ - var activeIndex = -1 - set(value) { - field = value - refresh() - } + var activeIndex by refreshOnUpdate(-1) init { @Suppress("LeakingThis") |