Wizard: move boolean setting description to the bottom

This commit is contained in:
Ilya Kirillov
2020-09-08 18:20:43 +03:00
parent ce00366c7f
commit 2ab68b3245
2 changed files with 6 additions and 14 deletions
@@ -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))
})
}
}
@@ -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