diff --git a/pom.xml b/pom.xml
index d5d0bb6..03ac74b 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
com.github.hanseter
json-properties-fx
- 1.0.19
+ 1.0.20
bundle
JSON Properties Editor Fx
diff --git a/src/main/kotlin/com/github/hanseter/json/editor/actions/PreviewAction.kt b/src/main/kotlin/com/github/hanseter/json/editor/actions/PreviewAction.kt
index 4e5efc0..719ac7d 100755
--- a/src/main/kotlin/com/github/hanseter/json/editor/actions/PreviewAction.kt
+++ b/src/main/kotlin/com/github/hanseter/json/editor/actions/PreviewAction.kt
@@ -3,8 +3,10 @@ package com.github.hanseter.json.editor.actions
import com.github.hanseter.json.editor.*
import com.github.hanseter.json.editor.controls.IdReferenceControl
import com.github.hanseter.json.editor.i18n.JsonPropertiesMl
+import com.github.hanseter.json.editor.types.IdReferenceModel
import com.github.hanseter.json.editor.types.SupportedType
import com.github.hanseter.json.editor.types.TypeModel
+import com.github.hanseter.json.editor.util.ViewOptions
import javafx.event.Event
import javafx.geometry.Pos
import javafx.scene.Node
@@ -36,10 +38,11 @@ class PreviewAction(
mouseEvent: Event?
): PropertiesEditResult? {
val value = (model as TypeModel).value
+ val viewOptions = (model as IdReferenceModel).viewOptions
if (value != null) {
val dataAndSchema = idReferenceProposalProvider.get().getDataAndSchema(value)
if (dataAndSchema != null && mouseEvent != null) {
- showPreviewPopup(dataAndSchema, value, mouseEvent?.target as? Node)
+ showPreviewPopup(dataAndSchema, value, mouseEvent?.target as? Node,viewOptions)
}
}
return null
@@ -55,12 +58,14 @@ class PreviewAction(
private fun showPreviewPopup(
dataAndSchema: IdReferenceProposalProvider.DataWithSchema,
value: String,
- parent: Node?
+ parent: Node?,
+ viewOptions: ViewOptions
) {
val (data, previewSchema) = dataAndSchema
val preview = JsonPropertiesEditor(true)
preview.referenceProposalProvider = idReferenceProposalProvider.get()
preview.resolutionScopeProvider = resolutionScopeProvider.get()
+ preview.viewOptions= viewOptions
preview.display(value, value, data, previewSchema) { it }
val scrollPane = ScrollPane(preview)
scrollPane.maxHeight = 500.0
diff --git a/src/main/kotlin/com/github/hanseter/json/editor/types/IdReferenceModel.kt b/src/main/kotlin/com/github/hanseter/json/editor/types/IdReferenceModel.kt
index 77c08ea..4c683e3 100755
--- a/src/main/kotlin/com/github/hanseter/json/editor/types/IdReferenceModel.kt
+++ b/src/main/kotlin/com/github/hanseter/json/editor/types/IdReferenceModel.kt
@@ -1,9 +1,7 @@
package com.github.hanseter.json.editor.types
import com.github.hanseter.json.editor.extensions.EffectiveSchema
-import com.github.hanseter.json.editor.util.BindableJsonType
-import com.github.hanseter.json.editor.util.EditorContext
-import com.github.hanseter.json.editor.util.IdRefDisplayMode
+import com.github.hanseter.json.editor.util.*
import org.everit.json.schema.StringSchema
class IdReferenceModel(
@@ -23,6 +21,13 @@ class IdReferenceModel(
bound?.setValue(schema, value)
}
+ val viewOptions: ViewOptions
+ get() = ViewOptions(
+ idRefDisplayMode = context.idRefDisplayMode,
+ decimalFormatSymbols = context.decimalFormatSymbols,
+ groupBy = PropertyGrouping.NONE
+ )
+
companion object {
val CONVERTER: (Any) -> String = { it as? String ?: it.toString() }
private fun idToString(
@@ -51,8 +56,8 @@ class IdReferenceModel(
override val previewString: PreviewString
get() = PreviewString.create(
- idToString(value,context,schema),
- idToString(defaultValue,context,schema),
+ idToString(value, context, schema),
+ idToString(defaultValue, context, schema),
rawValue
)