use of controller.controller.TypeController in project uPMT by coco35700.
the class MainViewController method initialize.
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
Image image = ResourceLoader.loadImage("momentIcon.png");
this.ajoutMomentButton.setImage(image);
if (!main.getCurrentProject().getInterviews().isEmpty()) {
main.setCurrentDescription(main.getCurrentProject().getInterviews().getFirst());
}
treeViewSchema.setEditable(true);
treeViewInterview.setEditable(true);
treeViewSchema.setCellFactory((TreeView<TypeController> t) -> new TypeTreeView(main));
treeViewInterview.setCellFactory((TreeView<DescriptionInterview> t) -> new InterviewTreeView(main));
TreeItem<TypeController> Schemaroot;
TreeItem<DescriptionInterview> Interviewroot;
Schemaroot = new TreeItem<TypeController>();
Interviewroot = new TreeItem<DescriptionInterview>();
Schemaroot.getChildren().add(SchemaTransformations.SchemaToTreeView(main.getCurrentProject().getSchema()));
Interviewroot.getChildren().add(SchemaTransformations.EntretienToTreeView(main.getCurrentProject().getInterviews()));
treeViewSchema.setRoot(Schemaroot);
treeViewSchema.setShowRoot(false);
treeViewInterview.setRoot(Interviewroot);
treeViewInterview.setShowRoot(false);
main.setTreeViewSchema(treeViewSchema);
main.setTreeViewInterview(treeViewInterview);
if (main.getCurrentDescription() != null) {
// Give time to end initializing the scheme on the left
Platform.runLater(new Runnable() {
@Override
public void run() {
for (DescriptionInterview d : main.getCurrentProject().getInterviews()) {
GridPane gp = new GridPane();
gp.setMinHeight(200);
gp.setPadding(new Insets(100, 0, 0, 0));
addLinesToGrid(gp);
main.setGrid(gp);
MainViewTransformations.loadGridData(gp, main, d);
interviewsPane.put(d, gp);
}
updateGrid();
}
});
}
ajoutMomentButton.setOnDragDetected(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
// TODO Auto-generated method stub
if (main.getCurrentDescription() != null) {
Dragboard db = ajoutMomentButton.startDragAndDrop(TransferMode.ANY);
ClipboardContent content = new ClipboardContent();
content.putString("ajoutMoment");
content.putRtf("Moment Vide");
db.setContent(content);
}
}
});
if (main.getCurrentDescription() != null)
setDroppableText(main.getCurrentDescription().getDescripteme().getTexte().trim());
paneDragText = new Pane();
paneDragText.setStyle("-fx-background-color:#f4f4f4;");
paneDragText.setCursor(Cursor.MOVE);
paneDragText.setOpacity(0.2);
// Quand on selectionne du texte, on met un panel devant le text pour pouvoir le dragger
droppableText.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if (!droppableText.getSelectedText().equals("") && !droppableText.getSelectedText().equals(" ") && !droppableText.getSelectedText().equals("\n"))
stackForDragDrop.getChildren().add(paneDragText);
}
});
// Quand on clique sur la panel qui s'est mit par dessus le texte, on l'enleve pour � nouveau rendre le texte selectionnable
paneDragText.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
droppableText.deselect();
stackForDragDrop.getChildren().clear();
stackForDragDrop.getChildren().add(droppableText);
}
});
// Quand on drag le panel qui s'est mit par dessus le text
paneDragText.setOnDragDetected(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
// TODO Auto-generated method stub
if (main.getCurrentDescription() != null) {
Dragboard db = ajoutMomentButton.startDragAndDrop(TransferMode.ANY);
ClipboardContent content = new ClipboardContent();
content.putString("ajoutMoment");
content.put(DataFormat.HTML, droppableText.getSelectedText());
db.setContent(content);
}
}
});
buttonTextInterview.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
if (droppableText.isDisabled()) {
buttonTextInterview.setImage(ResourceLoader.loadImage("closeMenuBlack.png"));
droppableText.setDisable(false);
mainSplitPane.setDividerPosition(1, splitPos);
stackForDragDrop.getChildren().add(droppableText);
topBarContainerTextInterview.setCenter(textInterviewTitle);
paneOfTextArea.setMaxWidth(paneOfTextArea.USE_COMPUTED_SIZE);
} else {
buttonTextInterview.setImage(ResourceLoader.loadImage("openMenuBlack.png"));
droppableText.deselect();
droppableText.setDisable(true);
splitPos = mainSplitPane.getDividers().get(1).getPosition();
mainSplitPane.setDividerPosition(1, 1);
stackForDragDrop.getChildren().clear();
topBarContainerTextInterview.setCenter(null);
paneOfTextArea.setMaxWidth(buttonTextInterview.getFitWidth());
}
}
});
}
use of controller.controller.TypeController in project uPMT by coco35700.
the class TypeTreeView method addProperty.
// method used to add a property to the current cell
public void addProperty(Type nt) {
TreeItem<TypeController> newType = new TreeItem<TypeController>();
TypeController tc = new TypeController(nt, getTreeItem().getParent().getValue().getType());
newType.setValue(tc);
getTreeItem().getChildren().add(newType);
this.getTreeItem().setExpanded(true);
// System.out.println("On ajoute une propriete !");
// System.out.println("On a essay� de la renommer");
}
use of controller.controller.TypeController in project uPMT by coco35700.
the class TypeTreeView method addClass.
// method used to add a class to the current cell
public void addClass(int classNumber) {
TreeItem<TypeController> newTypeController = new TreeItem<TypeController>();
Type nt = new Category("Classe " + classNumber);
TypeController tc;
if (getItem().getType().getClass().equals(Schema.class)) {
tc = new TypeController(nt, getTreeItem().getValue().getType());
} else {
tc = new TypeController(nt, getTreeItem().getParent().getValue().getType());
}
newTypeController.setValue(tc);
getTreeItem().getChildren().add(newTypeController);
getItem().getType().getTypes().add(nt);
this.getTreeItem().setExpanded(true);
}
use of controller.controller.TypeController in project uPMT by coco35700.
the class TypeTreeView method addFolder.
// method used to add a folder to the current cell
public void addFolder(int folderNumber) {
TreeItem<TypeController> newTypeController = new TreeItem<TypeController>();
Type nt = new Folder("Dossier " + folderNumber);
TypeController tc;
if (getItem().getType().getClass().equals(Schema.class)) {
tc = new TypeController(nt, getTreeItem().getValue().getType());
} else {
tc = new TypeController(nt, getTreeItem().getParent().getValue().getType());
}
tc = new TypeController(nt, getTreeItem().getValue().getType());
newTypeController.setValue(tc);
getTreeItem().getChildren().add(newTypeController);
getItem().getType().getTypes().add(nt);
this.getTreeItem().setExpanded(true);
}
use of controller.controller.TypeController in project uPMT by coco35700.
the class RemovePropertyFromClassCommand method undo.
@Override
public void undo() {
controller.GetAddPropertySchemeWithValueController().update(oldp);
;
// adding the new property to the scheme
TreeItem<TypeController> newType = new TreeItem<TypeController>();
TypeController tc = new TypeController(oldp, controller.getType());
newType.setValue(tc);
tree.getChildren().add(newType);
// getItem().getType().getTypes().add(nt);
tree.setExpanded(true);
main.needToSave();
}
Aggregations