Search in sources :

Example 11 with ChartGestureEvent

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

the class ChartGestureMouseAdapter method mousePressed.

@Override
public void mousePressed(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.PRESSED))
        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
        lastDragEvent = new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.PRESSED, button));
        handleEvent(lastDragEvent);
    }
}
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 12 with ChartGestureEvent

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

the class ChartGestureMouseAdapterFX method handleMousePressed.

/**
 * Handles a mouse pressed event. This implementation does nothing, override the method if
 * required.
 *
 * @param canvas the canvas ({@code null} not permitted).
 * @param e the event ({@code null} not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas chartPanel, MouseEvent eOrig) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.PRESSED))
        return;
    MouseEventWrapper e = new MouseEventWrapper(eOrig);
    ChartEntity entity = findChartEntity(e);
    ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
    Button button = Button.getButton(e.getButton());
    // handle event
    lastDragEvent = new ChartGestureEvent(cw, e, entity, new ChartGesture(gestureEntity, Event.PRESSED, button));
    handleEvent(lastDragEvent);
}
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 13 with ChartGestureEvent

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

the class ChartGestureMouseAdapter method mouseEntered.

@Override
public void mouseEntered(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.ENTERED))
        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.ENTERED, 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 14 with ChartGestureEvent

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

the class ChartGestureMouseAdapter method mouseDragged.

@Override
public void mouseDragged(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.DRAGGED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        // keep the same chartEntity
        ChartEntity entity = lastDragEvent.getEntity();
        ChartGesture.Entity gestureEntity = lastDragEvent.getGesture().getEntity();
        Button button = lastDragEvent.getGesture().getButton();
        // handle event
        lastDragEvent = new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.DRAGGED, button));
        handleEvent(lastDragEvent);
    }
}
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