in test-recorder/src/main/kotlin/com/intellij/remoterobot/recorder/ui/dialogs/CreateNewMouseEventStepDialogWrapper.kt [37:78]
override fun createCenterPanel(): JComponent {
val actionPanel = ActionPanel()
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("Locator:", JTextField(stepModel.xpath).apply {
document.whenTextChanged(disposable) { stepModel.xpath = text }
})
.addLabeledComponent("Timeout (sec):", IntegerField().apply {
stepModel.searchTimeout?.let {
value = it.seconds.toInt()
}
columns = 4
minValue = 0
valueEditor.addListener { stepModel.searchTimeout = Duration.ofSeconds(it.toLong()) }
})
.addLabeledComponent("Action:", JComboBox(MouseEventStepActionType.values()).apply {
selectedItem = stepModel.operation.actionType
addItemListener {
actionPanel.showMouseActionSettings(it.item as MouseEventStepActionType, stepModel)
revalidate()
repaint()
}
setRenderer { _, stepActionType, _, _, _ -> JBLabel(stepActionType.text) }
})
.panel
)
addToCenter(actionPanel.apply {
showMouseActionSettings(stepModel.operation.actionType, stepModel)
})
}
}