Crossfire JXClient, Trunk
src
gui
src
main
java
com
realtime
crossfire
jxclient
gui
commands
AccountLoginCommand.java
Go to the documentation of this file.
1
/*
2
* This file is part of JXClient, the Fullscreen Java Crossfire Client.
3
*
4
* JXClient is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* JXClient is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with JXClient; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
*
18
* Copyright (C) 2005-2008 Yann Chachkoff
19
* Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20
* Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21
*/
22
23
package
com.realtime.crossfire.jxclient.gui.commands;
24
25
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
commandlist
.
GUICommand
;
26
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
gui
.
AbstractGUIElement
;
27
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
gui
.
Gui
;
28
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
textinput
.
CommandCallback
;
29
import
com
.
realtime
.
crossfire
.
jxclient
.
gui
.
textinput
.
GUIText
;
30
import
com
.
realtime
.
crossfire
.
jxclient
.
skin
.
skin
.
GuiFactory
;
31
import
org.jetbrains.annotations.NotNull;
32
37
public
class
AccountLoginCommand
implements
GUICommand
{
38
42
@NotNull
43
private
final
CommandCallback
commandCallback
;
44
48
@NotNull
49
private
final
AbstractGUIElement
element
;
50
54
@NotNull
55
private
final
GuiFactory
guiFactory
;
56
63
public
AccountLoginCommand
(@NotNull
final
CommandCallback
commandCallback
, @NotNull
final
AbstractGUIElement
button, @NotNull
final
GuiFactory
guiFactory
) {
64
this.commandCallback =
commandCallback
;
65
element
= button;
66
this.guiFactory =
guiFactory
;
67
}
68
69
@Override
70
public
boolean
canExecute
() {
71
return
true
;
72
}
73
74
@Override
75
public
void
execute
() {
76
final
Gui
gui =
guiFactory
.
getGui
(
element
);
77
if
(gui ==
null
) {
78
return
;
79
}
80
81
final
GUIText
loginField = gui.
getFirstElement
(
GUIText
.class,
"account_login"
);
82
final
GUIText
passwordField = gui.
getFirstElement
(
GUIText
.class,
"account_password"
);
83
84
if
(loginField ==
null
|| passwordField ==
null
) {
85
return
;
86
}
87
88
final
String login = loginField.
getText
();
89
final
String password = passwordField.
getText
();
90
91
commandCallback
.
accountLogin
(login, password);
92
}
93
94
}
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.skin.skin
Definition:
DefaultJXCSkin.java:23
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.execute
void execute()
Definition:
AccountLoginCommand.java:75
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.guiFactory
final GuiFactory guiFactory
Definition:
AccountLoginCommand.java:55
com.realtime.crossfire.jxclient.gui.gui.Gui
Definition:
Gui.java:49
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.canExecute
boolean canExecute()
Definition:
AccountLoginCommand.java:70
com.realtime.crossfire.jxclient.skin
com.realtime.crossfire.jxclient.gui.textinput.CommandCallback.accountLogin
void accountLogin(@NotNull String login, @NotNull String password)
com.realtime.crossfire.jxclient.skin.skin.GuiFactory
Definition:
GuiFactory.java:41
com.realtime.crossfire.jxclient.gui.textinput
Definition:
ActivateCommandInputCommand.java:23
com.realtime.crossfire.jxclient.gui.commandlist
Definition:
CommandList.java:23
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand
Definition:
AccountLoginCommand.java:37
com.realtime.crossfire.jxclient.gui.textinput.CommandCallback
Definition:
CommandCallback.java:33
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.AccountLoginCommand
AccountLoginCommand(@NotNull final CommandCallback commandCallback, @NotNull final AbstractGUIElement button, @NotNull final GuiFactory guiFactory)
Definition:
AccountLoginCommand.java:63
com.realtime.crossfire.jxclient.skin.skin.GuiFactory.getGui
Gui getGui(@NotNull final AbstractGUIElement element)
Definition:
GuiFactory.java:110
com.realtime.crossfire.jxclient.gui.textinput.GUIText.getText
String getText()
Definition:
GUIText.java:234
com.realtime.crossfire.jxclient.gui
com.realtime.crossfire.jxclient.gui.gui.Gui.getFirstElement
public< T extends GUIElement > T getFirstElement(@NotNull final Class< T > class_)
Definition:
Gui.java:300
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.element
final AbstractGUIElement element
Definition:
AccountLoginCommand.java:49
com.realtime.crossfire.jxclient.gui.gui
Definition:
AbstractGUIElement.java:23
com.realtime.crossfire
com.realtime.crossfire.jxclient.gui.textinput.GUIText
Definition:
GUIText.java:61
com.realtime
com
com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
Definition:
AbstractGUIElement.java:37
com.realtime.crossfire.jxclient.gui.commands.AccountLoginCommand.commandCallback
final CommandCallback commandCallback
Definition:
AccountLoginCommand.java:43
com.realtime.crossfire.jxclient.gui.commandlist.GUICommand
Definition:
GUICommand.java:29
Generated by
1.8.17