From 2ab68b3245f08d927391a16605e41ed48111f160 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 8 Sep 2020 18:20:43 +0300 Subject: [PATCH] Wizard: move boolean setting description to the bottom --- .../projectWizard/wizard/ui/CommentLabel.kt | 16 ++++------------ .../wizard/ui/components/CheckboxComponent.kt | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/CommentLabel.kt b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/CommentLabel.kt index 621ed3e8ab3..99eed535f35 100644 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/CommentLabel.kt +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/CommentLabel.kt @@ -10,6 +10,8 @@ import com.intellij.ui.components.JBLabel import com.intellij.util.ui.JBUI import com.intellij.util.ui.UIUtil import javax.swing.JComponent +import javax.swing.JPanel +import javax.swing.SpringLayout import javax.swing.SwingConstants class CommentLabel(text: String? = null) : JBLabel() { @@ -34,21 +36,11 @@ class CommentLabel(text: String? = null) : JBLabel() { fun commentLabel(text: String, init: JBLabel.() -> Unit = {}) = CommentLabel(text).apply(init) -fun componentWithCommentAtRight(component: JComponent, label: String?) = borderPanel { - addToLeft(component) - label?.let { - addToCenter(commentLabel(it) { - withBorder(JBUI.Borders.emptyLeft(5)) - verticalAlignment = SwingConstants.CENTER - }) - } -} - -fun componentWithCommentAtBottom(component: JComponent, label: String?) = borderPanel { +fun componentWithCommentAtBottom(component: JComponent, label: String?, gap: Int = 4) = borderPanel { addToTop(component) label?.let { addToCenter(commentLabel(it) { - withBorder(JBUI.Borders.emptyLeft(4)) + withBorder(JBUI.Borders.emptyLeft(gap)) }) } } \ No newline at end of file diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/CheckboxComponent.kt b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/CheckboxComponent.kt index d53ef2f80d3..6499771bcc3 100644 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/CheckboxComponent.kt +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/CheckboxComponent.kt @@ -4,7 +4,7 @@ import com.intellij.ui.components.JBCheckBox import com.intellij.util.ui.UIUtil import org.jetbrains.kotlin.tools.projectWizard.core.Context import org.jetbrains.kotlin.tools.projectWizard.core.entity.SettingValidator -import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.componentWithCommentAtRight +import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.componentWithCommentAtBottom import javax.swing.JComponent class CheckboxComponent( @@ -29,7 +29,7 @@ class CheckboxComponent( override val alignTarget: JComponent? get() = checkbox - override val uiComponent = componentWithCommentAtRight(checkbox, description) + override val uiComponent = componentWithCommentAtBottom(checkbox, description, gap = 2) override fun updateUiValue(newValue: Boolean) = safeUpdateUi { checkbox.isSelected = newValue