X

Geertjan's Blog

  • May 10, 2006

Error Annotation Support for Wicket (Part 1)

Geertjan Wielenga
Product Manager
More news from Petr's work on the editor functionality for Wicket. Now, if the corresponding HTML file does not have a matching Wicket ID, the following is shown in the NetBeans editor (this is a pre-prototype, but clearly it basically works, despite a few unresolved issues):

The error framework in NetBeans IDE has been expanded in NetBeans IDE 5.0. As a result, you are able to click on the icon and then the IDE will do something. In other words, it will suggest to fix the problem. Of course, how it fixes the problem depends on the Wicket component in question (as well as, probably, other factors too). So Petr asked me to find out what should happen next, i.e., what should the IDE do to fix the error?

My suggestion is that the IDE should, in the above scenario, add this to the corresponding HTML file, immediately below the opening BODY tag:

<!-- <span wicket:id="messge1">this text will be replaced</span> -->

However, what do other people out there think about this? Maybe something else should be inserted on the HTML side instead. Feedback welcome.

(By the way, Petr and I made it onto TheServerSide.com. However, sorry to be picky, but both our names are spelled wrong and I am not a NetBeans evangelist...)

Join the discussion

Comments ( 8 )
  • Timo Verhoeven Wednesday, May 10, 2006
    Adding a corresponding element in the HTML is a good idea. Two points to consider:
    1) Depending on the type of element added via Java code, an appropriate HTML tag should be chosen. <span ...> is not always allowed. E.g. a TextField assumes the matching HTML tag to be <input ...>, a DropDownChoice needs a <select ...>, etc.
    2) The position the HTML element is inserted at is quite relevant: the hierarchy of the wicket components added via Java must match the hierarchy in HTML. I.e. adding a TextField to a Form (in Java) requires the matching tag to be child of the tag for the form.
    My 0,02€,
    Timo
  • Alex Lam Thursday, May 11, 2006
    Quite like the wicket icon on the left - but I'd suggest making the "hole" in the middle a bit larger since otherwise it's rather hard to recognise its geometry, even if we can work out the topology.
  • Michel Graciano Thursday, May 11, 2006
    Hi,
    the module source code are available in some place or are planned to make available that?
    Regards
  • Petr Thursday, May 11, 2006
    Hi,
    the source code is not available yet, but I'm preparing project on dev.java.net, where you can be involved in development of this module.
  • Ulrich Thursday, May 11, 2006
    I agree with Timo about the added elements,
    but think a comment or something should also be added, to assist in jumping to these "fix-elements" in the page source.
  • Jonathan Locke Friday, May 12, 2006
    I love it.
    Actually, there could be two suggestions in this case. One would be to insert a tag appropriate to the missing id, ideally /at the correct place in the markup tree/ (or to create the container tags necessary too).
    The other possibility would be to change the id to match an id in the markup that is on a tag of the right type which is not yet connected to a component. This would make it easy to take an HTML mockup with ids and add the components.
    If you wanted to go crazy, the constructor itself could have a fix whenever all the ids don't match up like "Add Wicket components".
  • Jonathan Locke Friday, May 12, 2006
    BTW, I do realize that doing smart things to reconcile the tag tree with the component tree is not trivial. It would require a fairly sophisticated model of both trees and a fair amount of logic. But the result would be quite stunning, IMO... really RAD Wicket programming.
  • guest Wednesday, January 17, 2007
    aaa
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.