use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class CommonPropertyValueContextMenuItemConfiguration method addKeyframeItem.
@Bean
@Order(0)
public PropertyValueContextMenuItem addKeyframeItem(UiTimelineManager timelineManager, UiCommandInterpreterService commandInterpreter, EffectParametersRepository effectParametersRepository) {
return contextMenuEnabledIfKeyframesEnabled(request -> {
MenuItem addKeyframeMenuItem = new MenuItem("Add keyframe");
addKeyframeMenuItem.setOnAction(e -> {
KeyframeAddedRequest keyframeRequest = KeyframeAddedRequest.builder().withDescriptorId(request.effectLine.getDescriptorId()).withGlobalTimelinePosition(timelineManager.getCurrentPosition()).withValue(request.effectLine.getCurrentValueSupplier().get()).withRevertable(true).build();
commandInterpreter.sendWithResult(new AddKeyframeForPropertyCommand(effectParametersRepository, keyframeRequest));
});
return addKeyframeMenuItem;
});
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class CommonPropertyValueContextMenuItemConfiguration method pasteValue.
@Bean
@Order(-10)
public PropertyValueContextMenuItem pasteValue(UiTimelineManager timelineManager) {
return allPrimitiveEffectLineSupportingMenuIfRequired(request -> {
MenuItem pasteKeyframeMenuItem = new MenuItem("Paste");
pasteKeyframeMenuItem.setOnAction(e -> {
Clipboard clipboard = Clipboard.getSystemClipboard();
Object value = clipboard.getContent(RAW_DATA_FORMAT);
if (value != null) {
try {
request.effectLine.getUpdateFromValue().accept(value);
} catch (Exception ex) {
LOGGER.debug("Trying to paste {} into type {}, which is not supported", value, request.containerDescriptor.getKeyframeableEffect().getClass(), ex);
}
}
});
return pasteKeyframeMenuItem;
});
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class CommonPropertyValueContextMenuItemConfiguration method resetDefaultsValues.
@Bean
@Order(30)
public PropertyValueContextMenuItem resetDefaultsValues(UiTimelineManager timelineManager, UiCommandInterpreterService commandInterpreter, EffectParametersRepository effectParametersRepository) {
return alwaysEnableContextMenu(request -> {
MenuItem resetDefaultsMenuItem = new MenuItem("Reset defaults");
resetDefaultsMenuItem.setOnAction(e -> {
commandInterpreter.sendWithResult(new ResetDefaultValuesCommand(effectParametersRepository, request.valueProvider.getId()));
});
return resetDefaultsMenuItem;
});
}
Aggregations