Re: Need Editor Framework help

2013-08-20 Thread Michael Prentice
Alfredo, thank you. That helps simplify things a lot. I have only used 
UiBinder a little bit and I haven't done anything with RequestFactory. So 
those examples combined with Editor Framework have really complicated 
things and make it hard to learn just the Editor Framework part. Your 
EditorViewImpl example is exactly what I was looking for.

Thomas, thank you for the detailed response!
I will likely need some level of validation on both the client and server. 
Hopefully there is time in the project to do this properly.

Yes, we are using GWT Designer but seeing that it is not being actively 
supported by Google and is still not open for contributions, I'm not sure 
how much longer that will be the case. It is quite helpful and powerful 
when it works and after it finally loads.

I understand that the Editor Framework doesn't deal with events, but it is 
great to see you explain that it will still fit within an MVP architecture. 
We are using an EventBus with EventBinder.

I hadn't seen that blog post, it does seem to have a little bit of detail 
that isn't on http://www.gwtproject.org/doc/latest/DevGuideUiEditors.html

I'll take another crack at it today and hopefully be able to figure out 
whether EF will work for us or not. Maybe we'll end up using it in certain 
places but not in others. We'll see...


On Tuesday, August 20, 2013 6:03:29 AM UTC-4, Thomas Broyer wrote:
>
>
>
> On Tuesday, August 20, 2013 12:44:22 AM UTC+2, Michael Prentice wrote:
>>
>> I spent most of Friday reading up on Editor Framework and it seemed quite 
>> powerful and useful. But today I'm looking at actually making use of it and 
>> I've had some fairly basic questions which I have not been able to find 
>> answers to in this group or anywhere on Google/gwtproject.org.
>>
>> 1) Does the use of Editor Framework require the use of UiBinder?
>>
>
> No.
>  
>
>> i.e. can I use it with a regular Java view? 
>>
>
> You don't even need "widgets" actually; see 
> https://gwt.googlesource.com/gwt/+/2.5.1/user/test/com/google/gwt/editor/client/
>  for 
> examples.
>  
>
>> 2) Does the use of Editor Framework require the use of RequestFactory?
>>
>
> No, that's why there are 2 distinct EditorDrivers: SimpleBeanEditorDriver 
> and RequestFactoryEditorDriver.
>  
>
>> This answer appears to be no, but I haven't been able to find any 
>> examples that don't use RequestFactory. Do such examples exist?
>>
>
> Again, see 
> https://gwt.googlesource.com/gwt/+/2.5.1/user/test/com/google/gwt/editor/client/
> See also https://gist.github.com/tbroyer/780560
>  
>
>> 3) What options exist in GWT for doing databinding? It looks like 
>> UiBinder itself takes care of doing data binding. So I guess that Editor 
>> Framework is not so much about data binding, instead it adds validation, 
>> Editor composition, and?
>>
>
> UiBinder is not *at all* about data binding. It only generates the Java 
> code that you would have written by hand to build and arrange your widgets 
> and listen to their events. The "binding" in UiBinder is only about 
> associating objects with your @UiField-annotated fields and bind events to 
> your @UiHandler-annotated methods.
>
> The Editor framework on the other hand is *all* about data binding. It 
> can propagate constraint violations to HasEditorErrors editors, and 
> HasEditorDelegate editors can generate errors, but the framework itself 
> does not deal with validation (you can use JSR303 bean validation in GWT, 
> or defer to your server; for example, in one of our apps, the server 
> validates objects asynchronously when they're saved, and the client fetches 
> the constraint violations for display – errors are not blocking, mostly 
> metadata).
>
> I still can't really figure out if the Editor Framework is right for my 
>> project or not. I use DTOs via GWT-RPC without any RequestFactory.
>>
>
> That's OK.
>  
>
>> My current views are Java (no UiBinder)
>>
>
> How painful it should be working on these things… (or are you using the 
> GWT Designer?)
>  
>
>> but I might switch to UiBinder. I've got the architecture for MVP laid 
>> out pretty well and I'm having a hard time figuring out how Editors fit 
>> into the mix.
>>
>
> The way I do it is to have the view create and initialize the 
> EditorDriver; the presenter gets it from the view and edits/flushes the 
> data.
>
> The views thus generally define a method such as 
> "SimpleBeanEditorDriver createDriver()". That way, only the view 
> needs to know about the Editor being used (which is generally a Widget).
>
> The DTOs whose data is exposed in my views does not map directly to what 
>> is displayed in the view one-to-one. Many views display data taken from 
>> multiple DTOs. Also actions/selections in one view must result in changes 
>> to other views on the page. This means that selecting an item in one view 
>> could cause (via Events) multiple presenters to disable/enable elements in 
>> their views.
>>
>
> The Editor framework is built around the Flow Sync

Re: Need Editor Framework help

2013-08-20 Thread Thomas Broyer


On Tuesday, August 20, 2013 12:44:22 AM UTC+2, Michael Prentice wrote:
>
> I spent most of Friday reading up on Editor Framework and it seemed quite 
> powerful and useful. But today I'm looking at actually making use of it and 
> I've had some fairly basic questions which I have not been able to find 
> answers to in this group or anywhere on Google/gwtproject.org.
>
> 1) Does the use of Editor Framework require the use of UiBinder?
>

No.
 

> i.e. can I use it with a regular Java view? 
>

You don't even need "widgets" actually; see 
https://gwt.googlesource.com/gwt/+/2.5.1/user/test/com/google/gwt/editor/client/
 for 
examples.
 

> 2) Does the use of Editor Framework require the use of RequestFactory?
>

No, that's why there are 2 distinct EditorDrivers: SimpleBeanEditorDriver 
and RequestFactoryEditorDriver.
 

> This answer appears to be no, but I haven't been able to find any examples 
> that don't use RequestFactory. Do such examples exist?
>

Again, see 
https://gwt.googlesource.com/gwt/+/2.5.1/user/test/com/google/gwt/editor/client/
See also https://gist.github.com/tbroyer/780560
 

> 3) What options exist in GWT for doing databinding? It looks like UiBinder 
> itself takes care of doing data binding. So I guess that Editor Framework 
> is not so much about data binding, instead it adds validation, Editor 
> composition, and?
>

UiBinder is not *at all* about data binding. It only generates the Java 
code that you would have written by hand to build and arrange your widgets 
and listen to their events. The "binding" in UiBinder is only about 
associating objects with your @UiField-annotated fields and bind events to 
your @UiHandler-annotated methods.

The Editor framework on the other hand is *all* about data binding. It can 
propagate constraint violations to HasEditorErrors editors, and 
HasEditorDelegate editors can generate errors, but the framework itself 
does not deal with validation (you can use JSR303 bean validation in GWT, 
or defer to your server; for example, in one of our apps, the server 
validates objects asynchronously when they're saved, and the client fetches 
the constraint violations for display – errors are not blocking, mostly 
metadata).

I still can't really figure out if the Editor Framework is right for my 
> project or not. I use DTOs via GWT-RPC without any RequestFactory.
>

That's OK.
 

> My current views are Java (no UiBinder)
>

How painful it should be working on these things… (or are you using the GWT 
Designer?)
 

> but I might switch to UiBinder. I've got the architecture for MVP laid out 
> pretty well and I'm having a hard time figuring out how Editors fit into 
> the mix.
>

The way I do it is to have the view create and initialize the EditorDriver; 
the presenter gets it from the view and edits/flushes the data.

The views thus generally define a method such as 
"SimpleBeanEditorDriver createDriver()". That way, only the view 
needs to know about the Editor being used (which is generally a Widget).

The DTOs whose data is exposed in my views does not map directly to what is 
> displayed in the view one-to-one. Many views display data taken from 
> multiple DTOs. Also actions/selections in one view must result in changes 
> to other views on the page. This means that selecting an item in one view 
> could cause (via Events) multiple presenters to disable/enable elements in 
> their views.
>

The Editor framework is built around the Flow Synchronization pattern: it 
doesn't deal with events at all (neither from the "model" to update the 
"view", nor from the "view" to update the "model").
So all these events will have to be dealt with outside the Editor framework 
(e.g. with UiBinder's @UiHandler, and possibly through an EventBus)
 

> Are there are good IO videos that cover Editor Framework in detail?
>

I can't remember of one. Maybe the "overhaul" video from when GWT 2.1 was 
presented? (simultaneously with the first milestone of GWT 2.1, where 
RequestFactory, the Editor framework, etc. were introduced)
But it wouldn't be "in detail".

I've read the details on gwtproject.org, code.google.com, and various blogs 
> plus the DynaTableRf example.
>

Did you read http://blog.ltgt.net/gwt-21-editors/ ? (shameless 
self-promotion)
 

> But while trying to implement this stuff today, it just feels wrong, like 
> it isn't going to fit/work/etc with what I'm doing. So I'm trying to figure 
> out if I should just not use Editor Framework at all.
>

The "many views display data taken from multiple DTOs" makes me think the 
Editor framework might not be a good fit for your project, but it's hard to 
tell.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/gr

Re: Need Editor Framework help

2013-08-19 Thread Alfredo Quiroga-Villamil
In my humble opinion, the editor framework is by far one of the cooolest
and most important features found in GWT. For some reason it doesn't seem
to be something that gets used a lot, at least I haven't seen a lot of
people using it.

Your questions:

1) It doesn't have to be used with UI Binder. It can work just fine with
plain java views.
2) No
3) The Editor framework is mostly if not all about data binding.

My very simplistic, in a nut shell Editor description.

- Suppose you have a View and it consists of a Label, checkbox, texarea,
etc...
- That View that you want the user to interact with is what is called an
Editor in the examples you'll find. For example in
http://www.gwtproject.org/doc/latest/DevGuideUiEditors.html :

public class PersonEditor extends Dialog implements Editor {

 - That View/Editor will have fields representing ... well what you want
your view to look like.

- You will back that Editor/View with a Java Bean. In this case Person. The
field names in your editor/view must match the Bean fields. Although I
think there was even an annotation as well that you could use if you wanted
to use a different field name. (Getting old so I forget stuff)

- So now you have a View/Editor that is being backed up or better expressed
it's bound with a Java Bean.

- At this point all you really need to remember for the most part are two
methods.

a) edit=> will populate your View/Editor fields based on the value/s
found in your Java Bean (Person in this case)
b) flush  => The other direction, will take the values from your
View/Editor html elements and populate your Bean instance.

There are more complicated cases. Editors of Editors, a few other things,
but overall and again very simplistically that is the idea.

See an example on how we employ the Editor framework for example in this
View we have in the touch4j demo:

http://touch4j.appspot.com/#EditorViewPlace:Editors

Click/Tap on source on the right hand corner.

I omitted some initialization steps in my very poor description such as an
interface definition, etc... but overall that is the idea.

For your case, you can publish events for example on your RPC response
containing the DTO you've received and the different presenters can have or
react to those events you published, build beans that back up your
Editor/View and update them in a very simple way. Think about what would
happen without the Editor framework. You would need to have in your
different presenters:

onReceivedEvent(Person person) {
   firstNameLabel.setValue(person.getFirstName);
   // If you have a lot of html elements in your view this is tedious work.
   // More so if you have to check for nulls etc...
}

With the Editor framework that becomes:

onReceivedEvent(Person person) {
   yourEditorDriver.edit(person);
   // Your UI elements are automatically updated
}

Then to obtain any user driven interactions with your UI HTML elements you
could have something like after the user hits Save:

onSaveEvent() {
   Person edited = yourEditorDriver.flush();
   firePersonPersistEvent(edited);
   // All the UI changes that were done by the user are automatically
updated in the Person Bean.
}

Hope that helps.



On Mon, Aug 19, 2013 at 6:44 PM, Michael Prentice wrote:

> I spent most of Friday reading up on Editor Framework and it seemed quite
> powerful and useful. But today I'm looking at actually making use of it and
> I've had some fairly basic questions which I have not been able to find
> answers to in this group or anywhere on Google/gwtproject.org.
>
> 1) Does the use of Editor Framework require the use of UiBinder? i.e. can
> I use it with a regular Java view?
> 2) Does the use of Editor Framework require the use of RequestFactory?
> This answer appears to be no, but I haven't been able to find any examples
> that don't use RequestFactory. Do such examples exist?
> 3) What options exist in GWT for doing databinding? It looks like UiBinder
> itself takes care of doing data binding. So I guess that Editor Framework
> is not so much about data binding, instead it adds validation, Editor
> composition, and?
>
> I still can't really figure out if the Editor Framework is right for my
> project or not. I use DTOs via GWT-RPC without any RequestFactory. My
> current views are Java (no UiBinder) but I might switch to UiBinder. I've
> got the architecture for MVP laid out pretty well and I'm having a hard
> time figuring out how Editors fit into the mix.
>
> The DTOs whose data is exposed in my views does not map directly to what
> is displayed in the view one-to-one. Many views display data taken from
> multiple DTOs. Also actions/selections in one view must result in changes
> to other views on the page. This means that selecting an item in one view
> could cause (via Events) multiple presenters to disable/enable elements in
> their views.
>
> Are there are good IO videos that cover Editor Framework in detail? So far
> my searches have not come up with any, but the names don't alwa

Need Editor Framework help

2013-08-19 Thread Michael Prentice
I spent most of Friday reading up on Editor Framework and it seemed quite 
powerful and useful. But today I'm looking at actually making use of it and 
I've had some fairly basic questions which I have not been able to find 
answers to in this group or anywhere on Google/gwtproject.org.

1) Does the use of Editor Framework require the use of UiBinder? i.e. can I 
use it with a regular Java view?
2) Does the use of Editor Framework require the use of RequestFactory? This 
answer appears to be no, but I haven't been able to find any examples that 
don't use RequestFactory. Do such examples exist?
3) What options exist in GWT for doing databinding? It looks like UiBinder 
itself takes care of doing data binding. So I guess that Editor Framework 
is not so much about data binding, instead it adds validation, Editor 
composition, and?

I still can't really figure out if the Editor Framework is right for my 
project or not. I use DTOs via GWT-RPC without any RequestFactory. My 
current views are Java (no UiBinder) but I might switch to UiBinder. I've 
got the architecture for MVP laid out pretty well and I'm having a hard 
time figuring out how Editors fit into the mix.

The DTOs whose data is exposed in my views does not map directly to what is 
displayed in the view one-to-one. Many views display data taken from 
multiple DTOs. Also actions/selections in one view must result in changes 
to other views on the page. This means that selecting an item in one view 
could cause (via Events) multiple presenters to disable/enable elements in 
their views.

Are there are good IO videos that cover Editor Framework in detail? So far 
my searches have not come up with any, but the names don't always specify 
the content.

I've read the details on gwtproject.org, code.google.com, and various blogs 
plus the DynaTableRf example. But while trying to implement this stuff 
today, it just feels wrong, like it isn't going to fit/work/etc with what 
I'm doing. So I'm trying to figure out if I should just not use Editor 
Framework at all.

Thank you,

Michael Prentice
GDG Space Coast

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.