Re: How to simulate a click for a GWT button using fireEvent
Hello Nantanael, You have provided GWT Java code. You might have misunderstood. I wish to fire the event in *JavaScript*, on the front-end. (The compiled code) I have no access to the GWT code. I simply want to manipulate the front end (The compiled code) What I am asking requires knowledge of how the GWT event bus operates in IE8. On Friday, 27 January 2017 12:49:06 UTC-5, Natanael Clara wrote: > > I have use this. > > this.getComo().addKeyPressHandler(new KeyPressHandler() { > @Override > public void onKeyPress(KeyPressEvent event) { > int teclado = event.getNativeEvent().getKeyCode(); > if ((teclado == KeyCodes.KEY_ENTER)) { > getEntrar().fireEvent(new GwtEvent() { > @Override > protected void dispatch(ClickHandler handler) { > handler.onClick(null); > } > > @Override > public > com.google.gwt.event.shared.GwtEvent.Type getAssociatedType() > { > return ClickEvent.getType(); > } > }); > > } > } > }); > > Em 26/01/2017 16:59, Privat escreveu: > > I am trying to simulate a mouse click event on GWT (Google Web Toolkit) > Application in *<=IE8* (using fireEvent, not dispatchEvent) > > A sample custom button can be found here: > http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCustomButton > (The toggle button is easiest to see if the click was processed) > > > The major boilerplate for simulating the click can be found here: > http://stackoverflow.com/a/6158050 (This is where I got the simulate > function used below) > > > I have been able to successfully simulate the click event by using the > following commands for *IE9+* (in this case simulate used dispatchEvent) > > > simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), > "mouseover"); > simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), > "mousedown"); > simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), > "mouseup"); > > > In my application the fireEvent fails, because GWT's $wnd.event is null. > (Line: 117, > https://github.com/stephenh/google-web-toolkit/blob/master/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java > ) > > > If there is no way to simulate the click with plain JS, then is there a > way to use GWT's EventDispatcher to simulate the click? > -- > You received this message because you are subscribed to the Google Groups > "GWT Users" 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-we...@googlegroups.com > . > Visit this group at https://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 "GWT Users" 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 https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: How to simulate a click for a GWT button using fireEvent
I have use this. this.getComo().addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { int teclado = event.getNativeEvent().getKeyCode(); if ((teclado == KeyCodes.KEY_ENTER)) { getEntrar().fireEvent(new GwtEvent() { @Override protected void dispatch(ClickHandler handler) { handler.onClick(null); } @Override public com.google.gwt.event.shared.GwtEvent.Type getAssociatedType() { return ClickEvent.getType(); } }); } } }); Em 26/01/2017 16:59, Privat escreveu: I am trying to simulate a mouse click event on GWT (Google Web Toolkit) Application in <=IE8 (using fireEvent, not dispatchEvent) A sample custom button can be found here: http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCustomButton (The toggle button is easiest to see if the click was processed) The major boilerplate for simulating the click can be found here: http://stackoverflow.com/a/6158050 (This is where I got the simulate function used below) I have been able to successfully simulate the click event by using the following commands for IE9+ (in this case simulate used dispatchEvent) simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseover"); simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mousedown"); simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseup"); In my application the fireEvent fails, because GWT's $wnd.event is null. (Line: 117, https://github.com/stephenh/google-web-toolkit/blob/master/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java) If there is no way to simulate the click with plain JS, then is there a way to use GWT's EventDispatcher to simulate the click? -- You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://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 "GWT Users" 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 https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
How to simulate a click for a GWT button using fireEvent
I am trying to simulate a mouse click event on GWT (Google Web Toolkit) Application in *<=IE8* (using fireEvent, not dispatchEvent) A sample custom button can be found here: http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCustomButton (The toggle button is easiest to see if the click was processed) The major boilerplate for simulating the click can be found here: http://stackoverflow.com/a/6158050 (This is where I got the simulate function used below) I have been able to successfully simulate the click event by using the following commands for *IE9+* (in this case simulate used dispatchEvent) simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseover"); simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mousedown"); simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseup"); In my application the fireEvent fails, because GWT's $wnd.event is null. (Line: 117, https://github.com/stephenh/google-web-toolkit/blob/master/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java ) If there is no way to simulate the click with plain JS, then is there a way to use GWT's EventDispatcher to simulate the click? -- You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
fireEvent
I realize this is a group for GWT and not any derivatives of such ... but this question may fit. I am using SmartGWT 2.x and I have some code that looks like this: final IButton refreshButton = new IButton(Refresh); refreshButton.setWidth(80); refreshButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //SC.say(refreshButton: clickEvent: event= + event.toDebugString()); myGrid.markForRedraw(); myGrid.invalidateCache(); myGrid.fetchData(); myGrid.redraw(); } }); When I click this button, the code internally works great. However attempts to get my grid to refresh calling those methods do not work. I'd like programatically have some code that would firethis event. such as: refreshButton.fireEvent(GWTEvent? event) However, I am not sure what I need in here and how to make this work. Could it be: refreshButton.fireEvent(new ClickEvent()); ? If anyone has any experience with this or SmartGWT grid refreshes, that'll be great. Thanks! BTW, I did look on the SmartGWT forums and saw the same question posted numerous times. Unfortunately, those guys aren't of much help.It wasn't my choice to use SmartGWT. Thanks again! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@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.
MooFlow, Gwt FireEvent on Both
Hey everyone, I want to integrate MooFlow external lib in my Gwt Application, so I begin by reading the essentials of JSNI and doing my things. So far it's OK, I create the Impl class to wrap the functions I need, I create also the JSObject and finally the widget itself (called CoverFlow). Now all I need is to add the possibility to catch the onClickView Event in my widget (java widget). With the implementation below, I can't see the HEY message when I click on an image, it sounds like the line: cfo.addEvent('onClickView', ... don't work in my Impl class !!! this is my Impl class public class CoverFlowImpl { public native CoverFlowScriptObject create(Element container, int startIndex, boolean useSlider) /*-{ var options = { useSlider: useSlider, useAutoPlay: false, useCaption: false, useResize: false, useWindowResize: false, useMouseWheel: true, useKeyInput: true, startIndex: startIndex }; var mf = new $wnd.MooFlow(container, options); return mf; }-*/; public native void loadJSON(CoverFlowScriptObject cfo, String json) / *-{ cfo.loadJSONArray(json); }-*/; public native void addClickViewHandler(CoverFlowScriptObject cfo, HasSelectedItemChanged handler) /*-{ cfo.addEvent('onClickView', function(obj){ alert('HEY'); //just to indicate if the event is fired var event = @com.audaxis.gwt.ui.coverflow.client.SelectedItemChangedEvent::new() (); handl...@com.google.gwt.event.shared.hashandlers::fireEvent(Lcom/ google/gwt/event/shared/GwtEvent;)(event); }; }-*/; } The Opaque JS Object public final class CoverFlowScriptObject extends JavaScriptObject{ private final static CoverFlowImpl impl = new CoverFlowImpl(); protected CoverFlowScriptObject() {} public static CoverFlowScriptObject createCoverFlow(Element container, int startIndex, boolean useSlider){ return impl.create(container, startIndex, useSlider); } public void laodJSON(String json){ impl.loadJSON(this, json); } public void addClickViewEvent(HasSelectedItemChanged handler){ impl.addClickViewHandler(this, handler); } } My Widget public class CoverFlow extends Composite implements HasSelectedItemChanged{ private Panel simplePanel; private CoverFlowScriptObject cvo; private CollectionCoverFlowItem items; public CoverFlow() { init(null); } protected void init(Panel parent){ simplePanel = parent != null ? parent : new SimplePanel(); cvo = getCoverFlowJSObject(); initWidget(simplePanel); } @Override public HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler) { cvo.addClickViewEvent(this); return addHandler(handler, SelectedItemChangedEvent.getType()); } } And finally ---HasSelectedItemChanged public interface HasSelectedItemChanged extends HasHandlers{ HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler); } Is my implementation correcte ? Is this the right implementation to fire events from JavaScript to Java ? Could anyone help me please !! Thanks in advance -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@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: MooFlow, Gwt FireEvent on Both
How do I to fire a Gwt event from JavaScript ? 2010/4/12 Elmaho elmaho...@gmail.com Hey everyone, I want to integrate MooFlow external lib in my Gwt Application, so I begin by reading the essentials of JSNI and doing my things. So far it's OK, I create the Impl class to wrap the functions I need, I create also the JSObject and finally the widget itself (called CoverFlow). Now all I need is to add the possibility to catch the onClickView Event in my widget (java widget). With the implementation below, I can't see the HEY message when I click on an image, it sounds like the line: cfo.addEvent('onClickView', ... don't work in my Impl class !!! this is my Impl class public class CoverFlowImpl { public native CoverFlowScriptObject create(Element container, int startIndex, boolean useSlider) /*-{ var options = { useSlider: useSlider, useAutoPlay: false, useCaption: false, useResize: false, useWindowResize: false, useMouseWheel: true, useKeyInput: true, startIndex: startIndex }; var mf = new $wnd.MooFlow(container, options); return mf; }-*/; public native void loadJSON(CoverFlowScriptObject cfo, String json) / *-{ cfo.loadJSONArray(json); }-*/; public native void addClickViewHandler(CoverFlowScriptObject cfo, HasSelectedItemChanged handler) /*-{ cfo.addEvent('onClickView', function(obj){ alert('HEY'); //just to indicate if the event is fired var event = @com.audaxis.gwt.ui.coverflow.client.SelectedItemChangedEvent::new() (); handl...@com.google.gwt.event.shared.hashandlers ::fireEvent(Lcom/ google/gwt/event/shared/GwtEvent;)(event); }; }-*/; } The Opaque JS Object public final class CoverFlowScriptObject extends JavaScriptObject{ private final static CoverFlowImpl impl = new CoverFlowImpl(); protected CoverFlowScriptObject() {} public static CoverFlowScriptObject createCoverFlow(Element container, int startIndex, boolean useSlider){ return impl.create(container, startIndex, useSlider); } public void laodJSON(String json){ impl.loadJSON(this, json); } public void addClickViewEvent(HasSelectedItemChanged handler){ impl.addClickViewHandler(this, handler); } } My Widget public class CoverFlow extends Composite implements HasSelectedItemChanged{ private Panel simplePanel; private CoverFlowScriptObject cvo; private CollectionCoverFlowItem items; public CoverFlow() { init(null); } protected void init(Panel parent){ simplePanel = parent != null ? parent : new SimplePanel(); cvo = getCoverFlowJSObject(); initWidget(simplePanel); } @Override public HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler) { cvo.addClickViewEvent(this); return addHandler(handler, SelectedItemChangedEvent.getType()); } } And finally ---HasSelectedItemChanged public interface HasSelectedItemChanged extends HasHandlers{ HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler); } Is my implementation correcte ? Is this the right implementation to fire events from JavaScript to Java ? Could anyone help me please !! Thanks in advance -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@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 post to this group, send email to google-web-tool...@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: MooFlow, Gwt FireEvent on Both
the function isn't recongnized in JS (I recieve the undefined exception) !! line: cfo.addEvent('onClickView', function(obj){ }) Is there any solution On 12 avr, 11:49, Elmaho elmaho...@gmail.com wrote: Hey everyone, I want to integrate MooFlow external lib in my Gwt Application, so I begin by reading the essentials of JSNI and doing my things. So far it's OK, I create the Impl class to wrap the functions I need, I create also the JSObject and finally the widget itself (called CoverFlow). Now all I need is to add the possibility to catch the onClickView Event in my widget (java widget). With the implementation below, I can't see the HEY message when I click on an image, it sounds like the line: cfo.addEvent('onClickView', ... don't work in my Impl class !!! this is my Impl class public class CoverFlowImpl { public native CoverFlowScriptObject create(Element container, int startIndex, boolean useSlider) /*-{ var options = { useSlider: useSlider, useAutoPlay: false, useCaption: false, useResize: false, useWindowResize: false, useMouseWheel: true, useKeyInput: true, startIndex: startIndex }; var mf = new $wnd.MooFlow(container, options); return mf; }-*/; public native void loadJSON(CoverFlowScriptObject cfo, String json) / *-{ cfo.loadJSONArray(json); }-*/; public native void addClickViewHandler(CoverFlowScriptObject cfo, HasSelectedItemChanged handler) /*-{ cfo.addEvent('onClickView', function(obj){ alert('HEY'); //just to indicate if the event is fired var event = @com.audaxis.gwt.ui.coverflow.client.SelectedItemChangedEvent::new() (); handl...@com.google.gwt.event.shared.hashandlers::fireEvent(Lcom/ google/gwt/event/shared/GwtEvent;)(event); }; }-*/; } The Opaque JS Object public final class CoverFlowScriptObject extends JavaScriptObject{ private final static CoverFlowImpl impl = new CoverFlowImpl(); protected CoverFlowScriptObject() {} public static CoverFlowScriptObject createCoverFlow(Element container, int startIndex, boolean useSlider){ return impl.create(container, startIndex, useSlider); } public void laodJSON(String json){ impl.loadJSON(this, json); } public void addClickViewEvent(HasSelectedItemChanged handler){ impl.addClickViewHandler(this, handler); } } My Widget public class CoverFlow extends Composite implements HasSelectedItemChanged{ private Panel simplePanel; private CoverFlowScriptObject cvo; private CollectionCoverFlowItem items; public CoverFlow() { init(null); } protected void init(Panel parent){ simplePanel = parent != null ? parent : new SimplePanel(); cvo = getCoverFlowJSObject(); initWidget(simplePanel); } @Override public HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler) { cvo.addClickViewEvent(this); return addHandler(handler, SelectedItemChangedEvent.getType()); } } And finally ---HasSelectedItemChanged public interface HasSelectedItemChanged extends HasHandlers{ HandlerRegistration addSelectedItemChanged(SelectedItemChangedHandler handler); } Is my implementation correcte ? Is this the right implementation to fire events from JavaScript to Java ? Could anyone help me please !! Thanks in advance -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@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.