We could argue the merits of method chaining (I'll let the compiler guys speak to whether or not this is better, worse, or indifferent for code generation) -- but the bigger problem is that we'd have to change the style of code throughout the system to make it useful, but any attempt to do so would break existing subclasses that override these methods.
On Tue, Mar 2, 2010 at 7:19 PM, Qcho <[email protected]> wrote: > Hi, I am currently working on a project using GWT. > > Maybe is a good suggestion to change the return value of functions > such as addStyleDependentName or addStyleName from void to the UI > modified itself, so you can do things like this: > > DockLayoutPanel appPanel = new DockLayoutPanel(Unit.EM); > appPanel.addNorth(new HTML("hh1").addStyleName("header"), > 4); > appPanel.addNorth(new HTML("hh2").addStyleName("subHeader"), > 10); > appPanel.addSouth(new HTML("foot").addStyleName("footer"), > 4); > appPanel.addWest(new HTML("nav").addStyleName("navigation"), > 10); > > this code wont compile since the chaining of addStyleName returns void > and not the Widget element. > > Simple example provided. > > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
