PDA

View Full Version : Override Browser Context Menu?



anton_ds
27 Aug 2009, 9:36 PM
Hello forum Members and GXT Developers Team.

I need to replace Browser Context menu with my own GXT Menu in all application, on all controls except Field Childs. on Field's parented controls I need standart browser menu.

Now i'm trying to use add NativePreviewHandler interface like in code below:



CChangePassword extends Window implements NativePreviewHandler {
...............................
public CChangePassword() {
setModal(true);
Event.addNativePreviewHandler(this);
}
...............................
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
System.out.println(event.getTypeInt());

}


It's work fine on Layouts and content panels but on ModalWindow i'm getting a Error:


00:17:33,685 [ERROR] Uncaught exception escaped java.lang.NullPointerException: null at kz.csd.journal.commons.client.CChangePassword$2.handleEvent(CChangePassword.java:80) at kz.csd.journal.commons.client.CChangePassword$2.handleEvent(CChangePassword.java:1) at com.extjs.gxt.ui.client.event.BaseObservable.callListener(BaseObservable.java:176) at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:96) at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:444) at com.extjs.gxt.ui.client.widget.form.Field.onBlur(Field.java:1048) at com.extjs.gxt.ui.client.widget.form.TextField.onBlur(TextField.java:405) at com.extjs.gxt.ui.client.widget.form.Field.onComponentEvent(Field.java:600) at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:760) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1322) at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1305) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1266) at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:67) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:146) at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1235) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:153) at java.lang.Thread.run(Unknown Source)

Can anyone help me with it?

P.S. My attributes:
GWT build is 2.0
GXT is 2.0.1
Platform is Windows XP SP3
Hosted Browser is FireFox with OOPHM

anton_ds
28 Aug 2009, 1:39 AM
Same problem with this code:



@Override
public void onBrowserEvent(Event event) {
System.out.println("df");
}


I think it's some kind of bug?? Or missing something??

Arno.Nyhm
31 Aug 2009, 12:53 AM
NOTE:

1:1 duplicate of this question:

onPreviewNativeEvent bug?
http://extjs.com/forum/showthread.php?t=78933