Re: HTML 5 native dragover event of DataGrid cell never fired

2012-07-11 Thread Miltos Miltiadou
Hi, can you post the sample code for setting the effectAllowed and 
dropEffect via JSNI?

Thanks in advance.
Miltos

On Friday, June 22, 2012 2:33:07 PM UTC+3, js wrote:
>
> Hi,
>
> actually I have the effectAllowed and dropEffect set via JSNI.
>
> Actually I have already figured out what the problem was: I did not 
> setData() on DataTransfer object. As you also suggested. (Yep, asking a 
> question helps to figure out the answer :)
> Anyway thanks for your reply.
>
> *TL;TR *Solution is to set any data to DataTransfer object of dragstart 
> event. e.g. event.getDataTransfer().setData("text", "anything")
>
>
> On Friday, June 22, 2012 12:58:25 PM UTC+2, Thomas Broyer wrote:
>>
>> To properly initiate a drag, you have to set the effectAllowed.
>> http://dev.w3.org/html5/spec/dnd.html#introduction-7
>> It looks like you'll to use JSNI though, as this property is not exposed 
>> by GWT on the DataTransfer object.
>> Or maybe it's just because you didn't call setData() in your Cell 
>> (event.getDataTransfer().setData("text", "test"))
>>
>>
>> On Friday, June 22, 2012 12:27:43 PM UTC+2, js wrote:
>>>
>>> Hi,
>>>
>>> I've been having hard time trying to make DataGrid rows sortable with 
>>> HTML 5 native drag and drop.
>>> I have custom Cell which sinks drag events (see below). If I drag the 
>>> cell dragstart event is fired but visualization of drag operation is not 
>>> displayed. Moreover dragover event on other cells in DataGrid is also never 
>>> fired, which I think is cause of the missing visualization of drag 
>>> operation. It seems like that drag&drop operation is not initialized 
>>> properly.
>>>
>>> I've tried to create test Label (see below) for which everything works 
>>> OK, i.e. when dragged dragstart is fired (on Label object). When dragged 
>>> over Datagrid cells the dragover events are fired on cell's object, even 
>>> drop event is properly fired.
>>>
>>> I suspect DataGrid widget that it swallows the event somewhere in it's 
>>> onBrowserEvent() but I wasn't able to find the place where it happens.
>>>
>>> Does anybody has an idea what's wrong here or what do I do wrong?
>>>
>>> public class DraggableTextCell extends AbstractCell
>>> {
>>> public DraggableTextCell() 
>>> {
>>> super(
>>> "dragstart",
>>> "drag",
>>> "dragover",
>>> "drop"
>>> );
>>> }
>>>
>>> @Override
>>> public void render(
>>> final Context context,
>>> final String value,
>>> final SafeHtmlBuilder sb
>>> )
>>> {
>>> sb.append(mTemplates.textCell(value));
>>> }
>>>
>>> @Override
>>> public void onBrowserEvent(
>>> final Context context,
>>> final Element parent,
>>> final String value,
>>> final NativeEvent event,
>>> final ValueUpdater valueUpdater
>>> )
>>> {
>>> final String eventType = event.getType();
>>> if (eventType.equals("dragstart"))
>>> {
>>> log.info("dragStart");
>>> }
>>> else if (eventType.equals(DragEvent.DRAG.nativeType()))
>>> {
>>> log.info("drag");
>>> }
>>> else if (eventType.equals(DragEvent.DRAG_OVER.nativeType()))
>>> {
>>> log.info("dragOver");
>>> }
>>> else if (eventType.equals(DragEvent.DROP.nativeType()))
>>> {
>>> event.preventDefault();
>>> event.stopPropagation();
>>> log.info("drop");
>>> }
>>> }
>>> }
>>>
>>>
>>> /* Test label */
>>> final Label l = new Label("Draggable");
>>> l.getElement().setDraggable(Element.DRAGGABLE_TRUE);
>>> l.addDragStartHandler(new DragStartHandler() {
>>> @Override
>>> public void onDragStart(final DragStartEvent event)
>>> {
>>> event.setData("text", "test");
>>> }
>>> });
>>>
>>

-- 
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/-/k3Zpy8Hl3Z4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: UiBinder Maps

2012-03-29 Thread Miltos Miltiadou
Hi Nicolas, did you find any solution with this issue. I am facing the same 
problem. Please post your solution, if you find any!

Thanks Miltos.

On Friday, September 30, 2011 10:03:48 PM UTC+3, Nicolas wrote:
>
> Hi I'm trying to use Google Maps in my project so I add 
>  
> in the gwt.xml file. I use deferred binding for create the UI and the 
> View.ui.xml file's code is: 
> http://dl.google.com/gwt/DTD/xhtml.ent";> 
>  xmlns:g="urn:import:com.google.gwt.user.client.ui" 
> xmlns:p1="urn:import:com.google.gwt.user.cellview.client" 
> xmlns:p2="urn:import:com.google.gwt.maps.client"> 
>
>  
> .important { 
> font-weight: bold; 
> } 
>  
>  
>
>  
>  
>
> The View.java file's code is: 
> import com.google.gwt.core.client.GWT; 
> import com.google.gwt.maps.client.MapWidget; 
> import com.google.gwt.uibinder.client.UiBinder; 
> import com.google.gwt.uibinder.client.UiField; 
> import com.google.gwt.user.client.ui.Composite; 
> import com.google.gwt.user.client.ui.Widget; 
> import com.google.gwt.user.client.ui.VerticalPanel; 
> import com.google.gwt.user.client.ui.Label; 
> import com.google.gwt.user.client.ui.MenuBar; 
> import com.google.gwt.user.cellview.client.CellTable; 
>
> public class View extends Composite { 
>
> private static ViewUiBinder uiBinder = GWT 
> .create(ViewUiBinder.class); 
> @UiField VerticalPanel rootPanel; 
> @UiField MapWidget map; 
>
> interface ViewUiBinder extends UiBinder { 
> } 
>
> public View() { 
> initWidget(uiBinder.createAndBindUi(this)); 
> } 
> } 
>
> The problem is when i switch from the code view to the design view 
> elipse show me this error: 
> Error loading module(s). 
>
> GWT Designer can't load a module because of error in gwt.xml module 
> description, incorrect resource which requires processing with GWT 
> generator or by some other configuration error. 
>
> Please check your $project_dir/.gwt/.gwt-log for GWT-specific errors. 
>
> This log has the following error messages: 
>
>
>
> [ERROR] Failed to create an instance of 
> 'com.google.gwt.maps.client.MapWidget' via deferred binding 
>
>
> Show stack trace. 
> Hide stack trace. 
>
> Stack trace: 
> org.eclipse.wb.internal.core.utils.exception.DesignerException: 4108 
> (Error loading module(s).). 
> [ERROR] Failed to create an instance of 
> 'com.google.gwt.maps.client.MapWidget' via deferred binding. 
>
> The Google Maps API's version is gwt-maps-1.1.1-rc1.jar. 
>
> I would like to know what I doing wrong.?? 
> Is the Google Maps API version the lastest version?? 
>
> Thanks.

-- 
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/-/mteCtD5gFFsJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.