Search in sources :

Example 1 with PreviewMouseListener

use of org.gephi.preview.spi.PreviewMouseListener in project gephi by gephi.

the class PreviewModelImpl method prepareManagedListeners.

private void prepareManagedListeners() {
    ArrayList<PreviewMouseListener> listeners = new ArrayList<>();
    for (PreviewMouseListener listener : Lookup.getDefault().lookupAll(PreviewMouseListener.class)) {
        for (Renderer renderer : getManagedEnabledRenderers()) {
            if (renderer instanceof MouseResponsiveRenderer) {
                if (((MouseResponsiveRenderer) renderer).needsPreviewMouseListener(listener) && !listeners.contains(listener)) {
                    listeners.add(listener);
                }
            }
        }
    }
    //First listeners to receive events will be the ones coming from last called renderers.
    Collections.reverse(listeners);
    enabledMouseListeners = listeners.toArray(new PreviewMouseListener[0]);
}
Also used : PreviewMouseListener(org.gephi.preview.spi.PreviewMouseListener) MouseResponsiveRenderer(org.gephi.preview.spi.MouseResponsiveRenderer) Renderer(org.gephi.preview.spi.Renderer) MouseResponsiveRenderer(org.gephi.preview.spi.MouseResponsiveRenderer)

Aggregations

MouseResponsiveRenderer (org.gephi.preview.spi.MouseResponsiveRenderer)1 PreviewMouseListener (org.gephi.preview.spi.PreviewMouseListener)1 Renderer (org.gephi.preview.spi.Renderer)1