value list provider

Skip to first unread message

brian doherty

Apr 24, 2018, 3:07:02 AM4/24/18
to Hippo Community
I have a value list provider that is extending PropertyFieldPlugin.  It is part of a compound.  The other field in the compound has a doc picker.  The value list should update based on what is chosen in the doc picker.  There are some other methods in the class that are working fine.  However, the getValueList() method always runs on the same object.  New objects are created from the constructor, and I can see their IDs in the debugger.  However, when we get to getValueList(), it never runs on the new objects - just the first object created.  Is there a way around this so that getValueList() will run on each object?

brian doherty

Apr 24, 2018, 3:15:38 AM4/24/18
to Hippo Community
I am using the same class for the plugin and the value list provider, and they are both included in the yaml.  The full class name is listed in plugin.class and the name of the value list provider service is in the value list provider field.

Barış Can Vural

Apr 30, 2018, 4:42:50 AM4/30/18
to Hippo Community
Hi Brian,

I had to implement a similar solution for a customer. My case was to dynamically populate a dynamic dropdown based on what was selected in an external document picker ( ). Here's how I did it:

  • I overwrote the org.hippoecm.frontend.editor.plugins.field.PropertyFieldPlugin and put my custom plugin class on the "editor template" node of the field that correspond to the dynamic dropdown.
  • In the constructor of this custom plugin class, I read the external document picker's value. Here's that class (my value list provider is a separate class):
public class MyCustomPlugin extends PropertyFieldPlugin {

    private static final String OBSERVER_ID = "observerId";
    private static final String CATEGORIES_PROPERTY_NAME = "categories";
    private static final String DEFAULT_CATEGORIES_PROPERTY_NAME = "mynamespace:categories";
    private static final String DEFAULT_OBSERVER_ID = "testobservable";

    private final JcrPropertyValueModel<String> propValueModel;

    public MyCustomPlugin(final IPluginContext context, final IPluginConfig config) {
        super(context, config);

        final String nodePath = getCategoriesPropertyPath(); //get the path of the node that external document picker relates to
        final JcrPropertyModel<String> propModel = new JcrPropertyModel<>(nodePath);
        propValueModel = new JcrPropertyValueModel<>(propModel);

        final String observableId = config.getString(OBSERVER_ID, DEFAULT_OBSERVER_ID); //I have a property called "observerId" on the plugin.
        final ObservableValueModel<String> observableValueModel = new CategoriesPathModel(propValueModel, nodePath); //Observe the changes on the external dropdown

//Start a service that sends the observable model, with observableId.
                 //Dynamic dropdown knows about this observableId (more on this further down)
        final ModelReference<String> modelReference = new ModelReference<>(observableId, observableValueModel); 

    // The field that external document picker is linked to is called "mynamespace:categories"
    private String getCategoriesPropertyPath() {
        final String categories = getPluginConfig().getString(CATEGORIES_PROPERTY_NAME, DEFAULT_CATEGORIES_PROPERTY_NAME);
        final JcrNodeModel nodeModel = (JcrNodeModel) getDefaultModel();
        return nodeModel.getItemModel().getPath() + "/" + categories;

    //Apache wicket stuff.
    protected void onDetach() {

    //More Apache wicket stuff. This is how you pass data around
    private static class CategoriesPathModel extends ObservableValueModel<String> {

        private final String path;

        CategoriesPathModel(final JcrPropertyValueModel<String> valueModel, final String path) {
            this.path = path;

        protected String load() {
            return path;

  • I mention in the code comments that "observableId" is something dynamic dropdown knows about. I achieved this by adding properties like: 

And on the "cluster options" node of this node (child node) I have the following properties:

  • As you can see, dynamic dropdown knows about this observerId. When the property field plugin sends observable value model objects, dynamic dropdown looks at the observerId of this event and if it matches the observerId in the above image, it proceeds to look up its customvaluelistnameprovider to figure out which value list to look at and then it looks at the customvaluelistprovider (my customvaluelistnameprovider simply returns the name of my custom value list provider) 
  • The interesting part of the above can be seen in org.onehippo.forge.selection.frontend.plugin.DynamicDropdownPlugin , in the constructor after "context.registerTracker......" part
  • All the logic of actually looking up the node values from jcr is handled in the customvaluelistprovider.

Hope all of this helps!
Reply all
Reply to author
0 new messages