forked from FAForever/downlords-faf-client
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign context menu (FAForever#2596)
- Loading branch information
1 parent
58719d8
commit 22eec11
Showing
22 changed files
with
271 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
src/main/java/com/faforever/client/fx/contextmenu/ChangeUsernameColorMenuItem.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,48 @@ | ||
package com.faforever.client.fx.contextmenu; | ||
|
||
import com.faforever.client.chat.ChatChannelUser; | ||
import com.faforever.client.i18n.I18n; | ||
import com.faforever.client.preferences.PreferencesService; | ||
import com.faforever.client.theme.UiService; | ||
import com.faforever.client.ui.StageHolder; | ||
import com.faforever.client.util.Assert; | ||
import javafx.geometry.Bounds; | ||
import javafx.scene.Node; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.config.ConfigurableBeanFactory; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import static com.faforever.client.chat.ChatColorMode.RANDOM; | ||
|
||
@Component | ||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | ||
@RequiredArgsConstructor | ||
public class ChangeUsernameColorMenuItem extends AbstractMenuItem<ChatChannelUser> { | ||
|
||
private final PreferencesService preferencesService; | ||
private final UiService uiService; | ||
private final I18n i18n; | ||
private final ContextMenuBuilder contextMenuBuilder; | ||
|
||
@Override | ||
protected void onClicked() { | ||
Assert.checkNullIllegalState(object, "no chat user has been set"); | ||
Node node = getStyleableNode(); | ||
Bounds screenBounds = node.localToScreen(node.getBoundsInLocal()); | ||
contextMenuBuilder.newBuilder() | ||
.addCustomItem(uiService.loadFxml("theme/chat/color_picker_menu_item.fxml", ChatUserColorPickerCustomMenuItemController.class), object) | ||
.build() | ||
.show(StageHolder.getStage(), screenBounds.getMinX(), screenBounds.getMinY()); | ||
} | ||
|
||
@Override | ||
protected boolean isItemVisible() { | ||
return object != null && !preferencesService.getPreferences().getChat().getChatColorMode().equals(RANDOM); | ||
} | ||
|
||
@Override | ||
protected String getItemText() { | ||
return i18n.get("chat.userContext.changeColor"); | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.