Search in sources :

Example 1 with Project

use of model.Project in project uPMT by coco35700.

the class Main method start.

public void start(Stage primaryStage) throws IOException {
    loadProperties();
    initProjects();
    createBasicSchema();
    /*if(!projects.isEmpty()){
			currentProject = projects.getFirst();
			//System.out.println(currentProject.getSchemaProjet());
		}
		else {
			currentProject = new Projet("projetTMP", new Schema("SchemaTemporaire"));
		}*/
    currentProject = new Project("--emptyProject--", new Schema("SchemaTemporaire"));
    this.primaryStage = primaryStage;
    this.primaryStage.setTitle(_langBundle.getString("main_title"));
    // Launching layouts
    initRootLayout();
    showLaunchingScreen();
}
Also used : Project(model.Project) Schema(model.Schema)

Example 2 with Project

use of model.Project in project uPMT by coco35700.

the class Main method initProjects.

/**
 * Method used to load all the projects
 */
private void initProjects() {
    this.projects = new LinkedList<Project>();
    LoadDataProjects dc = LoadDataProjects.instance();
    dc.setProjets(projects);
    if (Utils.checkRecovery()) {
        this.mainViewController.alertRecovery();
    }
    Utils.loadProjects(projects, this);
}
Also used : Project(model.Project) LoadDataProjects(utils.LoadDataProjects)

Example 3 with Project

use of model.Project in project uPMT by coco35700.

the class Utils method loadProjects.

public static void loadProjects(LinkedList<Project> projects, Main main) {
    HashSet<String> projectNames = loadProjectsNames();
    if (projectNames.isEmpty()) {
    // For debug purposes
    // System.out.println("No projects to load");
    } else {
        System.out.println("Loading projects");
        for (String s : projectNames) {
            if (s.contains(Project.FORMAT)) {
                // projects.add(Projet.load(s));
                Project p = Project.loadData(s);
                if (p == null) {
                    Alert alert = new Alert(AlertType.CONFIRMATION);
                    // alert.setTitle("Error, version conflict");
                    alert.setTitle(main._langBundle.getString("error_version"));
                    // alert.setHeaderText("Your saves are in conflict with this new version.");
                    alert.setHeaderText(main._langBundle.getString("error_version_text_alarm"));
                    // alert.setContentText("Please contact us in the github repository.");
                    alert.setContentText(main._langBundle.getString("error_version_text_contact"));
                    Optional<ButtonType> result = alert.showAndWait();
                    if (result.get() == ButtonType.OK) {
                        alert.close();
                    } else {
                        alert.close();
                    }
                } else
                    projects.add(p);
            }
        }
    }
}
Also used : Project(model.Project) Alert(javafx.scene.control.Alert) ButtonType(javafx.scene.control.ButtonType)

Example 4 with Project

use of model.Project in project uPMT by coco35700.

the class NewProjectDialogController method createProject.

public void createProject() {
    Project p = new Project(nomProjet.getText(), this.choixSchema.getValue());
    p.getSchema().setName(nomProjet.getText());
    main.setProjectInCreation(p);
    // main.getProjects().add(p);
    // main.setCurrentProject(p);
    // p.save();
    window.close();
    launchingScreenWindow.close();
// in case the center was set to null because of automatic interview Creation
/*if (main.getRootLayout().getCenter() == null) {
			main.launchMainView();
		}*/
// main.launchMainView();
// main.refreshDataTreeView();
// main.needToSave();
}
Also used : Project(model.Project)

Example 5 with Project

use of model.Project in project uPMT by coco35700.

the class NewProjectDialogController method initialize.

@Override
public void initialize(URL location, ResourceBundle resources) {
    // TODO Auto-generated method stub
    choixSchema.getItems().add(main.getDefaultSchema());
    for (Project p : main.getProjects()) {
        choixSchema.getItems().add(p.getSchema());
    }
    // change the text to make it pretty
    choixSchema.setConverter(new StringConverter<Schema>() {

        @Override
        public String toString(Schema object) {
            // TODO Auto-generated method stub
            return object.getName();
        }

        @Override
        public Schema fromString(String string) {
            // TODO Auto-generated method stub
            return new Schema(string);
        }
    });
    choixSchema.setValue(main.getDefaultSchema());
}
Also used : Project(model.Project) Schema(model.Schema)

Aggregations

Project (model.Project)5 Schema (model.Schema)2 Alert (javafx.scene.control.Alert)1 ButtonType (javafx.scene.control.ButtonType)1 LoadDataProjects (utils.LoadDataProjects)1