use of controller.command.RenameMomentCommand in project uPMT by coco35700.
the class MomentExpVBox method editNameMode.
private void editNameMode() {
TextField t = new TextField();
t.setMaxWidth(180);
t.setText(moment.getName());
t.requestFocus();
ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (!newPropertyValue) {
RenameMomentCommand cmd = new RenameMomentCommand(nameController, moment.getName(), t.getText(), main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
t.focusedProperty().removeListener(this);
}
}
};
t.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
t.setText(t.getText());
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
}
if (event.getCode() == KeyCode.ESCAPE) {
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
}
}
});
t.focusedProperty().addListener(listener);
Platform.runLater(() -> t.requestFocus());
Platform.runLater(() -> t.selectAll());
borderPaneLabel.setCenter(t);
// borderPaneLabel.setCenter(t);
}
use of controller.command.RenameMomentCommand in project uPMT by coco35700.
the class SelectDescriptemePartController method validateSelection.
@FXML
public void validateSelection() {
String newExtract = "";
if (this.descriptemeArea.getSelectedText().trim().length() != 0)
newExtract = this.descriptemeArea.getSelectedText().trim();
else
newExtract = null;
if (propertyExtractController != null) {
// System.out.println("Description: "+main.getCurrentMoment().getCurrentProperty().getDescripteme().getTexte());
// System.out.println("Valeur: "+main.getCurrentMoment().getCurrentProperty().getValeur());
ChangeExtractProperty cmd = new ChangeExtractProperty(propertyExtractController, propertyExtractController.getProperty().getExtract().getTexte(), newExtract, main);
main.getCurrentMoment().getCurrentProperty().setExtract(newExtract);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
} else {
// System.out.println("Moment: "+main.getCurrentMoment().getMoment().getNom());
RenameMomentCommand cmd = new RenameMomentCommand(main.getCurrentMoment().getMomentExtractController(), main.getCurrentMoment().getMoment().getDescripteme(), newExtract, main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
}
main.needToSave();
stage.close();
}
Aggregations