Interface PropertySuggestionSourceRegistry
- All Known Implementing Classes:
PropertySuggestionSourceRegistryImpl
public interface PropertySuggestionSourceRegistry
Registry for dynamic suggestion sources for perspective component properties. This system allows 3rd parties to
register SuggestionSource
implementations and then mark component properties using the JSON-schema to
use that suggestion source. The end result being that in the Designer, the property will have a dropdown displayed
in the editor that allows the user to pick from the suggested values.
To use this system, perform the following two steps:
-
Annotate the property in question in your JSON schema using the "suggestion-source" extension. For example:
"myProperty": { "type": "string", "default": "foo", "description": "This property will have dynamic suggestions", "extension": { "suggestion-source": "my-suggestion-source-key" } }
-
Register your suggestion source implementation using the matching key from the schema. This will probably
be done in your designer hook's startup method. For exmaple:
PerspectiveDesignerInterface perspectiveDesigner = PerspectiveDesignerInterface.get(designerContext); perspectiveDesigner.getSuggestionSourceRegistry().registerSuggestionSource( "my-suggestion-source-key", (node, schema) -> CompletableFuture.completedFuture(loadSuggestions()) );
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionget
(DesignerContext context) void
registerSuggestionSource
(String key, SuggestionSource source)
-
Field Details
-
SUGGESTION_EXTENSION
- See Also:
-
-
Method Details
-
get
-
registerSuggestionSource
-
findSuggestionSource
-