private void dispatchStep()

in cell/src/main/java/jetbrains/jetpad/cell/Cell.java [199:229]


  private <EventT extends Event> void dispatchStep(EventT e, CellEventSpec<EventT> spec) {
    if (spec == CellEventSpec.KEY_PRESSED || spec == CellEventSpec.KEY_RELEASED || spec == CellEventSpec.KEY_TYPED) {
      for (EventPriority p : EventPriority.values()) {
        for (CellTrait t : myCellTraits) {
          if (p == EventPriority.LOW) {
            if (spec == CellEventSpec.KEY_PRESSED) {
              t.onKeyPressedLowPriority(this, (KeyEvent) e);
            } else if (spec == CellEventSpec.KEY_RELEASED) {
              t.onKeyReleasedLowPriority(this, (KeyEvent) e);
            } else {
              t.onKeyTypedLowPriority(this, (KeyEvent) e);
            }
          } else {
            if (spec == CellEventSpec.KEY_PRESSED) {
              t.onKeyPressed(this, (KeyEvent) e);
            } else if (spec == CellEventSpec.KEY_RELEASED) {
              t.onKeyReleased(this, (KeyEvent) e);
            } else {
              t.onKeyTyped(this, (KeyEvent) e);
            }
          }
          if (e.isConsumed()) return;
        }
      }
    } else {
      for (CellTrait t : myCellTraits) {
        spec.dispatch(this, e, t);
        if (e.isConsumed()) return;
      }
    }
  }