I've implement GenericSelectBlock and have a corresponding edit block
defined.

I've implemented a method to get the model for the t:Select component in the
*.tml block:

    public AbstractSelectModel getModel()
    {
        List list =
this.persistenceService.findAll(InitiativeConstants.DOMAIN_CLASS);
        Collections.sort(list);

        this.values = new InjectedGenericSelectModel<Initiative>(list,
Initiative.class, "name", "id", this.propertyAccess,);
        return this.values;
    }


What I don't understand is how that succeeds and this one fails:


    public AbstractSelectModel getModel()
    {
        List list =
this.persistenceService.findAll(InitiativeConstants.DOMAIN_CLASS);
        Collections.sort(list);

        labeler = new InitiativeLabeler();
        this.values = new GenericSelectModel<Initiative>(list,
Initiative.class, "name", "id", this.propertyAccess);
        return this.values;
    }


The only thing I did was create the labeler. I don't use it for anything. If
I go one step farther - I get the same problem.

        labeler = new InitiativeLabeler();
        this.values = new InjectedGenericSelectModel<Initiative>(list,
Initiative.class, "name", "id", this.propertyAccess, labeler);
        return this.values;

or

        InitiativeLabeler labeler = new InitiativeLabeler();
        this.values = new InjectedGenericSelectModel<Initiative>(list,
Initiative.class, "name", "id", this.propertyAccess, labeler);
        return this.values;


No matter what I try, the error on the page reads:


Render queue error in BeforeRenderTemplate[initiative/BlockEdit:sid]:
Failure reading parameter 'model' of component initiative/BlockEdit:sid:
Component class
com.fuzzybearings.notebook.web.pages.initiative.InitiativeLabeler may not be
instantiated directly. You should use an @InjectPage or @InjectComponent
annotation instead.


Now, InitiativeLabeler is not a component nor does it implement or extend
anything other than an interface I made up to simply write a special type of
label into the select.options piece of GenericSelectModel. I would like to
inject different labelers into the GenericSelectModel when I create it.

Is there a trick here? The original GenericSelectModel works just fine - but
the Instantiating the Labeler seems to break something.

Thoughts?

-Luther

Reply via email to