Crossfire JXClient, Trunk  R20561
ConnectionStateSkinEvent.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-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.skin.events;
23 
28 import org.jetbrains.annotations.NotNull;
29 
34 public class ConnectionStateSkinEvent implements SkinEvent {
35 
39  @NotNull
40  private final CommandList commandList;
41 
45  @NotNull
47 
51  @NotNull
53 
54  @Override
55  public void start() {
56  // ignore
57  }
58 
59  @Override
60  public void metaserver() {
61  // ignore
62  }
63 
64  @Override
65  public void preConnecting(@NotNull final String serverInfo) {
66  // ignore
67  }
68 
69  @Override
70  public void connecting(@NotNull final String serverInfo) {
71  commandList.execute();
72  }
73 
74  @Override
75  public void connecting(@NotNull final ClientSocketState clientSocketState) {
76  // ignore
77  }
78 
79  @Override
80  public void connected() {
81  // ignore
82  }
83 
84  @Override
85  public void connectFailed(@NotNull final String reason) {
86  // ignore
87  }
88 
89  };
90 
96  public ConnectionStateSkinEvent(@NotNull final CommandList commandList, @NotNull final GuiStateManager guiStateManager) {
97  this.commandList = commandList;
98  this.guiStateManager = guiStateManager;
99  guiStateManager.addGuiStateListener(guiStateListener);
100  }
101 
105  @Override
106  public void dispose() {
107  guiStateManager.removeGuiStateListener(guiStateListener);
108  }
109 
110 }
Interface for listeners interested gui state changes.
ConnectionStateSkinEvent(@NotNull final CommandList commandList, @NotNull final GuiStateManager guiStateManager)
Creates a new instance.
void addGuiStateListener(@NotNull final GuiStateListener listener)
Adds a gui state listener.
Interface for events attached to skins.
Definition: SkinEvent.java:28
final GuiStateManager guiStateManager
The GuiStateManager to watch.
void removeGuiStateListener(@NotNull final GuiStateListener listener)
Removes a gui state listener.
A SkinEvent that executes a CommandList at connection setup.
void dispose()
Will be called when the skin is disposed.Should release resources.
Connection progress states of the Crossfire server connection.
void execute()
Execute the command list by calling GUICommand#execute() for each command in order.
final GuiStateListener guiStateListener
The GuiStateListener attached to guiStateManager.