Search in sources :

Example 1 with DropPane

use of controller.DropPane 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 2 with DropPane

use of controller.DropPane 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

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