Friday, May 31, 2013

Re: Get Data CellTable

Thanks for your answer!

In fact, I don't want to refresh my table. I just want to get all the data which are in my table. My table is editable by the final user. 

Le vendredi 31 mai 2013 17:59:38 UTC-4, David a écrit :

The cells are reused so there's no way to get a specific rendered cell from the CellTable. Update the object in your data provider and call refresh() or updateRowData(...).

On Friday, May 31, 2013 3:44:08 PM UTC-5, sebastie...@isen-lille.fr wrote:
Maybe there is an other way to do that? I don't find a solution...

Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit :
I don't find a method to simply get the text in a cell. It's very weird!

Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit :
Hi everyone,
I have a simple CellTable with editable cells. I add a button "save" outside of the table. So, I want to be able to save the change of the final user.

I want to do something like that:
If the button is cliked:
int i=0;
int j=0;
while(i<table.getRowCount()){
while(j<table.getColumnCount(){
myList = table.getCellText(i,j) ??? ( I don't know how to do that )
j=j+1;
}
i=i+1;
j=0;
}

I don't know how to get a cell individually...

Can you help me?

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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Get Data CellTable


The cells are reused so there's no way to get a specific rendered cell from the CellTable. Update the object in your data provider and call refresh() or updateRowData(...).

On Friday, May 31, 2013 3:44:08 PM UTC-5, sebastie...@isen-lille.fr wrote:
Maybe there is an other way to do that? I don't find a solution...

Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit :
I don't find a method to simply get the text in a cell. It's very weird!

Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit :
Hi everyone,
I have a simple CellTable with editable cells. I add a button "save" outside of the table. So, I want to be able to save the change of the final user.

I want to do something like that:
If the button is cliked:
int i=0;
int j=0;
while(i<table.getRowCount()){
while(j<table.getColumnCount(){
myList = table.getCellText(i,j) ??? ( I don't know how to do that )
j=j+1;
}
i=i+1;
j=0;
}

I don't know how to get a cell individually...

Can you help me?

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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Dynamically generated HTML and GWT

Now, this has gone from fun to just downright frustrating.  I'm stuck at the point of finding and wrapping the submit button.  I get the ubiquitous, "A widget that has an existing parent widget may not be added to the detach list".  Looked through the dozens of posts regarding that message.  The most common response is "don't use wrap() the way are using it".  There's also, "that's not the use case for wrap()".  Maybe one of these is true in my case.

Code is fairly simple.

uibinder:
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:ScrollPanel width="100%" height="100%" ui:field="mainScrollPanel"/>
</ui:UiBinder> 

The view class's onLoad() (this is an Activites and Places app that uses MVP).  So this view is on the right side of a splitterpanel.  The left side has a stackpanel (think of the mail example).  When the appropriate stack panel item is selected, this view appears on the right of the splitter.

public class ReviewView extends ResizeComposite
{
  ...

  @UiField ScrollPanel mainScrollPanel; 

private String html;  // Set in a separate method and called before onLoad().  This HTML comes from an external source.

  ...
public void onLoad()
{
mainScrollPanel.clear();
HTMLPanel htmlPanel = new HTMLPanel( html );
mainScrollPanel.add( htmlPanel );
Element submitButtonElement = htmlPanel.getElementById( "save" );    // This appears to work, without being deferred.  I tried it defered also.
Button submitButton = Button.wrap( submitButtonElement );                 // This is where the assert exception occurs.
}
}

Of course the HTMLPanel has a parent widget, the ReviewView. And it is nested inside of a ScrollPanel, which is nested in a SplitterLayoutPanel, which is inside a RootLayoutPanel.  There are probably widgets attached to all of those.  So, can this be done? One solution in the posts is to wrap() from the inside out.  With an A&P app this seems nearly impossible as Widgets are always embedded in Widgets.  What is the point of wrap() if it is so finicky()?  

I also tried deferred method, replacing HTMLPanel with MyHtmlPanel:

onLoad() looks like this:

MyHtmlPanel htmlPanel = new MyHtmlPanel( html );
mainScrollPanel.add( htmlPanel );

And MyHtmlPanel looks like this:

private class MyHtmlPanel extends HTMLPanel
{
public MyHtmlPanel( String html )
{
super( html );
}
protected void onAttach()
{
Element submitButtonElement = this.getElementById( "save" );    // Appears to work.
Button submitButton = Button.wrap( submitButtonElement );        // Same error occurs here.
}
protected void onDetach()
{
}
}




--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Get Data CellTable

Maybe there is an other way to do that? I don't find a solution...

Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit :
I don't find a method to simply get the text in a cell. It's very weird!

Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit :
Hi everyone,
I have a simple CellTable with editable cells. I add a button "save" outside of the table. So, I want to be able to save the change of the final user.

I want to do something like that:
If the button is cliked:
int i=0;
int j=0;
while(i<table.getRowCount()){
while(j<table.getColumnCount(){
myList = table.getCellText(i,j) ??? ( I don't know how to do that )
j=j+1;
}
i=i+1;
j=0;
}

I don't know how to get a cell individually...

Can you help me?

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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: change in children not saved in GWT 2.5.1 after implement OSIV

Same problem,
Still haven't found any good solution,

Em sexta-feira, 31 de maio de 2013 11h50min21s UTC-3, Yan escreveu:
Hi there, 

I have a Parent object containing a list of Children objects. Both are EntityProxy.  My RequestFactory API is to persist the Parent along with Children collection.  My JPA layer is EclipseLink (JPA 1.0), with entity manager cache ENABLED. 

In UI, I change some property on children (without changing parent). When the backend API is called, I expect to see that the Parent's children objects will have the updates.

In GWT 2.4.0, I do see that because GWT 2.4.0 sends the list of children to server regardless.  In GWT 2.5.1, I see only the delta is sent across the wire (this is correct), but in the backend, I do not see the children collection with updates, that is incorrect. 

I did implement one-entitymanager-per-request pattern based on a solution someone offered on this group. I verified that only one instance of child is created by JPA during the request. I also verified that GWT client is correctly sending the delta to GWT server and setter methods are called on JPA entity to set the correct value (after JPA loads children from database). Afterwards, the setter is not called and no child object ever created again. 

However, when the code reaches the API (as seen in debugger), I do not see the children objects has the updates. 

Why is this?  GWT runtime is somehow loading the object from somewhere else?

Thanks,
Yan

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: change in children not saved in GWT 2.5.1 after implement OSIV

I'm having the same issue.

Tried to edit the proxy with the same request context as the parent proxy, but no solution.

Also tried to create new child proxies and set to the parent, also without sucess;

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

SimplePager next/last not being disabled appropriately


Using GWT 2.5.1, SimplePager.java has this method:

  @Override
  protected void onRangeOrRowCountChanged() {
    HasRows display = getDisplay();
    label.setText(createText());

    // Update the prev and first buttons.
    setPrevPageButtonsDisabled(!hasPreviousPage());

    // Update the next and last buttons.
    if (isRangeLimited() || !display.isRowCountExact()) {
      setNextPageButtonsDisabled(!hasNextPage());
      setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
    }
  }

Why are the next/last buttons enabled/disabled only if range is limited or if the row count isn't exact? I have a pager set to range limited false, and my data provider specifies that the row count is exact when I update the row count. With this setup, the next/last paging buttons will NEVER be updated!

Am I just using this wrong, or is it a bug?

I worked around the issue by subclassing SimplePager to allow me into that block at the bottom of onRangeOrRowCountChanged():

        @Override
        protected void onRangeOrRowCountChanged() {
            boolean rangeLimited = isRangeLimited();
            super.setRangeLimited(true);
            super.onRangeOrRowCountChanged();
            super.setRangeLimited(rangeLimited);
        }


--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: SimplePager last page issue

These methods are private in 2.5.1, so this fix does not work there.

The behavior to only set enabled/disabled on next/last seems broken. I have rangeLimited(false) and always have exact row count, and the enablement on my next/last paging controls can never be updated.


On Tuesday, October 16, 2012 10:18:46 AM UTC-4, Juan Pablo Gardella wrote:
Hi,

See http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/cellview/client/SimplePager.java these methods are defined in a super class.

Juan

2012/10/16 dafintrash <dafin...@gmail.com>
Your tip could use some clarification as the SimplePager class doesn't have the following methods: setPrevPageButtonsDisabled, setNextPageButtonsDisabled, setFastForwardDisabled.


On Monday, August 27, 2012 4:11:25 AM UTC+3, Juan Pablo Gardella wrote:
Hi,

There is a bug with SimplePager that enable go to next page in the last page (an must be disabled). Well, after some debugging if I change the method onRangeOrRowCountChanged() in this way works well.

@Override
  protected void onRangeOrRowCountChanged() {
    HasRows display = getDisplay();
    label.setText(createText());

    // Update the prev and first buttons.
    setPrevPageButtonsDisabled(!hasPreviousPage());

    // Update the next and last buttons.
    //if (isRangeLimited() || !display.isRowCountExact()) {
    if (isRangeLimited() || display.isRowCountExact()) { 
      setNextPageButtonsDisabled(!hasNextPage());
      setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
    }
  }

As see, I remove "!" in display.isRowCountExact() and works. Hope helps someone.

Juan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/pnTXCInn1bwJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

change in children not saved in GWT 2.5.1 after implement OSIV

Hi there, 

I have a Parent object containing a list of Children objects. Both are EntityProxy.  My RequestFactory API is to persist the Parent along with Children collection.  My JPA layer is EclipseLink (JPA 1.0), with entity manager cache ENABLED. 

In UI, I change some property on children (without changing parent). When the backend API is called, I expect to see that the Parent's children objects will have the updates.

In GWT 2.4.0, I do see that because GWT 2.4.0 sends the list of children to server regardless.  In GWT 2.5.1, I see only the delta is sent across the wire (this is correct), but in the backend, I do not see the children collection with updates, that is incorrect. 

I did implement one-entitymanager-per-request pattern based on a solution someone offered on this group. I verified that only one instance of child is created by JPA during the request. I also verified that GWT client is correctly sending the delta to GWT server and setter methods are called on JPA entity to set the correct value (after JPA loads children from database). Afterwards, the setter is not called and no child object ever created again. 

However, when the code reaches the API (as seen in debugger), I do not see the children objects has the updates. 

Why is this?  GWT runtime is somehow loading the object from somewhere else?

Thanks,
Yan

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

EJB-GWT and Netbeans IDE


Hi,

I wrote a short blog about using ejb and gwt in Netbeans ide:
http://lehelsipos.blogspot.com/2013/05/ejb-gwt-and-netbeans-ide.html

Lehel

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: UI Designer & GWT Developer BEST Workflow Practices?

I am not sure if I understand you correctly,

I am guessing you want to just use HTML/CSS for designing, so you could just mockup using html and copy the same into an ui.xml, maybe inside a HTMLPanel widget.

The HTMLPanel is a div in itself, and all your html code with css would remain the same.

This is how we do it :

Designer gives me a HTML document with all the necessary CSS and Jquery script for funtionality/animation. I copy the tags as is, and put it inside an ui.xml file made of GWT Widgets. The outermost div i change to an HTMLPanel and set the id or class attibute if any in the corresponding java file.

From there on, for any manipulation of the DOM for getting or setting of data, I use GQuery to manipulate or directly use the given jquery script within JSNI.

Hope this helps.

On Friday, 31 May 2013 00:49:23 UTC+5:30, Clarissa G wrote:
"Is there a way for a UI designer (myself) to still use clean HTML/CSS while pulling in GWT features/elements (that may use UIBINDER) instead of having to find/customize/use throw away jquery to demo functionality?"

On Friday, 31 May 2013 00:49:23 UTC+5:30, Clarissa G wrote:
"Is there a way for a UI designer (myself) to still use clean HTML/CSS while pulling in GWT features/elements (that may use UIBINDER) instead of having to find/customize/use throw away jquery to demo functionality?"

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Problem on Project: GWT + JPA(eclipselink 2.4) + DB(postgresql 9)

@Warning: 

Do you use that mentioned class? If not check your web.xml if its registered as listener.

@Exception:

Do you have javax.persistence-1.0 and javax.persistence-2.0 on classpath / in WEB-INF/lib ?

Looks like your RpcUtilizadoresImpl uses a method of javax.persistence.Persistence that exists in your IDE but not when you have deployed the app to your app server. This could be a hint that your classpath is different (or just have a different order).


-- 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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Wrong UTF-8 string parsing in GWT JSON


In RFC4627: JSON "String" and "Text" is two different things.

Text: is a sequence of JSON objects, with barckets, strings, quotes etc...
(RFC4627 section 2.)

String: Is a JSON basic data type (single JSON data).
(RFC4627 section 2.5.)

As RFC4627 text and string encoding shall be different.
As you write, Text is default UTF-8, determined by first 4 characters. (section 3)
But not the String!

String is always Unicode, unicode characters escaped by "\uXXXX". (section 2.5)

I was only problem with JSON string, not the whole JSON text.
(My text encoding is UTF-8, as default)


I found my solution: I have to use Unicode characters in JSON string. That's all...

As Philip writes, GWT works as indeed.
GWT JSON  parser "\uXXXX" interpret as UTF-16 character.
And this is independent from JSON text encoding, which is UTF-8.




On Friday, May 31, 2013 10:32:40 AM UTC+2, Thomas Broyer wrote:


On Friday, May 31, 2013 10:07:23 AM UTC+2, Tibor Szolnoki wrote:
Dear Philippe,

You are right...
If I change the escaped ("\uXXXX") codes to UTF-16, for my example:
String response="{ \"test\" : \"\\u00c1\\u00c9\\u0170\" }"; //"ÁÉÜ" in UTF-16
All works correctly.


But I found a strange thin too:
If I disable  the"\uxxxx" escaping in JSON writer in server side, all works as expected. But this is not a good idea according to RFC4627 :((((.

I can't find where it says it's "not a good idea". It says all over the place that JSON "SHALL be encoded in Unicode", with a default to UTF-8, so why not just use UTF-8?
 
In this mode, the JSON string transports the non-printable characters (0xc3, 0x81, 0xc3, 0x89, 0xc5, 0xb0) ("ÁÉÚ" in UTF-8) without any encoding....

These are bytes, not characters.
The encoding is determined by the first 4 bytes of the response (see RFC4627)

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Wrong UTF-8 string parsing in GWT JSON



On Friday, May 31, 2013 10:07:23 AM UTC+2, Tibor Szolnoki wrote:
Dear Philippe,

You are right...
If I change the escaped ("\uXXXX") codes to UTF-16, for my example:
String response="{ \"test\" : \"\\u00c1\\u00c9\\u0170\" }"; //"ÁÉÜ" in UTF-16
All works correctly.


But I found a strange thin too:
If I disable  the"\uxxxx" escaping in JSON writer in server side, all works as expected. But this is not a good idea according to RFC4627 :((((.

I can't find where it says it's "not a good idea". It says all over the place that JSON "SHALL be encoded in Unicode", with a default to UTF-8, so why not just use UTF-8?
 
In this mode, the JSON string transports the non-printable characters (0xc3, 0x81, 0xc3, 0x89, 0xc5, 0xb0) ("ÁÉÚ" in UTF-8) without any encoding....

These are bytes, not characters.
The encoding is determined by the first 4 bytes of the response (see RFC4627)

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: GWT support

Don't worry. Have a look at this video from this years IO conference: https://developers.google.com/events/io/sessions/327833110 

On Thursday, May 30, 2013 7:09:42 PM UTC+2, Katherine Mancera wrote:
good day

I want to get started with GWT in a project, but I doubt arises about it is that if google stop stand how long or not that is not yet covered.

thank you very much

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: GWT issue tracker spring cleaning



On Thursday, May 30, 2013 8:36:23 PM UTC+2, Ed wrote:
BTW: Note: some issues that are marked as Stale, I am planning to pick up and submit a patch, but that will not be soon, seen my agenda. So I hope the issue will still be considered then (or is considered dead by then when no activity happens in X weeks)    ;)

As with most OSS projects, patches are welcome whether there's an issue open for them or not (opening an issue then allows for better tracking, particularly when writing the release notes).
Before working on a patch though (particularly a big one), unless you're ready to maintain a personal/private fork, you'd probably better come discuss on the gwt-contrib: if it's something that would be rejected, no need to start working on a patch and it'll save you time (that you could then dedicate to some other patch :-P )

Think of "assumed stale" as "nobody seems to really care" (historically, "assumed stale" also meant "we think it might have been fixed, please test with the latest version", but it's not that different actually: we want to close the issue and send a "signal" to anyone who cares about it; if he says it's fixed, we can change the status to Fixed, if he says he no longer care, or doesn't respond, we'll leave it as is, or maybe change the status to NotPlanned; if he says he still wants it, then we'll probably leave it closed and "ask" for a patch; when the patch comes –or the contributor says he's about to start working on it– we can change the issue status).

BTW, there's a "glossary" at https://code.google.com/p/google-web-toolkit/wiki/BugTriageProcess but it might need an update, and it doesn't talk about AssumedStale.
Maybe we should move it to gwtproject.org, patches welcome ;-)
(if you want to propose enhancements to that wiki page, feel free to come discuss it at gwt-contrib –I'm not sure comments on the wiki will notify anyone, so better use gwt-contrib–)

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Wrong UTF-8 string parsing in GWT JSON

Dear Philippe,

You are right...
If I change the escaped ("\uXXXX") codes to UTF-16, for my example:
String response="{ \"test\" : \"\\u00c1\\u00c9\\u0170\" }"; //"ÁÉÜ" in UTF-16
All works correctly.


But I found a strange thin too:
If I disable  the"\uxxxx" escaping in JSON writer in server side, all works as expected. But this is not a good idea according to RFC4627 :((((. In this mode, the JSON string transports the non-printable characters (0xc3, 0x81, 0xc3, 0x89, 0xc5, 0xb0) ("ÁÉÚ" in UTF-8) without any encoding.... :(:(:( GWT JSON parser expands the UTF-8 character correctly, and the alert displays correct characters.

I think, JSON string transfer the characters in escaped UTF-16 encoding, but final expands/stores in String in UTF-8. Therefore, if I skip the UTF-16 escaping, I can send string in UTF-8 in raw (without escaping). :(:(:(:(



--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

How would like to load the GWT module dyanamically basing on the click of respective link?

I would like to load different gwt modules withIn the main div basing on the click of respective menuItem. I would like to use JQuery. In the below code, I would like to load the fooGwt module if we click on theloadFooModule and similarly, if I click on loadJqueryModule link then JQuery gwt moduleshould be loaded.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>  <%@ taglib prefix="menuItem" uri="menuItem" %>  <html>   <head>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>      <script>    $(document).ready(function() {      $("a").click(function() {            $("#fooModule").empty();            $("#jQueryModule").empty();        $("#main").remove();            alert($(this).text());            if ($(this).text() == "loadJqueryModule") {                    // Jquery gwt module.                $('head').append($("<script id='main' src='/jquery/jquery.nocache.js' />"));             } else {                     // Foo GWt module.                $('head').append($("<script id='main' src='/foo/foo.nocache.js' />"));             }      });    });     </script>   </head>   <body>     <h1>Web Application Starter Project</h1>      <a href="#" id="clickMe">loadFooModule</a>      <a href="#" id="clickMe5">loadJqueryModule</a>      <div id="fooModule">      </div>            <div id="jQueryModule">      </div>         </body>  </html>


O/p: In this it is loading one module which is Foo. The other module was not loading.

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Dynamically generated HTML and GWT

Form submission works like any form, so you will need a servlet to handle the post.
You will have to redirect the post to an internal IFrame otherwise your document will be replaced. This is what the GWT Form widget is doing.

David

On Thu, May 30, 2013 at 5:43 PM, Mike Dee <mdichiappari@gmail.com> wrote:
Thanks for pointing me in the right direction.

One last question.  How is the form submission handled?  Is a servlet needed?  In this case, the form will simply save any changes (to a db) and redisplay itself.

Thanks,
Mike

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Thursday, May 30, 2013

Firing a click event on a CellTable

Hello,
I am interested in using GWTTestCase to test some features of a view that extends CellTable. In my implementation, I have added a CellPreviewHandler that I would like to check by firing a click event on a cell of the CellTable.  I have tried several methods to no avail. 

My most recent attempt follows:

CellTable<Artist> cellTable = (CellTable<Artist>) view.getDataView();
NativeEvent event = Document.get().createClickEvent(0, 0, 0, 20, 30, false, false, false, false);
DomEvent.fireNativeEvent(event, cellTable);

This does not work.  The CellPreviewHandler doesn't get called.

This has also been tried:

CellTable<Artist> cellTable = (CellTable<Artist>) view.getDataView();
NativeEvent event = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);
TableCellElement element = cellTable.getRowElement(2).getCells().getItem(1);
element.dispatchEvent(event);

Same problem as the former. 

TL;DR
Does anyone have insight as to how I can simulate a click event that will fire a CellPreviewEvent on a CellTable for a desired Cell?

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Wrong UTF-8 string parsing in GWT JSON

Dear Philippe,

Thank you for the post,


>      String response="{ \"test\" : \"\\u00C3\\u0081\\u00C3\\u0089\\u00C5\\u00B0\" }";
> //"���" in UTF-8

No. That's not UTF-8, that's UNC encoding. It results in Java's UTF-16 encoding.

But "\u00C3\u0081" why not UTF-8 encoding?

See: http://www.utf8-chartable.de/

"Á" (LATIN CAPITAL LETTER A WITH ACUTE) hexa code is 0xC3 0x81
"\u00xx" in the JSON string is an escaped hexadecimal representation according to  RFC4627 (JSON)
See:
http://www.ietf.org/rfc/rfc4627.txt

But the character encoding is remain UTF-8, I think.

Regards,
Tibor


--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

GWT: Pass click event from widget contained in cell to the celltable

I have a widget that I render in a GWT cell, which extends the AbstractCell, via the render function below. The column is created as below with the getValue and the FieldUpdater (update) function being defined. The intent is to set selected row to correspond to the clicked widget. However, when I click on the widget, the onBrowserEvent function of the cell is not called. I think this is happening because the widget in question contains a FlexTable within it.

I verified this by setting a breakpoint in the function AbstractCellTable.onBrowserEvent2 and noticed that the function does not fire a cell event since the else if (section == getTableBodyElement())

return false. This is false because the section is a sub-section of the table body element corresponding to the table that I inserted via the widget.

Is there a way to pass the click in the inner table (widget) to the outer cell table?


//Render function to add widget to cell  public void render(Context context, MyItem value, SafeHtmlBuilder sb) {      if (value != null) {          SafeHtml safeValue = SafeHtmlUtils.fromTrustedString(value              .getWidget().getElement().getString());          sb.append(safeValue);      }  }      //Creating the corresponding column, setting up the field update,   // and adding the column to cell table    // Create Cell  MyItemCell myItemCell = new MyItemCell();    // Create Column  Column<MyItem, MyItem> myItemColumn = new Column<MyItem, MyItem>(myItemCell) {        @Override      public MyItem getValue(MyItem object) {          return object;      }    };    // add field updater  myItemColumn.setFieldUpdater(new FieldUpdater<MyItem, MyItem>() {      @Override      public void update(int index, MyItem object, MyItem value) {          // This function, for some reason,           // is not getting called when I click           // on the widget corresponding to MyItem          MyDataTable.this.getSelectionModel().setSelected(object, true);      }  });      // Add column to table
this.getDataTable().addColumn(myItemColumn);

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Problem on Project: GWT + JPA(eclipselink 2.4) + DB(postgresql 9)

Hi people!

I'm new  on the GWT 'world' and i'm making my final project of my graduation.

On this project I need use persistence and my problems begin here...

I'm trying to call a RPC but it return an error on create the Entity Manage Factory :(

This is the first warning:
Starting Jetty on port 0
   [WARN] Could not instantiate listener com.sun.faces.config.ConfigureListener: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener 

And this is the error when i try use RPC(with GWT application running):

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at mm.projeto.factory.JpaUtil.<clinit>(JpaUtil.java:13)
at mm.projeto.server.rpc.RpcUtilizadoresImpl.<init>(RpcUtilizadoresImpl.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
[WARN] /mm.projeto.MotoMeter/RpcUtilizadores
java.lang.NullPointerException
at mm.projeto.server.rpc.RpcUtilizadoresImpl.<init>(RpcUtilizadoresImpl.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
[ERROR] 500 - POST /mm.projeto.MotoMeter/RpcUtilizadores (127.0.0.1) 3422 bytes
   Request headers
      Host: 127.0.0.1:57512
      Connection: keep-alive
      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19
      Accept: */*
      Accept-Encoding: gzip,deflate,sdch
      Accept-Language: pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
      Referer: http://127.0.0.1:57512/MotoMeter.html?gwt.codesvr=127.0.0.1:57508
      Content-Length: 186
      Origin: http://127.0.0.1:57512
      X-GWT-Module-Base: http://127.0.0.1:57512/mm.projeto.MotoMeter/
      Content-Type: text/x-gwt-rpc; charset=UTF-8
      X-GWT-Permutation: HostedMode
   Response headers
      Content-Type: text/html; charset=iso-8859-1
      Content-Length: 3422

The method it's right because I try use on server and it's running! 

I've searched by this problem, but I can't solve :(

I hope anyone can help me :)

Thank you for your attention :)

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: how to inherit external module jxl ? Problems working with excel sheets

Hi. Dalla. I am stuck with the same problem. Could you explain how you do it on the server side ?

Thank you.

Le dimanche 19 juillet 2009 21:35:58 UTC+2, Dalla a écrit :
You could do this using a file upload to the server,
do the excel work on the server side and then serialize the data and
send it back
to the client, displaying it in any way you want using GWT.

--Dalla
http://date-time.appspot.com/

On 17 Juli, 03:19, sly <sly.wicker...@gmail.com> wrote:
> So is there no way for me to go ahead with using this module ?
> How else can I work with excel sheets ? Please do help me.
> My application needs to import an external excel sheet browsed in by
> the user and the data needs to be read and displayed using GWT.
> If anyone knows any working gwt app/project please do let me know.
>
> On Jul 16, 1:06 pm, Isaac Truett <itru...@gmail.com> wrote:
>
>
>
> > > After going through many of the threads here, I found out that the
> > > reason for this is that I have not inherited this module into my
> > > project. Where I am stuck right now is, HOW toINHERITit ???
>
> > You can't, because it isn't a GWT module. The classes you're trying to
> > use (java.io.File, for example) are not part of a GWT module and
> > they're not JRE classes that GWT emulates. Those classes can't be
> > compiled into JS to run in the browser.
>
> > On Wed, Jul 15, 2009 at 9:57 PM, sly<sly.wicker...@gmail.com> wrote:
>
> > > I'm new to gwt and have been working on a project which works with
> > > excel sheets. I need to read an excel sheet and use that data in my
> > > application.
> > > I have included the jar found in this url in the build path
> > >http://jexcelapi.sourceforge.net/. I'm developing on eclipse.
> > > When I run the project as a gwt app I get the following error.
>
> > > Line 20: No source code is available for type java.io.FileInputStream;
> > > did you forget toinherita required module?
> > > Line 22: No source code is available for type java.io.File; did you
> > > forget toinherita required module?
> > > Line 38: No source code is available for type jxl.Sheet; did you
> > > forget toinherita required module?
> > > Line 45: No source code is available for type java.io.InputStream; did
> > > you forget toinherita required module?
> > > Line 46: No source code is available for type jxl.WorkbookSettings;
> > > did you forget toinherita required module?
> > > Line 47: No source code is available for type jxl.Workbook; did you
> > > forget toinherita required module?
> > > Line 49: No source code is available for type jxl.Cell; did you forget
> > > toinherita required module?
> > > Line 52: No source code is available for type jxl.DateCell; did you
> > > forget toinherita required module?
> > > Line 57: No source code is available for type java.util.Locale; did
> > > you forget toinherita required module?
> > > Line 104: No source code is available for type
> > > jxl.read.biff.BiffException; did you forget toinherita required
> > > module?
>
> > > After going through many of the threads here, I found out that the
> > > reason for this is that I have not inherited this module into my
> > > project. Where I am stuck right now is, HOW toINHERITit ??? Below is
> > > a copy of my .gwt.xml
>
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//
> > > EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-
> > > source/core/src/gwt-module.dtd">
> > > <module rename-to='gwtsample'>
>
> > >  <inherits name='com.google.gwt.user.User'/>
>
> > >  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
>
> > >  <entry-point class='com.sample.client.gwtsample'/>
>
> > >  <inherits name="com.google.gwt.maps.GoogleMaps" />
>
> > >  <script src="http://maps.google.com/maps?
> > > gwt=1&amp;file=api&amp;v=2&amp;sensor=false;key=0UJTPX2XKYcABhyx5VXkq-
> > > K2YctzpXUYhHEfWTQ" />
> > > </module>
>
> > > I do not how toinheritthe jxl module.
> > > Below is a copy of my import statements in one of my class file
> > > import jxl.Cell;
> > > import jxl.DateCell;
> > > import jxl.Sheet;
> > > import jxl.Workbook;
> > > import jxl.WorkbookSettings;
> > > import jxl.read.biff.BiffException;
>
> > >  I tried <inherits name="jxl.Cell"/> and so on for all those classes .
> > > And still its not working.
> > > Can anyone please help me regarding this, I need to overcome this very
> > > badly. I'm a student and my project has stagnated for a few days and I
> > > cannot afford more of it.
>
> > > Also if anyone can help me with a sample gwt application which reads/
> > > writes an excel sheet, would really help me learn a lot.
>
> > > Thanking in advance.

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

UI Designer & GWT Developer BEST Workflow Practices?

"Is there a way for a UI designer (myself) to still use clean HTML/CSS while pulling in GWT features/elements (that may use UIBINDER) instead of having to find/customize/use throw away jquery to demo functionality?"

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: RichTextArea how to implement native Drag & Drop?

When I try for a pure GWT solution by adding all the drag/drop listeners to the RichTextArea I get the enter, a few overs, and then strangely I get the leave event.  The drop event never occurs.  How can I fix this?  If I can get the onDrop event to fire it seems I could do the same work I was doing in JSNI with the DropEvent object.

Console log from the various handlers...
onDragEnter: An event type
onDragOver: An event type
onDragOver: An event type
onDragOver: An event type
onDragOver: An event type
onDragLeave: An event type

-Dave

On Wednesday, May 29, 2013 6:07:29 PM UTC-6, dhoffer wrote:
What is the best way to implement native DnD for RichTextArea?  I need to support users dropping items into the RichTextArea that originated from outside the browser (from another web app).

Currently what I have partially works (in production seems to work about 50% of the time) in hosted mode it's only working on the first Drop (could be because of recent changes).  Currently we are doing this with JSNI.  I'll paste the full code below but the key parts are that on the drop event I need to get the 'text' data, e.g.

var data = event.dataTransfer.getData("Text");

Then I parse that data/URI and build a div which I then append to the original element.

Some of the things I'm not sure about are...what Document to be working with.  The original code used document in the JSNI method but I see online that $doc should be used.  Or I could pass into the JSNI method the document, e.g. 

 IFrameElement fe = getElement().cast();
 Document document = fe.getContentDocument();

Or ideally I'd prefer to do this with a more pure GWT solution and use less JSNI if that's possible.  How best to respond to these native drops?  Why would this code only be working for the first drop?  (Note, we have several instances of this widget in the application)  Here is the full code. (The first set of methods ininitDnD just parse URI...nothing interesting until the allowDrop/droppedHandler/addEvent methods)


// This will be called only once at startup.
    protected void onInitializeOnce() {
        super.onInitializeOnce();

        Document document = getContentDocument();
        BodyElement body = getBodyElement();
        initDnD(document, body);
    }

 private native void initDnD(Document document, Element elem) /*-{

        function strictEncodeURIComponent(string) {
            return encodeURIComponent(string).replace(/[!'()*]/g, escape);
        }

        encode = strictEncodeURIComponent;
        decode = decodeURIComponent;

        var parseURI = function (string) {
            var pos, t, parts = {};
            
            pos = string.indexOf('#');
            if (pos > -1) {
                // escaping?
                parts.fragment = string.substring(pos + 1) || null;
                string = string.substring(0, pos);
            }

            // extract query
            pos = string.indexOf('?');
            if (pos > -1) {
                // escaping?
                parts.query = string.substring(pos + 1) || null;
                string = string.substring(0, pos);
            }

            // extract protocol
            if (string.substring(0, 2) === '//') {
                // relative-scheme
                parts.protocol = '';
                string = string.substring(2);
                // extract "user:pass@host:port"
                string = parseURIAuthority(string, parts);
            } else {
                pos = string.indexOf(':');
                if (pos > -1) {
                    parts.protocol = string.substring(0, pos);
                    if (string.substring(pos + 1, pos + 3) === '//') {
                        string = string.substring(pos + 3);

                        // extract "user:pass@host:port"
                        string = parseURIAuthority(string, parts);
                    } else {
                        string = string.substring(pos + 1);
                        parts.urn = true;
                    }
                }
            }

            // what's left must be the path
            parts.path = string;

            // and we're done
            return parts;
        };
        var parseURIHost = function (string, parts) {
            // extract host:port
            var pos = string.indexOf('/'),
                    t;

            if (pos === -1) {
                pos = string.length;
            }

            if (string[0] === "[") {
                // I claim most client software breaks on IPv6 anyways. To simplify things, URI only accepts
                // IPv6+port in the format [2001:db8::1]:80 (for the time being)
                var bracketPos = string.indexOf(']');
                parts.hostname = string.substring(1, bracketPos) || null;
                parts.port = string.substring(bracketPos + 2, pos) || null;
            } else if (string.indexOf(':') !== string.lastIndexOf(':')) {
                // IPv6 host contains multiple colons - but no port
                // this notation is actually not allowed by RFC 3986, but we're a liberal parser
                parts.hostname = string.substring(0, pos) || null;
                parts.port = null;
            } else {
                t = string.substring(0, pos).split(':');
                parts.hostname = t[0] || null;
                parts.port = t[1] || null;
            }

            if (parts.hostname && string.substring(pos)[0] !== '/') {
                pos++;
                string = "/" + string;
            }

            return string.substring(pos) || '/';
        };
        var parseURIAuthority = function (string, parts) {
            string = parseURIUserinfo(string, parts);
            return parseURIHost(string, parts);
        };
        var parseURIUserinfo = function (string, parts) {
            // extract username:password
            var pos = string.indexOf('@'),
                    firstSlash = string.indexOf('/'),
                    t;

            // authority@ must come before /path
            if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) {
                t = string.substring(0, pos).split(':');
                parts.username = t[0] ? decode(t[0]) : null;
                parts.password = t[1] ? decode(t[1]) : null;
                string = string.substring(pos + 1);
            } else {
                parts.username = null;
                parts.password = null;
            }

            return string;
        };
        var parseURIQuery = function (string) {
            if (!string) {
                return {};
            }

            // throw out the funky business - "?"[name"="value"&"]+
            string = string.replace(/&+/g, '&').replace(/^\?*&*|&+$/g, '');

            if (!string) {
                return {};
            }

            var items = {},
                    splits = string.split('&'),
                    length = splits.length;

            for (var i = 0; i < length; i++) {
                var v = splits[i].split('='),
                        name = encodeURIQuery(v.shift()),
                // no "=" is null according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#collect-url-parameters
                        value = v.length ? decodeURIQuery(v.join('=')) : null;

                if (items[name]) {
                    if (typeof items[name] === "string") {
                        items[name] = [items[name]];
                    }

                    items[name].push(value);
                } else {
                    items[name] = value;
                }
            }

            return items;
        };
        var encodeURIQuery = function (string) {
            return encode(string + "").replace(/%20/g, '+');
        };
        var decodeURIQuery = function (string) {
            return decode((string + "").replace(/\+/g, '%20'));
        };

        function allowDrop(event) {
            if (event.stopPropagation) {
                event.stopPropagation();
            }
            if (event.preventDefault) {
                event.preventDefault();
            }
            return false;
        }

        function droppedHandler(event) {
            // Try to use the 'text' everytime.
            try {
                alert("event= " + event);
                var data = event.dataTransfer.getData("Text");
                alert("data=" + data);
                if (data != null && data != "") {
                    try {
                        var parsedURI = parseURI(data);
                        var urlParameters = parseURIQuery(parsedURI.query);
                        var appsrc = urlParameters['appsrc'];
                        if (appsrc != null && appsrc == "COREFX") {
                            try {
                                // For some versions of IE, need to do this to prevent duplicates.
                                event.dataTransfer.setData('Text', '');
                            }
                            catch (e) {
                            }

                            if (event.preventDefault) {
                                event.preventDefault();
                            }

                            var title = data;
                            if (urlParameters['title'] != null) {
                                title = urlParameters['title'];
                            }
                            var newContentWrapper = document.createElement('div');
                            newContentWrapper.setAttribute('draggable', true);
                            newContentWrapper.setAttribute('ondragstart', "dragStart(event)");

                            var newContent = document.createElement('a');
                            newContent.setAttribute('href', data);
                            newContent.setAttribute('class', "external_system");

                            if (urlParameters['icon'] != null) {
                                var icon = decodeURI(urlParameters['icon']);
                                var newContentIcon = document.createElement('img');
                                newContentIcon.setAttribute('src', icon);
                                newContent.appendChild(newContentIcon);
                            }

                            var newContentTitle = document.createTextNode(title);
                            newContent.appendChild(newContentTitle);

                            newContentWrapper.appendChild(newContent);
                            var targetElement = event.target || event.srcElement;
                            targetElement.appendChild(newContentWrapper);
                            return false;
                        }
                    }
                    catch (e) {
                    }
                }
            }
            catch (error) {
            }
            return true;
        }

        var addEvent = (function () {
            if (document.addEventListener) {
                return function (el, type, fn) {
                    if (el && el.nodeName || el === window) {
                        el.addEventListener(type, fn, false);
                    } else if (el && el.length) {
                        for (var i = 0; i < el.length; i++) {
                            addEvent(el[i], type, fn);
                        }
                    }
                };
            } else {
                return function (el, type, fn) {
                    if (el && el.nodeName || el === window) {
                        el.attachEvent('on' + type, function (eventParam) {
                            if (!eventParam) {
                                eventParam = window.event;
                            }
                            return fn.call(el, eventParam);
                        });
                    } else if (el && el.length) {
                        for (var i = 0; i < el.length; i++) {
                            addEvent(el[i], type, fn);
                        }
                    }
                };
            }
        })();
        addEvent(elem, 'drop', droppedHandler);
        addEvent(elem, 'dragover', allowDrop);
    }-*/;

--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.