summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/JRummikub.java28
-rw-r--r--src/jrummikub/util/Event.java30
-rw-r--r--src/jrummikub/util/Event1.java4
-rw-r--r--src/jrummikub/util/Event2.java4
-rw-r--r--src/jrummikub/util/IListener.java4
-rw-r--r--src/jrummikub/util/IListener1.java2
-rw-r--r--src/jrummikub/util/IListener2.java2
-rw-r--r--src/jrummikub/view/impl/AbstractStonePanel.java4
-rw-r--r--src/jrummikub/view/impl/PlayerPanel.java6
9 files changed, 42 insertions, 42 deletions
diff --git a/src/jrummikub/JRummikub.java b/src/jrummikub/JRummikub.java
index 54566d5..571e679 100644
--- a/src/jrummikub/JRummikub.java
+++ b/src/jrummikub/JRummikub.java
@@ -40,19 +40,19 @@ public class JRummikub {
view.getPlayerPanel().getSortByNumberEvent().add(new IListener() {
@Override
- public void fire() {
+ public void handle() {
System.out.println("'Sort by number' fired");
}
});
view.getPlayerPanel().getSortByColorEvent().add(new IListener() {
@Override
- public void fire() {
+ public void handle() {
System.out.println("'Sort by color' fired");
}
});
view.getPlayerPanel().getEndTurnEvent().add(new IListener() {
@Override
- public void fire() {
+ public void handle() {
System.out.println("'End turn' fired");
}
});
@@ -73,14 +73,14 @@ public class JRummikub {
view.getPlayerPanel().getHandPanel().getClickEvent()
.add(new IListener1<Position>() {
@Override
- public void fire(Position p) {
+ public void handle(Position p) {
System.out.println("Hand clicked at " + p);
}
});
view.getPlayerPanel().getHandPanel().getStoneClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Hand clicked on " + s
+ (collect ? ", collect" : ""));
@@ -89,7 +89,7 @@ public class JRummikub {
view.getPlayerPanel().getHandPanel().getRangeClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Hand range-clicked on " + s
+ (collect ? ", collect" : ""));
@@ -98,7 +98,7 @@ public class JRummikub {
view.getPlayerPanel().getHandPanel().getSetClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Hand set-clicked at " + s
+ (collect ? ", collect" : ""));
@@ -108,14 +108,14 @@ public class JRummikub {
view.getTablePanel().getClickEvent()
.add(new IListener1<Position>() {
@Override
- public void fire(Position p) {
+ public void handle(Position p) {
System.out.println("Table clicked at " + p);
}
});
view.getTablePanel().getStoneClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Table clicked on " + s
+ (collect ? ", collect" : ""));
@@ -124,7 +124,7 @@ public class JRummikub {
view.getTablePanel().getRangeClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Table range-clicked on " + s
+ (collect ? ", collect" : ""));
@@ -133,7 +133,7 @@ public class JRummikub {
view.getTablePanel().getSetClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Table set-clicked at " + s
+ (collect ? ", collect" : ""));
@@ -143,7 +143,7 @@ public class JRummikub {
view.getTablePanel().getStoneCollectionPanel().getStoneClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Collection clicked on " + s
+ (collect ? ", collect" : ""));
@@ -152,7 +152,7 @@ public class JRummikub {
view.getTablePanel().getStoneCollectionPanel().getRangeClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Collection range-clicked on " + s
+ (collect ? ", collect" : ""));
@@ -161,7 +161,7 @@ public class JRummikub {
view.getTablePanel().getStoneCollectionPanel().getSetClickEvent()
.add(new IListener2<Stone, Boolean>() {
@Override
- public void fire(Stone s, Boolean collect) {
+ public void handle(Stone s, Boolean collect) {
System.out.println("Collection set-clicked at " + s
+ (collect ? ", collect" : ""));
diff --git a/src/jrummikub/util/Event.java b/src/jrummikub/util/Event.java
index 698e0ed..64a70b3 100644
--- a/src/jrummikub/util/Event.java
+++ b/src/jrummikub/util/Event.java
@@ -4,22 +4,22 @@ import java.util.HashSet;
/** Simple parameterless event generator */
public class Event implements IEvent {
- private HashSet<IListener> listeners = new HashSet<IListener>();
+ private HashSet<IListener> listeners = new HashSet<IListener>();
- @Override
- public void add(IListener listener) {
- listeners.add(listener);
- }
+ @Override
+ public void add(IListener listener) {
+ listeners.add(listener);
+ }
- @Override
- public void remove(IListener listener) {
- listeners.remove(listener);
- }
+ @Override
+ public void remove(IListener listener) {
+ listeners.remove(listener);
+ }
- /** Generate a single event */
- public void fire() {
- for (IListener listener : listeners) {
- listener.fire();
- }
- }
+ /** Generate a single event */
+ public void emit() {
+ for (IListener listener : listeners) {
+ listener.handle();
+ }
+ }
}
diff --git a/src/jrummikub/util/Event1.java b/src/jrummikub/util/Event1.java
index 8ddf2a5..3f5056d 100644
--- a/src/jrummikub/util/Event1.java
+++ b/src/jrummikub/util/Event1.java
@@ -27,9 +27,9 @@ public class Event1<T> implements IEvent1<T> {
* @param value
* the event parameter
*/
- public void fire(T value) {
+ public void emit(T value) {
for (IListener1<T> listener : listeners) {
- listener.fire(value);
+ listener.handle(value);
}
}
}
diff --git a/src/jrummikub/util/Event2.java b/src/jrummikub/util/Event2.java
index f89446e..764004f 100644
--- a/src/jrummikub/util/Event2.java
+++ b/src/jrummikub/util/Event2.java
@@ -31,9 +31,9 @@ public class Event2<T1, T2> implements IEvent2<T1, T2> {
* @param value2
* the second event parameter
*/
- public void fire(T1 value1, T2 value2) {
+ public void emit(T1 value1, T2 value2) {
for (IListener2<T1, T2> listener : listeners) {
- listener.fire(value1, value2);
+ listener.handle(value1, value2);
}
}
}
diff --git a/src/jrummikub/util/IListener.java b/src/jrummikub/util/IListener.java
index 9030f71..f805452 100644
--- a/src/jrummikub/util/IListener.java
+++ b/src/jrummikub/util/IListener.java
@@ -4,6 +4,6 @@ package jrummikub.util;
* Interface for classes that can receive parameterless events
*/
public interface IListener {
- /** This method is called whenever a class we're listening to emits an event */
- public void fire();
+ /** This method is called whenever a class we're listening to emits an event */
+ public void handle();
}
diff --git a/src/jrummikub/util/IListener1.java b/src/jrummikub/util/IListener1.java
index c5e7253..5a01569 100644
--- a/src/jrummikub/util/IListener1.java
+++ b/src/jrummikub/util/IListener1.java
@@ -14,5 +14,5 @@ public interface IListener1<T> {
* @param value
* the event parameter
*/
- public void fire(T value);
+ public void handle(T value);
}
diff --git a/src/jrummikub/util/IListener2.java b/src/jrummikub/util/IListener2.java
index 1733208..dd571a3 100644
--- a/src/jrummikub/util/IListener2.java
+++ b/src/jrummikub/util/IListener2.java
@@ -18,5 +18,5 @@ public interface IListener2<T1, T2> {
* @param value2
* the second event parameter
*/
- public void fire(T1 value1, T2 value2);
+ public void handle(T1 value1, T2 value2);
}
diff --git a/src/jrummikub/view/impl/AbstractStonePanel.java b/src/jrummikub/view/impl/AbstractStonePanel.java
index 19e5891..a19ea1f 100644
--- a/src/jrummikub/view/impl/AbstractStonePanel.java
+++ b/src/jrummikub/view/impl/AbstractStonePanel.java
@@ -65,7 +65,7 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
Stone stone = getStoneAt(pos);
if (stone == null) {
- clickEvent.fire(pos);
+ clickEvent.emit(pos);
return;
}
@@ -76,7 +76,7 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
else if (e.getClickCount() >= 2)
event = setClickEvent;
- event.fire(stone, e.isControlDown());
+ event.emit(stone, e.isControlDown());
}
});
}
diff --git a/src/jrummikub/view/impl/PlayerPanel.java b/src/jrummikub/view/impl/PlayerPanel.java
index 0a7e64a..385356b 100644
--- a/src/jrummikub/view/impl/PlayerPanel.java
+++ b/src/jrummikub/view/impl/PlayerPanel.java
@@ -96,7 +96,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
sortByNumberButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
- sortByNumberEvent.fire();
+ sortByNumberEvent.emit();
}
});
leftPanel.add(sortByNumberButton);
@@ -107,7 +107,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
sortByColorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
- sortByColorEvent.fire();
+ sortByColorEvent.emit();
}
});
leftPanel.add(sortByColorButton);
@@ -131,7 +131,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
endTurnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
- endTurnEvent.fire();
+ endTurnEvent.emit();
}
});