Re: Eclipse, GWT, which class to use and how to call it via a hyperlink?

66 views
Skip to first unread message

Andy King

unread,
Jan 16, 2013, 10:54:23 PM1/16/13
to google-we...@googlegroups.com
Glyn, just my two cents ... please take it with a grain of salt if you don't like it! ... it appears that you have programming experience, and I am impressed that you have got as far as you have ... my recommendation is that you go through a Java book (e.g., Head First Java) and a GWT book (e.g., GWT In Action, 2nd Edition) before trying to proceed with a major project.  I don't think it will take you much time to get through the Java training, and when you start the GWT book you could just develop your application as you learn.

On Monday, January 14, 2013 3:34:32 PM UTC-7, Glyndwr Bartlett wrote:

I am new to both java and GWT and am using Eclipse (Juno with the GWT plugin) to develop an application for a volunteer organisation. I have created a class called AwardTracker (in org.AwardTracker.client) which is my entry point. This displays a standard login page. I followed a tutorial for this and it is working. The next part I want to implement is to build a page to create an account. For this I have a “Create an account” hyperlink on the login page. I have created a new Package (org.AwardTracker.client.CreateAccount) to hold this class.

To create the class I am selecting, at the top of the page, Create new visual classes / GWT / GWT Java UI / Composite is this the correct one?

Once I have created the page how do I call it with the following event handler?

             Hyperlink hprlnkCreateAnAccount = new Hyperlink("Create an account", false, "newHistoryToken");

             hprlnkCreateAnAccount.addAttachHandler(new Handler() {

                    public void onAttachOrDetach(AttachEvent event) {

                    }
Thanks,
Glyn

RyanZA

unread,
Jan 17, 2013, 9:36:06 AM1/17/13
to google-we...@googlegroups.com
You have mistaken the 'Hyperlink' class - and yes, it is a common/easy mistake to make because of the naming. Hyperlink is a special type of link that deals with the GWT history stack. You sound like you are just looking for a simple html link, which is called an Anchor (<a> tag). You use it like this:

Anchor a = new Anchor("hi");
a.addClickhandler(new ClickHandler() {
     @Override
     public void onClick(ClickEvent event) {
           Window.alert("hi");
     }

});

Glyndwr Bartlett

unread,
Jan 17, 2013, 3:44:27 PM1/17/13
to google-we...@googlegroups.com
I have been able to resolve this. The trick is to replace the root panel with each view you want to display. Create a navigation handler class to control this.
 
My next step is to try to get MySQL database calling working. Wish me luck :-)
 
Regards,
 
Glyn

Glyndwr Bartlett

unread,
Jan 17, 2013, 3:46:14 PM1/17/13
to google-we...@googlegroups.com
Thanks Andy,
 
I am always open to advise.
 
Best regards,
 
Glyn

Glyndwr Bartlett

unread,
Jan 17, 2013, 3:49:08 PM1/17/13
to google-we...@googlegroups.com
Hi RyanZA,
 
Yes you are correct. I found this out a while ago but was not able to amend this as it took so long for the moderators to realese it (no criticism of the moderators intended; they do a very good job and are very busy). I replaced it with a and added a click event to that.
 
Regards,
 
Glyn
Reply all
Reply to author
Forward
0 new messages