Search in sources :

Example 6 with ChartGestureEvent

use of net.sf.mzmine.chartbasics.gestures.ChartGestureEvent in project mzmine2 by mzmine.

the class ChartGestureMouseAdapterFX method handleMouseReleased.

/**
 * @param canvas the canvas ({@code null} not permitted).
 * @param e the event ({@code null} not permitted).
 */
@Override
public void handleMouseReleased(ChartCanvas chartPanel, MouseEvent eOrig) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.RELEASED))
        return;
    MouseEventWrapper e = new MouseEventWrapper(eOrig);
    ChartEntity entity = findChartEntity(e);
    ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
    Button button = Button.getButton(e.getButton());
    // last gesture was dragged? keep the same chartEntity
    if (lastDragEvent != null) {
        entity = lastDragEvent.getEntity();
        gestureEntity = lastDragEvent.getGesture().getEntity();
    }
    // handle event
    handleEvent(new ChartGestureEvent(cw, e, entity, new ChartGesture(gestureEntity, Event.RELEASED, button)));
    // reset drag
    lastDragEvent = null;
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) MouseEventWrapper(net.sf.mzmine.chartbasics.gui.wrapper.MouseEventWrapper) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 7 with ChartGestureEvent

use of net.sf.mzmine.chartbasics.gestures.ChartGestureEvent in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseWheelMoved.

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.MOUSE_WHEEL))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.MOUSE_WHEEL, button)));
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 8 with ChartGestureEvent

use of net.sf.mzmine.chartbasics.gestures.ChartGestureEvent in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseExited.

@Override
public void mouseExited(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.EXITED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.EXITED, button)));
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 9 with ChartGestureEvent

use of net.sf.mzmine.chartbasics.gestures.ChartGestureEvent in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseReleased.

@Override
public void mouseReleased(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.RELEASED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // last gesture was dragged? keep the same chartEntity
        if (lastDragEvent != null) {
            entity = lastDragEvent.getEntity();
            gestureEntity = lastDragEvent.getGesture().getEntity();
        }
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.RELEASED, button)));
        // reset drag
        lastDragEvent = null;
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 10 with ChartGestureEvent

use of net.sf.mzmine.chartbasics.gestures.ChartGestureEvent in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseMoved.

@Override
public void mouseMoved(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.MOVED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.MOVED, button)));
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Aggregations

ChartGesture (net.sf.mzmine.chartbasics.gestures.ChartGesture)14 Button (net.sf.mzmine.chartbasics.gestures.ChartGesture.Button)14 Entity (net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity)14 ChartGestureEvent (net.sf.mzmine.chartbasics.gestures.ChartGestureEvent)14 ChartEntity (org.jfree.chart.entity.ChartEntity)14 ChartPanel (org.jfree.chart.ChartPanel)8 MouseEventWrapper (net.sf.mzmine.chartbasics.gui.wrapper.MouseEventWrapper)6 ChartViewWrapper (net.sf.mzmine.chartbasics.gui.wrapper.ChartViewWrapper)1