GMaps controls broken in GWT 1.6+? - gwt

I've ported my GWT app to 1.7.0 from 1.5.2 and widgets that are used as a control on a GoogleMap no longer get ClickEvents. I've checked that the DOM insertion of the control is the same and there are no differences there. Since GWT 1.6 introduced a significant change in the way events are handled I'm thinking something has gone amis there.
I use a GWT image as a a GoogleMaps control:
Image control = new Image("/oeg/images/info_32.png");
Which I place on the map using the Mapitz GMaps lib (yes I know its old, but I have kept supporting a working version that is updated - if anyone is interested just ask)
GControlPosition infoPosition =
new GControlPosition(GControlAnchor.G_ANCHOR_TOP_RIGHT(),
new GSize(7, 30));
getGmap().addControl(new GControl(control, infoPosition));
I've checked the compiled code and it literally just puts the html element on the map as a GControl just the way you'd expect and as I said I've checked the DOM to make sure nothing looks funny.
to get ClickEvents I used to do this...
control.addClickListener(new ClickListener() {
public void onClick(Widget sender)
{
doTipOfTheDay();
}
});
which I changed to this in the 1.6.0 world,
control.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent ce)
{
doTipOfTheDay();
}
});
I've also tried explicitly sinking the click event with
control.sinkEvents(Event.ONCLICK);
but none of this works in GWT-1.6.0/1.7.0 and it all worked fabulously in 1.5.2
Can anyone shed some light on this? Has anyone else run into event issues w/ controls on GMaps with GWT 1.6 and above?
FYI with other Gmaps objects I have no problems. I'm getting mouse clicks on the map surface, on markers etc.
but controls, not so much

Related

mouseenter event does not working for gwt celltable

I have one celltable and I need to add handler on its row for "mouseenter" event.
I have tried something like following, but its not working for "mouseenter" althought it works for "mouseover".
cellTable.addCellPreviewHandler(new CellPreviewEvent.Handler<Test>(){
#Override
public void onCellPreview(CellPreviewEvent<Test> event) {
if ("mouseenter".equals(event.getNativeEvent().getType())){
Window.alert("mouse entered");
}
}
});
Is not working properly for mouseenter events because apparently is only implemented by IE and Opera, since you're Chrome, you can just wait until they implement it.
Unfortunately Firefox, Chrome, and Safari still haven’t copied this brilliant Microsoft invention, that has even made it to the spec. Come on, guys!
From this source.

Change opacity of a TreeItem

I have a server and client using gwt.
In my client page i have a tree item displayed.
I want to do one of the following:
- disable the tree item when a function is called.
- made opaque the entire client page or only the tree item when a function is called.
By made opaque, i want to do the same as occur when i debug my project with eclipse and i stop and i get the following in the client page
GWT Code Server Disconnected
Most likely, you closed GWT Development Mode. Or, you might have lost network connectivity. To fix this, try restarting GWT Development Mode and REFRESH this page.
Please give me some indication on how to do it and if it is possible.
you create a handler for you function call(s) and add the style when the funciton is called. Because GWT works with javascript it changes your appearance during runtime.
item.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
event.getItem().setStyleName("newStyle");
}
});
and in the css you define you style:
newStyle: {
...
your style definition
}

Dragging and dropping something onto an xna window?

I have an XNA4 wndow set up and was wondering if I could get it to accept drag+drop actions, what I envision is someone grabs a jpeg and drags it into the window, upon release of the mouse an event is fired off with a string pointing to the jpeg.
Is this doable and if so how?
First, here is a link to a tutorial on doing this with a windows form:
http://support.microsoft.com/kb/307966
and here is a link to a post about doing just this (answer is past a few posts saying that it's impossible):
http://forums.create.msdn.com/forums/p/4020/20419.aspx
finally here is some code for ease of access (you need a reference to the System.Windows.Forms namespace):
protected override void Initialize()
{
Form gameForm = (Form)Form.FromHandle(Window.Handle);
gameForm.AllowDrop = true;
gameForm.DragEnter += new DragEventHandler(gameForm_DragEnter);
gameForm.DragDrop += new DragEventHandler(gameForm_DragDrop);
}
Also, it seems it's possible to run a game inside a Form control as of XNA 2
While I recognise that this is many years too late here is a direct link to a working demo.
The SLN might not want to autoload but you can just drop it into VS2013 and it will update it. I was getting a "licencing" popup when I tried to just run the SLN.
Hope this helps anyone who might still be working on this.
http://geekswithblogs.net/mikebmcl/archive/2011/03/27/drag-and-drop-in-a-windows-xna-game.aspx

FileUpload.reset() has different behavior for IE, Chrome

I tried to create a fileUploader with GWT.
Here is the problem, while I was adding ChangeHandler to fileUploader, I found that the behavior of IE and Chrome are different. If I choose the same file I uploaded, IE will trigger the onChange(), while Chrome won't. That's too weird. Can anybody tells me if it is a bug of GWT of not??
FileUpload fileUploader = new FileUpload();
fileUploader.addChangeHandler(new ChangeHandler(){
#Override
public void onChange(ChangeEvent event)
{
submitButton.setEnabled(true);
}
});
There are browser discrepancies that GWT cannot hide. The only mean to really reset a FileUpload in a cross-browser way, is to create a new one to replace the previous instance.

GWT need to know how to connect to.. or go from one page to another

im new to GWT ive been working on it since recently..
i want to know how can i go from "entry point page" ie,ImageViewer.java..
ive been suggested to create the memory by calling constructor on a perticular button
Button button = new Button("New button");
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event)
{
new LookupMaster(); //this is a composite
}
});
but this is not working.. i guess v can only call or get alert messages using this type..
can some one help me.
I'm not sure how to answer, since I have the feeling you're not understanding the basic concepts totally, but that's just my interpretation.
GWT is one html page that via JavaScript methods changes the content of that one page. When you want to display 'another' page you need to do this via methods that update the html dynamically. Since you are just starting with GWT, you might want to read this page on Build User Interfaces to understand the concepts and look at some examples provided with GWT.