static BaseCellMapper createMapper()

in cell/src/main/java/jetbrains/jetpad/cell/toDom/CellMappers.java [24:66]


  static BaseCellMapper<?> createMapper(Cell source, CellToDomContext ctx) {
    if (source instanceof TextCell) {
      return new TextCellMapper((TextCell) source, ctx);
    }

    if (source instanceof HorizontalCell) {
      return new HorizontalCellMapper((HorizontalCell) source, ctx  );
    }

    if (source instanceof VerticalCell) {
      return new VerticalCellMapper((VerticalCell) source, ctx);
    }

    if (source instanceof ScrollCell) {
      return new ScrollCellMapper((ScrollCell) source, ctx);
    }

    if (source instanceof ImageCell) {
      return new ImageCellMapper((ImageCell) source, ctx);
    }

    if (source instanceof IndentCell) {
      IndentCell cell = (IndentCell) source;
      if (!cell.isRootIndent()) {
        throw new IllegalStateException();
      }
      return new IndentRootCellMapper(cell, ctx);
    }

    if (source instanceof RootCell) {
      return new RootCellMapper((RootCell) source, ctx);
    }

    if (source instanceof DomCell) {
      return new DomCellMapper((DomCell) source, ctx);
    }

    if (source instanceof ViewCell) {
      return new ViewCellMapper((ViewCell) source, ctx);
    }

    return new DefaultCellMapper(source, ctx);
  }