Tuesday, May 19, 2020

Re: how to run gwt newer version in netbeans

Using Maven does not mean that you have to put your software product as Open Source. So you can still do everything in house.

For sure you need to teach the devs to build the software with Maven but NetBeans has a very good Maven support: 

Using Maven in NetBeans is actually quite straight forward... and using Maven does not mean that you don't use NetBeans anymore:
- Maven is a tool to do the build and libs dependencies for your app
- NetBeans is an IDE and it can use Maven natively within NetBeans just like Eclipse / IntelliJ / VisualStudio Code

Now to your example:

You have "client", "server" and "shared" (I always use the term API for "shared") which is correct, see my example: https://github.com/interseroh/demo-gwt-springboot
It looks the same as your structure.

BUT

I assume that you have those packages just in ONE NetBeans project, just like my example above (https://github.com/interseroh/demo-gwt-springboot/tree/master/src/main/java/com/lofidewanto/demo).

... and this is the problem: since you mixed the client and server classpath together in one NetBeans project. If you have a newer version of Jetty for your server module, your GWT transpiler would maybe stop to work. Therefore you need to separate them into THREE NetBeans projects:

(1) "client" project
(2) "shared" project
(3) "server" project

... so they have their own classpath.

The problem is now: you need Maven to handle the dependencies:

(1) client depends on shared
(2) server depends on shared
(3) No dependencies between client and server

Surely you could build 3 projects in NetBeans and put the Jar manually into the libs directory or put it as dependency within NetBeans but that's more manual work than just using Maven.

Hope this helps.
Lofi

Am Samstag, 16. Mai 2020 08:42:24 UTC+2 schrieb Vineet Jaiswal:
thank you Dr. Lofi for your quick response. the presentation is very helpful.

but there are few hurdles in using maven:

1. the team has expertise in netbeans. they don't now how to use maven. to use it first we have to arrange the training sessions.
2. company do not allow to move the code out of the company premises. they want the whole code to be kept only on there company server.
   
again I request, is there any way that we could continue netbeans. 


secondly! as you said never mix client- and server-side.
can you share any small example where we could see how we can keep client and server-side separately in gwt. 
because we are using the base architecture of gwt: 

example: 

-demo.home.client 
  -Home.java

-demo.home.server
  -Home_ServerImpl.java

-demo.home.shared
  -Home_Model.java
  -Home_RemoteService.java
  -Home_AsyncService.java


demo.home.shared.Home_RemoteService.java (class)
public interface Home_RemoteService extends RemoteService {

    public List<Home_Model> getHome(String id, boolean flag);
}

demo.home.shared.Home_AsyncService.java (class)
public interface Home_AsyncService {

    public void getHome(String id, boolean flag, AsyncCallback<List<Home_Model>> result);
}

demo.home.shared.Home_Model.java (class)
public class Home_Model implements Serializable, IsSerializable {

    private String name, address, ............;
    
    public getter & setters ............;

}

demo.home.server.Home_ServerImpl.java (class)
public class Home_ServerImpl extends RemoteServiceServlet implements Home_RemoteService {

    @Override
    public List<Home_Model>> getHome(String id, boolean flag) {
           ........................;
           ........................;
           ........................;
           ........................;
           return listHome_Model;

}

demo.home.client.Home.java (class)
public class Home implements IsWidget, ClickHandler {

    private final ServiceInvoker<Home_AsyncService> srvAsync;

    public Home() {
        srvAsync = new ServiceInvoker<Home_AsyncService>(GWT.create(Home_RemoteService.class), "Home");
    }

    public button_click() {

        srvAsync.getHome(id, flag, new AsyncCallback<List<Home_Model>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        ......................;
                        ......................;
                    }

                    @Override
                    public void onSuccess(List<Home_Model> result) {
                        ......................;
                        ......................;
                        ......................;
                        ......................;
                    }
         });
    }
}
 


* we have many Home_Model.java like classes which hold many common functions that we use both server & client side.

please suggest the architecture to separate the client & server side code in GWT. 



On Saturday, May 16, 2020 at 3:53:03 AM UTC+5:30, Dr. Lofi Dewanto wrote:
I would prefer just using:

(1) Maven for everything, never depends on IDE plugins, you can use GWT Maven plugin to run the transpiler and serve the HTML + JS files, no need to use plugin. 
(2) For debugging I'm using Chrome and it has a very good source map debugger.
(3) Best practice, never mix client- and server-side. Make a stand-alone Maven project for your client-based webapp / webbrowser.

Take a look at this presentation for the anatomy of GWT webapps: https://bit.ly/gwtintropresentation

Hope this helps,
Lofi

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/b2b419ba-07b4-45f5-abe6-41c29a102ed2%40googlegroups.com.

No comments:

Post a Comment