/** * @see Behavior#processStimulus(Enumeration) Behavior.processStimulus */ @Override public void processStimulus(final Enumeration criteria) { /* if(!univ.ui.isHandTool() && !univ.ui.isMagnifierTool() && !univ.ui.isPointTool()) { wakeupOn(wakeupCriterion); return; } */ while (criteria.hasMoreElements()) { final WakeupOnAWTEvent wakeup = (WakeupOnAWTEvent) criteria.nextElement(); final AWTEvent[] events = wakeup.getAWTEvent(); for (final AWTEvent evt : events) { if (evt instanceof MouseEvent) doProcess((MouseEvent) evt); if (evt instanceof KeyEvent) doProcess((KeyEvent) evt); } } wakeupOn(wakeupCriterion); }
public void addInteractiveBehavior(final InteractiveBehavior b) { if (null == mouseBehavior) { setInteractiveBehavior(b); return; } List<InteractiveBehavior> ls = mouseBehavior.getExternalBehaviors(); if (null == ls) { ls = new ArrayList<InteractiveBehavior>(); mouseBehavior.setExternalBehaviours(ls); } ls.add(b); }
/** * @deprecated This method should not be used any more from outside this * class. Use addInteractiveBehavior() instead. */ @Deprecated public void setInteractiveBehavior(final InteractiveBehavior b) { if (mouseBehavior != null) scene.removeChild(mouseBehavior.getParent()); mouseBehavior = b; mouseBehavior.setSchedulingBounds(bounds); final BranchGroup bg = new BranchGroup(); bg.setCapability(BranchGroup.ALLOW_DETACH); bg.addChild(mouseBehavior); scene.addChild(bg); }
b.doProcess(e); if (e.isConsumed()) return; if (shouldTranslate(mask)) { if (c != null && !c.isLocked()) contentTransformer.translate(e); else viewTransformer.translate(e); e.consume(); else if (shouldRotate(mask)) { if (c != null && !c.isLocked() && e.consume(); else if (shouldZoom(mask)) { viewTransformer.zoom(e); e.consume(); else if (shouldMovePoint(mask)) { picker.movePoint(c, e); e.consume();
/** * Handle the alt arrow mouse events for zooming here because the * superclass does not do anything: zoom(1) * * @param ke the key event, e.g., arrow up. */ @Override protected void doProcess(KeyEvent ke) { if (ke.isAltDown()) { int code = ke.getKeyCode(); switch (code) { case KeyEvent.VK_UP: viewTransformer.zoomTo(.9); return; case KeyEvent.VK_DOWN: viewTransformer.zoomTo(1.1); return; } } else { super.doProcess(ke); } }
@Override public void cleanup() { UniverseSettings.save(); if (win != null) { fireUniverseClosed(); while (!listeners.isEmpty()) listeners.remove(0); final ImageWindow3D win2 = win; win = null; if (null != mouseBehavior) mouseBehavior.setExternalBehaviours(null); } // Flush native resources used by this universe: super.removeAllLocales(); super.cleanup(); }
contentTransformer = new ContentTransformer(this, this); picker = new Picker(this); setInteractiveBehavior(new InteractiveBehavior(this));
if(!e.isControlDown() || e.getID() != MouseEvent.MOUSE_PRESSED) { super.doProcess(e); return;