Re: Multi paging or Multi module
On 10 Lip, 23:03, Bhayat baki.hayat.c...@gmail.com wrote: I have been trying about gwt tecnology for 2 weeks,and i try to create a web site but,i have some problems.this is start with trying to add new page to my application.for example i have a page that is created with full gwt and when user enter username and password ,according to these information user page or admin page will open but i have no idea about opening new pages(i am planing to create these pages with gwt) from my main application. With GWT it's better not to think in terms of pages (html pages), but panels or screens, i.e. in terms used in desktop applications. Most of the time, your GWT application would be hosted in a single page but the content of this page will change like a window of a deskotop application. So for example when the user logs into a desktop application, you would not send him to another application when he is admin user and still another when he is noadmin user. You just show appropriate panels/menus/widgets in the same window. That's what you should do in GWT app. When you are back from the server where your user was successfuly authenticated and server returns the type of user all you have to do is show appropriate part of the application. Somewhere in the authentication callback: if(authentication successful) { RootPanel.get(...).clear(); if(user is admin) RootPanel.get(...).add(new AdminAppPanel()); else RootPanel.get(...).add(new UserAppPanel()); } But if you still want to load another page you can do it, with native $doc.location= new page. For example you can have three entry point modules in your application, each with it's own html page. In your Login.html/GWT app you can login the user and decide which new page to load. public native void loadModule(String url) /*-{ $doc.location = url; }-*/; Somewhere in the Login.html/GWT app: if(admin user) loadModule(Admin.html); // load admin GWT module else loadModule(User.html); // load user GWT module But here you must deal somehow with the communication between Login and User/Admin modules. -- waf --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Multi paging or Multi module
Possibly another approach would be to combine Ajax with one Module per page. The top module would be in charge of fetching and placing pages into the main placeholder. The top module takes input from the user (clicks on a menu or other links within each page itself) and uses the unique parameter from each event to know which page to load. The top module does an Ajax request to your server to fetch the correct page. So the added work here is that you have to create a controller on the server that matches a unique page ID to a particular GWT Module. The server controller sends the entire top level entry point html file associated with the specific GWT Module (page) as the response to the Ajax request. The top module places that html into the main placeholder and it gets evaluated, the script tag pointing to the MyPackage.Pagexx.nocache.js file gets evaluated to request for that js file and thus its onModuleLoad() method will be ran at the end of that. I think that would work but I haven't tried it myself. Like I said, GWT ought to have included a way to do this. On Jul 10, 4:03 pm, Bhayat baki.hayat.c...@gmail.com wrote: I have been trying about gwt tecnology for 2 weeks,and i try to create a web site but,i have some problems.this is start with trying to add new page to my application.for example i have a page that is created with full gwt and when user enter username and password ,according to these information user page or admin page will open but i have no idea about opening new pages(i am planing to create these pages with gwt) from my main application. i searched this topic but i cant understand because they are talking about multi paging or two separate modules or two entry points in only one project but i couldnt make comminication between these pages. so please give me idea.if you have any example code could you send me please to understand easily ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Multi paging or Multi module
Well I certainly am no expert on GWT, but I'm pretty good with it. Lets see if I can help. If I understand you correctly it sounds like you might be having some trouble going from the standard way of giving a user a new page via a new request to the server to a more Ajax approach. You could give the user new pages via new get/post requests to the server but then you would need a separate GWT project for each page. Actually I think it would work to have multiple html files as starting points for separate Modules and each Module would have its own EntryPoint class with its onModuleLoad() method. Your web pages would simply have links or w/e to each of the html files to load the different GWT Modules. Instead, taking a more Ajax approach to your app, I would build all the pages in one GWT project (and one Module), each page being its own class inheriting from some higher level container class that you want to work with (ie. Composite or FlowPanel). You could create your own IPage interface to make all your page classes implement so that they all have some sort of generate() method. This method is where you put all the page specific GWT code to build the page how you want it. The top level of your site might have a menu or other links from the site or even just the action of being properly authenticated will call a GWT method that exists higher up in your GWT app that directs the site to a new page. Your GWT code simply knows which page to go to based on the event and instantiates the appropriate page class, sets it as the widget inside a main placeholder and calls its generate() method. Something along those lines. I haven't done a site like this yet, but I was thinking about this same issue earlier today and I think that is how it's supposed to be done. The only real problem with it is that it bloats your GWT javascript and makes the first load of the site potentially large. Not very large, because the only code adding to its size is the unique code inside each generate() method. But I suppose that might be considered like downloading all the html files of a static site at once (well won't be that bad cuz obviously any site design is gonna be around the placeholder). So that extra size all in one download does indeed bother me. If the site doesn't have too many pages with lots of unique content then it might not be so bad, but for a large site this might be horrendous. I do kinda like the idea of loading it all at the start so that the app is super responsive, but this may not be realistic. This is indeed problematic. Its too bad GWT doesn't include some sort of self loader to load separate sections of its code upon need. You should be able to create separate modules that get auto loaded upon the first time they become needed. Does anyone have a much wiser way of doing this? On Jul 10, 4:03 pm, Bhayat baki.hayat.c...@gmail.com wrote: I have been trying about gwt tecnology for 2 weeks,and i try to create a web site but,i have some problems.this is start with trying to add new page to my application.for example i have a page that is created with full gwt and when user enter username and password ,according to these information user page or admin page will open but i have no idea about opening new pages(i am planing to create these pages with gwt) from my main application. i searched this topic but i cant understand because they are talking about multi paging or two separate modules or two entry points in only one project but i couldnt make comminication between these pages. so please give me idea.if you have any example code could you send me please to understand easily ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---