Skip to content

Instantly share code, notes, and snippets.

@gbougeard
Created May 1, 2012 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbougeard/2568230 to your computer and use it in GitHub Desktop.
Save gbougeard/2568230 to your computer and use it in GitHub Desktop.
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