Re: Firing a click event on a CellTable

2013-06-30 Thread Sergey Kovin
similar case:

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;

.

protected CellList contactList;



contactList.addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent evt) {
evt.preventDefault();
final NativeEvent event = evt.getNativeEvent();

final NativeEvent newEvent = Document.get().createClickEvent(-1,
event.getScreenX(), event.getScreenY(), event.getClientX(), 
event.getClientY(),
event.getCtrlKey(), event.getAltKey(), event.getShiftKey(), 
event.getMetaKey());

DOM.eventGetTarget(Event.as(event)).dispatchEvent(newEvent);
}

}, ContextMenuEvent.getType());

...
But :  contactList.getElement().dispatchEvent(newEvent);
instead of : DOM.eventGetTarget(Event.as(event)).dispatchEvent(newEvent);
- not working...

So, i think, you correctly create native event, but you send them to 
incorrect target.


пятница, 31 мая 2013 г., 12:04:10 UTC+6 пользователь Chris написал:

 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:

 CellTableArtist cellTable = (CellTableArtist) 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:

 CellTableArtist cellTable = (CellTableArtist) 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Firing a click event on a CellTable

2013-06-30 Thread Kartik Suba
Hey, Chris

There are surely click event on the cells, but instead of handlers there 
are field updaters. You may take the example of the Clickable Cell where if 
you click on the cell its onBrowseEvent gets called which in turn calls the 
field updater. So the only thing you have to do is override the 
functionality of the field updater and associate it with the Column of the 
cell table. 

For your case i think ClickableCell can work as it is or may be you may 
have to override its functionality to handle Cell Preview Events.

Please revert if you find the info helpful or in case of any issues.

On Friday, 31 May 2013 11:34:10 UTC+5:30, Chris wrote:

 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:

 CellTableArtist cellTable = (CellTableArtist) 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:

 CellTableArtist cellTable = (CellTableArtist) 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Firing a click event on a CellTable

2013-05-31 Thread Chris
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:

CellTableArtist cellTable = (CellTableArtist) 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:

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