Re: how to create PushButton using UiBinder

2014-08-20 Thread Nguyen Thi Le

you can use this code
ui:image field=viewimage src=task/images/image.png /

g:PushButton 
g:upFace image={viewimage} /
/g:PushButton

On Wednesday, October 6, 2010 7:54:29 AM UTC+7, mars wrote:

 hi, 

 I tried to create a PushButton(with an image) in UiBinder but could 
 not get it work, here is my code 

 g:PushButton ui:field=myPushButton image=myImage.gif/ 

 anyone know how? thanks. 


-- 
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/d/optout.


Re: Getting the default DateBox() picker to advance year at a time

2014-08-20 Thread Sumit Mane
Thanks buddy, going to use this into my app. 
Just little contribution:
String formattedMonth = getModel().formatCurrentMonth();
change to:
String formattedMonth = getModel().formatCurrentMonthAndYear();

-- 
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/d/optout.


Re: Generation of permutations

2014-08-20 Thread Developer
bump

-- 
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/d/optout.


Re: Cross field validation on client

2014-08-20 Thread Zied Hamdi OneView
Hi,

I was looking at the 
link 
http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html#validation 
, and it's not clear when the validation is executed. it seams it is 
executed each time data is sent to the server!!???. If it's the case, this 
could be a performance problem since we might have some complex validation 
processes that we want to execute only when we call some service methods 
(in a perfect world we would be able to decide on the client or server side 
if we want to execute a validation or skip it).

this is really an issue because RequestFactory is thought as a rigid 
architecture : the user entered data can be reused only if the validation 
failed (otherwise the EntityProxy becomes frozen, and there's no easy way 
to duplicate an EntityProxy). So the best way to check a precondition 
constraint is in the validation process. The issue is that you have the 
choice between two scenarios: 

   - You can do your checks in a specific service method, throw an 
   exception and handle that in the onFailure() client side method. But!!! you 
   cannot reuse the EntityProxy anymore since it's frozen
   - You can do your checks in the validation phase, so you can keep your 
   EntityProxy reuasable, But!!! the validation is made each time you send 
   data to the server (which can be a hard resource consumption issue)

So the question is: is there a way to controle whether the server side 
validation process has to be made? (a per service method configuration or a 
runtime check switch)?

Any suggestions are welcome, and thanks for reading
 

Le mardi 30 octobre 2012 12:43:57 UTC+1, Hans a écrit :

 Hi,

 I'm building a registration form with two password fields being validated 
 on client side using GWT Validation framework.

 Is there any constraint for doing so (validating a value against another 
 field)? Or what's the best way to implement this (should work on server, 
 too)?


-- 
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/d/optout.


Re: Cross field validation on client

2014-08-20 Thread Thomas Broyer


On Wednesday, August 20, 2014 2:09:17 PM UTC+2, Zied Hamdi OneView wrote:

 Hi,

 I was looking at the link 
 http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html#validation 
 , and it's not clear when the validation is executed. it seams it is 
 executed each time data is sent to the server!!???.


Yes.
 

 If it's the case, this could be a performance problem since we might have 
 some complex validation processes that we want to execute only when we call 
 some service methods (in a perfect world we would be able to decide on the 
 client or server side if we want to execute a validation or skip it).


The idea is that you only validate those things that MUST be validated (and 
for that, you just put them in the default group, and other constraints in 
other groups; or you put them in a specific group and you use a 
ServiceLayerDecorator with an overridden validate() method to validate only 
that specific group).
 

 this is really an issue because RequestFactory is thought as a rigid 
 architecture : the user entered data can be reused only if the validation 
 failed (otherwise the EntityProxy becomes frozen, and there's no easy way 
 to duplicate an EntityProxy). So the best way to check a precondition 
 constraint is in the validation process. The issue is that you have the 
 choice between two scenarios: 

- You can do your checks in a specific service method, throw an 
exception and handle that in the onFailure() client side method. But!!! 
 you 
cannot reuse the EntityProxy anymore since it's frozen
- You can do your checks in the validation phase, so you can keep your 
EntityProxy reuasable, But!!! the validation is made each time you send 
data to the server (which can be a hard resource consumption issue)

 So the question is: is there a way to controle whether the server side 
 validation process has to be made? (a per service method configuration or a 
 runtime check switch)?


I'm sure you can come up with clever tricks to pass some value down to a 
ServiceLayerDecorator's validate() method (e.g. through a request header, 
or appending data to the payload and stripping it in a servlet filter).

I'm rather supportive of RF but it doesn't fit everyone's use-case (well, 
using only ValueProxies makes it a good replacement for GWT-RPC with an 
added batching feature, at the expense of bigger payloads but without the 
hassle of serialization policies).
Wrt validation, RF works best if you restrict validation to per field 
(value ranges, patterns, etc.) or otherwise fast checks, and allow invalid 
data (wrt. other (business) constraint violations) to be persisted, along 
with a valid/invalid flag of some sort. Then depending on the valid/invalid 
flag you can decide whether some actions on the persisted data are possible 
or not. Actually, that's the approach that best fits the web, because you 
don't want to get in the way of the user and risk all his work to be 
lost (browser crash, broken connectivity, etc.): when I tell you to save, 
just save, when I tell you to act, feel free to refuse if the saved data 
is wrong. It generally requires totally rethinking the way you work with 
data and the way you store it, so it might only be possible in greenfield 
projects with enough budget and sufficiently skilled architects/developers.
The alternative is to flush data (and edit()) into your proxies only when 
needed; that way you can just flush again in newly-edit()ed proxies 
should an error happen (if you use the Editor framework, that means *not* 
using the RequestFactoryEditorDriver; you could use edit on write proxies 
that read from frozen RF proxies and only edit() and write into RF proxies 
on flush; or you could copy data from the RF proxies to view model 
objects, and then edit the RF proxies and copy back again just before 
fire()ing the request)

-- 
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/d/optout.


Re: Generation of permutations

2014-08-20 Thread Thomas Broyer
I think the best practice is to decide which locale is your primary 
locale and:

   - define it as the fallback locale, and
   - use non-suffixed properties file for that locale

and accept that a permutation for the default locale might be generated 
(should be the case as soon as you use locale-sensitive number or date 
formatting, if you only have messages then the default and your primary 
locale would possibly generate the same code and thus a single permutation).

But using set-property name=locale value=de,en / (i.e. your supported 
locales minus default) should work I believe (John, who's the maintainer 
for the I18N stuff, said somewhere in the issue tracker that he wouldn't 
recommend it as it could break things in unpredictable ways, so I'd say if 
generating an extra permutation is really a problem for you, try removing 
the default locale and see if that works for you)

On Friday, August 15, 2014 11:40:00 AM UTC+2, Developer wrote:

 After adding

 set-property name=locale value=de_DE,en_US /

 I'm getting just two permutations - great!

 But I still need the AppResources.properties file. Otherwise I'm still 
 getting the above error message No resource found for key

 Even after adding 

 set-property-fallback name=locale value=de_DE /

 I still get that exception.

 Only if I restrict my app to one locale by changing
 set-property name=locale value=de_DE,en_US /
 to
 set-property name=locale value=de_DE /
 it i compiled without the existance of AppResources.properties but I'm 
 loosing the possibility to switch between de_DE and en_US then.



-- 
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/d/optout.


Re: GWT and BV/javax.validation 1.1

2014-08-20 Thread Ted Gulesserian
I had to upgrade to JPA 2.1 today to be able to use this feature:

http://dreamand.me/java/java-jee7-jpa-stored-procedure-example/ 

It also required upgrading Hibernate.  In the process I ran into the same 
issue that Jörg ran into.

My solution was to hold back hibernate-validator to 4.2.0 as my version of 
hibernate (4.3.6) still works with it. 

My concern is that if GWT development has wound down, and Google is no 
longer bankrolling it, no one is going to take on this project, and I am 
sure there are other projects that use BV 1.1 that GWT developers will be 
unable to use. 

If there is a straightforward and practical way of using a different 
version on the client side versus the server side, the GWT devs should at 
least explore that option. 

I use the built in Eclipse debugger extensively, both for client code as 
well as my server code, so the solution should definitely not break the 
eclipse IDE tools, because I think it's one of the best features of GWT 
development. 

Anyway, I just want to tell all the devs that I love this platform,  it has 
re-ignited my passion for making applications, keep up the amazing work.  

My two recent favorite features:

Editor Framework
Using the combinaion of Requestfactory with JPA. 


-- 
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/d/optout.


Re: CellTable with optimal page size

2014-08-20 Thread Thomas Lefort
I had the same request and went for the easy quick and dirty trick, ie 
override the onresize method.

@Override public void onResize() { super.onResize(); if(dataProvider.getList
().isEmpty() || !dataGrid.isVisible() || (dataGrid.getVisibleItems().size() 
== 0)) { return; } try { int pageStart = pager.getPageStart(); int rowHeight 
= dataGrid.getRowElement(0).getOffsetHeight(); // TODO - find a way to 
calculate the visible part of the rows panel int height = dataGrid.
getOffsetHeight() - 30; //((HeaderPanel) 
(dataGrid.asWidget())).getHeaderWidget().getOffsetHeight(); pager.
setPageSize(Math.max(1, (int) Math.floor((double) height / rowHeight))); 
pager.setPageStart(pageStart); } catch(Exception e) { } } 

As you can see in the code, I have not found a reliable way to get the 
header's size, and fixed it to 30px, there is always a little too much at 
the bottom because of that + the fact that you need an integer number of 
lines (so you will never have it fitting perfectly anyway), but at least it 
gets adjusted to the right number of lines automatically.

On Tuesday, 19 August 2014 18:48:25 UTC+2, Magnus wrote:

 I know that someone posted a method here some years ago, but I cannot find 
 it anymore...


-- 
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/d/optout.


JsInterop advance?

2014-08-20 Thread Cristian Rinaldi
Community: 
 I'm playing with JsInterop , and I have two questions: 

 1) Are you planning to try the static methods of JS objects, such as 
Object, Promise, etc.? 
 2) How do when an instance is mapped to an existing Object, eg 
Promise, has a constructor with parameters? 
  
Currently to resolve this 1) I created the following class Factory: JS 
https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java
 

But the interfaces define a contract at the level instance of a class 
or object, this way of doing things, I do not know if it is semantically 
correct. 

   To solve 2) there are not many options: 

 Create a Factory that returns an instance of the object, because it 
has no meaning, only to make the new, implement the interface, because the 
compiler already does. 
 There is some progress in this? 

 I saw in one of the post a proposal to do something like this: 
 
 Promise Promise.Prototype p = new (new Function ., new Function 
);

Where Promise, is the interface defined with prototype = Promise. 

@JsType(isNative = true, prototype = Promise)
public interface Promise {
   
  void then(Function f);

  void cath(Function f);
  }

Here 'access to jsCore project: 
  
https://github.com/workingflows/gwt-jscore/

I hope the answers ... 

greetings

-- 
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/d/optout.


Re: GWT and BV/javax.validation 1.1

2014-08-20 Thread Thomas Broyer


On Wednesday, August 20, 2014 2:32:54 PM UTC+2, Ted Gulesserian wrote:

 I had to upgrade to JPA 2.1 today to be able to use this feature:

 http://dreamand.me/java/java-jee7-jpa-stored-procedure-example/ 

 It also required upgrading Hibernate.  In the process I ran into the same 
 issue that Jörg ran into.

 My solution was to hold back hibernate-validator to 4.2.0 as my version of 
 hibernate (4.3.6) still works with it. 

 My concern is that if GWT development has wound down, and Google is no 
 longer bankrolling it,


I have no idea what you're talking about.
 

 no one is going to take on this project, and I am sure there are other 
 projects that use BV 1.1 that GWT developers will be unable to use.


As said above, only GWT client-side code is impacted. Using GWT (which only 
supports BV 1.0) does not mean you cannot use BV 1.1 on the server side.
 

 If there is a straightforward and practical way of using a different 
 version on the client side versus the server side, the GWT devs should at 
 least explore that option.


It depends on your build tool and project layout.
It's straightforward and pratical if you use a layout similar to theses 
Maven archetypes: https://github.com/tbroyer/gwt-maven-archetypes Just have 
the *-shared and *-client depend on BV 1.0 and the correct version of 
hibernate-validator, and *-server depend on BV 1.1 and a more recent 
hibernate-validator.
 

 I use the built in Eclipse debugger extensively, both for client code as 
 well as my server code, so the solution should definitely not break the 
 eclipse IDE tools, because I think it's one of the best features of GWT 
 development.


So you've not yet been impacted by the DevMode end-of-support by major 
browsers that forces everyone to switch to SuperDevMode? Are you using 
Internet Explorer?
 

 Anyway, I just want to tell all the devs that I love this platform,  it 
 has re-ignited my passion for making applications, keep up the amazing 
 work.  

 My two recent favorite features:

 Editor Framework
 Using the combinaion of Requestfactory with JPA.


FYI, Google, for one, no longer maintains (invests time into) those 
features and we've been talking about moving them (at least RequestFactory) 
to libraries rather than bundling them in GWT proper (widgets have a 
direct dependency on the Editor framework though, so it won't be possible 
for that one). They're still maintained though, but currently not by people 
who are paid to do so (AFAICT, at least that's my case).

-- 
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/d/optout.


Re: JsInterop advance?

2014-08-20 Thread Jens
Interesting. I also have a promise library that maps to ES6 native promises 
but I am still using normal JSNI to do so. Would be nice to see how this 
could work with JsInterop. Is there any documentation about JsInterop yet 
or do you just try around by looking at GWT tests?


-- J.

-- 
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/d/optout.


i have problem changing this to native javascript. please help me

2014-08-20 Thread anuj joshi
private native void createChart()
/*-{

$(function () {
$wnd.$(document).ready(function () {
$wnd.Highcharts.setOptions({
global: {
useUTC: false
}
});

$wnd.$('#container').highcharts({
chart: {
type: 'spline',
animation: $wnd.Highcharts.svg, // don't animate in old 
IE
marginRight: 10,
events: {
load: function () {

// set up the updating of the chart each second
var series = this.series[0];
setInterval(function () {
var x = (new Date()).getTime(), // current 
time
y = Math.random();
series.addPoint([x, y], true, true);
}, 1000);
}
}
},
title: {
text: 'Live random data'
},
xAxis: {
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {
title: {
text: 'Value'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function () {
return 'b' + this.series.name + '/bbr/' +
$wnd.Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', 
this.x) + 'br/' +
$wnd.Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: false
},
exporting: {
enabled: false
},
series: [{
name: 'Random data',
data: (function () {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;

for (i = -19; i = 0; i += 1) {
data.push({
x: time + i * 1000,
y: Math.random()
});
}
return data;
}())
}]
});
});
});

 }-*/;

}

-- 
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/d/optout.


Re: JsInterop advance?

2014-08-20 Thread Cristian Rinaldi
Hello Jens:

 I have just searched in GWT test and code, and talks of +Goktug Gokdogan 
in GWT.create event.

El miércoles, 20 de agosto de 2014 11:52:52 UTC-3, Jens escribió:

 Interesting. I also have a promise library that maps to ES6 native 
 promises but I am still using normal JSNI to do so. Would be nice to see 
 how this could work with JsInterop. Is there any documentation about 
 JsInterop yet or do you just try around by looking at GWT tests?


 -- J.


-- 
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/d/optout.


Re: render a SVG graphic as bitmap?

2014-08-20 Thread Joseph Lust
Also wrote a bunch of map animations in SVG back in 2011. Used SMIL to 
markup the animations and movements of viewports. Worked out quite well in 
FF at the time, but IE was terrible. Chrome worked well, but there were a 
number of SMIL methods that Chrome either didn't implement or did so 
incorrectly. I suspect it has much improved by now, especially given that 
browser vendors started to care about SVG once *retina displays* came out.

For great demos, check out http://svg-wow.org/. Note, when you use a world 
map with 1M+ points, it does render slower.


Joe

-- 
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/d/optout.


Re: render a SVG graphic as bitmap?

2014-08-20 Thread Cristiano Costantini
Hi,
You can use Apache Batik library and write a servlet that renders
raster images from SVG files and serves them over http.

Apache Batik is not uptaded since long time, but we use it successfully by
some years to renders maps stored on the server in SVG format.

Regards,
Cristiano



Il domenica 17 agosto 2014, Jens jens.nehlme...@gmail.com ha scritto:

 Just don't support IE 8 and be happy http://caniuse.com/#search=svg

 Other than that you would either use a graphics tool to export svg to
 jpg/png and fixed resolutions and let the client decide which to use or let
 the server convert it if you don't have any fixed resolutions.

 -- J.

 --
 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
 javascript:_e(%7B%7D,'cvml','google-web-toolkit%2bunsubscr...@googlegroups.com');
 .
 To post to this group, send email to google-web-toolkit@googlegroups.com
 javascript:_e(%7B%7D,'cvml','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/d/optout.


-- 
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/d/optout.


Re: render a SVG graphic as bitmap?

2014-08-20 Thread Cristiano Costantini
Sorry for the double message, I had problems with the mail app and it has
delivered it now!

Il mercoledì 20 agosto 2014, Cristiano Costantini 
cristiano.costant...@gmail.com ha scritto:

 Hi,
 You can use Apache Batik library and write a servlet that renders
 raster images from SVG files and serves them over http.

 Apache Batik is not uptaded since long time, but we use it successfully by
 some years to renders maps stored on the server in SVG format.

 Regards,
 Cristiano



 Il domenica 17 agosto 2014, Jens jens.nehlme...@gmail.com
 javascript:_e(%7B%7D,'cvml','jens.nehlme...@gmail.com'); ha scritto:

 Just don't support IE 8 and be happy http://caniuse.com/#search=svg

 Other than that you would either use a graphics tool to export svg to
 jpg/png and fixed resolutions and let the client decide which to use or let
 the server convert it if you don't have any fixed resolutions.

 -- J.

 --
 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/d/optout.



-- 
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/d/optout.


[gwt-contrib] JsInterop Advance

2014-08-20 Thread Cristian Rinaldi
Community: 
 I'm playing with JsInterop , and I have two questions: 

 1) Are you planning to try the static methods of JS objects, such as 
Object, Promise, etc.? 
 2) How do when an instance is mapped to an existing Object, eg 
Promise, has a constructor with parameters? 
  
Currently to resolve this 1) I created the following class Factory: JS 
https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java

But the interfaces define a contract at the level instance of a class 
or object, this way of doing things, I do not know if it is semantically 
correct. 

   To solve 2) there are not many options: 

 Create a Factory that returns an instance of the object, because it 
has no meaning, only to make the new, implement the interface, because the 
compiler already does. 
 There is some progress in this? 

 I saw in one of the post a proposal to do something like this: 
 
 Promise Promise.Prototype p = new (new Function ., new Function 
);

Where Promise, is the interface defined with prototype = Promise. 

@JsType(isNative = true, prototype = Promise)
public interface Promise {
   
  void then(Function f);

  void cath(Function f);
  }

Here 'access to jsCore project: 
  
https://github.com/workingflows/gwt-jscore/ 
https://github.com/workingflows/gwt-jscore/

I hope the answers ... 

greetings

-- 
You received this message because you are subscribed to the Google Groups GWT 
Contributors group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3268ccc7-9953-49c9-9079-574096f0d5d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] JsInterop Advance

2014-08-20 Thread 'Goktug Gokdogan' via GWT Contributors
On Wed, Aug 20, 2014 at 6:17 AM, Cristian Rinaldi csrina...@gmail.com
wrote:

 Community:
  I'm playing with JsInterop , and I have two questions:

  1) Are you planning to try the static methods of JS objects, such as
 Object, Promise, etc.?



There will be some static helpers provided from the SDK. I originally
started the JSNI 2.0 document but it is basically waiting for me to start
on Elemental 2.0 and accumulate more experience to turn it into something
more concrete.



  2) How do when an instance is mapped to an existing Object, eg
 Promise, has a constructor with parameters?



Actually I have new ideas on this derived from how some other APTs work.

I need to update the JsInterop doc but these are the options that I'm
thinking right now:

*Option 1 (works better for extending):*

@JsType(prototype = Promise)public interface Promise {
  /* Protoype_Promise is an autogenerated package visible class */
  public static class Prototype extends Protoype_Promise {
public Prototype(Function... functions) {
   super(functions);
}
  }

  void then(Function f);

  void cath(Function f);
}

​

*Option 2 (works better for general use):*

@JsType(prototype = Promise)public interface Promise {
  /* Protoype_Promise is an autogenerated package visible class */
  public static Promise create(Function... functions) {
 return new Protoype_Promise(functions);
  }

  void then(Function f);

  void cath(Function f);
}

​

*Of course one can do both:*

@JsType(prototype = Promise)public interface Promise {

  public static class Prototype extends Protoype_Promise {
public Prototype(Function... functions) {
   super(functions);
}
  }

  public static Promise create(Function... functions) {
 return new Prototype(functions);
  }

  void then(Function f);

  void cath(Function f);
}

​


 Currently to resolve this 1) I created the following class Factory: JS
 https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java

 But the interfaces define a contract at the level instance of a class
 or object, this way of doing things, I do not know if it is semantically
 correct.

To solve 2) there are not many options:

  Create a Factory that returns an instance of the object, because it
 has no meaning, only to make the new, implement the interface, because the
 compiler already does.
  There is some progress in this?

  I saw in one of the post a proposal to do something like this:

  Promise Promise.Prototype p = new (new Function ., new Function
 );

 Where Promise, is the interface defined with prototype = Promise.

 @JsType(isNative = true, prototype = Promise)
 public interface Promise {

   void then(Function f);

   void cath(Function f);
   }

 Here 'access to jsCore project:

 https://github.com/workingflows/gwt-jscore/
 https://github.com/workingflows/gwt-jscore/


Great work. This kind of stuff is also very valuable as a feedback.


 I hope the answers ...

 greetings

 --
 You received this message because you are subscribed to the Google Groups
 GWT Contributors group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/3268ccc7-9953-49c9-9079-574096f0d5d3%40googlegroups.com
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/3268ccc7-9953-49c9-9079-574096f0d5d3%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups GWT 
Contributors group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0ZpjT%2Bf%2ByqbwCHsSSPWaawLtJwf%2BPTTvbd68zE2Oxh%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] JsInterop Advance

2014-08-20 Thread 'Ray Cromwell' via GWT Contributors
Static methods on interfaces is a Java8 only feature, but I prefer it.
Since you can use Java8 with GWT even if you are running Java7 or below as
a JVM, and since these features are not for shared code, but for Web code,
I'm kinda leaning towards the idea of JSNI 2.0 requiring Java8. We should
have a debate about this in the community. We get several benefits:

1. Static methods on interfaces
2. Defender methods to implement JSNI fragments on JsTypes
3. APIs designed for Lambdas everywhere.


Here's a motivating usecase right now:

@JsType
interface SomeJsType {
  void someMethod();
  default void anotherMethod(int arg) {
js(this.doIt($0, must be present, arg);
  }
}

That is, there are some cases in Js interfaces where default prototype
dispatch is not what you want, and you need wrapper code.


Another use case

@JsType
@IterateAsArray(getter = item, length=length)
interface NodeListT extends Element extends IterableT {
T item(int x);
int length();

   default IteratorT iterator() {
  return NodeListIterator(this);
   }
}


for (T x : nodeList) { ... }

Are we ballsy enough to say GWT 3.0 = Java8 source level enforced for
client side code?




On Wed, Aug 20, 2014 at 12:38 PM, 'Goktug Gokdogan' via GWT Contributors 
google-web-toolkit-contributors@googlegroups.com wrote:




 On Wed, Aug 20, 2014 at 6:17 AM, Cristian Rinaldi csrina...@gmail.com
 wrote:

 Community:
  I'm playing with JsInterop , and I have two questions:

  1) Are you planning to try the static methods of JS objects, such as
 Object, Promise, etc.?



 There will be some static helpers provided from the SDK. I originally
 started the JSNI 2.0 document but it is basically waiting for me to start
 on Elemental 2.0 and accumulate more experience to turn it into something
 more concrete.



  2) How do when an instance is mapped to an existing Object, eg
 Promise, has a constructor with parameters?



 Actually I have new ideas on this derived from how some other APTs work.

 I need to update the JsInterop doc but these are the options that I'm
 thinking right now:

 *Option 1 (works better for extending):*

 @JsType(prototype = Promise)public interface Promise {
   /* Protoype_Promise is an autogenerated package visible class */
   public static class Prototype extends Protoype_Promise {
 public Prototype(Function... functions) {
super(functions);
 }
   }


 void then(Function f);

   void cath(Function f);
 }

 

 *Option 2 (works better for general use):*

 @JsType(prototype = Promise)public interface Promise {
   /* Protoype_Promise is an autogenerated package visible class */
   public static Promise create(Function... functions) {
  return new Protoype_Promise(functions);
   }


 void then(Function f);

   void cath(Function f);
 }

 

 *Of course one can do both:*

 @JsType(prototype = Promise)public interface Promise {

   public static class Prototype extends Protoype_Promise {
 public Prototype(Function... functions) {
super(functions);
 }
   }

   public static Promise create(Function... functions) {
  return new Prototype(functions);
   }


 void then(Function f);

   void cath(Function f);
 }

 


 Currently to resolve this 1) I created the following class Factory:
 JS
 https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java

 But the interfaces define a contract at the level instance of a class
 or object, this way of doing things, I do not know if it is semantically
 correct.

To solve 2) there are not many options:

  Create a Factory that returns an instance of the object, because it
 has no meaning, only to make the new, implement the interface, because the
 compiler already does.
  There is some progress in this?

  I saw in one of the post a proposal to do something like this:

  Promise Promise.Prototype p = new (new Function ., new Function
 );

 Where Promise, is the interface defined with prototype = Promise.

 @JsType(isNative = true, prototype = Promise)
 public interface Promise {

   void then(Function f);

   void cath(Function f);
   }

 Here 'access to jsCore project:

 https://github.com/workingflows/gwt-jscore/
 https://github.com/workingflows/gwt-jscore/


 Great work. This kind of stuff is also very valuable as a feedback.


 I hope the answers ...

 greetings

 --
 You received this message because you are subscribed to the Google Groups
 GWT Contributors group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/3268ccc7-9953-49c9-9079-574096f0d5d3%40googlegroups.com
 

Re: [gwt-contrib] JsInterop Advance

2014-08-20 Thread 'Goktug Gokdogan' via GWT Contributors
It is not like a library forces Java8; as we are supplying our own java8
compatible compiler, I think we are flexible to force Java8.
If there is shared code and they want to keep java7 compatibility, then
they should avoid using java8 specific features.


On Wed, Aug 20, 2014 at 1:21 PM, 'Ray Cromwell' via GWT Contributors 
google-web-toolkit-contributors@googlegroups.com wrote:

 Static methods on interfaces is a Java8 only feature, but I prefer it.
 Since you can use Java8 with GWT even if you are running Java7 or below as
 a JVM, and since these features are not for shared code, but for Web code,
 I'm kinda leaning towards the idea of JSNI 2.0 requiring Java8. We should
 have a debate about this in the community. We get several benefits:

 1. Static methods on interfaces
 2. Defender methods to implement JSNI fragments on JsTypes
 3. APIs designed for Lambdas everywhere.


 Here's a motivating usecase right now:

 @JsType
 interface SomeJsType {
   void someMethod();
   default void anotherMethod(int arg) {
 js(this.doIt($0, must be present, arg);
   }
 }

 That is, there are some cases in Js interfaces where default prototype
 dispatch is not what you want, and you need wrapper code.


 Another use case

 @JsType
 @IterateAsArray(getter = item, length=length)
 interface NodeListT extends Element extends IterableT {
 T item(int x);
 int length();

default IteratorT iterator() {
   return NodeListIterator(this);
}
 }


 for (T x : nodeList) { ... }

 Are we ballsy enough to say GWT 3.0 = Java8 source level enforced for
 client side code?




 On Wed, Aug 20, 2014 at 12:38 PM, 'Goktug Gokdogan' via GWT Contributors 
 google-web-toolkit-contributors@googlegroups.com wrote:




 On Wed, Aug 20, 2014 at 6:17 AM, Cristian Rinaldi csrina...@gmail.com
 wrote:

 Community:
  I'm playing with JsInterop , and I have two questions:

  1) Are you planning to try the static methods of JS objects, such
 as Object, Promise, etc.?



 There will be some static helpers provided from the SDK. I originally
 started the JSNI 2.0 document but it is basically waiting for me to start
 on Elemental 2.0 and accumulate more experience to turn it into something
 more concrete.



  2) How do when an instance is mapped to an existing Object, eg
 Promise, has a constructor with parameters?



 Actually I have new ideas on this derived from how some other APTs work.

 I need to update the JsInterop doc but these are the options that I'm
 thinking right now:

 *Option 1 (works better for extending):*

 @JsType(prototype = Promise)public interface Promise {
   /* Protoype_Promise is an autogenerated package visible class */
   public static class Prototype extends Protoype_Promise {
 public Prototype(Function... functions) {
super(functions);
 }
   }


 void then(Function f);

   void cath(Function f);
 }


 *Option 2 (works better for general use):*

 @JsType(prototype = Promise)public interface Promise {
   /* Protoype_Promise is an autogenerated package visible class */
   public static Promise create(Function... functions) {
  return new Protoype_Promise(functions);
   }


 void then(Function f);

   void cath(Function f);
 }


 *Of course one can do both:*

 @JsType(prototype = Promise)public interface Promise {

   public static class Prototype extends Protoype_Promise {
 public Prototype(Function... functions) {
super(functions);
 }
   }

   public static Promise create(Function... functions) {
  return new Prototype(functions);
   }


 void then(Function f);

   void cath(Function f);
 }



 Currently to resolve this 1) I created the following class Factory:
 JS
 https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java

 But the interfaces define a contract at the level instance of a
 class or object, this way of doing things, I do not know if it is
 semantically correct.

To solve 2) there are not many options:

  Create a Factory that returns an instance of the object, because it
 has no meaning, only to make the new, implement the interface, because the
 compiler already does.
  There is some progress in this?

  I saw in one of the post a proposal to do something like this:

  Promise Promise.Prototype p = new (new Function ., new Function
  );

 Where Promise, is the interface defined with prototype = Promise.

 @JsType(isNative = true, prototype = Promise)
 public interface Promise {

   void then(Function f);

   void cath(Function f);
   }

 Here 'access to jsCore project:

 https://github.com/workingflows/gwt-jscore/
 https://github.com/workingflows/gwt-jscore/


 Great work. This kind of stuff is also very valuable as a feedback.


 I hope the answers ...

 greetings

 --
 You received this message because you are subscribed to the Google
 Groups GWT Contributors group.
 To unsubscribe from this group and stop 

Re: [gwt-contrib] JsInterop Advance

2014-08-20 Thread Jens


 Are we ballsy enough to say GWT 3.0 = Java8 source level enforced for 
 client side code?


I hope so. 

I am pretty sure everyone who has given Java8 a try so far, even if it was 
just an example project, feels the pain when coming back to a GWT project. 
If Java8 gives more freedom and a cleaner API design for Elemental 2.0 then 
GWT 3.0 should require it. Thats why it will be called 3.0...going forward. 

But when doing so, SDM in GWT 2.7 must work well on any project size 
because people might not migrate that fast to GWT 3.0 (depending on how 
many breaking changes it will contain)

-- J.

-- 
You received this message because you are subscribed to the Google Groups GWT 
Contributors group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/eaf2c87d-ac41-4ed9-9b86-d9dce6d0a0e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.