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();
}
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);
}
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);
}
}
}
}
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();
}
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());
}
Aggregations