Search in sources :

Example 1 with MomentExpVBox

use of controller.MomentExpVBox in project uPMT by coco35700.

the class MainViewTransformations method allMomentsToString.

public static String allMomentsToString(Main main) {
    String ret = "Tous les moments: {\n";
    for (Node n : main.getGrid().getChildren()) {
        try {
            MomentExpVBox m = (MomentExpVBox) n;
            ret += m.toString();
        } catch (ClassCastException e) {
        }
    }
    ret += "}";
    return ret;
}
Also used : Node(javafx.scene.Node) MomentExpVBox(controller.MomentExpVBox)

Example 2 with MomentExpVBox

use of controller.MomentExpVBox in project uPMT by coco35700.

the class MainViewTransformations method getMomentVBoxByMoment.

public static MomentExpVBox getMomentVBoxByMoment(MomentExperience e, Main main) {
    MomentExpVBox ret = null;
    int i = 0;
    for (Node n : main.getGrid().getChildren()) {
        if (ret != null)
            break;
        try {
            MomentExpVBox m = (MomentExpVBox) n;
            if (m.getMoment().equals(e)) {
                ret = m;
                break;
            } else {
                if (!m.getSousMomentPane().getChildren().isEmpty()) {
                    ret = getMomentVBoxByMomentFromParent(m, e, main);
                }
            }
        }// Si exception alors c'est un panel
         catch (ClassCastException exc) {
        }
    }
    return ret;
}
Also used : Node(javafx.scene.Node) MomentExpVBox(controller.MomentExpVBox)

Example 3 with MomentExpVBox

use of controller.MomentExpVBox in project uPMT by coco35700.

the class MainViewTransformations method loadSousMoment.

public static void loadSousMoment(MomentExpVBox mev, Main main) {
    if (mev.getChildren().size() == 1) {
        mev.getChildren().add(mev.getSousMomentPane());
    }
    // Ajout >
    if (mev.getMoment().getSubMoments().size() > 0) {
        ColumnConstraints cP = new ColumnConstraints();
        /*cP.setMinWidth(PANELSIZE);
			cP.setPrefWidth(PANELSIZE);
			cP.setMaxWidth(PANELSIZE);*/
        cP.setPrefWidth(Control.USE_COMPUTED_SIZE);
        cP.setMaxWidth(Control.USE_COMPUTED_SIZE);
        mev.getSousMomentPane().getColumnConstraints().add(cP);
        DropPane p = new DropPane(mev, 0, DropPane.PANELSIZE, main);
        addPaneOnDragListener(p, main);
        mev.getSousMomentPane().add(p, mev.getSousMomentPane().getColumnConstraints().size() - 1, 0);
    }
    int i = 0;
    for (MomentExperience m : mev.getMoment().getSubMoments()) {
        i++;
        MomentExpVBox tmp = new MomentExpVBox(main);
        tmp.setMoment(m);
        tmp.setVBoxParent(mev);
        tmp.showMoment();
        tmp.LoadMomentData();
        ColumnConstraints c = new ColumnConstraints();
        mev.getSousMomentPane().getColumnConstraints().add(c);
        mev.getSousMomentPane().add(tmp, mev.getSousMomentPane().getColumnConstraints().size() - 1, 0);
        // Ajout>
        ColumnConstraints cP = new ColumnConstraints();
        /*cP.setMinWidth(PANELSIZE);
			cP.setPrefWidth(PANELSIZE);
			cP.setMaxWidth(PANELSIZE);*/
        cP.setPrefWidth(Control.USE_COMPUTED_SIZE);
        cP.setMaxWidth(Control.USE_COMPUTED_SIZE);
        mev.getSousMomentPane().getColumnConstraints().add(cP);
        // <
        DropPane p = new DropPane(mev, i, DropPane.PANELSIZE, main);
        addPaneOnDragListener(p, main);
        mev.getSousMomentPane().add(p, mev.getSousMomentPane().getColumnConstraints().size() - 1, 0);
        MainViewTransformations.addBorderPaneMomentListener(tmp, main);
        loadTypes(tmp, main);
        loadSousMoment(tmp, main);
    }
}
Also used : ColumnConstraints(javafx.scene.layout.ColumnConstraints) DropPane(controller.DropPane) MomentExperience(model.MomentExperience) MomentExpVBox(controller.MomentExpVBox)

Example 4 with MomentExpVBox

use of controller.MomentExpVBox in project uPMT by coco35700.

the class MainViewTransformations method loadGridData.

// private static int PANELSIZE = 20;
// Method used to load the grid related to a certain Interview
public static void loadGridData(GridPane grid, Main main, DescriptionInterview d) {
    // Grid initialisation ( reset )
    grid.getChildren().clear();
    grid.getColumnConstraints().clear();
    for (int j = 0; j < d.getNumberOfMoments(); j++) {
        // System.out.println("On ajoute deux colonnes, "+d.getNumberOfMoments());
        ColumnConstraints c = new ColumnConstraints();
        // c.setMinWidth(PANELSIZE);
        // c.setPrefWidth(PANELSIZE);
        // c.setMaxWidth(PANELSIZE);
        c.setPrefWidth(Control.USE_COMPUTED_SIZE);
        c.setMaxWidth(Control.USE_COMPUTED_SIZE);
        grid.getColumnConstraints().add(c);
        ColumnConstraints c2 = new ColumnConstraints();
        c2.setMinWidth(180);
        c2.setPrefWidth(Control.USE_COMPUTED_SIZE);
        c2.setMaxWidth(Control.USE_COMPUTED_SIZE);
        grid.getColumnConstraints().add(c2);
    }
    // Ajout de la colonne de fin
    ColumnConstraints c = new ColumnConstraints();
    c.setMinWidth(180);
    c.setPrefWidth(180);
    c.setMaxWidth(180);
    grid.getColumnConstraints().add(c);
    for (int i = 0; i < 1; i++) {
        for (int j = 0; j < d.getNumberOfMoments(); j++) {
            // System.out.println("On ajoute un panel");
            // Creation of the Moment box
            // if(j>=d.getNumberOfMoments()-1)width=180;
            DropPane p = new DropPane(j, DropPane.PANELSIZE, main);
            /*p.setPrefWidth(PANELSIZE);
				p.setMaxWidth(PANELSIZE);
				p.setMinWidth(PANELSIZE);*/
            p.setPrefWidth(Control.USE_COMPUTED_SIZE);
            p.setMaxWidth(Control.USE_COMPUTED_SIZE);
            p.setPrefHeight(200);
            p.setMinHeight(200);
            // p.setStyle("-fx-background-color:black;");
            addPaneOnDragListener(p, main);
            grid.add(p, j * 2, i);
            // System.out.println("On ajoute un moment");
            // System.out.println("J'ajoute un moment � "+j);
            MomentExpVBox mp = new MomentExpVBox(main);
            addBorderPaneMomentListener(mp, main);
            MomentExperience mom;
            boolean hasMoment = false;
            if (main.getCurrentDescription() != null) {
                for (MomentExperience m : d.getMoments()) {
                    // System.out.println(m.getNom()+" est � "+m.getGridCol()+" et j est � "+j);
                    if (m.getGridCol() == j) {
                        mom = m;
                        mp.setMoment(mom);
                        hasMoment = true;
                    }
                }
            }
            if (hasMoment) {
                mp.showMoment();
                mp.LoadMomentData();
                loadTypes(mp, main);
                loadSousMoment(mp, main);
            }
            grid.add(mp, (j * 2) + 1, i);
        }
    }
    DropPane p = new DropPane(d.getNumberOfMoments(), DropPane.DRAGGEDPANELSIZE, main);
    /*p.setPrefWidth(180);
		p.setMaxWidth(180);
		p.setMinWidth(180);*/
    p.setPrefHeight(200);
    p.setMinHeight(200);
    // p.setStyle("-fx-background-color:black;");
    addPaneOnDragListener(p, main);
    grid.add(p, d.getNumberOfMoments() * 2, 0);
    if (d.getNumberOfMoments() == 0) {
        p.emptyProjectPane();
    }
}
Also used : ColumnConstraints(javafx.scene.layout.ColumnConstraints) DropPane(controller.DropPane) MomentExperience(model.MomentExperience) MomentExpVBox(controller.MomentExpVBox)

Aggregations

MomentExpVBox (controller.MomentExpVBox)4 DropPane (controller.DropPane)2 Node (javafx.scene.Node)2 ColumnConstraints (javafx.scene.layout.ColumnConstraints)2 MomentExperience (model.MomentExperience)2