Search in sources :

Example 1 with RemoveEffectCommand

use of com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand in project tactview by helospark.

the class StandardClipContextMenuChainItemConfiguration method deleteAllEffectsMenuItem.

@Bean
@Order(102)
public ClipContextMenuChainItem deleteAllEffectsMenuItem(CopyPasteRepository copyPasteRepository, UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem deleteEffectsFromClipMenuItem = new MenuItem("Delete all effects");
        deleteEffectsFromClipMenuItem.setOnAction(e -> {
            List<RemoveEffectCommand> removeEffectsCommand = request.getPrimaryClip().getEffects().stream().map(effect -> new RemoveEffectCommand(timelineManager, effect.getId())).collect(Collectors.toList());
            commandInterpreter.sendWithResult(new CompositeCommand(removeEffectsCommand));
        });
        if (request.getPrimaryClip().getEffects().isEmpty()) {
            deleteEffectsFromClipMenuItem.setDisable(true);
        }
        return deleteEffectsFromClipMenuItem;
    });
}
Also used : RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) EffectFactoryChain(com.helospark.tactview.core.timeline.EffectFactoryChain) Qualifier(com.helospark.lightdi.annotation.Qualifier) AddScaleCommand(com.helospark.tactview.ui.javafx.commands.impl.AddScaleCommand) TimelineEditMode(com.helospark.tactview.ui.javafx.repository.timelineeditmode.TimelineEditMode) MenuItem(javafx.scene.control.MenuItem) SelectedNodeRepository(com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) RemoveClipService(com.helospark.tactview.ui.javafx.RemoveClipService) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) Configuration(com.helospark.lightdi.annotation.Configuration) Order(com.helospark.lightdi.annotation.Order) List(java.util.List) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) ProjectRepository(com.helospark.tactview.core.repository.ProjectRepository) CopyPasteRepository(com.helospark.tactview.ui.javafx.repository.CopyPasteRepository) Bean(com.helospark.lightdi.annotation.Bean) MenuItem(javafx.scene.control.MenuItem) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 2 with RemoveEffectCommand

use of com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand in project tactview by helospark.

the class RemoveEffectService method removeEffects.

public void removeEffects(Collection<String> effectIds) {
    List<RemoveEffectCommand> commands = effectIds.stream().filter(a -> timelineManager.findEffectById(a).isPresent()).map(a -> new RemoveEffectCommand(timelineManager, a)).collect(Collectors.toList());
    if (commands.size() > 0) {
        CompositeCommand compositeCommand = new CompositeCommand(commands);
        commandInterpreterService.synchronousSend(compositeCommand);
    }
}
Also used : RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) Component(com.helospark.lightdi.annotation.Component) List(java.util.List) Collection(java.util.Collection) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) Collectors(java.util.stream.Collectors) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand)

Aggregations

TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)2 CompositeCommand (com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand)2 RemoveEffectCommand (com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Bean (com.helospark.lightdi.annotation.Bean)1 Component (com.helospark.lightdi.annotation.Component)1 Configuration (com.helospark.lightdi.annotation.Configuration)1 Order (com.helospark.lightdi.annotation.Order)1 Qualifier (com.helospark.lightdi.annotation.Qualifier)1 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)1 EffectFactoryChain (com.helospark.tactview.core.timeline.EffectFactoryChain)1 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)1 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)1 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)1 RemoveClipService (com.helospark.tactview.ui.javafx.RemoveClipService)1 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)1 AddScaleCommand (com.helospark.tactview.ui.javafx.commands.impl.AddScaleCommand)1 CopyPasteRepository (com.helospark.tactview.ui.javafx.repository.CopyPasteRepository)1 SelectedNodeRepository (com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository)1