#770 SWT ChartMouseListener

closed
None
5
2007-07-04
2007-06-23
No

Hi,

The ChartComposite class is missing methods

addChartMouseListener(ChartMouseListener listener) and
removeChartMouseListener(ChartMouseListener listener).

Would be great if this could be fixed in version 1.2.

Thanks for supporting SWT,

Christoph

Discussion

  • Henry Proudhon

    Henry Proudhon - 2007-07-03

    Logged In: YES
    user_id=1379312
    Originator: NO

    Hi Christoph,

    sorry for taking long to reply. Do you mean passing actual instances of jfree ChartMouseListener to the ChartComposite (they are based on non-swt events in the end) or creating ths SWT equivalent of say the ChartMouseListener interface and implements the two methods. In the first case I do not see the use of passing awt events to the swt composite.

    Now with the second case, I have been wondering about this for some time and have been reluctant to do it (I mean duplicate code). An alternative would be to use SWT wrapper like toSwtEvent(an awt event) and toAwtEvent(an swt event) but I'm not sure if we can achieve great things here.

    If you can post a test case to see the use of the two methods, it would help...

     
  • Henry Proudhon

    Henry Proudhon - 2007-07-03
    • assigned_to: nobody --> nenry
     
  • Christoph Beck

    Christoph Beck - 2007-07-04

    Logged In: YES
    user_id=219413
    Originator: YES

    Hi,
    as the jfreechart api is full of awt, I would not mind about the awt
    event inside the ChartMouseEvent.
    The ChartComposite class already maintains an event listener list.

    I'm attaching a modified SWTPieChartDemo1.java which allows for slice
    selection via mouse.

    To make it work you need to add the following to ChartComposite:

    public void addChartMouseListener(ChartMouseListener listener) {
    chartMouseListeners.add(ChartMouseListener.class, listener);
    }

    public void removeChartMouseListener(ChartMouseListener listener) {
    chartMouseListeners.remove(ChartMouseListener.class, listener);
    }

    File Added: SWTPieChartDemo1.java

     
  • Henry Proudhon

    Henry Proudhon - 2007-07-04
    • status: open --> closed
     
  • Henry Proudhon

    Henry Proudhon - 2007-07-04

    Logged In: YES
    user_id=1379312
    Originator: NO

    You're right the SWT mouse event are already transformed into AWT ones and passed to the listeners. The only thing missing was to be able to setup the actual listener.
    Thanks for the demo, it really helped me to see the problem here.

    PS I've left your piece of code in the pie chart demo.

     

Log in to post a comment.