use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultEditMenuItemConfiguration method selectClipsUnderPlayheadMenuItem.
@Bean
@Order(1803)
public SelectableMenuContribution selectClipsUnderPlayheadMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager, UiTimelineManager uiTimelineManager) {
return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "Clips under playhead"), event -> {
TimelinePosition position = uiTimelineManager.getCurrentPosition();
List<String> newSelectedClips = timelineManager.getAllClipIds().stream().flatMap(a -> timelineManager.findClipById(a).stream()).filter(a -> a.getInterval().intersects(TimelineInterval.ofPoint(position))).map(a -> a.getId()).collect(Collectors.toList());
selectedNodeRepository.addSelectedClips(newSelectedClips);
});
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultEditMenuItemConfiguration method selectClipsToLeftContextMenuItem.
@Bean
@Order(1801)
public SelectableMenuContribution selectClipsToLeftContextMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager, TimelineState state) {
return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "Clips to _left"), event -> {
TimelinePosition playbackPosition = state.getPlaybackPosition();
selectedNodeRepository.clearAllSelectedItems();
List<String> clipsIds = new ArrayList<>();
for (var channel : timelineManager.getChannels()) {
for (var clip : channel.getAllClips()) {
if (!clip.getInterval().getStartPosition().isGreaterThan(playbackPosition)) {
clipsIds.add(clip.getId());
}
}
}
selectedNodeRepository.addSelectedClips(clipsIds);
});
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultWindowMenuItemConfiguration method loadLayoutMenuItem.
@Bean
@Order(3998)
public SelectableMenuContribution loadLayoutMenuItem(MessagingService messagingService, AlertDialogFactory alertDialogFactory) {
return new DefaultMenuContribution(List.of(WINDOW_MENU_ITEM, "Load layout"), e -> {
try {
FileChooser fileChooser = new FileChooser();
fileChooser.setSelectedExtensionFilter(new ExtensionFilter("TactView layout file", TACTVIEW_LAYOUT_EXTENSION));
fileChooser.setTitle("Open Layout");
File file = fileChooser.showOpenDialog(JavaFXUiMain.STAGE);
if (file != null) {
try (var inputStream = new FileInputStream(file)) {
DetachableTabPaneLoadModel result = objectMapper.readValue(inputStream, DetachableTabPaneLoadModel.class);
dockableTabRepository.loadAndSetModelToParent(result);
}
}
} catch (Exception e1) {
alertDialogFactory.showExceptionDialog("Unable to load layout", e1);
LOGGER.error("Unable to load layout", e1);
}
});
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class StandardClipContextMenuChainItemConfiguration method rippleDeleteMenuItem.
@Bean
@Order(109)
public ClipContextMenuChainItem rippleDeleteMenuItem(RemoveClipService removeClipService) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem deleteClipMenuItem = new MenuItem("Ripple delete");
deleteClipMenuItem.setOnAction(e -> removeClipService.rippleDeleteClips(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList()), TimelineEditMode.ALL_CHANNEL_RIPPLE));
return deleteClipMenuItem;
});
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class StandardClipContextMenuChainItemConfiguration method pasteMenuItem.
@Bean
@Order(101)
public ClipContextMenuChainItem pasteMenuItem(CopyPasteRepository copyPasteRepository) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem pasteEffectOnClipMenuItem = new MenuItem("Paste effect on clip");
pasteEffectOnClipMenuItem.setOnAction(e -> {
if (copyPasteRepository.isEffectOnClipboard()) {
copyPasteRepository.pasteOnExistingClips(List.of(request.getPrimaryClip().getId()));
}
});
if (!copyPasteRepository.isEffectOnClipboard()) {
pasteEffectOnClipMenuItem.setDisable(true);
}
return pasteEffectOnClipMenuItem;
});
}
Aggregations