How to start from scratch with MVP4G and GXT

108 views
Skip to first unread message

Toine

unread,
Sep 30, 2009, 4:55:07 PM9/30/09
to Mvp4g
Hello

What i see and read this is a very nice framework.

I'm new with GWT and MVP and GXT. The client for who i'm building an
application wants to have GXT in the applications.
The application is a middle sized project, which needs to run on a
Websphere Application Server ( v 7 )

As i am new with GXT and MVP, i start googling and found a lot of
info.
Looking at the google I/O 2009 and GUICE videos. I thought this is the
way to do the project.
only there was no GXT involved, gooling around again, I found MVP4G.

the framework is fully MVP, but my problem is. How to get started,

I looked at your examples, but do you have some kind of tutorial to
get started.

I created a ApplicationRootView and interface and Presenter,

I created a NorthView etc....

but i get the error >> >
[ERROR] Line 23: The method setProxyService(ProxyServiceAsync) is
undefined for the type NorthPresenter
[ERROR] Line 30: The method onStart() is undefined for the type
NorthPresenter

the Presenter >>>
public class NorthPresenter extends Presenter<NorthViewInterface> {

@SuppressWarnings("unused")
private ProxyServiceAsync proxyService = null;


public void setService(ProxyServiceAsync service){
this.proxyService = service;
}
}

So what am i missing.


Another question is in the ApplicationRootView you have TablePanel or
FormPanel

is there no need for the Viewport or can I just start with a
BorderLayout here and then fill it up with the Views..

Please Help
Thx in advance




plcoirier

unread,
Sep 30, 2009, 11:07:43 PM9/30/09
to Mvp4g
> I looked at your examples, but do you have some kind of tutorial to
> get started.
I unfortunately don't have tutorial. I try to give as much information
as possible in the examples and the wiki pages. If you think
information is missing, let me know and I will try to provide it.

> I created a ApplicationRootView and interface and Presenter,
>
> I created a NorthView etc....
>
> but i get the error >> >
> [ERROR] Line 23: The method setProxyService(ProxyServiceAsync) is
> undefined for the type NorthPresenter
I think your error here is that in your configuration file the name of
your service is "proxyService" and not "service".

When you inject a service with name "XXX" and class "YYY", you need to
define a setter for your service in your presenter class
like this: setXXX(YYY proxyService)

So either change the name of your service to "service" or change the
name of your method to "setProxyService".


> [ERROR] Line 30: The method onStart() is undefined for the type
> NorthPresenter
I believe you have this sort of line in the configuration file:
<event type="start" calledMethod="onStart" handlers="northPresenter" /
>

Each presenter that handles an event must define the calledMethod of
the event. In the previous line, northPresenter must define the
function onStart()

> Another question is in the ApplicationRootView you have TablePanel or
> FormPanel
>
> is there no need for the Viewport or can I just start with a
> BorderLayout here and then fill it up with the Views..
You can use any GXT layout you want. As a best practice I build my
view in order the presenter not to know what kind of
layout is used by the view.
Let say I have an application divided in a north part and a center
part. Those 2 parts can change while the application runs.
I will then define the following view interface for my presenter.

public ViewInterface{
void setNorthParth(Widget northWidget);
void setCentralParth(Widget centralWidget);
}

Like that, you can build your view the way you want, it won't impact
your presenter as long as your view implements this interface.

Toine

unread,
Oct 1, 2009, 5:00:12 AM10/1/09
to Mvp4g
Thx for the Info


i figured out the onStart() and for no I removed the service entry
behind the presenter
so it starts ( also added a bind to it)

What i want to do is create a

Layout with North , Center and South ( BorderLayoutData )

within the Center there will be a InnerWest, InnerEast and a Center
with collapsable sides

The Top ( LayoutRegion.North ) has Login , About and that sort of
stuff
The Bottom ( LayoutRegion.South) has some HTMLContainer

And the Middle will have All of the Side, Inner West has Menu ( which
will be expended when clicked ) , Inner.East , will be expend when
clicked on Grid
And Center will have TABPanel with again a TabPanel with each TAB

So all the different TABS have there own Views, am i right?

For instance the Tab Provider ( which is located in the InnerCenter )
has a TabPanel with 3 tabs A,B and C
in A there is a FilterPanel with Search, distance etc,, underneath is
a Summary with all the Categorys and count how many adds are there,
and underneath the Summary is a GRID with PageCounter etc...

if you click on the grid line InnerEast will show. If you click via
Filterpanel on Search, a Google map will be shown instead of the
Summary and Grid, The Google map has pinpoints
if you click on a pinpoint InnerEast will show with relevand
information of the Provider just like via the Grid.

This is One Tab

Some tabs are the same look and feel so the data only needs to be
changed the layout will be the same. If i understand it right every
unique PANEL needs to have its own view with a Presenter and
Interface.


But where do define the the Layouts in

what does the ApplicationRootView extends ViewPort, or doesn't it
matter

and like your examples do i define then the

BorderLayoutData borderLayoutDataNorth = new BorderLayoutData
(LayoutRegion.NORTH,50);
borderLayoutDataNorth.setMargins(new Margins(5));
borderLayoutDataNorth.setFloatable(true);
borderLayoutDataNorth.setHideCollapseTool(true);
borderLayoutDataNorth.setSplit(true);

and so on this View

or am i thinking the wrong way....
As i said i,m new with GXT and GWT so a lot of different Containers,
Panels etc are there to know.

Thx for your Help,

regards toine

Toine

unread,
Oct 1, 2009, 9:22:41 AM10/1/09
to Mvp4g
thx for the reply


I think i figured it out ...


Now be can really build something

Keep up the good Work


One question i have, when will the framework be a FINAL RELEASE and
not Beta...

this is for the client, you know how clients think about BETA ...

thx

plcoirier

unread,
Oct 1, 2009, 9:38:36 AM10/1/09
to Mvp4g
I'm gonna try to have a final release by mid-october. I want to
integrate the place service (to manage history) and bring improvements
described in the issues tab.
However the 0.13-beta version is stable and I will make sure that 1.0
release will be compatible with 0.13-beta version.
> > > your presenter as long as your view implements this interface.- Hide quoted text -
>
> - Show quoted text -

Toine

unread,
Oct 1, 2009, 4:34:28 PM10/1/09
to Mvp4g
Perfect

That is nice to know,
keep up the good work!

Toine

unread,
Oct 1, 2009, 5:00:21 PM10/1/09
to Mvp4g
Is it Possible to have in the mvp4g-conf.xml

<presenters package="nl.betterwell.bwgxt01.client.presenter" >
<presenter name="applicationRootPresenter"
class="ApplicationRootPresenter" view="applicationRootView" />
<presenter name="northPresenter" class="NorthPresenter"
view="northView" />
</presenters>

<presenters package="nl.betterwell.bwgxt01.client.presenter.display" >
<presenter name="displayPresenter"
class="DisplayPresenter" view="displayView" />

</presenters>

or do i put the displayPresenter in the
"nl.betterwell.bwgxt01.client.presenter"?

likewise for the views?

Thx in advance

Regards Toine

On 1 okt, 15:38, plcoirier <plcoir...@gmail.com> wrote:

plcoirier

unread,
Oct 1, 2009, 8:28:14 PM10/1/09
to Mvp4g
You can have two <presenters> tags (or <views> tag). But I wonder if
it won't make your configuration file messy, you may want to keep up
all your presenters inside the same <presenters> tag.

I was actually thinking of modifying the parsing of the configuration
file to allow sub-package. Right now the package attribute is added
only if the class attribute defines a simple class name (ie with no
package name). I could add the option to add the package attribute to
the class attribute even if it contains package name in case the class
attribute starts with a "."
You could have the following configuration file:
<presenters package="nl.betterwell.bwgxt01.client.presenter" >
<presenter name="applicationRootPresenter"
class="ApplicationRootPresenter" view="applicationRootView" />
<presenter name="northPresenter"
class="NorthPresenter" view="northView" />
<presenter name="displayPresenter"
class=".display.DisplayPresenter" view="displayView" />
</presenters>

What do you think?
> > > - Show quoted text -- Hide quoted text -

Toine

unread,
Oct 1, 2009, 8:39:37 PM10/1/09
to Mvp4g
I think that this will be handy.

The same should be with
<views package="">
<history package="">
<services package="">

Then it will be possible to create a nice structure in the code

Or

<presenters package="nl.betterwell.bwgxt01.client.presenter" >
<presenter name="applicationRootPresenter"
class="ApplicationRootPresenter" view="applicationRootView" />
<presenter name="northPresenter" class="NorthPresenter"
view="northView" />
<presenter name="myDisplayPresenter" subpackage="display.mydisplay"
class=".MyDisplayPresenter" view="myDisplayView" />
<presenter name="displayPresenter" subpackage="display"
class=".DisplayPresenter" view="displayView" />
</presenters>

i think the last is better because you can keep the structure the same
main package with subpackage attribute in the presenter tag

regards toine

Toine

unread,
Oct 2, 2009, 7:17:37 AM10/2/09
to Mvp4g
Another thing


Is it possible to use Dynamic caching on a certain way.
or can i just use Dynamic Caching from WebSphere

P.S what is you FirstName?

Regards Toine

Toine

unread,
Oct 2, 2009, 9:40:55 AM10/2/09
to Mvp4g
Another thing

Do i need to make a call to a EJB3 SessionBean on a different way. Or
can i use SessionContext

regards toine

plcoirier

unread,
Oct 2, 2009, 10:54:45 AM10/2/09
to Mvp4g
About the presenters tag, I like the first solution the best because
I'd like to keep the xml file as simple as possible so I'd like to
minimize the number of attributes.

I'm not familiar with EJB or Websphere so I don't know if I will be
really helpful.

If you want to access any information stored in your server session, I
would use RPC method.

About Websphere dynamic caching, I guess that since it's a server
feature, you can use it since GWT is used to develop the client side
(do you need to set some particular servlet on the server to use it?)

Could you let me know if you succeed to do what you want with EJB and
websphere or encounter any problem?

Thanks,
Pierre ;)
> ...
>
> read more »- Hide quoted text -

Toine

unread,
Oct 3, 2009, 6:11:26 PM10/3/09
to Mvp4g
I will let you know, How to solve it

Thx for the solution
> ...
>
> meer lezen »

Toine

unread,
Oct 4, 2009, 8:58:27 PM10/4/09
to Mvp4g
Hello

I'm getting
[ERROR] Line 89: The method setProxyService(ProxyServiceAsync) is
undefined for the type InnerCenterPresenter

in the Presenter is
private ProxyServiceAsync proxyService = null;


public void setProxyService(ProxyServiceAsync proxyService){
this.proxyService = proxyService;
}

in the xml

<services package="nl.betterwell.bwgxt01.client.services" >
<service name="proxyService" class="ProxyService" />
</services>

<presenters package="nl.betterwell.bwgxt01.client.presenter" >
<presenter name="applicationRootPresenter"
class="ApplicationRootPresenter" view="applicationRootView" />
<presenter name="northPresenter" class="NorthPresenter"
view="northView" />
<presenter name="centerPresenter" class="CenterPresenter"
view="centerView" />
<presenter name="southPresenter" class="SouthPresenter"
view="southView" />
<presenter name="innerWestPresenter" class="InnerWestPresenter"
view="innerWestView" />
<presenter name="innerCenterPresenter" class="InnerCenterPresenter"
view="innerCenterView" services="proxyService" />
<presenter name="innerEastPresenter" class="InnerEastPresenter"
view="innerEastView" />
</presenters>

<presenters
package="nl.betterwell.bwgxt01.client.presenter.authorization" >
<presenter name="loginPresenter" class="LoginPresenter"
view="loginView" />
</presenters>

What is wrong ??

regards toine
> ...
>
> meer lezen »

plcoirier

unread,
Oct 4, 2009, 9:20:34 PM10/4/09
to Mvp4g
I don't really know, could it be possible that you have 2
ProxyServiceAsync classes and it's the wrong that is used inside the
InnerCenterPresenter?

You must have in your log a line like this:
C:\...\com.mvp4g.client.Mvp4gStarterImpl2884620413052573523.java

It's the Java class that Mvp4g generates. Could you send me this
class?

Could also send me the complete class of InnerCenterPresenter?

Maybe with these two classes, I can help you more.

Toine

unread,
Oct 5, 2009, 6:57:47 AM10/5/09
to Mvp4g
Pierre

Is it maybe possible, instead of using a XML file for configuration,
use Java instead

for instance

Mvp4gStarter starter = GWT.create(Mvp4gStarter.class);
MyStartup startUp = GWT.create(MyStartup.class);
MyEvents events = GWT.create(MyEvents.class)
MyPresenter presenter = GWT.create(MyPresenter.class)
MyViews views = GWT.create(MyViews.class)
MyServices services = GWT.create(MyServices.class)
MyHistory history = GWT.create(MyHistory .class)

starter.init(startUp,events,presenter,views,services,history);
starter.start();

in the classes MyEvents for instance
class Myevents extends Mvp4GEvents

public static final Mvp4GEvents doStart = new Mvp4GEvents
("packageName","className","doStart","eventTypeClass","serviceName");

then you can create everything in Java and work faster ( as in
text ) , No type mismatches ect..

maybe a Idea
> ...
>
> meer lezen »

plcoirier

unread,
Oct 5, 2009, 8:55:49 AM10/5/09
to Mvp4g
The thing is you need to indicate somewhere how events should be
handled and how objects should be injected. I understand the problems
of the xml file. I'm thinking of a future version to use annotations
in order to simplify the xml file.
For example, instead of having:
<presenter name="myPresenter" class="MyPresenter" view="myView" />

you could have
@Presenter(name="myPresenter", view="myView")
public class MyPresenter extends Presenter<View>{

}

You could have the same annotation for views, services and history
converters.

I'm not sure how you could use annotation for events but I will think
about it.

Toine Eetgerink

unread,
Oct 5, 2009, 9:28:29 AM10/5/09
to mv...@googlegroups.com
OK

thats ok, because if you have a big application the xml file will grow very large.

you can simplify it using a <!-- --> comment between the tags 
and then in the design editor ( eclipse ) you will have some seperators 

but if you can use it  in the java code. its super

regards toine

2009/10/5 plcoirier <plco...@gmail.com>

Toine

unread,
Oct 5, 2009, 9:46:56 AM10/5/09
to Mvp4g
The Problem is solved.

It was a wrong missing entry in the web.xml

So nothing wrong with the framework.
> ...
>
> meer lezen »

Arminos

unread,
Nov 7, 2009, 5:01:38 PM11/7/09
to Mvp4g
I prepeared Rayan's google i/o presentation in writing:
http://extgwt-mvp4g-gae.blogspot.com/2009/10/gwt-app-architecture-best-practices.html

That is a basis of mvp4g
Message has been deleted

AlexanderLapygin

unread,
Nov 8, 2009, 11:54:27 AM11/8/09
to Mvp4g
My congratulations, Araik, good job !

On 8 ноя, 01:01, Arminos <ad...@agost.ru> wrote:
> I prepeared Rayan's google i/o presentation in writing:http://extgwt-mvp4g-gae.blogspot.com/2009/10/gwt-app-architecture-bes...

Араик Миносян

unread,
Nov 8, 2009, 3:20:18 PM11/8/09
to mv...@googlegroups.com
You are welcome Alexander )))

8 ноября 2009 г. 19:54 пользователь AlexanderLapygin <alexande...@gmail.com> написал:

Pierre

unread,
Nov 9, 2009, 9:38:05 AM11/9/09
to Mvp4g
Thanks for the link. I added to the home page.

On Nov 8, 9:20 pm, Араик Миносян <ad...@agost.ru> wrote:
> You are welcome Alexander )))
>
> 8 ноября 2009 г. 19:54 пользователь AlexanderLapygin <
> alexanderlapy...@gmail.com> написал:
> > > > Thx in advance- Hide quoted text -

Араик Миносян

unread,
Nov 9, 2009, 10:18:15 AM11/9/09
to mv...@googlegroups.com
It is pleasure.


9 ноября 2009 г. 17:38 пользователь Pierre <plco...@gmail.com> написал:
Reply all
Reply to author
Forward
0 new messages