  We prove that every poset with bounded cliquewidth and with sufficiently
large dimension contains the standard example of dimension $k$ as a subposet.
This applies in particular to posets whose cover graphs have bounded treewidth,
as the cliquewidth of a poset is bounded in terms of the treewidth of the cover
graph. For the latter posets, we prove a stronger statement: every such poset
with sufficiently large dimension contains the Kelly example of dimension $k$
as a subposet. Using this result, we obtain a full characterization of the
minor-closed graph classes $\mathcal{C}$ such that posets with cover graphs in
$\mathcal{C}$ have bounded dimension: they are exactly the classes excluding
the cover graph of some Kelly example. Finally, we consider a variant of poset
dimension called Boolean dimension, and we prove that posets with bounded
cliquewidth have bounded Boolean dimension.
  The proofs rely on Colcombet's deterministic version of Simon's factorization
theorem, which is a fundamental tool in formal language and automata theory,
and which we believe deserves a wider recognition in structural and algorithmic
graph theory.
