Interface PropertySuggestionSourceRegistry
- 
- All Known Implementing Classes:
 PropertySuggestionSourceRegistryImpl
public interface PropertySuggestionSourceRegistryRegistry for dynamic suggestion sources for perspective component properties. This system allows 3rd parties to register
SuggestionSourceimplementations 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 Modifier and Type Field Description static java.lang.StringSUGGESTION_EXTENSION 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<SuggestionSource>findSuggestionSource(java.lang.String key)static PropertySuggestionSourceRegistryget(DesignerContext context)voidregisterSuggestionSource(java.lang.String key, SuggestionSource source) 
 - 
 
- 
- 
Field Detail
- 
SUGGESTION_EXTENSION
static final java.lang.String SUGGESTION_EXTENSION
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
get
static PropertySuggestionSourceRegistry get(DesignerContext context)
 
- 
registerSuggestionSource
void registerSuggestionSource(java.lang.String key, SuggestionSource source) 
- 
findSuggestionSource
java.util.Optional<SuggestionSource> findSuggestionSource(java.lang.String key)
 
 - 
 
 -