Skip to content

Commit 836b35c

Browse files
author
Hanseter
committed
Fix some small bugs
1 parent dc1d8a1 commit 836b35c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/main/kotlin/com/github/hanseter/json/editor/JsonPropertiesEditor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class JsonPropertiesEditor @JvmOverloads constructor(
164164
}
165165

166166
fun removeObject(objId: String) {
167+
treeTableView.selectionModel.clearSelection()
167168
(idsToPanes.remove(objId)?.treeItem)?.also {
168169
(treeTableView.root as FilterableTreeItem).remove(it)
169170
}
@@ -203,6 +204,7 @@ class JsonPropertiesEditor @JvmOverloads constructor(
203204
}
204205

205206
fun clear() {
207+
treeTableView.selectionModel.clearSelection()
206208
idsToPanes.clear()
207209
(treeTableView.root as FilterableTreeItem).clear()
208210
rebindValidProperty()
@@ -322,7 +324,7 @@ class JsonPropertiesEditor @JvmOverloads constructor(
322324
createValidationMessage(
323325
label,
324326
treeItemData.validationMessage
325-
)?.also(DECORATOR::applyValidationDecoration)
327+
)?.also { Platform.runLater { DECORATOR.applyValidationDecoration(it) } }
326328
}
327329
}
328330

src/main/kotlin/com/github/hanseter/json/editor/controls/MultiLineStringControl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MultiLineStringControl : ControlWithProperty<String?> {
1414
prefHeightProperty().bind(maxHeightProperty())
1515
minHeightProperty().bind(maxHeightProperty())
1616
textProperty().addListener { _, _, text ->
17-
if ('\n' in text) {
17+
if (text?.contains('\n') == true) {
1818
maxHeight = 70.0
1919
setHorizonzalScrollbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED)
2020
} else {

src/main/kotlin/com/github/hanseter/json/editor/ui/FilterableTreeItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class FilterableTreeItem<T>(value: T) : TreeItem<T>(value) {
4646
fun setFilter(filter: (T) -> Boolean) {
4747
filteredList.setPredicate { child ->
4848
child.setFilter(filter)
49-
if (child.children.size > 0) {
49+
if (child.children.isNotEmpty()) {
5050
true
5151
} else {
5252
filter(child.value)

0 commit comments

Comments
 (0)