component hierarchy

13 views
Skip to first unread message

Minas Manthos

unread,
Dec 12, 2010, 8:04:31 PM12/12/10
to WicketForge
From some time a user requested to improve wicketforge -> to respect
components hierarchy in inspection and code completition. I've made a
tech demo that should work with common ways of wicket
implementations.

Example:
<a href="#" wicket:id="link"><span wicket:id="linktext"></span></a>

Link link = new Link("link") ...;
add(link);
add(new Label("linktext")); // this one will be reported as unknown
wicketId
link.add(new Label("linktext")); // this one is ok

This change is fundamental and maybe some references could not be
resolved anymore. I would like to have some more input/feedback from
others... if I should continue working on this or if its to
obstructive if wicketforge works like this... maybe I have missed a
common way of wicket implementation that does not work or cannot be
resolved...?

So if you like you can download this version from
http://code.google.com/p/wicketforge/downloads/detail?name=WicketForge-0.8.2.RESEARCH-SNAPSHOT.jar&can=4&q=
and install it manually into your idea plugin folder.

Please discuss in this thread and report:

-if you have (common) implementations that are not working correct
-if you run into an exception
-also welcome: if it works good for you

Please do not create issues for problems with this tech demo, just
report into this thread.

What will change in future:
-Components will not be shown in gutter anymore. I plan to include a
ToolWindow with components hierarchy in a tree and navigation (pretty
like toolwindow 'structure').
-Alt&Shift&F12 opens a window with components hierarchy. (This is
already included but far away from finished. I just used it for
debugging and have not invested much time in this, so you don't have
to report issues with this dialog... work in progress... ;-)

So, discussion opened... ;-)

Minas Manthos

unread,
Dec 12, 2010, 8:24:29 PM12/12/10
to WicketForge

Maarten Billemont

unread,
Dec 15, 2010, 4:01:51 AM12/15/10
to WicketForge
Works great on my markup, fails on my Java code. The hierarchy shows
fine in markup (but lots of validation errors seeing as wicketforge
fails to link the component IDs from the markup to Java component IDs)
but the hierarchy is broken (nearly non-existant) in my Java code.

Here's my code I tested it on:
http://stuff.lhunath.com/SchedulePage.html
http://stuff.lhunath.com/SchedulePage.java

Here's what it looks like in IDEA:
http://stuff.lhunath.com/shots/shot.1292403600.png
http://stuff.lhunath.com/shots/shot.1292403678.png

Minas Manthos

unread,
Dec 15, 2010, 12:47:57 PM12/15/10
to WicketForge
Ok Maarten, Thanks... This are exactly some use cases that are not yet
resolved correct. Will work on this and write again when jar updated.

On 15 Dez., 10:01, Maarten Billemont <lhun...@gmail.com> wrote:
> Works great on my markup, fails on my Java code.  The hierarchy shows
> fine in markup (but lots of validation errors seeing as wicketforge
> fails to link the component IDs from the markup to Java component IDs)
> but the hierarchy is broken (nearly non-existant) in my Java code.
>
> Here's my code I tested it on:http://stuff.lhunath.com/SchedulePage.htmlhttp://stuff.lhunath.com/SchedulePage.java

Minas Manthos

unread,
Dec 15, 2010, 4:58:51 PM12/15/10
to WicketForge
Ok, i've uploaded WicketForge 0.8.2.RESEARCH.2-SNAPSHOT

-add in ListView should now build correct hierarchy
-assignements in add now recognized (ex: add(link = new Link(...));)
-chained calls recognized (ex: add(new
Label(...).setOutpurMarkupId(true));)

Hierarchy in your files obove should be correct now. Would be nice to
get some feedback.

If you have more unresolved code please report.

Thanks
Minas.

On 15 Dez., 10:01, Maarten Billemont <lhun...@gmail.com> wrote:
> Works great on my markup, fails on my Java code.  The hierarchy shows
> fine in markup (but lots of validation errors seeing as wicketforge
> fails to link the component IDs from the markup to Java component IDs)
> but the hierarchy is broken (nearly non-existant) in my Java code.
>
> Here's my code I tested it on:http://stuff.lhunath.com/SchedulePage.htmlhttp://stuff.lhunath.com/SchedulePage.java

Maarten Billemont

unread,
Dec 23, 2010, 4:45:01 AM12/23/10
to wicke...@googlegroups.com
> Ok, i've uploaded WicketForge 0.8.2.RESEARCH.2-SNAPSHOT
>
> -add in ListView should now build correct hierarchy
> -assignements in add now recognized (ex: add(link = new Link(...));)
> -chained calls recognized (ex: add(new
> Label(...).setOutpurMarkupId(true));)
>
> Hierarchy in your files obove should be correct now. Would be nice to
> get some feedback.
>
> If you have more unresolved code please report.

Nice!

Looking good now; no more issues on that page. I'll report back if I encounter any more issues.

Maarten Billemont

unread,
Dec 29, 2010, 4:23:14 AM12/29/10
to wicke...@googlegroups.com

What class is used as the base of the hierarchy?

I'm mostly asking because it fails in cases where I have static inner classes. In those cases, the hierarchy should base itself on that inner class.

Minas Manthos

unread,
Dec 29, 2010, 4:30:40 AM12/29/10
to WicketForge
From caret position -> looking for inherited class from 'Page' or
'WebMarkupContainerWithAssociatedMarkup'

can you add a sample please?

Maarten Billemont

unread,
Dec 29, 2010, 4:48:48 AM12/29/10
to wicke...@googlegroups.com

Minas Manthos

unread,
Dec 29, 2010, 5:15:08 AM12/29/10
to WicketForge
Thanks, will look into this one this evening.

On 29 Dez., 10:48, Maarten Billemont <lhun...@gmail.com> wrote:
> http://stuff.lhunath.com/shots/shot.1293615934.png
>
> Screenshot ofhttps://github.com/Lamentum/JLibs/blob/1.3-maint/wayward/src/main/jav...

Maarten Billemont

unread,
Jan 3, 2011, 8:58:55 AM1/3/11
to wicke...@googlegroups.com
I just noticed some issues with a moderately more complex case.

I've a page with a form in it. The markup is just a normal page with a form in it and components in the form. The java code is a normal page with a form added to it, but the form is an inner class of that page. The components inside the inner-class form are generating warnings in the markup.

So basically, WicketForge doesn't know where to find the components that are in the form from the java code. I realize this is a bit of an annoying case because I'm basically asking WicketForge to know that the form inner-class provides components for the form-elements in the markup bound under the component that the code binds an instance of my form-inner class to.

PastedGraphic-2.png
PastedGraphic-3.png

Minas Manthos

unread,
Jan 3, 2011, 3:39:43 PM1/3/11
to WicketForge
Ok, please try with new WicketForge-0.8.2.RESEARCH.3-SNAPSHOT
>  PastedGraphic-2.png
> 163KViewDownload
>
>  PastedGraphic-3.png
> 178KViewDownload

Minas Manthos

unread,
Jan 3, 2011, 4:07:26 PM1/3/11
to WicketForge
Ok, this one is more complex to solve... -> add of new Component with
assignment and chained adds...

I had to spend some hours to support this... IMO this kind is not in
the 95% of common wicket usage and implementation can easily be
changed to make it detectable by plugin. Of course, I don't want to
say developers to change their code (or having restrictions because
using WicketForge) but I had to spend some hours to support this and
(at the moment) my limited free time is better invested in other
issues/todos... I will keep this in mind and solve it when other
important things are done...


On Dec 29 2010, 10:48 am, Maarten Billemont <lhun...@gmail.com> wrote:
> http://stuff.lhunath.com/shots/shot.1293615934.png
>
> Screenshot ofhttps://github.com/Lamentum/JLibs/blob/1.3-maint/wayward/src/main/jav...

Maarten Billemont

unread,
Jan 4, 2011, 7:58:15 AM1/4/11
to wicke...@googlegroups.com

On 03 Jan 2011, at 22:07, Minas Manthos wrote:

> Ok, this one is more complex to solve... -> add of new Component with
> assignment and chained adds...

I'm not sure what you're referring to here.


On 03 Jan 2011, at 21:39, Minas Manthos wrote:

> Ok, please try with new WicketForge-0.8.2.RESEARCH.3-SNAPSHOT

This snapshot seems to correctly deal with both cases I highlighted. Nice job!

Minas Manthos

unread,
Jan 4, 2011, 8:20:21 AM1/4/11
to WicketForge
Fine, thanks for feedback.

It looks like hierarchy could be solved for most implementations, so I
will starting to work on toolwindow and hierarchy dialog.

Minas Manthos

unread,
Feb 27, 2011, 7:06:39 AM2/27/11
to WicketForge
FYI:

I've started to merge research-branch into trunk... will be released
in a few days...

regards minas

Maarten Billemont

unread,
Mar 8, 2011, 4:54:14 AM3/8/11
to wicke...@googlegroups.com
On 27 Feb 2011, at 13:06, Minas Manthos wrote:
>
> FYI:
>
> I've started to merge research-branch into trunk... will be released
> in a few days...

I've heard reports that it doesn't work too well with fragments. Haven't tested myself.

Minas Manthos

unread,
Mar 8, 2011, 12:23:54 PM3/8/11
to WicketForge
Reply all
Reply to author
Forward
0 new messages