Open GoogleCodeExporter opened 9 years ago
Ideas for improvement:
1) Current way of setting DOM element IDs (using Element.setId method) results
in generated IDs being present in all environments and builds. In a typical
case, where IDs are required only by automated functional GUI test tools (like
Selenium), it makes little sense to include those IDs in production builds. We
could use UIObject.ensureDebugId, or introduce some deferred binding property
that enables/disables setting IDs.
2) Currently, element ID prefix is represented by the owner type name, and
cannot be customized by the user. We could add a type-level annotation (e.g.
@ElementIdPrefix) to customize this prefix. In the end, users could have IDs
such as "ItemListPanel_someLabel" instead of "MyView_someLabel".
Original comment by Vojtech....@gmail.com
on 19 Mar 2012 at 12:28
I just wanted to mention that I'm using this patch (unchanged) in one of my
Mvp4g projects, and I've found it quite useful. It's much easier to test with
automated tools like Selenium if there's a legible HTML id available for
important widgets.
I personally don't mind that the HTML ids are there all of the time, even in
production builds. In fact, I think I would prefer that.
It might be nice to customize the prefix, but I don't think it's a requirement.
From what I've seen so far, the generated id works pretty well as-is.
Original comment by prono...@gmail.com
on 24 Apr 2012 at 3:08
Ken, thanks for your feedback! We're also using this framework directly in our
project. We'll create a separate open source project out of this.
Cheers, Vojtech
Original comment by Vojtech....@gmail.com
on 24 Apr 2012 at 9:28
[deleted comment]
Hmmm, I'm having an issue getting this to work. Generated _ViewIdHandlerImpl
class only contains code to setElementId on owner, not the other uifields.
Original comment by lower...@gmail.com
on 20 Aug 2012 at 9:49
@loweryjk, most likely you're declaring wrong owner type in your
ElementIdHandler sub-interface.
For example:
public class MyViewImpl implements MyPresenter.MyViewInterface {
// Fields marked with @WithElementId go here
// Owner type is MyViewImpl, not MyViewInterface!
interface ViewIdHandler extends ElementIdHandler<MyViewImpl> {
ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
}
public MyViewImpl() {
ViewIdHandler.idHandler.generateAndSetIds(this);
}
}
As you can see, the owner type is MyViewImpl, since that's the one that
contains fields marked with @WithElementId.
This is very similar to UiBinder: the second type parameter ("type of the
object that owns generated UI") is the actual View class (MyViewImpl).
Original comment by Vojtech....@gmail.com
on 21 Aug 2012 at 8:58
Original issue reported on code.google.com by
Vojtech....@gmail.com
on 10 Jan 2012 at 4:15Attachments: