use of com.helospark.tactview.core.util.messaging.MessagingService in project tactview by helospark.
the class GraphSetterChainItem method handle.
@Override
protected EffectLine handle(GraphProvider graphingProvider, ValueProviderDescriptor descriptor) {
Button button = new Button("Open graph window", new Glyph("FontAwesome", FontAwesome.Glyph.DIAMOND));
GraphingComponent graphingComponent = new GraphingComponent(250, 100, effectGraphAccessor, messagingService, menuItemFactories, commandInterpreter, stylesheetAdderService, nameToIdRepository);
graphingComponent.setGraphProvider(graphingProvider);
graphingComponent.setZoom(0.4);
graphingComponent.setParent(scene.getWindow());
graphingComponent.redrawGraphProvider();
VBox vbox = new VBox(button, graphingComponent);
PrimitiveEffectLine result = PrimitiveEffectLine.builder().withCurrentValueProvider(() -> effectParametersRepository.getValueAtAsObject(graphingProvider.getId(), uiTimelineManager.getCurrentPosition())).withVisibleNode(vbox).withDescriptorId(graphingProvider.getId()).withEffectParametersRepository(effectParametersRepository).withCommandInterpreter(commandInterpreter).withDescriptor(descriptor).withUpdateFunction(position -> {
graphingComponent.redrawGraphProvider();
}).withUpdateFromValue(value -> {
}).build();
button.setOnMouseClicked(event -> {
dockableTabRepository.openTab(graphingDialog);
graphingDialog.showProvider(graphingProvider);
});
return result;
}
use of com.helospark.tactview.core.util.messaging.MessagingService in project tactview by helospark.
the class StandardGraphElementFactoryConfiguration method fileClipGraphElementFactory.
@Bean
public GraphElementFactory fileClipGraphElementFactory(List<ClipFactory> clipFactories, ClipFactoryChain clipFactoryChain, MessagingService messagingService) {
return StandardGraphElementFactory.builder().withId("file").withDoesSupport(uri -> uri.startsWith("file://")).withName("File").withCategory(GraphCategory.INPUT).withNeedsInputParam(true).withCreator(graphRequest -> {
AddClipRequest request = AddClipRequest.builder().withAddClipRequestMetadataKey(Map.of()).withPosition(TimelinePosition.ofZero()).withFilePath(graphRequest.uri.replaceFirst("file://", "")).build();
VisualTimelineClip clip = (VisualTimelineClip) clipFactoryChain.createClips(request).get(0);
clip.setInterval(INTERVAL);
messagingService.sendAsyncMessage(new ClipDescriptorsAdded(clip.getId(), clip.getDescriptors(), clip));
return new VisualTimelineClipElement(clip);
}).withRestorer((node, metadata) -> {
node.get("creatorFactoryId").asText();
return new VisualTimelineClipElement(node, metadata, (VisualTimelineClip) clipFactoryChain.restoreClip(node.get("clip"), metadata));
}).build();
}
Aggregations