Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Add getSourceChart() into IChartPanelMouseEvent
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=83&t=56040
Page 1 of 1

Author:  mtnfx [ Thu 04 Jan, 2018, 17:56 ]
Post subject:  Add getSourceChart() into IChartPanelMouseEvent

Hello,

I think following method is missing in
public interface IChartPanelMouseEvent {
    IChart getSourceChart();
}

Without such method there is no way in singleton (one per all charts) event handler to identify source chart of the event without tricks.
Can you add it in some of the future releases?

Author:  API Support [ Thu 11 Jan, 2018, 16:05 ]
Post subject:  Re: Add getSourceChart() into IChartPanelMouseEvent

Here is an example to get the chart object.
  
IChart chart = context.getChart(Instrument.EURUSD);
chart.addMouseListener(false, new ChartPanelMouseAdapter() {
        @Override
        public void mouseClicked(IChartPanelMouseEvent e) {
            super.mouseClicked(e);
            console.getOut().println(chart.getInstrument());
        }
});

Author:  mtnfx [ Thu 11 Jan, 2018, 16:18 ]
Post subject:  Re: Add getSourceChart() into IChartPanelMouseEvent

In this example I see chart it has no direct relevance to IChartPanelMouseEvent received in mouseClicked() event.

I was saying about singleton listener for all charts, e.g.
        ChartPanelMouseAdapter singletonChartListener = new ChartPanelMouseAdapter() {
            @Override
            public void mouseMoved(IChartPanelMouseEvent e) {
                IChart chart = e.getSourceChart();
            }
        };
        for( IChart chart : context.getCharts() ) {
            chart.addMouseListener(false, singletonChartListener);
        }

  Page 1 of 1