у меня есть следующий код
в модели
@Bindable boolean readOnly
в представлении
checkBox(text: 'Read Only', constraints:'wrap',selected:bind(target: model, targetProperty:'readOnly'))
в контроллере
new groovy.swing.SwingBuilder().frame(title:'File opened',pack:true,show:true){
panel(layout: new MigLayout('fill'), border: titledBorder('Content')){
separator(constraints:"cell 0 1")
textArea(text: part1 , editable: false)
separator(constraints:"cell 0 2")
textArea(text: part2 , editable: false)
separator(constraints:"cell 0 1")
t1 = textArea(text: part3 , editable: "${model.readOnly}",columns:50)
separator(constraints:"cell 0 2")
t2 = textArea(text: part4 , editable: "${model.readOnly}")
separator(constraints:"cell 0 3")
button('Save!', actionPerformed: save, constraints: 'span 5, bottom, right')
}
}
но он всегда включен, не имеет значения, установлен флажок или нет.
system.out.println("${model.readOnly}")
показывает true
и false
правильно, но по какой-то причине в кадре он всегда установлен на true
примечание: также присваивание boolean a = "${model.readOnly}"
устанавливает всегда значение true, или if "${model.readOnly}" == true
или if ("${model.readOnly}")
работают как всегда true
oh, а также устанавливают размер в кадре, например
new groovy.swing.SwingBuilder().frame(title:'File opened',pack:true,show:true, size : [640,480]){
тоже не работает