Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ffeb88
commit 30425c4
Showing
17 changed files
with
379 additions
and
252 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/main/java/com/faforever/client/fx/contextmenu/CancelActionNotifyMeMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.faforever.client.fx.contextmenu; | ||
|
||
import com.faforever.client.domain.GameBean; | ||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.replay.LiveReplayService; | ||
import com.faforever.client.replay.LiveReplayService.LiveReplayAction; | ||
import javafx.util.Pair; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.config.ConfigurableBeanFactory; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.faforever.client.replay.LiveReplayService.LiveReplayAction.NOTIFY_ME; | ||
|
||
@Component | ||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | ||
@RequiredArgsConstructor | ||
public class CancelActionNotifyMeMenuItem extends AbstractMenuItem<GameBean> { | ||
|
||
private final I18n i18n; | ||
private final LiveReplayService liveReplayService; | ||
|
||
@Override | ||
protected void onClicked() { | ||
liveReplayService.stopTrackingReplay(); | ||
} | ||
|
||
@Override | ||
protected boolean isItemVisible() { | ||
boolean isValid = object != null && object.getStartTime() != null; | ||
if (!isValid) { | ||
return false; | ||
} | ||
|
||
Optional<Pair<Integer, LiveReplayAction>> trackingReplayOptional = liveReplayService.getTrackingReplay(); | ||
return trackingReplayOptional.stream().anyMatch(trackingReplay -> trackingReplay.getKey().equals(object.getId()) | ||
&& trackingReplay.getValue() == NOTIFY_ME); | ||
} | ||
|
||
@Override | ||
protected String getItemText() { | ||
return i18n.get("vault.liveReplays.contextMenu.notifyMe.cancel"); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...in/java/com/faforever/client/fx/contextmenu/CancelActionRunReplayImmediatelyMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.faforever.client.fx.contextmenu; | ||
|
||
import com.faforever.client.domain.GameBean; | ||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.replay.LiveReplayService; | ||
import com.faforever.client.replay.LiveReplayService.LiveReplayAction; | ||
import javafx.util.Pair; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.config.ConfigurableBeanFactory; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.faforever.client.replay.LiveReplayService.LiveReplayAction.RUN_REPLAY; | ||
|
||
@Component | ||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | ||
@RequiredArgsConstructor | ||
public class CancelActionRunReplayImmediatelyMenuItem extends AbstractMenuItem<GameBean> { | ||
|
||
private final I18n i18n; | ||
private final LiveReplayService liveReplayService; | ||
|
||
@Override | ||
protected void onClicked() { | ||
liveReplayService.stopTrackingReplay(); | ||
} | ||
|
||
@Override | ||
protected boolean isItemVisible() { | ||
boolean isValid = object != null && object.getStartTime() != null; | ||
if (!isValid) { | ||
return false; | ||
} | ||
|
||
Optional<Pair<Integer, LiveReplayAction>> trackingReplayOptional = liveReplayService.getTrackingReplay(); | ||
return trackingReplayOptional.stream().anyMatch(trackingReplay -> trackingReplay.getKey().equals(object.getId()) | ||
&& trackingReplay.getValue() == RUN_REPLAY); | ||
} | ||
|
||
@Override | ||
protected String getItemText() { | ||
return i18n.get("vault.liveReplays.contextMenu.runImmediately.cancel"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/com/faforever/client/fx/contextmenu/NotifyMeMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.faforever.client.fx.contextmenu; | ||
|
||
import com.faforever.client.domain.GameBean; | ||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.replay.LiveReplayService; | ||
import com.faforever.client.replay.LiveReplayService.LiveReplayAction; | ||
import javafx.util.Pair; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.config.ConfigurableBeanFactory; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.faforever.client.replay.LiveReplayService.LiveReplayAction.NOTIFY_ME; | ||
|
||
@Component | ||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | ||
@RequiredArgsConstructor | ||
public class NotifyMeMenuItem extends AbstractMenuItem<GameBean> { | ||
|
||
private final I18n i18n; | ||
private final LiveReplayService liveReplayService; | ||
|
||
@Override | ||
protected void onClicked() { | ||
liveReplayService.performActionWhenAvailable(object, NOTIFY_ME); | ||
} | ||
|
||
@Override | ||
protected boolean isItemVisible() { | ||
boolean isValid = object != null && object.getStartTime() != null; | ||
if (!isValid) { | ||
return false; | ||
} | ||
|
||
Optional<Pair<Integer, LiveReplayAction>> trackingReplayOptional = liveReplayService.getTrackingReplay(); | ||
return trackingReplayOptional.isEmpty() || trackingReplayOptional.stream() | ||
.anyMatch(trackingReplay -> !trackingReplay.getKey().equals(object.getId()) || trackingReplay.getValue() != NOTIFY_ME); | ||
} | ||
|
||
@Override | ||
protected String getItemText() { | ||
return i18n.get("vault.liveReplays.contextMenu.notifyMe"); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/faforever/client/fx/contextmenu/RunReplayImmediatelyMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.faforever.client.fx.contextmenu; | ||
|
||
import com.faforever.client.domain.GameBean; | ||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.replay.LiveReplayService; | ||
import com.faforever.client.replay.LiveReplayService.LiveReplayAction; | ||
import javafx.util.Pair; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.config.ConfigurableBeanFactory; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.faforever.client.replay.LiveReplayService.LiveReplayAction.RUN_REPLAY; | ||
|
||
@Component | ||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | ||
@RequiredArgsConstructor | ||
public class RunReplayImmediatelyMenuItem extends AbstractMenuItem<GameBean> { | ||
|
||
private final I18n i18n; | ||
private final LiveReplayService liveReplayService; | ||
|
||
@Override | ||
protected void onClicked() { | ||
liveReplayService.performActionWhenAvailable(object, RUN_REPLAY); | ||
} | ||
|
||
@Override | ||
protected boolean isItemVisible() { | ||
boolean isValid = object != null && object.getStartTime() != null; | ||
if (!isValid) { | ||
return false; | ||
} | ||
|
||
Optional<Pair<Integer, LiveReplayAction>> trackingReplayOptional = liveReplayService.getTrackingReplay(); | ||
return trackingReplayOptional.isEmpty() || trackingReplayOptional.stream() | ||
.anyMatch(trackingReplay -> !trackingReplay.getKey().equals(object.getId()) || trackingReplay.getValue() != RUN_REPLAY); | ||
} | ||
|
||
@Override | ||
protected String getItemText() { | ||
return i18n.get("vault.liveReplays.contextMenu.runImmediately"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/faforever/client/notification/RunReplayAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.faforever.client.notification; | ||
|
||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.replay.LiveReplayService; | ||
|
||
public class RunReplayAction extends Action { | ||
|
||
public RunReplayAction(I18n i18n, ActionCallback callback) { | ||
super(i18n.get("game.watch"), callback); | ||
} | ||
} |
Oops, something went wrong.