@@ -114,31 +114,43 @@ class NodeTabView : Fragment() {
114
114
115
115
fieldset(" Additional configuration" ) {
116
116
styleClass.addAll(" services-panel" )
117
- val extraServices = if (nodeController.hasNotary()) {
118
- listOf (USD , GBP , CHF , EUR ).map { CurrencyIssuer (it) }
119
- } else {
120
- listOf (NotaryService (true ), NotaryService (false ))
121
- }
122
-
123
- val servicesList = CheckListView (extraServices.observable()).apply {
124
- vboxConstraints { vGrow = Priority .ALWAYS }
125
- model.item.extraServices.set(checkModel.checkedItems)
126
- if (! nodeController.hasNotary()) {
127
- checkModel.check(0 )
128
- checkModel.checkedItems.addListener(ListChangeListener { change ->
129
- while (change.next()) {
130
- if (change.wasAdded()) {
131
- val item = change.addedSubList.last()
132
- val idx = checkModel.getItemIndex(item)
133
- checkModel.checkedIndices.forEach {
134
- if (it != idx) checkModel.clearCheck(it)
117
+ if (nodeController.hasNotary()) {
118
+ val extraServices: List <ExtraService > = listOf (USD , GBP , CHF , EUR ).map { CurrencyIssuer (it) }
119
+ val servicesList = CheckListView (extraServices.observable()).apply {
120
+ vboxConstraints { vGrow = Priority .ALWAYS }
121
+ model.item.extraServices.set(checkModel.checkedItems)
122
+ if (! nodeController.hasNotary()) {
123
+ checkModel.check(0 )
124
+ checkModel.checkedItems.addListener(ListChangeListener { change ->
125
+ while (change.next()) {
126
+ if (change.wasAdded()) {
127
+ val item = change.addedSubList.last()
128
+ val idx = checkModel.getItemIndex(item)
129
+ checkModel.checkedIndices.forEach {
130
+ if (it != idx) checkModel.clearCheck(it)
131
+ }
135
132
}
136
133
}
137
- }
138
- })
134
+ })
135
+ }
136
+ }
137
+ add(servicesList)
138
+ } else {
139
+ val notaryTypes = listOf (NotaryService (true ), NotaryService (false ))
140
+ val notaryTypeToggleGroup = togglegroup()
141
+ notaryTypeToggleGroup.selectedValueProperty<NotaryService >().addListener { observValue, oldValue, newValue ->
142
+ oldValue?.let {
143
+ model.item.extraServices.removeAll(it)
144
+ }
145
+ newValue?.let {
146
+ model.item.extraServices.add(it)
147
+ }
148
+ }
149
+ notaryTypes.forEachIndexed { index, notaryType ->
150
+ val toggle = radiobutton(notaryType.toString(), notaryTypeToggleGroup, notaryType)
151
+ toggle.isSelected = index == 0
139
152
}
140
153
}
141
- add(servicesList)
142
154
}
143
155
}
144
156
0 commit comments