Hello,

  David J. Orme - the XSWT lead - writes:

A long-awaited (by me) XSWT feature landed in CVS today.  There are
several new convenience create() methods for XSWT that return an
interface rather than a Map.  This is easier to explain than to
describe.  For example, given the XSWT code:

        <label text="Host name:"/>
        <text x:id="HostName" x:style="BORDER"/>
        <label text="Port number:"/>
        <text x:id="HostPort" x:style="BORDER"/>

We can define an interface that describes this layout as follows:

     public interface ISelectServerPane {
         public Text getHostName();   // Define getters corresponding
to
the
         public Text getHostPort();     // x:id attributes we care
about
     }

Now (with CVS changes from today) XSWT lets me write the following Java
code:

        pane = (ISelectServerPane) XSWT.createl(holder,
                "selectServerPane.xswt", getClass(),
ISelectServerPane.class);

        pane.getHostPort().addVerifyListener(myVerifyListener);
        pane.getHostName().setText("localhost");

Look Ma, no ugly typecasts when I use the "pane" variable any more!
Everything is now typesafe!


Regards,

Dave Orme


------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ xul-announce mailing list xul-announce@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xul-announce

Reply via email to