use of org.csstudio.display.pace.gui.GUI in project phoebus by ControlSystemStudio.
the class PACEInstance method doSaveChanges.
private void doSaveChanges(final JobMonitor monitor) {
final String text = createElogText();
final LogEntryBuilder builder = new LogEntryBuilder();
builder.title(MessageFormat.format(Messages.ELogTitleFmt, model.getTitle()));
builder.appendDescription(text);
final LogEntry entry = builder.createdDate(Instant.now()).build();
LogEntryModel logEntryModel = new LogEntryModel(entry);
new LogEntryEditorStage(gui, logEntryModel, logEntry -> {
if (logEntry != null) {
final String user = logEntryModel.getUsername();
try {
// Change PVs
model.saveUserValues(user);
// On success, clear user values
model.clearUserValues();
} catch (Exception ex) {
logger.log(Level.WARNING, "Save failed", ex);
// At least some saves failed, to revert
try {
model.revertOriginalValues();
} catch (Exception ex2) {
// Since saving didn't work, restoral will also fail.
// Hopefully those initial PVs that did get updated will
// also be restored...
logger.log(Level.WARNING, "Restore failed", ex2);
}
ExceptionDetailsErrorDialog.openError(gui, Messages.SaveError, Messages.PVWriteError, ex);
}
}
}).show();
}
use of org.csstudio.display.pace.gui.GUI in project phoebus by ControlSystemStudio.
the class GUIDemo method start.
@Override
public void start(final Stage stage) throws Exception {
final GUI gui = new GUI(dirty -> System.out.println("Table is dirty: " + dirty));
stage.setScene(new Scene(gui, 800, 600));
stage.show();
JobManager.schedule("Load...", monitor -> {
Thread.sleep(2000);
final Model model = new Model(Model.class.getResourceAsStream("/pace_examples/localtest.pace"));
gui.setModel(model);
model.start();
});
}
Aggregations