use of org.csstudio.trends.databrowser3.persistence.XMLPersistence in project org.csstudio.display.builder by kasemir.
the class DataBrowserWidgetJFX method updateChanges.
@Override
public void updateChanges() {
super.updateChanges();
if (dirty_file.checkAndClear()) {
// This is being done here because the load function causes effects that need to happen on the FxUserThread
final InputStream safe_stream = model_file_stream;
model_file_stream = null;
// Clear model that might already contain items
final Model db_model = model_widget.getDataBrowserModel();
db_model.clear();
// Load new model
if (safe_stream != null)
try {
db_model.setMacros(model_widget.getMacrosOrProperties());
new XMLPersistence().load(db_model, safe_stream);
// Override settings in *.plt file with those of widget
db_model.setToolbarVisible(model_widget.propShowToolbar().getValue());
} catch (Exception ex) {
logger.log(Level.WARNING, "Error loading data browser content", ex);
}
}
if (dirty_opts.checkAndClear())
plot.getPlot().showToolbar(model_widget.propShowToolbar().getValue());
if (dirty_size.checkAndClear())
plot.getPlot().setPrefSize(model_widget.propWidth().getValue(), model_widget.propHeight().getValue());
}
use of org.csstudio.trends.databrowser3.persistence.XMLPersistence in project org.csstudio.display.builder by kasemir.
the class DataBrowserWidgedModel method createDataBrowserModel.
/**
* Create a Data Browser model, loaded with the configuration file
* @return Data Browser Model
* @throws Exception
*/
public Model createDataBrowserModel() throws CoreException, Exception {
final Model model = new Model();
final IMacroTableProvider opi_macros = getAllMacros();
final MacroValueProvider db_macros = name -> opi_macros.getMacroValue(name);
model.setMacros(db_macros);
try (final InputStream input = SingleSourcePlugin.getResourceHelper().getInputStream(getExpandedFilename())) {
new XMLPersistence().load(model, input);
}
return model;
}
Aggregations