\documentclass{article}

\usepackage{pgfextra}
\usepackage{pgfuml}
\usepackage{MnSymbol}

\begin{document}

\begin{tikzpicture}
  \begin{scope}[thick]
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test](0,10){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator 
      tutu 
    }
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=1](5,10){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator 
      tutu 
    }
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=2](10,10){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator 
      tutu 
    }
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=3](0,5){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator 
      tutu 
    }
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=4](5,5){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator 
      tutu 
    }
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=4](10,5){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
      \separator[extra]
      tutu 
    }
  \end{scope}
\end{tikzpicture}

\newpage



\begin{tikzpicture}
  \umlclass[name=TutuTutuTutuTutuTutuTutu,label=tutu](0,0){}

  \umlclass[name=Tata,label=tata,abstract](5,0){}

  \umlclass[label=titi,width=4cm,name height=2cm](5,5){}
  \draw[<->] ([yshift=1mm]titi.north west) -- +(4,0);
  \draw (titi.north west) -- +(0,1);
  \draw (titi.north east) -- +(0,1);

  \umlclass[name=TT,width=2.5cm](0,5){}

  \umlclass[name=xTTTTx,param=E,name height=2cm,label=l](10,0){}
  \draw (l.east) -- (l.west);

  \umlclass[name=A class name,label=un label,interface,name font=\sf\tiny](10,5){}

  \umlclass[name=A class name,label=un autre label,interface,name font=\large,stereotype={Un test \tabularnewline A \tabularnewline B\tabularnewline C \tabularnewline D}](10,10){a}

  \begin{scope}[thick]
    \umlclass[name=A class name,label=encore un autre label,stereotype=Un test,parts=3](5,10){
      avec des attributs\\
      a1\\
      a2
      \separator 
      tutu 
    }
  \end{scope}

  \draw (tutu) -- (tata);

  \draw (tutu) -- (titi);
\end{tikzpicture}

\newpage

\begin{tikzpicture}[font=\footnotesize,remember picture]
  \umlclass[name=Model,label=m](1,4){
    + addView(View)\\
    + removeView(View)\\
    \marknode[fill=blue!30]{nv}{\# notifyViews()}
  }
  \umlclass[name=View,label=v,interface](7.5,4){
    \marknode{synchro}{+ synchro(Model)}
  }
  \umlclass[name=ButtonListener,label=bl](1,1){
    + ButtonListener(Controller)\\
    \marknode{ap}{+ actionPerformed(ActionEvent)}
  }
  \umlclass[name=Controller,label=c,interface](7.5,1){
    \marknode{e}{+ event(String)}
  }
%  \umlasso[name end={\scriptsize views},arity end=\textasteriskcentered](m)(v)
%  \umlasso[name end={\scriptsize controller},arity end=1](bl)(c)
    \begin{scope}[red,->,overlay,line width=1pt]
      \draw (nv.east) -- (synchro.west);
      \draw (ap.east) -- (e.west);
    \end{scope}
\end{tikzpicture}

\newpage


\begin{tikzpicture}[remember picture,font=\small]
  \umlclass[name=BankAccount,label=class,parts=3](9,1) {
    - first : String\\
    - last : String\\
    - balance : float 
    \separator
    \marknode{constr}{+ BankAccount(String,String,float)}\\
    + BankAccount(String,String)\\
    + getBalance() : float\\
    + deposit(float)\\
  }%
  \draw ([yshift=1.5cm,xshift=-2.75cm]class.north) node {
    \texttt{BankAccount} \marknode{var}{\texttt{anAccount}} \texttt{= new} \marknode{const}{\texttt{BankAccount("Fabien", "Dagnat", 1000);}}
  };
  \begin{scope}[color=brown]
    \umlclass[name={ : BankAccount},label=obj,width=2.4cm](0.5,1) {
      \color{red}"Fabien"\\
      \color{red}"Dagnat"\\
      \color{red}1000\\
    }%
    \draw[line width=0.8pt,-stealth] ([xshift=-2.5cm]const.south) --  node[above,pos=0.6] {(1)} ([xshift=-1cm]class.north);
    \draw[line width=0.8pt,-stealth] (class.attribute west) -- ([yshift=2mm]obj.east);
    \draw[dashed] (obj.south) |-  ([yshift=-2cm]class.west) node[below,pos=0.65] {\footnotesize L'objet conserve un lien sur sa classe};
  \end{scope}
  \begin{scope}[line width=0.8pt,color=red]
    \draw ([yshift=-0.1cm]const.south west) -- node[coordinate] (middle) {} ([yshift=-0.1cm]const.south east);
    \draw (constr) node[draw,ellipse,minimum width=7cm,minimum height=0.8cm] (ellipse) {};
    \draw[stealth-] (ellipse) -- node[right,pos=0.8] {(2)} (middle);
    \draw[line width=0.8pt,-stealth] (ellipse.west) -- ([yshift=-2mm]obj.east);
  \end{scope}
  \begin{scope}[color=green]
    \draw[line width=0.8pt,-stealth] (obj.north) -- node[above left] {(3)} (var.south);
    \draw[dashed,-stealth] ([yshift=-1mm]var.south).. controls (2.4,3.5) and (1.8,3.3) .. (obj.north);%
  \end{scope}
\end{tikzpicture}  

\newpage
\begin{tikzpicture}[>=stealth,remember picture]
  \umlclass[name=Pigeon,label=pigeon,parts=3](1,1) {
    \separator
    \marknode{pc}{Pigeon(\ldots)}
  }%
  \umlclass[name=Oiseau,label=oiseau,parts=3](1,4) {
    \separator
    \marknode{oc}{Oiseau(\ldots)}
  }%
  \umlclass[name=Animal,label=animal,parts=3](1,7) {
    \separator
    \marknode{ac}{Animal(\ldots)}
  }%
  \umlclass[name={ : Pigeon},label=po,parts=4](7,4) {
    \separator
    \separator[extra]
    \\
  }%
  \umlinherit(oiseau)(animal)
  \umlinherit(pigeon)(oiseau)
  \begin{scope}[color=blue!70]
  %  \umlasso[dashed,inv route,name=$\filledmedtriangleleft$ est instance de,name pos=below left](pigeon)(po)
  \end{scope}
  \begin{scope}[line width=0.8pt,->,color=black!50]
    \draw (pigeon.attribute east) -- (po.extra west);
    \draw (oiseau.attribute east) -- (po.method west);
    \draw (animal.attribute east) -- (po.attribute west);
  \end{scope}
  \begin{scope}[line width=1pt,->,red,overlay]
    \draw (po) -- node[below] {(1)} (pc.east);
    \draw ([xshift=-2mm,yshift=1mm]pc.north) -- node[left,pos=0.6] {(2)} ([xshift=-2mm,yshift=-1mm]oc.south);
    \draw ([xshift=-2mm,yshift=1mm]oc.north) -- node[left,pos=0.6] {(3)} ([xshift=-2mm,yshift=-1mm]ac.south);
    \draw ([xshift=-1.6cm]ac) node {(4)};
    \draw ([xshift=2mm,yshift=-1mm]ac.south) -- node[right,pos=0.4] {(5)} ([xshift=2mm,yshift=1mm]oc.north);
    \draw ([xshift=-1.6cm]oc) node {(6)};
    \draw ([xshift=2mm,yshift=-1mm]oc.south) -- node[right,pos=0.4] {(7)} ([xshift=2mm,yshift=1mm]pc.north);
    \draw ([xshift=-1.6cm]pc) node {(8)};
  \end{scope}
\end{tikzpicture}

\newpage
\begin{tikzpicture}[font=\scriptsize,color=black]
  \umlclass[interface,name=Iterable,param=T,label=iterable](2.5,5.4){
    + iterator() : Iterator<T>\\
  }%
  \umlclass[interface,name=Iterator,param=T,label=iterator](8.3,5.4){
    + hasNext() : boolean\\
    + next() : T \\
    {\color{gray}(+ remove())} \\
  }%
  \umlclass[name=MyList,param=T,label=myList,width=10cm,parts=3](5.5,2){
    - content : T[]
    \separator%
    + iterator() : Iterator<T>\\
    \\\\\\\\\\\\\\
  }%
  \umlclass[name=Itr,param=T,label=itr,parts=3](8.3,1.6){
    - cursor : int
    \separator%
    + hasNext() : boolean\\
    + next() : T \\
    {\color{gray}(+ remove())} \\
  }%
  \draw[dashed,-open triangle 45] (myList.north) ++(-3,0) -- node {\textit{implements}} (iterable);
  \draw[dashed,-open triangle 45] (itr.north) -- node[pos=0.7] {\textit{implements}} (iterator);
\end{tikzpicture}

%\debug{\keyList}
\newpage
\pgfkeys{/width/.code={\pgfkeys{/pgf/minimum width=#1}}}
\newcommand{\mynode}[2][]{\pgfkeys{#1,/pgfuml/class shape/parts=3,/pgfuml/class shape/part align={center, left,right}}\node[class shape,draw ,outer xsep=0pt,inner sep=4pt] (s){#2}}
\begin{tikzpicture}
  \mynode[width=4.75cm]{
    Student 
    \nodepart{attribute} 
    a\\
    n\\
    t
    \nodepart{method} 
    ggggggg\\
    g
  };

  \draw ([yshift=1mm]s.north west) -- +(4.75,0);

  \foreach \anchor/\placement in { text/left, text east/above, text
    west/above,attribute/left, attribute east/above, attribute west/above,
    method/left, method east/below, method west/below , text split/left,
    text split east/above, text split west/above,
     attribute split/left, attribute split east/above, attribute split west/above, 
     method split/left, method split east/below, method split west/below, 
     north/above, south/below, east/below, west/below,
     center/above, mid/above, base/below,
     north west/above, north east/above, south west/below, south east/below
  } 
  \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} node {}; 
\end{tikzpicture}

\renewcommand{\mynode}[2][]{\pgfkeys{#1,/pgfuml/class shape/parts=3}\node[class shape,draw ,outer xsep=0pt,inner sep=4pt,minimum height=10cm] (s){#2}}
\begin{tikzpicture}
  \mynode[width=4.75cm]{
    Student 
    \nodepart{attribute} 
    a\\
    n\\
    t
    \nodepart{method} 
    gggggggggggggggggggggggggggggggg\\
    g
  };
\end{tikzpicture}

\begin{tikzpicture}
  \node[class shape,class parts=3,draw, minimum width=2.75cm]{
    Student 
    \nodepart{attribute} 
    age:int \\
    name:String \\
    tutu
    \nodepart{method} 
    getAge():int \\ 
    getName():String
  };
\end{tikzpicture}
\begin{tikzpicture}
  \node[class shape,class parts=3, draw, text width=2.75cm]{
    Student 
    \nodepart{attribute} 
    age:int \\
    name:String \\
    tutu
    \nodepart{method} 
    getAge():int \\ 
    getName():Stringgggg ggggggggggg
  };
\end{tikzpicture}

\end{document}
