use of org.csstudio.display.builder.model.widgets.SymbolWidget in project org.csstudio.display.builder by kasemir.
the class WidgetTransfer method installSymbolWidgetFromImageFiles.
/**
* @param files The pathnames of the image files used by the symbol widget.
* @param selection_tracker Used to get the grid steps from its model to be
* used in offsetting multiple widgets.
* @param widgets The container of the created widgets.
* @param updates Updates to perform on widgets
*/
private static void installSymbolWidgetFromImageFiles(final List<String> fileNames, final SelectedWidgetUITracker selection_tracker, final List<Widget> widgets, final List<Runnable> updates) {
logger.log(Level.FINE, "Creating SymbolWidget for {0,number,#########0} dropped images", fileNames.size());
final DisplayModel model = selection_tracker.getModel();
final SymbolWidget widget = (SymbolWidget) SymbolWidget.WIDGET_DESCRIPTOR.createWidget();
ArrayWidgetProperty<WidgetProperty<String>> propSymbols = widget.propSymbols();
for (int i = 0; i < fileNames.size(); i++) {
if (i < propSymbols.size()) {
propSymbols.getElement(i).setValue(fileNames.get(i));
} else {
widget.addSymbol(fileNames.get(i));
}
}
final int index = widgets.size();
widget.propX().setValue(model.propGridStepX().getValue() * index);
widget.propY().setValue(model.propGridStepY().getValue() * index);
widgets.add(widget);
updates.add(() -> updateSymbolWidgetSize(widget));
}
Aggregations