21 package com.realtime.crossfire.jxclient.gui.commands;
30 import java.awt.Component;
31 import org.jetbrains.annotations.NotNull;
80 final GUIText currentPasswordField = gui.getFirstElement(
GUIText.class,
"account_password_current");
81 final GUIText newPasswordField = gui.getFirstElement(
GUIText.class,
"account_password_new");
82 final GUIText confirmPasswordField = gui.getFirstElement(
GUIText.class,
"account_password_confirm");
84 if (currentPasswordField == null || newPasswordField == null || confirmPasswordField == null) {
88 final String currentPassword = currentPasswordField.
getText();
89 final String newPassword = newPasswordField.
getText();
90 final String confirmPassword = confirmPasswordField.
getText();
92 if (currentPassword.isEmpty()) {
95 error.
setText(
"Please enter your current password!");
100 if (newPassword.isEmpty()) {
103 error.
setText(
"Can't have an empty password!");
107 if (!confirmPassword.equals(newPassword)) {
110 error.
setText(
"Passwords don't match!");
Abstract base class for all label classes.
static Gui getGui(@NotNull final Component element)
Returns the Gui an element is part of.
void setText(@NotNull final String text)
The label text.
boolean canExecute()
Returns whether this command may be executed.whether this command may be executed ...
Combines a list of GUIElements to for a gui.
AccountPasswordCommand(@NotNull final CommandCallback commandCallback, @NotNull final Component button)
Creates a new instance.
String getText()
Returns the entered text.
A GUIHTMLLabel that displays the last received "failure" message.
Utility class for Gui related functions.
Interface that defines callback functions needed by commands.
A GUICommand sending an account password change request.
void execute()
Executes the command.Does nothing if called while canExecute() returnsfalse .
final Component element
The Component to find the Gui containing the fields.
void accountPassword(@NotNull String currentPassword, @NotNull String newPassword)
Change the account password.
final CommandCallback commandCallback
The CommandCallback to use.
Abstract base class for text input fields.