rickilama54 / smartgwt

Automatically exported from code.google.com/p/smartgwt
0 stars 0 forks source link

Implement the GWT interfaces HasText, HasValue, etc which makes it easier to use MVP #362

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In order to use MVP (gwt-presenter) Smart GWT should implement the
following interfaces:
- HasText
- HasHtml
- HasValue<T>
- HasValueChangeHandlers<T>

In this way it is possible to create a complete loosely coupled UI which
makes it easier to implement an application using the Model-View-Presenter
pattern and unittest the presenter layer.

As a workaround in my application I now have to extend or wrap existing UI
components such as a Label, Button and TextItem.

Original issue reported on code.google.com by avth...@gmail.com on 15 Nov 2009 at 8:45

GoogleCodeExporter commented 8 years ago
Can you point to any article on MVP that show how one can benefit by having 
Smart GWT implement these 
interfaces?

Original comment by sanjiv.j...@gmail.com on 28 Nov 2009 at 2:43

GoogleCodeExporter commented 8 years ago
Based on the implementation several GWT projects we have seen that is important 
to
have a good architecture/design for a GWT application. Otherwise it could 
easily lead
to spaghetti code which is very hard to maintain and extend. Especially when 
there
are a lot screens (> 50) and complex flow logic. 

SmartGWT provides sort of an own MVP/MVC pattern using a DataSource, but that 
's only
for data handling. We are using this pattern to separate the UI (V) from the 
model
(M) with a presenter (P). In this way the complete application is structured in 
the
same way. Besides that the code, for example the presenter, is also easier to 
unittest.

Hereby some links.

- GWT best practices:
http://code.google.com/intl/de-DE/events/io/sessions/GoogleWebToolkitBestPractic
es.html
- MVP framework: http://code.google.com/p/gwt-mvp/
- MVP article:
http://blog.hivedevelopment.co.uk/2009/08/google-web-toolkit-gwt-mvp-example.htm
l

I hope this helps you to understand the need for having the specified 
interfaces.
As a workaround I created some Adapter classes, for example:

import com.google.gwt.user.client.ui.HasText;

public class HasTextLabelAdapter implements HasText {

    private final Label label;

    public HasTextLabelAdapter(Label label) {
        this.label = label;
    }

    public String getText() {
        return label.getContents();
    }

    public void setText(String text) {
        label.setContents(text);
    }
}

Original comment by avth...@gmail.com on 8 Dec 2009 at 10:19

GoogleCodeExporter commented 8 years ago
Any news on this request? It has lied dormant for quite a bit...

Thank you

Original comment by davide.cavestro on 17 Aug 2010 at 10:02

GoogleCodeExporter commented 8 years ago
We created our own interfaces and adapters.
For new projects we switched back to vanilla GWT because we had to many 
problems with SmartGWT.

Original comment by avth...@gmail.com on 17 Aug 2010 at 1:28

GoogleCodeExporter commented 8 years ago
is there any other way than creating my own interfaces and adapters?
Have they integrated this in newer version of SmartGWT?.

Original comment by fantom24...@gmail.com on 15 Sep 2010 at 9:12

GoogleCodeExporter commented 8 years ago
SmartGWT 2.4 release claims compatibility with GWT 2.1.1, does it means that it 
has implemented following interfaces:
- HasText
- HasHtml
- HasValue<T>
- HasValueChangeHandlers<T>

and we can use MVP (Activities and Places) with SmartGWT?

Original comment by desaisam...@gmail.com on 24 Jan 2011 at 4:58