Using pickers for XWiki Rendering Macro parameters

Last modified by Vincent Massol on 2023/07/02

The type property of a XWiki.WikiMacroParameterClass object allows to specify into which Java type the parameter value (defined as a String) must be converted to.
Depending of the type provided, a custom picker can be used instead of the default one when editing the macro parameters in the wysiwyg editor.

Here are the types implementing a custom picker:

TypePicker
org.xwiki.model.reference.AttachmentReferenceAttachment picker
java.lang.BooleanCheckbox
java.awt.ColorColor picker
java.util.DateDate picker
org.xwiki.model.reference.DocumentReferencePage picker
org.xwiki.model.reference.EntityReferenceStringCustom picker for entity references
org.xwiki.model.EntityTypeCustom picker for entity types
org.xwiki.user.UserReferenceUser Picker

You can also provide the reference of an existing Java Enum to get a custom select picker with its values. If you want to create a custom enum for your parameter, you can try the following approach.

You can find the pickers implementation.

Get Connected