-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
11 changed files
with
179 additions
and
14 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
src/main/java/com/faforever/moderatorclient/ui/ForceRenameController.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,45 @@ | ||
package com.faforever.moderatorclient.ui; | ||
|
||
import com.faforever.moderatorclient.api.domain.UserService; | ||
import com.faforever.moderatorclient.ui.domain.PlayerFX; | ||
import javafx.scene.Parent; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.stage.Stage; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class ForceRenameController implements Controller<Parent> { | ||
|
||
private final UserService userService; | ||
|
||
private PlayerFX player; | ||
|
||
public GridPane root; | ||
public TextField newNameTextField; | ||
public Label oldNameLabel; | ||
|
||
@Override | ||
public Parent getRoot() { | ||
return root; | ||
} | ||
|
||
public void close() { | ||
((Stage) root.getScene().getWindow()).close(); | ||
} | ||
|
||
public void submit() { | ||
userService.updatePlayer(player.getId(), newNameTextField.getText()); | ||
close(); | ||
} | ||
|
||
public void setPlayer(PlayerFX player) { | ||
this.player = player; | ||
oldNameLabel.setText(player.getLogin()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.HBox?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
<GridPane fx:id="root" hgap="10.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/16" | ||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.faforever.moderatorclient.ui.ForceRenameController"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="200.0" minWidth="90.0" prefWidth="200.0"/> | ||
<ColumnConstraints hgrow="ALWAYS" minWidth="200.0"/> | ||
</columnConstraints> | ||
<rowConstraints> | ||
<RowConstraints minHeight="30.0"/> | ||
<RowConstraints minHeight="30.0"/> | ||
<RowConstraints minHeight="30.0"/> | ||
</rowConstraints> | ||
<children> | ||
<Label text="Old name:"/> | ||
<Label fx:id="oldNameLabel" text="<name>" GridPane.columnIndex="1"/> | ||
<Label text="Rename to:" GridPane.rowIndex="1"/> | ||
<TextField fx:id="newNameTextField" promptText="New name" GridPane.columnIndex="1" GridPane.rowIndex="1"/> | ||
<HBox alignment="CENTER_RIGHT" spacing="10.0" GridPane.columnIndex="1" GridPane.rowIndex="2" | ||
GridPane.vgrow="NEVER"> | ||
<children> | ||
<Button onAction="#close" mnemonicParsing="false" text="Cancel"/> | ||
<Button onAction="#submit" alignment="TOP_RIGHT" contentDisplay="CENTER" defaultButton="true" | ||
mnemonicParsing="false" text="Forcibly Rename"/> | ||
</children> | ||
</HBox> | ||
</children> | ||
<padding> | ||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> | ||
</padding> | ||
|
||
</GridPane> |