Kotlin UI DSL: fix regression — should be an empty row before note if there is some rows before

This commit is contained in:
Vladimir Krivosheev
2018-03-22 15:46:32 +01:00
parent cc65205f71
commit 28b3a7727f
3 changed files with 17 additions and 3 deletions
@@ -53,6 +53,9 @@ internal class MigLayoutBuilder : LayoutBuilderImpl {
}
override fun noteRow(text: String) {
// add empty row as top gap
// newRow()
val cc = CC()
cc.vertical.gapBefore = gapToBoundSize(VERTICAL_GAP, false)
cc.vertical.gapAfter = gapToBoundSize(VERTICAL_GAP * 2, false)
@@ -5,7 +5,7 @@ columnConstraints:
- {}
- {grow: 100.0}
componentConstrains:
'JLabel #0':
'MultiLineLabel #0':
spanX: 2097051.0
wrap: true
vertical:
@@ -24,3 +24,13 @@ componentConstrains:
max: {value: 250.0, unitString: px}
preferred: {value: 250.0, unitString: px}
'JCheckBox #3': {skip: 1.0, spanX: 2097051.0, wrap: true}
'JLabel #4':
spanX: 2097051.0
wrap: true
vertical:
gapBefore:
min: {value: 5.0, unitString: px}
preferred: {value: 5.0, unitString: px}
gapAfter:
min: {value: 10.0, unitString: px}
preferred: {value: 10.0, unitString: px}
@@ -106,10 +106,11 @@ class UiDslTest {
fun `note row in the dialog`() {
val passwordField = JPasswordField()
doTest(panel {
noteRow("Profiler requires access to the kernel-level API. Enter the sudo password to allow this. ")
noteRow("Profiler requires access to the kernel-level API.\nEnter the sudo password to allow this. ")
row("Sudo password:") { passwordField() }
row { CheckBox(CommonBundle.message("checkbox.remember.password"), true)() }
}, "[0, 0, 544, 31], [0, 36, 99, 26], [119, 36, 425, 26], [119, 67, 425, 23]")
noteRow("Should be an empty row above as a gap")
}, "[0, 0, 512, 47], [0, 52, 99, 26], [119, 52, 393, 26], [119, 83, 393, 23], [0, 111, 512, 31]")
}
private fun doTest(panel: JPanel, expectedLocations: String) {