/** Captures this interaction in the specified capture mode. Depending on the mode, subsequent * events will go only to the current layer, or that layer and its parents, or that layer and * its children. Other layers in the interaction will receive a cancellation event and nothing * further. */ public void capture (CaptureMode mode) { assert dispatchLayer != null; if (canceled) throw new IllegalStateException("Cannot capture canceled interaction."); if (capturingLayer != dispatchLayer && captured()) throw new IllegalStateException( "Interaction already captured by " + capturingLayer); capturingLayer = dispatchLayer; captureMode = mode; notifyCancel(capturingLayer, captureMode, event); }