From 28b3a7727faf6f32aabcba9844c3f06ae2037fe2 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 22 Mar 2018 15:44:47 +0100 Subject: [PATCH] =?UTF-8?q?Kotlin=20UI=20DSL:=20fix=20regression=20?= =?UTF-8?q?=E2=80=94=20should=20be=20an=20empty=20row=20before=20note=20if?= =?UTF-8?q?=20there=20is=20some=20rows=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellij/ui/layout/migLayout/MigLayoutBuilder.kt | 3 +++ .../testData/ui/layout/note row in the dialog.yml | 12 +++++++++++- .../testSrc/com/intellij/ui/layout/UiDslTest.kt | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt index c0913a9aae02..4ae179d83c84 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt @@ -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) diff --git a/platform/platform-tests/testData/ui/layout/note row in the dialog.yml b/platform/platform-tests/testData/ui/layout/note row in the dialog.yml index a8197cee79a9..7ab889724019 100644 --- a/platform/platform-tests/testData/ui/layout/note row in the dialog.yml +++ b/platform/platform-tests/testData/ui/layout/note row in the dialog.yml @@ -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} diff --git a/platform/platform-tests/testSrc/com/intellij/ui/layout/UiDslTest.kt b/platform/platform-tests/testSrc/com/intellij/ui/layout/UiDslTest.kt index 8ef983103ea7..247ce755cd66 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/layout/UiDslTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/ui/layout/UiDslTest.kt @@ -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) {