override fun createCenterPanel()

in test-recorder/src/main/kotlin/com/intellij/remoterobot/recorder/ui/dialogs/CreateNewCommonStepDialogWrapper.kt [36:68]


    override fun createCenterPanel(): JComponent {
        val actionPanel = ActionPanel(disposable)

        return BorderLayoutPanel().apply {
            addToTop(
                FormBuilder.createFormBuilder()
                    .addLabeledComponent("Name", JTextField(stepModel.name).apply {
                        document.whenTextChanged(disposable) {
                            ApplicationManager.getApplication().invokeLater {
                                stepModel.observableStepName.value = text
                            }
                        }
                        val listener: (String) -> Unit = { this.text = it }
                        stepModel.observableStepName.onChanged(listener)
                        disposable.whenDisposed { stepModel.observableStepName.removeListener(listener) }
                    })
                    .addLabeledComponent("Step", JComboBox<CommonStepMeta>().apply {
                        val steps = CommonStepModel.getSteps()
                        steps.forEach { addItem(it) }
                        selectedItem = steps.first()
                        addItemListener {
                            stepModel.step = it.item as CommonStepMeta
                            actionPanel.showCommonStepSetting(stepModel)
                            revalidate()
                            repaint()
                        }
                        setRenderer { _, step, _, _, _ -> JBLabel(step.title) }
                    })
                    .panel
            )
            addToCenter(actionPanel.apply { showCommonStepSetting(stepModel) })
        }
    }