summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-17 20:00:43 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-17 20:00:43 +0200
commit4f71c5cb4700b39d816c6a4ae123ad94fef456df (patch)
tree3ed53d9d84956179e86b5483c8d07bd767d4b0f8 /src/jrummikub/control
parent2c9f1d5d202ca1cea69846aea42a4962e7482a6b (diff)
downloadJRummikub-4f71c5cb4700b39d816c6a4ae123ad94fef456df.tar
JRummikub-4f71c5cb4700b39d816c6a4ae123ad94fef456df.zip
Kommentare und 2 Methoden, die jetzt kurz genug sind
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@446 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/AbstractSettingsControl.java71
1 files changed, 38 insertions, 33 deletions
diff --git a/src/jrummikub/control/AbstractSettingsControl.java b/src/jrummikub/control/AbstractSettingsControl.java
index ff43ce2..79f8274 100644
--- a/src/jrummikub/control/AbstractSettingsControl.java
+++ b/src/jrummikub/control/AbstractSettingsControl.java
@@ -17,6 +17,10 @@ import jrummikub.util.IListener2;
import jrummikub.view.ISettingsPanel;
import jrummikub.view.IView;
+/**
+ * Abstract control class managing joined methods and attributes of all
+ * different (network, default...) settings controls
+ */
public abstract class AbstractSettingsControl {
protected IView view;
protected List<Connection> connections = new ArrayList<Connection>();
@@ -45,15 +49,15 @@ public abstract class AbstractSettingsControl {
}
private void addPlayerSettingsListeners() {
- connections.add(view.getSettingsPanel().getAddPlayerEvent()
- .add(new IListener() {
+ connections.add(view.getSettingsPanel().getAddPlayerEvent().add(
+ new IListener() {
@Override
public void handle() {
addPlayer();
}
}));
- connections.add(view.getSettingsPanel().getRemovePlayerEvent()
- .add(new IListener1<Integer>() {
+ connections.add(view.getSettingsPanel().getRemovePlayerEvent().add(
+ new IListener1<Integer>() {
@Override
public void handle(Integer i) {
removePlayer(i);
@@ -66,32 +70,32 @@ public abstract class AbstractSettingsControl {
setPlayerColor(i, color);
}
}));
- connections.add(view.getSettingsPanel().getChangePlayerNameEvent()
- .add(new IListener2<Integer, String>() {
+ connections.add(view.getSettingsPanel().getChangePlayerNameEvent().add(
+ new IListener2<Integer, String>() {
@Override
public void handle(Integer i, String name) {
setPlayerName(i, name);
}
}));
- connections.add(view.getSettingsPanel().getChangePlayerTypeEvent()
- .add(new IListener2<Integer, Type>() {
+ connections.add(view.getSettingsPanel().getChangePlayerTypeEvent().add(
+ new IListener2<Integer, Type>() {
@Override
public void handle(Integer i, Type type) {
setPlayerType(i, type);
}
}));
}
-
+
private void addOptionListeners1() {
connections.add(view.getSettingsPanel()
- .getChangeInitialMeldThresholdEvent()
- .add(new IListener1<Integer>() {
- @Override
- public void handle(Integer value) {
- settings.setInitialMeldThreshold(value);
- update();
- }
- }));
+ .getChangeInitialMeldThresholdEvent().add(
+ new IListener1<Integer>() {
+ @Override
+ public void handle(Integer value) {
+ settings.setInitialMeldThreshold(value);
+ update();
+ }
+ }));
connections.add(view.getSettingsPanel().getChangeJokerNumberEvent()
.add(new IListener1<Integer>() {
@@ -111,14 +115,14 @@ public abstract class AbstractSettingsControl {
}
}));
connections.add(view.getSettingsPanel()
- .getChangeNumberOfStonesDealtEvent()
- .add(new IListener1<Integer>() {
- @Override
- public void handle(Integer value) {
- settings.setNumberOfStonesDealt(value);
- update();
- }
- }));
+ .getChangeNumberOfStonesDealtEvent().add(
+ new IListener1<Integer>() {
+ @Override
+ public void handle(Integer value) {
+ settings.setNumberOfStonesDealt(value);
+ update();
+ }
+ }));
}
private void addOptionListeners2() {
@@ -130,8 +134,8 @@ public abstract class AbstractSettingsControl {
update();
}
}));
- connections.add(view.getSettingsPanel().getChangeTimeEvent()
- .add(new IListener1<Integer>() {
+ connections.add(view.getSettingsPanel().getChangeTimeEvent().add(
+ new IListener1<Integer>() {
@Override
public void handle(Integer value) {
settings.setTotalTime(value);
@@ -147,8 +151,8 @@ public abstract class AbstractSettingsControl {
}
}));
- connections.add(view.getSettingsPanel().getChangeNoLimitsEvent()
- .add(new IListener1<Boolean>() {
+ connections.add(view.getSettingsPanel().getChangeNoLimitsEvent().add(
+ new IListener1<Boolean>() {
@Override
public void handle(Boolean value) {
settings.setNoLimits(value);
@@ -182,7 +186,7 @@ public abstract class AbstractSettingsControl {
}
}));
}
-
+
/**
* Start the operation of the settings control
*/
@@ -231,7 +235,7 @@ public abstract class AbstractSettingsControl {
settings.getPlayerList().remove(i);
update();
}
-
+
protected boolean checkSettings() {
if (!checkName()) {
return false;
@@ -269,7 +273,8 @@ public abstract class AbstractSettingsControl {
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
PlayerSettings player2 = settings.getPlayerList().get(j);
if (player2.getName().equals(name) && player2.getType() == type) {
- view.getSettingsPanel()
+ view
+ .getSettingsPanel()
.setError(
ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
view.getSettingsPanel().enableStartGameButton(false);
@@ -325,7 +330,7 @@ public abstract class AbstractSettingsControl {
return;
}
}
-
+
/**
* Abort settings control once settings are set
*/