wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Jahnke <j...@wegtam.com>
Subject Re: Testing a panel in isolation (component id not found).
Date Mon, 17 Mar 2014 11:31:11 GMT
Hi,

On Mon, 17 Mar 2014 13:05:57 +0200
Martin Grigorov <mgrigorov@apache.org> wrote:

MG> This is the right way.
MG> Can you show us the code that causes this error ?
MG> #startComponentInPage() should not fail with such error ...

the exception is thrown at the line with tester.startComponentInPage, 
but here is the code of my custom panel:

public class MyCustomPanel extends Panel {
    protected String name = "";
    protected String icon = "";
    protected String genre = "";
    protected String description = "";

    public MyCustomPanel(String id, IModel<MyDataModel> model) {
        super(id, model);
        prepareDefaultVariables(model.getObject());
    }

    protected void prepareDefaultVariables(MyDataModel data) {
        name = data.getName();
        icon = data.getIconName();
        genre = data.getGenre();
        description = data.getDescription();
    }

    protected void renderDefaultVariables() {
        add(new Label("name", name));
        PackageResourceReference iconRef = new PackageResourceReference(getClass(), icon);
        add(new Image("icon", iconRef));
        add(new Label("genre", genre));
        add(new Label("description", description));
    }
}

BTW: I'm using wicket 6.12 and are currently unable to upgrade to 6.14. :-|

Regards,

Jens

-- 
17. Lenzing 2014, 12:19
Homepage : http://www.wegtam.com

	SAFETY
I can live without
Someone I love
But not without
Someone I need.

Mime
View raw message