/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * This class generates a bigger preview with detailled information
 *
 * @author Celine To
 */
package com.sudoku.grid.preview;

import com.sudoku.data.manager.UserManager;
import com.sudoku.data.model.Comment;
import com.sudoku.data.model.Grid;
import com.sudoku.data.model.Tag;
import com.sudoku.data.model.User;
import com.sudoku.grid.gridcells.IhmGridLines;
import com.sudoku.grid.manager.IhmGridLayout;
import java.util.ArrayList;
import java.util.List;
import javafx.geometry.Insets;
import javafx.scene.layout.BorderPane;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

public class IhmGridDetailledPreview extends IhmGridLayout {

  protected final BorderPane border;

  public IhmGridDetailledPreview(Grid g, int size) {

    super(IhmGridLines.ALL_VIEW.add(IhmGridLines.FIT_GRID), g, size);

    // retrieve grid's name, grid creator's pseudo, tags, and first comment to display
    Grid gr = g;
    String gridTitle = gr.getTitle();
    String userPseudo = "test pseudo"; //gr.getCreateUser().getPseudo();
    List<Tag> tags = gr.getTags();
    List<String> tagsNames = new ArrayList<String>();
    for (Tag tag : tags) {
      tagsNames.add(tag.getName());
    }
    List<Comment> comments = gr.getComments();
    String comment1 = comments.get(1).getComment();

    border = new BorderPane();
    getChildren().add(border);
    border.setPadding(new Insets(20.0, 20.0, 20.0, 20.0));

    VBox topVBox = new VBox();
    //topVBox.setAlignment(Pos.CENTER);
    // Amount of vertical space between each child in the vbox
    topVBox.setSpacing(5);
    topVBox.getChildren().add(new Label("titre : " + gridTitle));
    topVBox.getChildren().add(new Label("user's pseudo : " + userPseudo));
    topVBox.getChildren().add(gridLines);
    topVBox.getChildren().add(new Label("tags : " + tagsNames.toString()));
    topVBox.getChildren().add(new Label("comments : " + comment1));
    border.setCenter(topVBox);

  }

}

@@ -804,16 +804,48 @@
 t.VBox;%0D
+%0Aimport javafx.scene.text.Font;%0D
 %0A%0D%0Apubli
@@ -1245,21 +1245,28 @@
 o = 
-%22test p
+gr.getCreateP
 seudo
-%22
+()
 ; //
@@ -1531,12 +1531,88 @@
 ment
-1 = 
+Stream=%22%22;%0D%0A    for(int i=0;i%3Ccomments.size();i++)%0D%0A        commentStream= %22- %22+
 comm
@@ -1620,17 +1620,17 @@
 nts.get(
-1
+i
 ).getCom
@@ -1635,16 +1635,21 @@
 omment()
++%22%5Cn%22
 ;%0D%0A%0D%0A   
@@ -1916,62 +1916,28 @@
     
-topVBox.setSpacing(5);%0D%0A    topVBox.getChildren().add(
+%0D%0A    Label Titre = 
 new 
@@ -1943,17 +1943,17 @@
  Label(%22
-t
+T
 itre : %22
@@ -1969,84 +1969,451 @@
 tle)
-)
 ;%0D%0A    
-topVBox.getChildren().add(new Label(%22user's pseudo : %22 + userPseudo)
+Label Utilisateur = new Label(%22Utilisateur : %22 + userPseudo) ; %0D%0A    Label LesTags= new Label(%22Tags : %22 + tagsNames.toString());%0D%0A    Label LesCommentaires = new Label(%22Commentaires %5Cn%5Cn %22 + commentStream);%0D%0A    Titre.setFont(Font.font(%22Verdana%22, 13));%0D%0A    Utilisateur.setFont(Font.font(%22Verdana%22, 13));%0D%0A    LesTags.setFont(Font.font(%22Verdana%22, 13));%0D%0A    LesCommentaires.setFont(Font.font(%22Verdana%22, 13));%0D%0A%0D%0A    topVBox.setSpacing(5
 );%0D%0A
@@ -2446,17 +2446,13 @@
 add(
-gridLines
+Titre
 );%0D%0A
@@ -2485,51 +2485,103 @@
 add(
-new Label(%22tags : %22 + tagsNames.toString())
+Utilisateur);%0D%0A    topVBox.getChildren().add(gridLines);%0D%0A    topVBox.getChildren().add(LesTags
 );%0D%0A
@@ -2614,43 +2614,23 @@
 add(
-new Label(%22comments : %22 + c
+LesC
 omment
-1)
+aires
 );%0D%0A

Fix Comments bug.