Hello,
I want to separate codes in my SmartGWT project so I don't need to have huge chunk of code in the EntryPoint. Anyway in GWT I would just need to create a new class which extends the Composite class, and then I just need to create an instance so i can add it into the RootPanel. However that doesn't work with GWT. So i wonder how it should be done, or what's the best practice for separating codes in SmartGWT? An example code would be helpful.
After some googling I found an old thread here on this forum with the same question. So I made a try to see if it works. However it doesn't work and I get error. Below is the code which produce the error.
I want to separate codes in my SmartGWT project so I don't need to have huge chunk of code in the EntryPoint. Anyway in GWT I would just need to create a new class which extends the Composite class, and then I just need to create an instance so i can add it into the RootPanel. However that doesn't work with GWT. So i wonder how it should be done, or what's the best practice for separating codes in SmartGWT? An example code would be helpful.
After some googling I found an old thread here on this forum with the same question. So I made a try to see if it works. However it doesn't work and I get error. Below is the code which produce the error.
Code:
package com.project.client; import com.google.gwt.core.client.EntryPoint; import com.project.screen.LoginScreen; public class Project implements EntryPoint { public void onModuleLoad() { LoginScreen login = new LoginScreen(); login.draw(); } }
Code:
package com.project.screen; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.HeaderItem; import com.smartgwt.client.widgets.form.fields.PasswordItem; import com.smartgwt.client.widgets.layout.VLayout; public class LoginScreen extends VLayout { public LoginScreen() { DynamicForm form = new DynamicForm(); HeaderItem header = new HeaderItem(); header.setDefaultValue("Login"); PasswordItem passwordItem = new PasswordItem(); passwordItem.setName("password"); form.setFields(header, passwordItem); form.setValue("userName", "bsmith"); form.setValue("firstName", "Bob"); form.setValue("lastName", "Smith"); form.setValue("email", "bob@.com"); form.setValue("password", "sekrit"); addMember(form); } }
Comment