use of controller.command.RemoveTypeCommand in project uPMT by coco35700.
the class MainViewTransformations method addTypeListener.
public static void addTypeListener(TypeClassRepresentationController boutType, MomentExpVBox m, Type type, Main main) {
boutType.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (newPropertyValue) {
boutType.colorFocus();
} else {
boutType.resetFocusColor();
}
}
});
boutType.setOnMouseClicked(new EventHandler<Event>() {
@Override
public void handle(Event event) {
boutType.requestFocus();
}
});
boutType.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if ((event.getCode().equals(KeyCode.DELETE) || event.getCode().equals(KeyCode.BACK_SPACE)) & boutType.isFocused()) {
RemoveTypeCommand cmd = new RemoveTypeCommand(boutType, m, main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
}
}
});
}
Aggregations