Wizard: make project templates list scrollable

This commit is contained in:
Ilya Kirillov
2020-10-01 16:04:06 +03:00
parent db069c3264
commit 2a5679e0c6
2 changed files with 4 additions and 6 deletions
@@ -77,7 +77,7 @@ class ProjectSettingsComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizar
).asSubComponent() ).asSubComponent()
override val component: JComponent by lazy(LazyThreadSafetyMode.NONE) { override val component: JComponent by lazy(LazyThreadSafetyMode.NONE) {
val panel = panel { panel {
row { row {
nameAndLocationComponent.component(growX) nameAndLocationComponent.component(growX)
} }
@@ -85,9 +85,6 @@ class ProjectSettingsComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizar
buildSystemAdditionalSettingsComponent.component(growX) buildSystemAdditionalSettingsComponent.component(growX)
} }
}.addBorder(JBUI.Borders.emptyRight(UIConstants.PADDING)) }.addBorder(JBUI.Borders.emptyRight(UIConstants.PADDING))
ScrollPaneFactory.createScrollPane(panel, true).apply {
viewport.background = JBColor.PanelBackground
}
} }
override fun onValueUpdated(reference: SettingReference<*, *>?) { override fun onValueUpdated(reference: SettingReference<*, *>?) {
@@ -47,10 +47,10 @@ class ProjectTemplateSettingComponent(
override val alignment: TitleComponentAlignment override val alignment: TitleComponentAlignment
get() = TitleComponentAlignment.AlignFormTopWithPadding(4) get() = TitleComponentAlignment.AlignFormTopWithPadding(4)
private val borderedPanel = list.addBorder(BorderFactory.createLineBorder(JBColor.border())) private val scrollPane = ScrollPaneFactory.createScrollPane(list)
override val component: JComponent = borderPanel { override val component: JComponent = borderPanel {
addToCenter(borderPanel { addToCenter(list) }.addBorder(JBUI.Borders.empty(0,/*left*/ 3, 0, /*right*/ 3))) addToCenter(borderPanel { addToCenter(scrollPane) }.addBorder(JBUI.Borders.empty(0,/*left*/ 3, 0, /*right*/ 3)))
addToBottom(templateDescriptionComponent.component.addBorder(JBUI.Borders.empty(/*top*/8,/*left*/ 3, 0, 0))) addToBottom(templateDescriptionComponent.component.addBorder(JBUI.Borders.empty(/*top*/8,/*left*/ 3, 0, 0)))
} }
@@ -93,6 +93,7 @@ private val ProjectTemplate.icon: Icon
MultiplatformMobileApplicationProjectTemplate -> KotlinIcons.Wizard.MULTIPLATFORM_MOBILE MultiplatformMobileApplicationProjectTemplate -> KotlinIcons.Wizard.MULTIPLATFORM_MOBILE
MultiplatformMobileLibraryProjectTemplate -> KotlinIcons.Wizard.MULTIPLATFORM_MOBILE_LIBRARY MultiplatformMobileLibraryProjectTemplate -> KotlinIcons.Wizard.MULTIPLATFORM_MOBILE_LIBRARY
NodeJsApplicationProjectTemplate -> KotlinIcons.Wizard.NODE_JS NodeJsApplicationProjectTemplate -> KotlinIcons.Wizard.NODE_JS
ComposeDesktopApplicationProjectTemplate -> KotlinIcons.Wizard.COMPOSE
} }
class TemplateDescriptionComponent : Component() { class TemplateDescriptionComponent : Component() {