summaryrefslogtreecommitdiffstats
path: root/src/jrummikub
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-19 16:11:23 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-19 16:11:23 +0200
commitd0d349e5a8cd1d48bfe50fc93e762b26ee17a39a (patch)
treebc51f6e3a79684f67c193c82778dd7008acd763b /src/jrummikub
parent92fe29000b3a8da2adc498154521e7969b6f9c5f (diff)
downloadJRummikub-d0d349e5a8cd1d48bfe50fc93e762b26ee17a39a.tar
JRummikub-d0d349e5a8cd1d48bfe50fc93e762b26ee17a39a.zip
Fix warnings
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@484 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub')
-rw-r--r--src/jrummikub/control/ApplicationControl.java2
-rw-r--r--src/jrummikub/control/SaveControl.java12
-rw-r--r--src/jrummikub/control/network/ConnectionControl.java30
-rw-r--r--src/jrummikub/control/network/NetworkControl.java18
-rw-r--r--src/jrummikub/util/Pair.java2
-rw-r--r--src/jrummikub/view/IView.java20
-rw-r--r--src/jrummikub/view/impl/HandPanel.java2
-rw-r--r--src/jrummikub/view/impl/PlayerPanel.java1
-rw-r--r--src/jrummikub/view/impl/View.java2
9 files changed, 60 insertions, 29 deletions
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java
index d07a0f6..1ed517f 100644
--- a/src/jrummikub/control/ApplicationControl.java
+++ b/src/jrummikub/control/ApplicationControl.java
@@ -68,7 +68,7 @@ public class ApplicationControl {
saveControl.getLoadErrorEvent().add(new IListener() {
@Override
public void handle() {
- view.showError();
+ view.showLoadingError();
}
});
}
diff --git a/src/jrummikub/control/SaveControl.java b/src/jrummikub/control/SaveControl.java
index 3e12a9d..86aaac6 100644
--- a/src/jrummikub/control/SaveControl.java
+++ b/src/jrummikub/control/SaveControl.java
@@ -108,15 +108,19 @@ public class SaveControl {
loadErrorEvent.emit();
}
}
-
- public Event getLoadErrorEvent(){
+
+ /**
+ * The load error event is emitted when the file selected for loading is not
+ * a rum file
+ *
+ * @return the event
+ */
+ public Event getLoadErrorEvent() {
return loadErrorEvent;
}
private void save(File file) {
if (gameState == null || gameSettings == null) {
- // TODO Menüpunkt ausgrauen
- System.err.println("kein aktives Spiel");
return;
}
try {
diff --git a/src/jrummikub/control/network/ConnectionControl.java b/src/jrummikub/control/network/ConnectionControl.java
index 6ded0f3..0a36ebd 100644
--- a/src/jrummikub/control/network/ConnectionControl.java
+++ b/src/jrummikub/control/network/ConnectionControl.java
@@ -32,6 +32,9 @@ import org.jivesoftware.smack.util.Base64;
import org.jivesoftware.smackx.muc.DiscussionHistory;
import org.jivesoftware.smackx.muc.MultiUserChat;
+/**
+ * Connection control managing network connections, essages and events
+ */
public class ConnectionControl implements IConnectionControl {
private final static String ELEMENT_NAME = "rummikub";
private final static String NAMESPACE = "http://home.universe-factory.net/rummikub/";
@@ -59,6 +62,12 @@ public class ConnectionControl implements IConnectionControl {
private volatile GameData offeredGame;
+ /**
+ * Creates new connection control
+ *
+ * @param loginData
+ * player's login data
+ */
public ConnectionControl(LoginData loginData) {
this.loginData = loginData;
}
@@ -222,7 +231,8 @@ public class ConnectionControl implements IConnectionControl {
protected void addData(DefaultPacketExtension extension) {
extension.setValue("messageType", "change_color");
extension.setValue("uuid", uuid.toString());
- extension.setValue("color", Base64.encodeObject(color, Base64.GZIP));
+ extension.setValue("color",
+ Base64.encodeObject(color, Base64.GZIP));
}
});
@@ -248,8 +258,8 @@ public class ConnectionControl implements IConnectionControl {
protected void addData(DefaultPacketExtension extension) {
extension.setValue("messageType", "game_offer");
extension.setValue("uuid", data.getGameID().toString());
- extension.setValue("gameSettings",
- Base64.encodeObject(data.getGameSettings(), Base64.GZIP));
+ extension.setValue("gameSettings", Base64.encodeObject(
+ data.getGameSettings(), Base64.GZIP));
}
});
}
@@ -287,8 +297,8 @@ public class ConnectionControl implements IConnectionControl {
.getExtension(ELEMENT_NAME, NAMESPACE);
if (((Message) packet).getType() == Message.Type.error) {
- System.err.println("Received error message from '" + packet.getFrom()
- + "'");
+ System.err.println("Received error message from '"
+ + packet.getFrom() + "'");
return;
}
@@ -304,13 +314,14 @@ public class ConnectionControl implements IConnectionControl {
String sender, String messageType) {
if (messageType.equals("game_offer")) {
UUID uuid = UUID.fromString(extension.getValue("uuid"));
- GameSettings settings = (GameSettings) Base64.decodeToObject(extension
- .getValue("gameSettings"));
+ GameSettings settings = (GameSettings) Base64
+ .decodeToObject(extension.getValue("gameSettings"));
GameData gameData = new GameData(uuid, settings, sender);
gameOfferEvent.emit(gameData);
} else if (messageType.equals("game_withdrawal")) {
- gameWithdrawalEvent.emit(UUID.fromString(extension.getValue("uuid")));
+ gameWithdrawalEvent
+ .emit(UUID.fromString(extension.getValue("uuid")));
} else if (messageType.equals("game_request")) {
if (offeredGame != null) {
sendGameOffer();
@@ -393,7 +404,8 @@ public class ConnectionControl implements IConnectionControl {
break; // Join was successful, break the loop
} catch (XMPPException e) {
XMPPError error = e.getXMPPError();
- if (error.getType() == Type.CANCEL && error.getCode() == 409) {
+ if (error.getType() == Type.CANCEL
+ && error.getCode() == 409) {
// There was a conflict, try again with another
// nickname
nickname += "_";
diff --git a/src/jrummikub/control/network/NetworkControl.java b/src/jrummikub/control/network/NetworkControl.java
index cfb3c14..71000aa 100644
--- a/src/jrummikub/control/network/NetworkControl.java
+++ b/src/jrummikub/control/network/NetworkControl.java
@@ -37,6 +37,8 @@ public class NetworkControl {
*
* @param loginData
* user's login data
+ * @param connectionControl
+ * current connection for events and messages
* @param view
* for events and handlers
*/
@@ -48,24 +50,24 @@ public class NetworkControl {
addConnectionSetupListeners(loginData, view);
addConnectionControlListeners(view);
- connections.add(view.getGameListPanel().getJoinEvent().add(
- new IListener1<GameData>() {
+ connections.add(view.getGameListPanel().getJoinEvent()
+ .add(new IListener1<GameData>() {
@Override
public void handle(GameData gameData) {
join(gameData);
}
}));
- connections.add(view.getGameListPanel().getOpenNewGameEvent().add(
- new IListener() {
+ connections.add(view.getGameListPanel().getOpenNewGameEvent()
+ .add(new IListener() {
@Override
public void handle() {
createSettingsControl();
}
}));
- connections.add(view.getGameListPanel().getCancelEvent().add(
- new IListener() {
+ connections.add(view.getGameListPanel().getCancelEvent()
+ .add(new IListener() {
@Override
public void handle() {
abort();
@@ -222,8 +224,8 @@ public class NetworkControl {
}
view.showGameListPanel(false);
- settingsControl = new NetworkSettingsControl(connectionControl
- .getNickname(), view, new GameSettings());
+ settingsControl = new NetworkSettingsControl(
+ connectionControl.getNickname(), view, new GameSettings());
settingsControl.getOfferGameEvent().add(new IListener1<GameSettings>() {
@Override
public void handle(GameSettings settings) {
diff --git a/src/jrummikub/util/Pair.java b/src/jrummikub/util/Pair.java
index 5ebc7f2..80b9ea0 100644
--- a/src/jrummikub/util/Pair.java
+++ b/src/jrummikub/util/Pair.java
@@ -61,7 +61,6 @@ public class Pair<T1, T2> implements Serializable {
return result;
}
- @SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
if (this == obj)
@@ -70,6 +69,7 @@ public class Pair<T1, T2> implements Serializable {
return false;
if (getClass() != obj.getClass())
return false;
+ @SuppressWarnings("rawtypes")
Pair other = (Pair) obj;
if (first == null) {
if (other.first != null)
diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java
index 86ab5be..0074b8d 100644
--- a/src/jrummikub/view/IView.java
+++ b/src/jrummikub/view/IView.java
@@ -237,7 +237,6 @@ public interface IView {
*/
public void showGameListPanel(boolean show);
-
/**
* Is set if a player tried to lay out less than initial meld threshold
*
@@ -250,6 +249,7 @@ public interface IView {
* Show stone collection
*
* @param enable
+ * showing collection
*/
public void setStoneCollectionHidden(boolean enable);
@@ -258,7 +258,14 @@ public interface IView {
*/
public void setInitialMeldFirstError();
+ /**
+ * Set invalid sets to enable showing
+ *
+ * @param sets
+ * invalid sets on table
+ */
public void setInvalidStoneSets(Collection<StoneSet> sets);
+
/**
* Different types of bottom panels
*/
@@ -276,7 +283,16 @@ public interface IView {
/** */
WIN_PANEL
}
- void showError();
+ /**
+ * Show when loading is unsuccessful
+ */
+ void showLoadingError();
+
+ /**
+ * Enables/disables saving in menu bar
+ *
+ * @param enable
+ */
void enableSave(boolean enable);
}
diff --git a/src/jrummikub/view/impl/HandPanel.java b/src/jrummikub/view/impl/HandPanel.java
index 181be07..c07bee0 100644
--- a/src/jrummikub/view/impl/HandPanel.java
+++ b/src/jrummikub/view/impl/HandPanel.java
@@ -6,8 +6,6 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
import java.awt.image.BufferedImage;
import java.util.Collection;
import java.util.Collections;
diff --git a/src/jrummikub/view/impl/PlayerPanel.java b/src/jrummikub/view/impl/PlayerPanel.java
index 2cf7eaa..cfb858f 100644
--- a/src/jrummikub/view/impl/PlayerPanel.java
+++ b/src/jrummikub/view/impl/PlayerPanel.java
@@ -6,7 +6,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
import java.text.DecimalFormat;
import java.util.Collections;
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index e436419..cb9bd93 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -165,7 +165,7 @@ public class View extends JFrame implements IView {
}
@Override
- public void showError() {
+ public void showLoadingError() {
JOptionPane.showMessageDialog(this, "Kein g\u00fcltiger Spielstand",
"Fehler", JOptionPane.ERROR_MESSAGE);
}