use of model.Type in project uPMT by coco35700.
the class TypeClassRepresentationController method loadProperties.
public void loadProperties() {
// for each Property, add a representation
if (!classe.getTypes().isEmpty()) {
for (Type p : classe.getTypes()) {
Property prop = (Property) p;
TypePropertyRepresentation controller = new TypePropertyRepresentation(prop, moment, treeClassTreeItem, main);
this.properties.getChildren().add(controller);
}
}
}
use of model.Type in project uPMT by coco35700.
the class MainViewTransformations method loadTypes.
public static void loadTypes(MomentExpVBox mp, Main main) {
// System.out.println(mp.getMoment().getNom()+": ");
for (Type t : mp.getMoment().getTypes()) {
TypeClassRepresentationController classe = new TypeClassRepresentationController((Category) t, mp, main);
mp.getTypeSpace().getChildren().add(classe);
addTypeListener(classe, mp, t, main);
// System.out.println(t.toString());
}
// System.out.println("------------------------------------");
}
use of model.Type in project uPMT by coco35700.
the class MainViewController method duplicate.
private Category duplicate(Category c) {
Category newc = new Category(c.getName());
newc.setColor(c.getColor());
for (Type t : c.getTypes()) {
newc.addType(t);
}
return newc;
}
use of model.Type in project uPMT by coco35700.
the class TypeTreeViewControllerClass method rename.
@Override
public void rename() {
super.rename();
ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (!newPropertyValue) {
if (type.getType().isCategory()) {
String oldName = new String(type.getType().getName());
if (!oldName.equals(textField.getText())) {
boolean hasName = false;
// System.out.println("Parent: "+type.getParent().getName());
for (Type classe : type.getParent().getTypes()) {
// System.out.println("Classes: "+classe.getName());
if (classe.getName().equals(textField.getText())) {
hasName = true;
break;
}
}
if (!hasName) {
RenameClassSchemeCommand cmd = new RenameClassSchemeCommand(type.getClassNameController(), oldName, textField.getText(), main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
} else {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle(main._langBundle.getString("invalid_name"));
alert.setHeaderText(null);
alert.setContentText(main._langBundle.getString("class_name_invalid"));
alert.show();
}
}
}
typePane.setLeft(nomType);
rename.setDisable(false);
textField.focusedProperty().removeListener(this);
}
}
};
textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
if (type.getType().isProperty()) {
textField.setText(textField.getText());
}
typePane.setLeft(nomType);
rename.setDisable(false);
}
if (event.getCode() == KeyCode.ESCAPE) {
typePane.setLeft(nomType);
rename.setDisable(true);
}
}
});
textField.focusedProperty().addListener(listener);
typePane.setLeft(textField);
Platform.runLater(() -> textField.requestFocus());
Platform.runLater(() -> textField.selectAll());
}
Aggregations