Apologies - looks like (not sure why) our internal method of parsing the schema for events isn’t used by the public ComponetDescriptor.register hook. What you’ll want to do instead is add a manually constructed ComponentEventDescriptor to your schema; something like this: (just move the event
key from the schema.json to its own resource file, for simplicity)
public static JsonSchema EVENT_SCHEMA =
JsonSchema.parse(RadComponents.class.getResourceAsStream("/radimage.event.json"));
public static ComponentEventDescriptor EVENT_DESCRIPTOR = new ComponentEventDescriptor("onActionPerformed", "Fired when an action occurs", EVENT_SCHEMA);
/**
* Components register with the Java side ComponentRegistry but providing a ComponentDescriptor. Here we
* build the descriptor for this one component. Icons on the component palette are optional.
*/
public static ComponentDescriptor DESCRIPTOR = ComponentDescriptorImpl.ComponentBuilder.newBuilder()
.withPaletteCategory(RadComponents.COMPONENT_CATEGORY)
.withPaletteDescription("A simple image component.")
.withId(COMPONENT_ID)
.withModuleId(RadComponents.MODULE_ID)
.withSchema(SCHEMA) // this could alternatively be created purely in Java if desired
.withPaletteName("Rad Image")
.withDefaultMetaName("radImage")
.withEvents(List.of(EVENT_DESCRIPTOR))
.shouldAddToPalette(true)
.withResources(RadComponents.BROWSER_RESOURCES)
.build();