It is all about the MVP paradigm recomended by Google when using GWT. If I return an instance of PieChart to the presenter then I am breaking the paradigm since the presenter is not supposed to know whether it is a PieChart, a Button, a PushButton, etc. that has the MouseOver/Out events.
Thank you for your answer. Xavier On 8 mayo, 14:55, MC Get Vizzy <[email protected]> wrote: > I'm not an expert on the subtleties of GWT event handling. Implementing the > MouseOver and MouseOut interfaces sounds like it might be a good idea, and > you're welcome to add it to our issue tracker > (http://code.google.com/p/google-visualization-api-issues/issues/list). But > I don't understand why your getChart() method doesn't just return a PieChart > object. > > sorry I couldn't be more helpful, > > MC Get Vizzy > > > > > > > > On Tue, May 3, 2011 at 5:15 PM, xgumara <[email protected]> wrote: > > Hi, > > > I'm using GWT Visualization API in a GWT project with a MVP pattern. > > The problem is that I cannot add OnMouseOver/OnMouseOut events to the > > charts in the Presenter (where I should handle events) because they do > > not implement HasOnMouseOverHandlers/HasOnMouseOutHandlers. Let me > > explain: > > > In the presenter I would like to do: > > > (using variable name "display" as the view) > > > display.getChart().addOnMouseOutHandler(new OnMouseOutHandler(){ > > > @Override > > public void onMouseOutEvent(OnMouseOutEvent event) { > > // TODO Auto-generated method stub > > > } > > > }); > > > And the same for the onMouseOverHandler. > > > But I can't since CoreChart(s) do not implement HasMouseOutHandlers/ > > HasMouseOverHandlers. So the only thing I can do is: > > > com.google.gwt.visualization.client.visualizations.corechart.PieChart > > chart; > > > public com.google.gwt.event.shared.HasHandlers getChart(){ > > return chart; > > } > > > HasHandlers does not have onMouseOutEvent and onMouseOverEvent. > > > Charts also implement > > com.google.gwt.event.logical.shared.HasAttachHandlers > > com.google.gwt.event.shared.HasHandlers > > com.google.gwt.user.client.EventListener > > com.google.gwt.user.client.ui.IsWidget, > > Selectable (that works for onSelect events) > > > Any ideas in how I could solve this? And more important, shouldn't > > PieChart and others CoreChart implement HasMouseOutHandlers and > > HasMouseOverHandlers instead of just HasHandlers? > > > Thank you. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Visualization API" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/google-visualization-api?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
