Created
May 1, 2012 14:20
-
-
Save gbougeard/2568230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void init(){ | |
// Mode création, on crée une nouvelle Formation | |
current = new Formation(); | |
// On initialise le nombre des FormationItem à positionner | |
// On est parti pour du foot à 11, mais on pourrait très bien faire du foot à 7 voire du rugby à XV | |
current.setFormationItemList(new ArrayList<FormationItem>()); | |
// par défaut on met numItem == coord | |
for (int i = 1; i <= 11; i++) { | |
FormationItem item = new FormationItem(); | |
item.setNumItem(i); | |
item.setCoord(i); | |
item.setFormation(current); | |
current.getFormationItemList().add(item); | |
} | |
// On créé la grille | |
lstTarget = new ArrayList<CanvasFormationItem>(); | |
for (int i = 1; i <= 30; i++) { | |
CanvasFormationItem item = new CanvasFormationItem(); | |
item.setStrIdx(String.format("%d", i)); | |
// On associe le FormationItem qui a le coord correspondant | |
if (current != null && current.getFormationItemList() != null) { | |
for (FormationItem fi : current.getFormationItemList()) { | |
if (fi.getCoord().equals(Integer.valueOf(i))) { | |
item.setFormationItem(fi); | |
break; | |
} | |
} | |
} | |
lstTarget.add(item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment