use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class DefaultFileMenuItemConfiguration method exitContributionMenuItem.
@Bean
@Order(200)
public SelectableMenuContribution exitContributionMenuItem(ExitWithSaveService exitWithSaveService) {
KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("quit", new KeyCodeCombination(KeyCode.Q, KeyCodeCombination.CONTROL_DOWN), "Exit").getCombination();
return new DefaultMenuContribution(List.of(FILE_ROOT, "E_xit"), event -> {
exitWithSaveService.optionallySaveAndThenRun(() -> {
Platform.exit();
System.exit(0);
});
}, combination);
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class DefaultViewMenuItemConfiguration method fullScreenWindowContributionMenuItem.
@Bean
@Order(1800)
public SelectableMenuContribution fullScreenWindowContributionMenuItem(MessagingService messagingService) {
return new DefaultMenuContribution(List.of(VIEW_ROOT, "Full screen"), e -> {
stage.setFullScreen(true);
stage.setFullScreenExitHint("Hit escape to exit fullscreen");
stage.setFullScreenExitKeyCombination(new KeyCodeCombination(KeyCode.ESCAPE));
});
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class DefaultWindowMenuItemConfiguration method saveLayoutMenuItem.
@Bean
@Order(3997)
public SelectableMenuContribution saveLayoutMenuItem(MessagingService messagingService, QuerySaveFilenameService querySaveFilenameService, @Value("${tactview.homedirectory}") String homeDirectory, AlertDialogFactory alertDialogFactory) {
return new DefaultMenuContribution(List.of(WINDOW_MENU_ITEM, "Save layout"), e -> {
QuerySaveFileNameRequest request = QuerySaveFileNameRequest.builder().withInitialDirectory(homeDirectory).withTitle("Save layout file").build();
Optional<String> optionalFileName = querySaveFilenameService.queryUserAboutFileName(request);
if (optionalFileName.isPresent()) {
try {
String fileName = optionalFileName.get();
if (!fileName.endsWith("." + TACTVIEW_LAYOUT_EXTENSION)) {
fileName += ("." + TACTVIEW_LAYOUT_EXTENSION);
}
DetachableTabPaneLoadModel data = dockableTabRepository.extractLoadModel();
String result = objectMapper.writeValueAsString(data);
try (FileOutputStream fos = new FileOutputStream(new File(fileName))) {
fos.write(result.getBytes(StandardCharsets.UTF_8));
}
} catch (Exception e1) {
alertDialogFactory.showExceptionDialog("Unable to save layout", e1);
LOGGER.error("Unable to save layout", e1);
}
}
});
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class StandardEffectContextMenuChainItemConfiguration method moveDownItem.
@Bean
@Order(91)
public EffectContextMenuChainItem moveDownItem(UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem moveDownClip = new MenuItem("Move down");
int index = timelineManager.findEffectChannel(request.getEffect().getId());
int numberOfEffectChannels = timelineManager.getNumberOfEffectChannels(request.getEffect().getId()) - 1;
System.out.println("Down index: " + index + " " + numberOfEffectChannels);
if (index >= numberOfEffectChannels) {
moveDownClip.setDisable(true);
} else {
moveDownClip.setOnAction(e -> commandInterpreter.sendWithResult(new MoveEffectToChannelCommand(timelineManager, request.getEffect().getId(), index + 1)));
}
return moveDownClip;
});
}
use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.
the class StandardEffectContextMenuChainItemConfiguration method maximizeMenuItem.
@Bean
@Order(120)
public EffectContextMenuChainItem maximizeMenuItem(ExtendsClipToMaximizeLengthService extendsClipToMaximizeLengthService, TimelineManagerAccessor timelineManager) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem maximizeClipMenuItem = new MenuItem("Maximize");
timelineManager.findClipForEffect(request.getEffect().getId()).ifPresent(clip -> {
maximizeClipMenuItem.setOnAction(e -> extendsClipToMaximizeLengthService.extendEffectToClipSize(clip.getId(), request.getEffect()));
});
return maximizeClipMenuItem;
});
}
Aggregations