Chat window - messages now appear in the list above (but it's still disconnected from network part)

Dealt with Command class - now it's method is called run and the interface extends Runnable.
All UI-related calls may be switched
This commit is contained in:
Maxmtg
2013-04-17 11:48:06 +00:00
parent ce8ac3fcdd
commit 4c4430e793
65 changed files with 209 additions and 185 deletions

View File

@@ -2865,7 +2865,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void executeTrigger(final ZCTrigger type) { public final void executeTrigger(final ZCTrigger type) {
for (final AbilityTriggered t : this.zcTriggers) { for (final AbilityTriggered t : this.zcTriggers) {
if (t.getTrigger().equals(type) && t.isBasic()) { if (t.getTrigger().equals(type) && t.isBasic()) {
t.execute(); t.run();
} }
} }
} }
@@ -2945,7 +2945,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void runChangeControllerCommands() { public final void runChangeControllerCommands() {
for (final Command c : this.changeControllerCommandList) { for (final Command c : this.changeControllerCommandList) {
c.execute(); c.run();
} }
} }
@@ -4149,7 +4149,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
for (final Command var : this.untapCommandList) { for (final Command var : this.untapCommandList) {
var.execute(); var.run();
} }
this.setTapped(false); this.setTapped(false);

View File

@@ -25,21 +25,15 @@ package forge;
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
public interface Command extends java.io.Serializable { public interface Command extends java.io.Serializable, Runnable {
/** Constant <code>Blank</code>. */ /** Constant <code>Blank</code>. */
public final Command BLANK = new Command() { public final Command BLANK = new Command() {
private static final long serialVersionUID = 2689172297036001710L; private static final long serialVersionUID = 2689172297036001710L;
@Override @Override
public void execute() { public void run() {
} }
};
/** };
* <p>
* execute.
* </p>
*/
void execute();
} }

View File

@@ -130,9 +130,9 @@ public class CommandList implements Command, Iterable<Command> {
* </p> * </p>
*/ */
@Override @Override
public final void execute() { public final void run() {
for (int i = 0; i < this.size(); i++) { for (int i = 0; i < this.size(); i++) {
this.get(i).execute(); this.get(i).run();
} }
} }

View File

@@ -220,7 +220,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
private static final long serialVersionUID = -5861759814760561373L; private static final long serialVersionUID = -5861759814760561373L;
@Override @Override
public void execute() { public void run() {
doUnanimate(c, sa, finalDesc, hiddenKeywords, addedAbilities, addedTriggers, doUnanimate(c, sa, finalDesc, hiddenKeywords, addedAbilities, addedTriggers,
colorTimestamp, false, removedAbilities, timestamp); colorTimestamp, false, removedAbilities, timestamp);

View File

@@ -241,7 +241,7 @@ public class AnimateEffect extends AnimateEffectBase {
private static final long serialVersionUID = -5861759814760561373L; private static final long serialVersionUID = -5861759814760561373L;
@Override @Override
public void execute() { public void run() {
doUnanimate(c, sa, finalDesc, hiddenKeywords, addedAbilities, addedTriggers, doUnanimate(c, sa, finalDesc, hiddenKeywords, addedAbilities, addedTriggers,
colorTimestamp, givesStAbs, removedAbilities, timestamp); colorTimestamp, givesStAbs, removedAbilities, timestamp);

View File

@@ -134,7 +134,7 @@ public class AttachEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -639204333673364477L; private static final long serialVersionUID = -639204333673364477L;
@Override @Override
public void execute() { public void run() {
final GameEntity entity = card.getEnchanting(); final GameEntity entity = card.getEnchanting();
if (entity == null) { if (entity == null) {
return; return;

View File

@@ -190,7 +190,7 @@ public class CloneEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -78375985476256279L; private static final long serialVersionUID = -78375985476256279L;
@Override @Override
public void execute() { public void run() {
if (cloneCard.isCloned()) { if (cloneCard.isCloned()) {
cloneCard.switchStates(CardCharacteristicName.Cloner, CardCharacteristicName.Original); cloneCard.switchStates(CardCharacteristicName.Cloner, CardCharacteristicName.Original);
cloneCard.setState(CardCharacteristicName.Original); cloneCard.setState(CardCharacteristicName.Original);

View File

@@ -191,7 +191,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 878543373519872418L; private static final long serialVersionUID = 878543373519872418L;
@Override @Override
public void execute() { public void run() {
final Ability ability = new Ability(hostCard, ManaCost.ZERO) { final Ability ability = new Ability(hostCard, ManaCost.ZERO) {
@Override @Override
public void resolve() { public void resolve() {
@@ -234,7 +234,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 878543373519872418L; private static final long serialVersionUID = 878543373519872418L;
@Override @Override
public void execute() { doLoseControl(c, hostCard, bTapOnLose, kws, tStamp); } public void run() { doLoseControl(c, hostCard, bTapOnLose, kws, tStamp); }
}; };
return loseControl; return loseControl;

View File

@@ -268,7 +268,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -4184510100801568140L; private static final long serialVersionUID = -4184510100801568140L;
@Override @Override
public void execute() { public void run() {
sac.setStackDescription(sa.getParam("AtEOT") + " " + target[index] + "."); sac.setStackDescription(sa.getParam("AtEOT") + " " + target[index] + ".");
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sac); Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sac);
} }

View File

@@ -66,7 +66,7 @@ public class DebuffAllEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 7486231071095628674L; private static final long serialVersionUID = 7486231071095628674L;
@Override @Override
public void execute() { public void run() {
if (tgtC.isInPlay()) { if (tgtC.isInPlay()) {
for (final String kw : hadIntrinsic) { for (final String kw : hadIntrinsic) {
tgtC.addIntrinsicKeyword(kw); tgtC.addIntrinsicKeyword(kw);

View File

@@ -73,7 +73,7 @@ public class DebuffEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 5387486776282932314L; private static final long serialVersionUID = 5387486776282932314L;
@Override @Override
public void execute() { public void run() {
if (tgtC.isInPlay()) { if (tgtC.isInPlay()) {
for (final String kw : hadIntrinsic) { for (final String kw : hadIntrinsic) {
tgtC.addIntrinsicKeyword(kw); tgtC.addIntrinsicKeyword(kw);

View File

@@ -196,7 +196,7 @@ public class EffectEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -5861759814760561373L; private static final long serialVersionUID = -5861759814760561373L;
@Override @Override
public void execute() { public void run() {
Singletons.getModel().getGame().getAction().exile(e); Singletons.getModel().getGame().getAction().exile(e);
} }
}; };

View File

@@ -92,7 +92,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -6573962672873853565L; private static final long serialVersionUID = -6573962672873853565L;
@Override @Override
public void execute() { public void run() {
if (tgtC.isInPlay()) { if (tgtC.isInPlay()) {
for (final String gain : gains) { for (final String gain : gains) {
tgtC.removeExtrinsicKeyword("Protection from " + gain); tgtC.removeExtrinsicKeyword("Protection from " + gain);
@@ -128,7 +128,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -6573962672873853565L; private static final long serialVersionUID = -6573962672873853565L;
@Override @Override
public void execute() { public void run() {
for (final String gain : gains) { for (final String gain : gains) {
player.removeKeyword("Protection from " + gain); player.removeKeyword("Protection from " + gain);
} }

View File

@@ -173,7 +173,7 @@ public class ProtectEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 7682700789217703789L; private static final long serialVersionUID = 7682700789217703789L;
@Override @Override
public void execute() { public void run() {
if (tgtC.isInPlay()) { if (tgtC.isInPlay()) {
for (final String gain : gains) { for (final String gain : gains) {
tgtC.removeExtrinsicKeyword("Protection from " + gain); tgtC.removeExtrinsicKeyword("Protection from " + gain);
@@ -205,7 +205,7 @@ public class ProtectEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 7682700789217703789L; private static final long serialVersionUID = 7682700789217703789L;
@Override @Override
public void execute() { public void run() {
if (unTgtC.isInPlay()) { if (unTgtC.isInPlay()) {
for (final String gain : gains) { for (final String gain : gains) {
unTgtC.removeExtrinsicKeyword("Protection from " + gain); unTgtC.removeExtrinsicKeyword("Protection from " + gain);

View File

@@ -52,7 +52,7 @@ public class PumpAllEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 5415795460189457660L; private static final long serialVersionUID = 5415795460189457660L;
@Override @Override
public void execute() { public void run() {
tgtC.addTempAttackBoost(-1 * a); tgtC.addTempAttackBoost(-1 * a);
tgtC.addTempDefenseBoost(-1 * d); tgtC.addTempDefenseBoost(-1 * d);

View File

@@ -43,7 +43,7 @@ public class PumpEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -42244224L; private static final long serialVersionUID = -42244224L;
@Override @Override
public void execute() { public void run() {
applyTo.addTempAttackBoost(-1 * a); applyTo.addTempAttackBoost(-1 * a);
applyTo.addTempDefenseBoost(-1 * d); applyTo.addTempDefenseBoost(-1 * d);
@@ -85,7 +85,7 @@ public class PumpEffect extends SpellAbilityEffect {
private static final long serialVersionUID = -32453460L; private static final long serialVersionUID = -32453460L;
@Override @Override
public void execute() { public void run() {
if (keywords.size() > 0) { if (keywords.size() > 0) {
for (int i = 0; i < keywords.size(); i++) { for (int i = 0; i < keywords.size(); i++) {

View File

@@ -34,7 +34,7 @@ public class RegenerateAllEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 259368227093961103L; private static final long serialVersionUID = 259368227093961103L;
@Override @Override
public void execute() { public void run() {
c.resetShield(); c.resetShield();
} }
}; };

View File

@@ -51,7 +51,7 @@ public class RegenerateEffect extends SpellAbilityEffect {
private static final long serialVersionUID = 1922050611313909200L; private static final long serialVersionUID = 1922050611313909200L;
@Override @Override
public void execute() { public void run() {
tgtC.resetShield(); tgtC.resetShield();
} }
}; };

View File

@@ -82,7 +82,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = 3367390368512271319L; private static final long serialVersionUID = 3367390368512271319L;
@Override @Override
public void execute() { public void run() {
if (card.isInPlay()) { if (card.isInPlay()) {
Singletons.getModel().getGame().getAction().sacrifice(card, null); Singletons.getModel().getGame().getAction().sacrifice(card, null);
} }
@@ -100,7 +100,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = 6667896040611028600L; private static final long serialVersionUID = 6667896040611028600L;
@Override @Override
public void execute() { public void run() {
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability); Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} }
@@ -110,7 +110,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = 1786900359843939456L; private static final long serialVersionUID = 1786900359843939456L;
@Override @Override
public void execute() { public void run() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Stangg Twin")); final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Stangg Twin"));
if (list.size() == 1) { if (list.size() == 1) {
@@ -345,7 +345,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = -7067218066522935060L; private static final long serialVersionUID = -7067218066522935060L;
@Override @Override
public void execute() { public void run() {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append("Kinsbaile Borderguard enters the battlefield with a "); sb.append("Kinsbaile Borderguard enters the battlefield with a ");
sb.append("+1/+1 counter on it for each other Kithkin you control."); sb.append("+1/+1 counter on it for each other Kithkin you control.");
@@ -378,7 +378,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = 304026662487997331L; private static final long serialVersionUID = 304026662487997331L;
@Override @Override
public void execute() { public void run() {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append("When Kinsbaile Borderguard is put into a graveyard "); sb.append("When Kinsbaile Borderguard is put into a graveyard ");
sb.append("from play, put a 1/1 white Kithkin Soldier creature "); sb.append("from play, put a 1/1 white Kithkin Soldier creature ");
@@ -398,7 +398,7 @@ public class CardFactoryCreatures {
private static final long serialVersionUID = -75234586897814L; private static final long serialVersionUID = -75234586897814L;
@Override @Override
public void execute() { public void run() {
int intermSumPower = 0; int intermSumPower = 0;
int intermSumToughness = 0; int intermSumToughness = 0;
// intermSumPower = intermSumToughness = 0; // intermSumPower = intermSumToughness = 0;

View File

@@ -475,7 +475,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 4825430555490333062L; private static final long serialVersionUID = 4825430555490333062L;
@Override @Override
public void execute() { public void run() {
c.addCounter(type, n, true); c.addCounter(type, n, true);
} }
}; };
@@ -2013,7 +2013,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 3014846051064254493L; private static final long serialVersionUID = 3014846051064254493L;
@Override @Override
public void execute() { public void run() {
if (crd.isInPlay()) { if (crd.isInPlay()) {
crd.addTempAttackBoost(-1 * magnitude); crd.addTempAttackBoost(-1 * magnitude);
crd.addTempDefenseBoost(-1 * magnitude); crd.addTempDefenseBoost(-1 * magnitude);
@@ -2302,7 +2302,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = -7913835645603984242L; private static final long serialVersionUID = -7913835645603984242L;
@Override @Override
public void execute() { public void run() {
card.addExtrinsicKeyword("(Echo unpaid)"); card.addExtrinsicKeyword("(Echo unpaid)");
} }
}; };
@@ -2949,7 +2949,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 6436821515525468682L; private static final long serialVersionUID = 6436821515525468682L;
@Override @Override
public void execute() { public void run() {
final List<Card> lands = card.getController().getLandsInPlay(); final List<Card> lands = card.getController().getLandsInPlay();
lands.remove(card); lands.remove(card);
if (!(lands.size() <= 2)) { if (!(lands.size() <= 2)) {
@@ -2978,7 +2978,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 403635232455049834L; private static final long serialVersionUID = 403635232455049834L;
@Override @Override
public void execute() { public void run() {
final List<Card> clICtrl = card.getOwner().getCardsIn(ZoneType.Battlefield); final List<Card> clICtrl = card.getOwner().getCardsIn(ZoneType.Battlefield);
boolean fnd = false; boolean fnd = false;
@@ -3005,7 +3005,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 1489845860231758299L; private static final long serialVersionUID = 1489845860231758299L;
@Override @Override
public void execute() { public void run() {
if (card.isCreature()) { if (card.isCreature()) {
card.addCounter(CounterType.P1P1, card.getSunburstValue(), true); card.addCounter(CounterType.P1P1, card.getSunburstValue(), true);
} else { } else {
@@ -3019,7 +3019,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = -7564420917490677427L; private static final long serialVersionUID = -7564420917490677427L;
@Override @Override
public void execute() { public void run() {
card.setSunburstValue(0); card.setSunburstValue(0);
} }
}; };
@@ -3034,7 +3034,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 6536398032388958127L; private static final long serialVersionUID = 6536398032388958127L;
@Override @Override
public void execute() { public void run() {
final List<Card> cardsInPlay = CardLists.getType(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), "World"); final List<Card> cardsInPlay = CardLists.getType(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), "World");
cardsInPlay.remove(card); cardsInPlay.remove(card);
for (int i = 0; i < cardsInPlay.size(); i++) { for (int i = 0; i < cardsInPlay.size(); i++) {
@@ -3119,7 +3119,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = -7530312713496897814L; private static final long serialVersionUID = -7530312713496897814L;
@Override @Override
public void execute() { public void run() {
final List<Card> creats = card.getController().getCreaturesInPlay(); final List<Card> creats = card.getController().getCreaturesInPlay();
creats.remove(card); creats.remove(card);
// System.out.println("Creats size: " + creats.size()); // System.out.println("Creats size: " + creats.size());
@@ -3192,7 +3192,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = 304026662487997331L; private static final long serialVersionUID = 304026662487997331L;
@Override @Override
public void execute() { public void run() {
final Player modularPlayer = card.getController(); final Player modularPlayer = card.getController();
final List<Card> choices = Lists.newArrayList(); final List<Card> choices = Lists.newArrayList();
for(Card c : modularPlayer.getGame().getCardsIn(ZoneType.Battlefield)) { for(Card c : modularPlayer.getGame().getCardsIn(ZoneType.Battlefield)) {

View File

@@ -109,7 +109,7 @@ public class AbilityTriggered extends Ability implements Command {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final void resolve() { public final void resolve() {
this.todo.execute(); this.todo.run();
} }
/** /**
@@ -118,7 +118,7 @@ public class AbilityTriggered extends Ability implements Command {
* </p> * </p>
*/ */
@Override @Override
public final void execute() { public final void run() {
this.resolve(); this.resolve();
} }

View File

@@ -894,7 +894,7 @@ public class GameAction {
// card state effects like Glorious Anthem // card state effects like Glorious Anthem
for (final String effect : game.getStaticEffects().getStateBasedMap().keySet()) { for (final String effect : game.getStaticEffects().getStateBasedMap().keySet()) {
final Command com = GameActionUtil.getCommands().get(effect); final Command com = GameActionUtil.getCommands().get(effect);
com.execute(); com.run();
} }
GameActionUtil.grantBasicLandsManaAbilities(); GameActionUtil.grantBasicLandsManaAbilities();
@@ -1303,7 +1303,7 @@ public class GameAction {
private static final long serialVersionUID = -4514610171270596654L; private static final long serialVersionUID = -4514610171270596654L;
@Override @Override
public void execute() { public void run() {
if (c.isInPlay() && c.isCreature()) { if (c.isInPlay() && c.isCreature()) {
c.addExtrinsicKeyword("Haste"); c.addExtrinsicKeyword("Haste");
} }
@@ -1316,7 +1316,7 @@ public class GameAction {
private static final long serialVersionUID = -4514610171270596654L; private static final long serialVersionUID = -4514610171270596654L;
@Override @Override
public void execute() { public void run() {
if (c.getSVar("HasteFromSuspend").equals("True")) { if (c.getSVar("HasteFromSuspend").equals("True")) {
c.setSVar("HasteFromSuspend", "False"); c.setSVar("HasteFromSuspend", "False");
c.removeExtrinsicKeyword("Haste"); c.removeExtrinsicKeyword("Haste");

View File

@@ -190,7 +190,7 @@ public final class GameActionUtil {
} }
@Override @Override
public void execute() { public void run() {
if (!c.isCopiedSpell()) { if (!c.isCopiedSpell()) {
final List<Card> maelstromNexii = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Maelstrom Nexus")); final List<Card> maelstromNexii = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Maelstrom Nexus"));
@@ -318,7 +318,7 @@ public final class GameActionUtil {
} }
@Override @Override
public void execute() { public void run() {
final List<Card> thrummingStones = controller.getCardsIn(ZoneType.Battlefield, "Thrumming Stone"); final List<Card> thrummingStones = controller.getCardsIn(ZoneType.Battlefield, "Thrumming Stone");
for (int i = 0; i < thrummingStones.size(); i++) { for (int i = 0; i < thrummingStones.size(); i++) {
@@ -368,9 +368,9 @@ public final class GameActionUtil {
final GameState game = Singletons.getModel().getGame(); final GameState game = Singletons.getModel().getGame();
final Command cascade = new CascadeExecutor(sa.getActivatingPlayer(), sa.getSourceCard(), game); final Command cascade = new CascadeExecutor(sa.getActivatingPlayer(), sa.getSourceCard(), game);
cascade.execute(); cascade.run();
final Command ripple = new RippleExecutor(sa.getActivatingPlayer(), sa.getSourceCard()); final Command ripple = new RippleExecutor(sa.getActivatingPlayer(), sa.getSourceCard());
ripple.execute(); ripple.run();
} }
private static int getAmountFromPart(CostPart part, Card source, SpellAbility sourceAbility) { private static int getAmountFromPart(CostPart part, Card source, SpellAbility sourceAbility) {
@@ -913,7 +913,7 @@ public final class GameActionUtil {
private static final long serialVersionUID = -3500747003228938898L; private static final long serialVersionUID = -3500747003228938898L;
@Override @Override
public void execute() { public void run() {
// get all creatures // get all creatures
final List<Card> cards = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Umbra Stalker")); final List<Card> cards = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Umbra Stalker"));
for (final Card c : cards) { for (final Card c : cards) {
@@ -931,14 +931,14 @@ public final class GameActionUtil {
private static final long serialVersionUID = 8076177362922156784L; private static final long serialVersionUID = 8076177362922156784L;
@Override @Override
public void execute() { public void run() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Old Man of the Sea")); final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Old Man of the Sea"));
for (final Card oldman : list) { for (final Card oldman : list) {
if (!oldman.getGainControlTargets().isEmpty()) { if (!oldman.getGainControlTargets().isEmpty()) {
if (oldman.getNetAttack() < oldman.getGainControlTargets().get(0).getNetAttack()) { if (oldman.getNetAttack() < oldman.getGainControlTargets().get(0).getNetAttack()) {
final List<Command> coms = oldman.getGainControlReleaseCommands(); final List<Command> coms = oldman.getGainControlReleaseCommands();
for (int i = 0; i < coms.size(); i++) { for (int i = 0; i < coms.size(); i++) {
coms.get(i).execute(); coms.get(i).run();
} }
} }
} }
@@ -952,7 +952,7 @@ public final class GameActionUtil {
private static final long serialVersionUID = 4235093010715735727L; private static final long serialVersionUID = 4235093010715735727L;
@Override @Override
public void execute() { public void run() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Liu Bei, Lord of Shu")); final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Liu Bei, Lord of Shu"));
if (list.size() > 0) { if (list.size() > 0) {
@@ -988,7 +988,7 @@ public final class GameActionUtil {
private static final long serialVersionUID = 5895665460018262987L; private static final long serialVersionUID = 5895665460018262987L;
@Override @Override
public void execute() { public void run() {
// get all creatures // get all creatures
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tarmogoyf")); final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tarmogoyf"));

View File

@@ -1228,7 +1228,7 @@ public class CombatUtil {
private static final long serialVersionUID = -1703473800920781454L; private static final long serialVersionUID = -1703473800920781454L;
@Override @Override
public void execute() { public void run() {
if (charger.isInPlay()) { if (charger.isInPlay()) {
charger.removeIntrinsicKeyword("Trample"); charger.removeIntrinsicKeyword("Trample");
} }
@@ -1367,7 +1367,7 @@ public class CombatUtil {
private static final long serialVersionUID = 7662543891117427727L; private static final long serialVersionUID = 7662543891117427727L;
@Override @Override
public void execute() { public void run() {
if (blocker.isInPlay()) { if (blocker.isInPlay()) {
blocker.addTempAttackBoost(mag); blocker.addTempAttackBoost(mag);
blocker.addTempDefenseBoost(mag); blocker.addTempDefenseBoost(mag);
@@ -1423,7 +1423,7 @@ public class CombatUtil {
private static final long serialVersionUID = 1497565871061029469L; private static final long serialVersionUID = 1497565871061029469L;
@Override @Override
public void execute() { public void run() {
if (crd.isInPlay()) { if (crd.isInPlay()) {
crd.addTempAttackBoost(-1); crd.addTempAttackBoost(-1);
crd.addTempDefenseBoost(-1); crd.addTempDefenseBoost(-1);
@@ -1532,7 +1532,7 @@ public class CombatUtil {
private static final long serialVersionUID = -3215615538474963181L; private static final long serialVersionUID = -3215615538474963181L;
@Override @Override
public void execute() { public void run() {
if (crd.isInPlay()) { if (crd.isInPlay()) {
crd.addTempAttackBoost(-pump); crd.addTempAttackBoost(-pump);
crd.addTempDefenseBoost(-pump); crd.addTempDefenseBoost(-pump);

View File

@@ -205,7 +205,7 @@ public abstract class Phase implements java.io.Serializable {
final int length = c.size(); final int length = c.size();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
c.remove(0).execute(); c.remove(0).run();
} }
} }

View File

@@ -226,7 +226,7 @@ public class PlayerZoneBattlefield extends PlayerZone {
Singletons.getModel().getGame().getStaticEffects().removeStateBasedEffect(effect); Singletons.getModel().getGame().getStaticEffects().removeStateBasedEffect(effect);
// this is to make sure cards reset correctly // this is to make sure cards reset correctly
final Command comm = GameActionUtil.getCommands().get(tempEffect); final Command comm = GameActionUtil.getCommands().get(tempEffect);
comm.execute(); comm.run();
} }
} }
} }

View File

@@ -2,17 +2,26 @@ package forge.gui;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import org.apache.commons.lang3.StringUtils;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Command;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FTextArea; import forge.gui.toolbox.FTextArea;
import forge.gui.toolbox.FTextField; import forge.gui.toolbox.FTextField;
@@ -32,12 +41,26 @@ public enum FNetOverlay {
} }
private final JTextArea txtLog = new FTextArea(); private final JTextArea txtLog = new FTextArea();
private final FTextField txtInput = new FTextField.Builder().maxLength(60).build(); private final JTextField txtInput = new FTextField.Builder().maxLength(60).build();
private final FLabel cmdSend = new FLabel.ButtonBuilder().text("Send").build();
private boolean minimized = false; private boolean minimized = false;
private int height = 120; private int height = 120;
private int width = 400; private int width = 400;
private final ActionListener onSend = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String message = txtInput.getText();
txtInput.setText("");
if ( StringUtils.isBlank(message) )
return;
addMessage(message);
}
};
private final int minimizedHeight = 30; private final int minimizedHeight = 30;
/** /**
@@ -49,7 +72,7 @@ public enum FNetOverlay {
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA)); pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
pnl.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS))); pnl.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap")); pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 2"));
// pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center"); // pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center");
// Block all input events below the overlay // Block all input events below the overlay
@@ -60,15 +83,20 @@ public enum FNetOverlay {
txtLog.setOpaque(true); txtLog.setOpaque(true);
txtLog.setFocusable(true); txtLog.setFocusable(true);
txtLog.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA)); txtLog.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
txtLog.setText("console is here\nconsole is here\nconsole is here\nconsole is here\nconsole is here\nconsole is here\nconsole is here\nconsole is here"); txtLog.setText("This is Forge chat window\n");
JScrollPane _operationLogScroller = new JScrollPane(txtLog); JScrollPane _operationLogScroller = new JScrollPane(txtLog);
_operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); _operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
_operationLogScroller.setBorder(null); _operationLogScroller.setBorder(null);
new SmartScroller(_operationLogScroller); new SmartScroller(_operationLogScroller);
pnl.add(_operationLogScroller, "pushx, hmin 24, growy, growx, gap 2px 2px 2px 0"); pnl.add(_operationLogScroller, "pushx, hmin 24, growy, growx, gap 2px 2px 2px 0, sx 2");
pnl.add(txtInput, "pushx, growx, h 26px!, gap 0 0 2px 0"); txtInput.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
pnl.add(txtInput, "pushx, growx, h 26px!, gap 2px 2px 2px 0");
pnl.add(cmdSend, "w 60px!, h 28px!, gap 0 0 2px 0");
txtInput.addActionListener(onSend);
cmdSend.setCommand(new Runnable() { @Override public void run() { onSend.actionPerformed(null); } });
} }
private class OverlayPanel extends JPanel { private class OverlayPanel extends JPanel {
@@ -102,7 +130,9 @@ public enum FNetOverlay {
getPanel().validate(); getPanel().validate();
} }
SimpleDateFormat inFormat = new SimpleDateFormat("HH:mm:ss");
public void addMessage(String message) { public void addMessage(String message) {
txtLog.append(message); String toAdd = String.format("[%s]: %s%n", inFormat.format(new Date()), message);
txtLog.append(toAdd);
} }
} }

View File

@@ -143,7 +143,7 @@ public class ImportDialog {
_fileChooser.setMultiSelectionEnabled(false); _fileChooser.setMultiSelectionEnabled(false);
_fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); _fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
_btnChooseDir.setCommand(new Command() { _btnChooseDir.setCommand(new Command() {
@Override public void execute() { @Override public void run() {
// bring up a file open dialog and, if the OK button is selected, apply the filename // bring up a file open dialog and, if the OK button is selected, apply the filename
// to the import source text field // to the import source text field
if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(null)) { if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(null)) {
@@ -215,7 +215,7 @@ public class ImportDialog {
synchronized (_onAnalyzerDone) { synchronized (_onAnalyzerDone) {
// this will populate the panel with data selection widgets // this will populate the panel with data selection widgets
_AnalyzerUpdater analyzer = new _AnalyzerUpdater(text, _onAnalyzerDone, isMigration); _AnalyzerUpdater analyzer = new _AnalyzerUpdater(text, _onAnalyzerDone, isMigration);
analyzer.execute(); analyzer.run();
_analyzerActive = true; _analyzerActive = true;
} }
if (!isMigration) { if (!isMigration) {
@@ -654,7 +654,7 @@ public class ImportDialog {
_Importer importer = new _Importer( _Importer importer = new _Importer(
_srcDir, _selections, _unknownDeckCombo, _operationLog, _progressBar, _srcDir, _selections, _unknownDeckCombo, _operationLog, _progressBar,
_moveCheckbox.isSelected(), _overwriteCheckbox.isSelected()); _moveCheckbox.isSelected(), _overwriteCheckbox.isSelected());
importer.execute(); importer.run();
_btnCancel.requestFocusInWindow(); _btnCancel.requestFocusInWindow();
} }

View File

@@ -44,7 +44,7 @@ public class ViewItem extends FPanel {
this.btnPurchase.setCommand(new Command() { this.btnPurchase.setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
final QuestAssets qA = Singletons.getModel().getQuest().getAssets(); final QuestAssets qA = Singletons.getModel().getQuest().getAssets();
final int cost = ViewItem.this.getItem().getBuyingPrice(qA); final int cost = ViewItem.this.getItem().getBuyingPrice(qA);
if (cost >= 0 && (qA.getCredits() - cost) >= 0) { if (cost >= 0 && (qA.getCredits() - cost) >= 0) {

View File

@@ -136,6 +136,6 @@ public final class SEditorUtil {
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave())
.setCommand(new Command() { .setCommand(new Command() {
@Override public void execute() { SEditorIO.saveDeck(); } }); @Override public void run() { SEditorIO.saveDeck(); } });
} }
} }

View File

@@ -86,20 +86,20 @@ public enum CCardCatalog implements ICDoc {
// Add/remove buttons (refresh analysis on add) // Add/remove buttons (refresh analysis on add)
VCardCatalog.SINGLETON_INSTANCE.getBtnAdd().setCommand(new Command() { VCardCatalog.SINGLETON_INSTANCE.getBtnAdd().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 1); CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 1);
} }
}); });
VCardCatalog.SINGLETON_INSTANCE.getBtnAdd4().setCommand(new Command() { VCardCatalog.SINGLETON_INSTANCE.getBtnAdd4().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 4); CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 4);
} }
}); });
final Command updateFilterCommand = new Command() { final Command updateFilterCommand = new Command() {
@Override @Override
public void execute() { public void run() {
if (!disableFiltering) { if (!disableFiltering) {
applyCurrentFilter(); applyCurrentFilter();
} }
@@ -114,7 +114,7 @@ public enum CCardCatalog implements ICDoc {
private boolean lastToggle = true; private boolean lastToggle = true;
@Override @Override
public void execute() { public void run() {
disableFiltering = true; disableFiltering = true;
lastToggle = !lastToggle; lastToggle = !lastToggle;
for (SEditorUtil.StatTypes s : SEditorUtil.StatTypes.values()) { for (SEditorUtil.StatTypes s : SEditorUtil.StatTypes.values()) {
@@ -130,7 +130,7 @@ public enum CCardCatalog implements ICDoc {
// assemble add restriction menu // assemble add restriction menu
VCardCatalog.SINGLETON_INSTANCE.getBtnAddRestriction().setCommand(new Command() { VCardCatalog.SINGLETON_INSTANCE.getBtnAddRestriction().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
JPopupMenu popup = new JPopupMenu("RestrictionPopupMenu"); JPopupMenu popup = new JPopupMenu("RestrictionPopupMenu");
GuiUtils.addMenuItem(popup, "Current text search", GuiUtils.addMenuItem(popup, "Current text search",
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),
@@ -382,7 +382,7 @@ public enum CCardCatalog implements ICDoc {
VCardCatalog.SINGLETON_INSTANCE.addRestrictionWidget(restriction.getLeft(), new Command() { VCardCatalog.SINGLETON_INSTANCE.addRestrictionWidget(restriction.getLeft(), new Command() {
@Override @Override
public void execute() { public void run() {
if (null != key) { if (null != key) {
activeSet.remove(key); activeSet.remove(key);
} }

View File

@@ -67,23 +67,23 @@ public enum CCurrentDeck implements ICDoc {
public void initialize() { public void initialize() {
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSave())
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { SEditorIO.saveDeck(); } }); public void run() { SEditorIO.saveDeck(); } });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSaveAs()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnSaveAs())
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { exportDeck(); } }); public void run() { exportDeck(); } });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies())
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { printProxies(); } }); public void run() { printProxies(); } });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnOpen()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnOpen())
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { openDeck(); } }); public void run() { openDeck(); } });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnNew()) ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnNew())
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { newDeck(); } }); public void run() { newDeck(); } });
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().addFocusListener(new FocusAdapter() { VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().addFocusListener(new FocusAdapter() {
@Override @Override
@@ -102,19 +102,19 @@ public enum CCurrentDeck implements ICDoc {
}); });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove()).setCommand(new Command() { ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove()).setCommand(new Command() {
@Override public void execute() { @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 1); CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 1);
} }); } });
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4()).setCommand(new Command() { ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4()).setCommand(new Command() {
@Override public void execute() { @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 4); CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 4);
} }
}); });
VCurrentDeck.SINGLETON_INSTANCE.getBtnImport() VCurrentDeck.SINGLETON_INSTANCE.getBtnImport()
.setCommand(new Command() { @Override .setCommand(new Command() { @Override
public void execute() { importDeck(); } }); public void run() { importDeck(); } });
} }
/** /**

View File

@@ -51,19 +51,19 @@ public enum CDeckgen implements ICDoc {
public void initialize() { public void initialize() {
((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandCardpool()).setCommand(new Command() { ((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandCardpool()).setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
newRandomConstructed(); newRandomConstructed();
} }
}); });
((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck2()).setCommand(new Command() { ((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck2()).setCommand(new Command() {
@Override public void execute() { newGenerateConstructed(2); } }); @Override public void run() { newGenerateConstructed(2); } });
((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck3()).setCommand(new Command() { ((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck3()).setCommand(new Command() {
@Override public void execute() { newGenerateConstructed(3); } }); @Override public void run() { newGenerateConstructed(3); } });
((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck5()).setCommand(new Command() { ((FLabel) VDeckgen.SINGLETON_INSTANCE.getBtnRandDeck5()).setCommand(new Command() {
@Override public void execute() { newGenerateConstructed(5); } }); @Override public void run() { newGenerateConstructed(5); } });
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -318,7 +318,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(true); VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(true);
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard()).setCommand(new Command() { ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard()).setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
cycleEditorMode(); cycleEditorMode();
} }); } });

View File

@@ -290,7 +290,7 @@ public final class CEditorQuest extends ACEditorBase<CardPrinted, Deck> {
VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(true); VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(true);
((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard()).setCommand(new Command() { ((FLabel) VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard()).setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
sideboardMode = !sideboardMode; sideboardMode = !sideboardMode;
switchEditorMode(sideboardMode); switchEditorMode(sideboardMode);
} }); } });

View File

@@ -87,7 +87,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
private final JLabel fullCatalogToggle = new FLabel.Builder().text("See full catalog") private final JLabel fullCatalogToggle = new FLabel.Builder().text("See full catalog")
.fontSize(14).hoverable(true).cmdClick(new Command() { .fontSize(14).hoverable(true).cmdClick(new Command() {
@Override @Override
public void execute() { public void run() {
toggleFullCatalog(); toggleFullCatalog();
} }
}) })
@@ -115,7 +115,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
private String CDRemLabel = new String(); private String CDRemLabel = new String();
private String prevRem4Label = null; private String prevRem4Label = null;
private String prevRem4Tooltip = null; private String prevRem4Tooltip = null;
private Command prevRem4Cmd = null; private Runnable prevRem4Cmd = null;
/** /**
* Child controller for quest card shop UI. * Child controller for quest card shop UI.
@@ -463,7 +463,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setToolTipText("Sell unneeded extra copies of all cards"); VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setToolTipText("Sell unneeded extra copies of all cards");
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setCommand(new Command() { VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
List<Map.Entry<InventoryItem, Integer>> cardsToRemove = new LinkedList<Map.Entry<InventoryItem,Integer>>(); List<Map.Entry<InventoryItem, Integer>> cardsToRemove = new LinkedList<Map.Entry<InventoryItem,Integer>>();
for (Map.Entry<InventoryItem, Integer> item : getTableDeck().getCards()) { for (Map.Entry<InventoryItem, Integer> item : getTableDeck().getCards()) {
CardPrinted card = (CardPrinted)item.getKey(); CardPrinted card = (CardPrinted)item.getKey();

View File

@@ -46,7 +46,7 @@ public enum CProbabilities implements ICDoc {
@SuppressWarnings("serial") @SuppressWarnings("serial")
public void initialize() { public void initialize() {
((FLabel) VProbabilities.SINGLETON_INSTANCE.getLblReshuffle()).setCommand( ((FLabel) VProbabilities.SINGLETON_INSTANCE.getLblReshuffle()).setCommand(
new Command() { @Override public void execute() { update(); } }); new Command() { @Override public void run() { update(); } });
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -298,10 +298,10 @@ public enum VCardCatalog implements IVDoc<CCardCatalog>, ITableContainer {
pnl.add(new FLabel.Builder().text("X").fontSize(10).hoverable(true) pnl.add(new FLabel.Builder().text("X").fontSize(10).hoverable(true)
.tooltip("Remove filter").cmdClick(new Command() { .tooltip("Remove filter").cmdClick(new Command() {
@Override @Override
public void execute() { public void run() {
pnlRestrictions.remove(pnl); pnlRestrictions.remove(pnl);
refreshRestrictionWidgets(); refreshRestrictionWidgets();
onRemove.execute(); onRemove.run();
} }
}).build(), "top"); }).build(), "top");

View File

@@ -92,7 +92,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
}; };
private final Command cmdClose = new Command() { @Override private final Command cmdClose = new Command() { @Override
public void execute() { close(); } }; public void run() { close(); } };
// Swing components // Swing components
private final FPanel pnlDialog = new FPanel(new MigLayout("insets 0, gap 0, wrap, ax center, ay center")); private final FPanel pnlDialog = new FPanel(new MigLayout("insets 0, gap 0, wrap, ax center, ay center"));

View File

@@ -63,7 +63,7 @@ public enum CHomeUI implements ICDoc {
selectPrevious(); selectPrevious();
VHomeUI.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() { VHomeUI.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
FControl.SINGLETON_INSTANCE.changeState(FControl.Screens.DECK_EDITOR_CONSTRUCTED); FControl.SINGLETON_INSTANCE.changeState(FControl.Screens.DECK_EDITOR_CONSTRUCTED);
CDeckEditorUI.SINGLETON_INSTANCE.setCurrentEditorController(new CEditorConstructed()); CDeckEditorUI.SINGLETON_INSTANCE.setCurrentEditorController(new CEditorConstructed());
} }
@@ -71,14 +71,14 @@ public enum CHomeUI implements ICDoc {
VHomeUI.SINGLETON_INSTANCE.getLblExit().setCommand(new Command() { VHomeUI.SINGLETON_INSTANCE.getLblExit().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
System.exit(0); System.exit(0);
} }
}); });
VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setCommand(new Command() { VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
FControl.SINGLETON_INSTANCE.getServer().listen(); FControl.SINGLETON_INSTANCE.getServer().listen();
VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setEnabled(true); VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setEnabled(true);
VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setEnabled(false); VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setEnabled(false);
@@ -89,7 +89,7 @@ public enum CHomeUI implements ICDoc {
VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setCommand(new Command() { VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
FControl.SINGLETON_INSTANCE.getServer().stop(); FControl.SINGLETON_INSTANCE.getServer().stop();
VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setEnabled(false); VHomeUI.SINGLETON_INSTANCE.getLblStopServer().setEnabled(false);
VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setEnabled(true); VHomeUI.SINGLETON_INSTANCE.getLblStartServer().setEnabled(true);

View File

@@ -80,25 +80,25 @@ public enum CSubmenuGauntletBuild implements ICDoc {
//public void keyPressed(final KeyEvent e) { search(); } }; //public void keyPressed(final KeyEvent e) { search(); } };
private final Command cmdAddDeck = new Command() { @Override private final Command cmdAddDeck = new Command() { @Override
public void execute() { addDeck(); } }; public void run() { addDeck(); } };
private final Command cmdRemoveDeck = new Command() { @Override private final Command cmdRemoveDeck = new Command() { @Override
public void execute() { removeDeck(); } }; public void run() { removeDeck(); } };
private final Command cmdDeckUp = new Command() { @Override private final Command cmdDeckUp = new Command() { @Override
public void execute() { deckUp(); } }; public void run() { deckUp(); } };
private final Command cmdDeckDown = new Command() { @Override private final Command cmdDeckDown = new Command() { @Override
public void execute() { deckDown(); } }; public void run() { deckDown(); } };
private final Command cmdSave = new Command() { @Override private final Command cmdSave = new Command() { @Override
public void execute() { saveGauntlet(); } }; public void run() { saveGauntlet(); } };
private final Command cmdNew = new Command() { @Override private final Command cmdNew = new Command() { @Override
public void execute() { newGauntlet(); } }; public void run() { newGauntlet(); } };
private final Command cmdOpen = new Command() { @Override private final Command cmdOpen = new Command() { @Override
public void execute() { openGauntlet(); } }; public void run() { openGauntlet(); } };
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.gui.home.ICSubmenu#initialize() * @see forge.gui.home.ICSubmenu#initialize()

View File

@@ -67,14 +67,14 @@ public enum CSubmenuGauntletContests implements ICDoc {
private final Command cmdRandomRegular = new Command() { private final Command cmdRandomRegular = new Command() {
@Override @Override
public void execute() { public void run() {
DeckgenUtil.randomSelect(view.getLstDecks()); DeckgenUtil.randomSelect(view.getLstDecks());
} }
}; };
private final Command cmdRandomColors = new Command() { private final Command cmdRandomColors = new Command() {
@Override @Override
public void execute() { public void run() {
view.getLstDecks().setSelectedIndices(DeckgenUtil.randomSelectColors()); view.getLstDecks().setSelectedIndices(DeckgenUtil.randomSelectColors());
} }
}; };
@@ -278,7 +278,7 @@ public enum CSubmenuGauntletContests implements ICDoc {
public Command getCommandOnSelect() { public Command getCommandOnSelect() {
return new Command() { return new Command() {
@Override @Override
public void execute() { public void run() {
updateData(); updateData();
} }
}; };

View File

@@ -69,9 +69,9 @@ public enum CSubmenuGauntletLoad implements ICDoc {
view.getBtnStart().addActionListener(actStartGame); view.getBtnStart().addActionListener(actStartGame);
view.getGauntletLister().setCmdDelete(new Command() { @Override view.getGauntletLister().setCmdDelete(new Command() { @Override
public void execute() { enableStartButton(); } }); public void run() { enableStartButton(); } });
view.getGauntletLister().setCmdSelect(new Command() { @Override view.getGauntletLister().setCmdSelect(new Command() { @Override
public void execute() { enableStartButton(); } }); public void run() { enableStartButton(); } });
} }
private void updateData() { private void updateData() {
@@ -140,7 +140,7 @@ public enum CSubmenuGauntletLoad implements ICDoc {
public Command getCommandOnSelect() { public Command getCommandOnSelect() {
return new Command() { return new Command() {
@Override @Override
public void execute() { public void run() {
updateData(); updateData();
} }
}; };

View File

@@ -63,14 +63,14 @@ public enum CSubmenuGauntletQuick implements ICDoc {
private final Command cmdRandomRegular = new Command() { private final Command cmdRandomRegular = new Command() {
@Override @Override
public void execute() { public void run() {
DeckgenUtil.randomSelect(view.getLstDecks()); DeckgenUtil.randomSelect(view.getLstDecks());
} }
}; };
private final Command cmdRandomColors = new Command() { private final Command cmdRandomColors = new Command() {
@Override @Override
public void execute() { public void run() {
view.getLstDecks().setSelectedIndices(DeckgenUtil.randomSelectColors()); view.getLstDecks().setSelectedIndices(DeckgenUtil.randomSelectColors());
} }
}; };

View File

@@ -213,6 +213,6 @@ public class ContestGauntletLister extends JPanel {
r0.setSelected(true); r0.setSelected(true);
previousSelect = r0; previousSelect = r0;
if (cmdRowSelect != null) { cmdRowSelect.execute(); } if (cmdRowSelect != null) { cmdRowSelect.run(); }
} }
} }

View File

@@ -257,7 +257,7 @@ public class QuickGauntletLister extends JPanel {
r0.setSelected(true); r0.setSelected(true);
previousSelect = r0; previousSelect = r0;
if (cmdRowSelect != null) { cmdRowSelect.execute(); } if (cmdRowSelect != null) { cmdRowSelect.run(); }
} }
private void deleteFile(RowPanel r0) { private void deleteFile(RowPanel r0) {
@@ -273,7 +273,7 @@ public class QuickGauntletLister extends JPanel {
GauntletIO.getGauntletFile(gd).delete(); GauntletIO.getGauntletFile(gd).delete();
if (cmdRowDelete != null) { cmdRowDelete.execute(); } if (cmdRowDelete != null) { cmdRowDelete.run(); }
this.setSelectedIndex(0); this.setSelectedIndex(0);
this.remove(r0); this.remove(r0);

View File

@@ -46,19 +46,19 @@ public enum CSubmenuChallenges implements ICDoc {
view.getBtnSpellShop().setCommand( view.getBtnSpellShop().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.showSpellShop(); } }); public void run() { SSubmenuQuestUtil.showSpellShop(); } });
view.getBtnBazaar().setCommand( view.getBtnBazaar().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.showBazaar(); } }); public void run() { SSubmenuQuestUtil.showBazaar(); } });
view.getBtnUnlock().setCommand( view.getBtnUnlock().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuChallenges.this.update(); } }); public void run() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuChallenges.this.update(); } });
view.getBtnTravel().setCommand( view.getBtnTravel().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.travelWorld(); CSubmenuChallenges.this.update(); } }); public void run() { SSubmenuQuestUtil.travelWorld(); CSubmenuChallenges.this.update(); } });
view.getBtnStart().addActionListener( view.getBtnStart().addActionListener(
new ActionListener() { @Override new ActionListener() { @Override
@@ -67,7 +67,7 @@ public enum CSubmenuChallenges implements ICDoc {
((FLabel) view.getLblZep()).setCommand( ((FLabel) view.getLblZep()).setCommand(
new Command() { new Command() {
@Override @Override
public void execute() { public void run() {
if (!SSubmenuQuestUtil.checkActiveQuest("Launch a Zeppelin.")) { if (!SSubmenuQuestUtil.checkActiveQuest("Launch a Zeppelin.")) {
return; return;
} }
@@ -176,7 +176,7 @@ public enum CSubmenuChallenges implements ICDoc {
final QuestController qc = Singletons.getModel().getQuest(); final QuestController qc = Singletons.getModel().getQuest();
return new Command() { return new Command() {
@Override @Override
public void execute() { public void run() {
if (qc.getAchievements() == null) { if (qc.getAchievements() == null) {
CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA); CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA);
} }

View File

@@ -41,19 +41,19 @@ public enum CSubmenuDuels implements ICDoc {
view.getBtnSpellShop().setCommand( view.getBtnSpellShop().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.showSpellShop(); } }); public void run() { SSubmenuQuestUtil.showSpellShop(); } });
view.getBtnBazaar().setCommand( view.getBtnBazaar().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.showBazaar(); } }); public void run() { SSubmenuQuestUtil.showBazaar(); } });
view.getBtnTravel().setCommand( view.getBtnTravel().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.travelWorld(); CSubmenuDuels.this.update(); } }); public void run() { SSubmenuQuestUtil.travelWorld(); CSubmenuDuels.this.update(); } });
view.getBtnUnlock().setCommand( view.getBtnUnlock().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update(); } }); public void run() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update(); } });
view.getBtnStart().addActionListener( view.getBtnStart().addActionListener(
new ActionListener() { @Override new ActionListener() { @Override
@@ -141,7 +141,7 @@ public enum CSubmenuDuels implements ICDoc {
final QuestController qc = Singletons.getModel().getQuest(); final QuestController qc = Singletons.getModel().getQuest();
return new Command() { return new Command() {
@Override @Override
public void execute() { public void run() {
if (qc.getAchievements() == null) { if (qc.getAchievements() == null) {
CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA); CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA);
} }

View File

@@ -48,10 +48,10 @@ public enum CSubmenuQuestData implements ICDoc {
private final List<String> customPrizeFormatCodes = new ArrayList<String>(); private final List<String> customPrizeFormatCodes = new ArrayList<String>();
private final Command cmdQuestSelect = new Command() { @Override private final Command cmdQuestSelect = new Command() { @Override
public void execute() { changeQuest(); } }; public void run() { changeQuest(); } };
private final Command cmdQuestDelete = new Command() { @Override private final Command cmdQuestDelete = new Command() { @Override
public void execute() { update(); } }; public void run() { update(); } };
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.control.home.IControlSubmenu#update() * @see forge.control.home.IControlSubmenu#update()
@@ -59,7 +59,7 @@ public enum CSubmenuQuestData implements ICDoc {
@Override @Override
public void initialize() { public void initialize() {
view.getBtnEmbark().setCommand( view.getBtnEmbark().setCommand(
new Command() { @Override public void execute() { newQuest(); } }); new Command() { @Override public void run() { newQuest(); } });
// disable the very powerful sets -- they can be unlocked later for a high price // disable the very powerful sets -- they can be unlocked later for a high price
final List<String> unselectableSets = new ArrayList<String>(); final List<String> unselectableSets = new ArrayList<String>();
@@ -70,7 +70,7 @@ public enum CSubmenuQuestData implements ICDoc {
unselectableSets.add("ARC"); unselectableSets.add("ARC");
unselectableSets.add("PC2"); unselectableSets.add("PC2");
view.getBtnCustomFormat().setCommand(new Command() { @Override public void execute() { view.getBtnCustomFormat().setCommand(new Command() { @Override public void run() {
final DialogChooseSets dialog = new DialogChooseSets(customFormatCodes, unselectableSets, false); final DialogChooseSets dialog = new DialogChooseSets(customFormatCodes, unselectableSets, false);
dialog.setOkCallback(new Runnable() { dialog.setOkCallback(new Runnable() {
@Override @Override
@@ -81,7 +81,7 @@ public enum CSubmenuQuestData implements ICDoc {
}); });
} }); } });
view.getBtnPrizeCustomFormat().setCommand(new Command() { @Override public void execute() { view.getBtnPrizeCustomFormat().setCommand(new Command() { @Override public void run() {
final DialogChooseSets dialog = new DialogChooseSets(customPrizeFormatCodes, unselectableSets, false); final DialogChooseSets dialog = new DialogChooseSets(customPrizeFormatCodes, unselectableSets, false);
dialog.setOkCallback(new Runnable() { dialog.setOkCallback(new Runnable() {
@Override @Override

View File

@@ -30,7 +30,7 @@ public enum CSubmenuQuestDecks implements ICDoc {
private final Command cmdDeckSelect = new Command() { private final Command cmdDeckSelect = new Command() {
@Override @Override
public void execute() { public void run() {
currentDeck = VSubmenuQuestDecks.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck(); currentDeck = VSubmenuQuestDecks.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
Singletons.getModel().getQuestPreferences().setPref(QPref.CURRENT_DECK, currentDeck.toString()); Singletons.getModel().getQuestPreferences().setPref(QPref.CURRENT_DECK, currentDeck.toString());
Singletons.getModel().getQuestPreferences().save(); Singletons.getModel().getQuestPreferences().save();
@@ -38,7 +38,7 @@ public enum CSubmenuQuestDecks implements ICDoc {
}; };
private final Command cmdDeckDelete = new Command() { @Override private final Command cmdDeckDelete = new Command() { @Override
public void execute() { update(); } }; public void run() { update(); } };
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.control.home.IControlSubmenu#update() * @see forge.control.home.IControlSubmenu#update()
@@ -47,7 +47,7 @@ public enum CSubmenuQuestDecks implements ICDoc {
public void initialize() { public void initialize() {
VSubmenuQuestDecks.SINGLETON_INSTANCE.getBtnNewDeck().setCommand(new Command() { VSubmenuQuestDecks.SINGLETON_INSTANCE.getBtnNewDeck().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
if (!SSubmenuQuestUtil.checkActiveQuest("Create a Deck.")) { if (!SSubmenuQuestUtil.checkActiveQuest("Create a Deck.")) {
return; return;
} }
@@ -114,7 +114,7 @@ public enum CSubmenuQuestDecks implements ICDoc {
final QuestController qc = Singletons.getModel().getQuest(); final QuestController qc = Singletons.getModel().getQuest();
return new Command() { return new Command() {
@Override @Override
public void execute() { public void run() {
if (qc.getAchievements() == null) { if (qc.getAchievements() == null) {
CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA); CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA);
} }

View File

@@ -289,7 +289,7 @@ public class QuestFileLister extends JPanel {
r0.setSelected(true); r0.setSelected(true);
previousSelect = r0; previousSelect = r0;
if (cmdRowSelect != null) { cmdRowSelect.execute(); } if (cmdRowSelect != null) { cmdRowSelect.run(); }
} }
private void editFileName(String s0) { private void editFileName(String s0) {
@@ -320,7 +320,7 @@ public class QuestFileLister extends JPanel {
oldpath.renameTo(newpath); oldpath.renameTo(newpath);
} }
if (cmdRowEdit != null) { cmdRowEdit.execute(); } if (cmdRowEdit != null) { cmdRowEdit.run(); }
} }
private void deleteFile(RowPanel r0) { private void deleteFile(RowPanel r0) {
@@ -336,7 +336,7 @@ public class QuestFileLister extends JPanel {
new File(NewConstants.QUEST_SAVE_DIR, r0.getQuestData().getName() + ".dat").delete(); new File(NewConstants.QUEST_SAVE_DIR, r0.getQuestData().getName() + ".dat").delete();
if (cmdRowDelete != null) { cmdRowDelete.execute(); } if (cmdRowDelete != null) { cmdRowDelete.run(); }
this.remove(r0); this.remove(r0);
this.repaint(); this.repaint();

View File

@@ -40,7 +40,7 @@ public enum CSubmenuDraft implements ICDoc {
private final Command cmdDeckSelect = new Command() { private final Command cmdDeckSelect = new Command() {
@Override @Override
public void execute() { public void run() {
VSubmenuDraft.SINGLETON_INSTANCE.getBtnStart().setEnabled(true); VSubmenuDraft.SINGLETON_INSTANCE.getBtnStart().setEnabled(true);
} }
}; };
@@ -55,7 +55,7 @@ public enum CSubmenuDraft implements ICDoc {
view.getLstDecks().setSelectCommand(cmdDeckSelect); view.getLstDecks().setSelectCommand(cmdDeckSelect);
view.getBtnBuildDeck().setCommand(new Command() { @Override view.getBtnBuildDeck().setCommand(new Command() { @Override
public void execute() { setupDraft(); } }); public void run() { setupDraft(); } });
view.getBtnStart().addActionListener(new ActionListener() { view.getBtnStart().addActionListener(new ActionListener() {
@Override public void actionPerformed(final ActionEvent e) { startGame(GameType.Draft); } }); @Override public void actionPerformed(final ActionEvent e) { startGame(GameType.Draft); } });

View File

@@ -52,7 +52,7 @@ public enum CSubmenuSealed implements ICDoc {
private final Command cmdDeckSelect = new Command() { private final Command cmdDeckSelect = new Command() {
@Override @Override
public void execute() { public void run() {
VSubmenuSealed.SINGLETON_INSTANCE.getBtnStart().setEnabled(true); VSubmenuSealed.SINGLETON_INSTANCE.getBtnStart().setEnabled(true);
} }
}; };

View File

@@ -22,21 +22,21 @@ public enum CSubmenuDownloaders implements ICDoc {
SINGLETON_INSTANCE; SINGLETON_INSTANCE;
private final Command cmdLicensing = new Command() { @Override private final Command cmdLicensing = new Command() { @Override
public void execute() { VSubmenuDownloaders.SINGLETON_INSTANCE.showLicensing(); } }; public void run() { VSubmenuDownloaders.SINGLETON_INSTANCE.showLicensing(); } };
private final Command cmdPicDownload = new Command() { @Override private final Command cmdPicDownload = new Command() { @Override
public void execute() { new GuiDownloadPicturesLQ(); } }; public void run() { new GuiDownloadPicturesLQ(); } };
private final Command cmdSetDownload = new Command() { @Override private final Command cmdSetDownload = new Command() { @Override
public void execute() { new GuiDownloadSetPicturesLQ(); } }; public void run() { new GuiDownloadSetPicturesLQ(); } };
private final Command cmdQuestImages = new Command() { @Override private final Command cmdQuestImages = new Command() { @Override
public void execute() { new GuiDownloadQuestImages(); } }; public void run() { new GuiDownloadQuestImages(); } };
private final Command cmdDownloadPrices = new Command() { @Override private final Command cmdDownloadPrices = new Command() { @Override
public void execute() { new GuiDownloadPrices(); } }; public void run() { new GuiDownloadPrices(); } };
private final Command cmdHowToPlay = new Command() { @Override private final Command cmdHowToPlay = new Command() { @Override
public void execute() { VSubmenuDownloaders.SINGLETON_INSTANCE.showHowToPlay(); } }; public void run() { VSubmenuDownloaders.SINGLETON_INSTANCE.showHowToPlay(); } };
private final Command cmdImportPictures = new Command() { @Override private final Command cmdImportPictures = new Command() { @Override
public void execute() { new ImportDialog(null, null); } }; public void run() { new ImportDialog(null, null); } };
private final Command cmdReportBug = new Command() { @Override private final Command cmdReportBug = new Command() { @Override
public void execute() { BugReporter.reportBug(null); } public void run() { BugReporter.reportBug(null); }
}; };
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -196,7 +196,7 @@ public enum CSubmenuPreferences implements ICDoc {
view.getBtnReset().setCommand(new Command() { view.getBtnReset().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
ForgePreferences prefs = Singletons.getModel().getPreferences(); ForgePreferences prefs = Singletons.getModel().getPreferences();
prefs.reset(); prefs.reset();
prefs.save(); prefs.save();
@@ -281,7 +281,7 @@ public enum CSubmenuPreferences implements ICDoc {
view.getLblChooseSkin().setText("Please restart Forge (click here to close)."); view.getLblChooseSkin().setText("Please restart Forge (click here to close).");
view.getLblChooseSkin().setHoverable(true); view.getLblChooseSkin().setHoverable(true);
view.getLblChooseSkin().setCommand(new Command() { @Override view.getLblChooseSkin().setCommand(new Command() { @Override
public void execute() { RestartUtil.restartApplication(null); } }); public void run() { RestartUtil.restartApplication(null); } });
prefs.setPref(FPref.UI_SKIN, name); prefs.setPref(FPref.UI_SKIN, name);
prefs.save(); prefs.save();

View File

@@ -108,10 +108,10 @@ public enum VSubmenuAvatars implements IVSubmenu<CSubmenuAvatars> {
"w 90%!, pushy, growy, gap 5% 0 0 0"); "w 90%!, pushy, growy, gap 5% 0 0 0");
final Command cmdHuman = new Command() { @Override final Command cmdHuman = new Command() { @Override
public void execute() { lblAvatarAI.setSelected(false); lblAvatarHuman.requestFocusInWindow(); } }; public void run() { lblAvatarAI.setSelected(false); lblAvatarHuman.requestFocusInWindow(); } };
final Command cmdAI = new Command() { @Override final Command cmdAI = new Command() { @Override
public void execute() { lblAvatarHuman.setSelected(false); lblAvatarAI.requestFocusInWindow(); } }; public void run() { lblAvatarHuman.setSelected(false); lblAvatarAI.requestFocusInWindow(); } };
lblAvatarHuman.setCommand(cmdHuman); lblAvatarHuman.setCommand(cmdHuman);
lblAvatarAI.setCommand(cmdAI); lblAvatarAI.setCommand(cmdAI);
@@ -144,7 +144,7 @@ public enum VSubmenuAvatars implements IVSubmenu<CSubmenuAvatars> {
final Command cmd = new Command() { final Command cmd = new Command() {
@Override @Override
public void execute() { public void run() {
String[] indices = Singletons.getModel().getPreferences() String[] indices = Singletons.getModel().getPreferences()
.getPref(FPref.UI_AVATARS).split(","); .getPref(FPref.UI_AVATARS).split(",");

View File

@@ -86,7 +86,7 @@ public enum CSubmenuArchenemy implements ICDoc {
private static final long serialVersionUID = -4548064747843903896L; private static final long serialVersionUID = -4548064747843903896L;
@Override @Override
public void execute() { public void run() {
Predicate<CardPrinted> predSchemes = new Predicate<CardPrinted>() { Predicate<CardPrinted> predSchemes = new Predicate<CardPrinted>() {
@Override @Override

View File

@@ -85,7 +85,7 @@ public enum CSubmenuPlanechase implements ICDoc {
public void initialize() { public void initialize() {
VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() { VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() { Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
@Override @Override
public boolean apply(CardPrinted arg0) { public boolean apply(CardPrinted arg0) {

View File

@@ -110,7 +110,7 @@ public class ViewWinLose {
FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build(); FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build();
btnCopyLog.setCommand(new Command() { btnCopyLog.setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
StringSelection ss = new StringSelection(txtLog.getText()); StringSelection ss = new StringSelection(txtLog.getText());
try { try {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);

View File

@@ -416,7 +416,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
this.previousSelect = r0; this.previousSelect = r0;
if (this.cmdRowSelect != null) { if (this.cmdRowSelect != null) {
this.cmdRowSelect.execute(); this.cmdRowSelect.run();
} }
} }
private <T extends DeckBase> void editDeck(final Deck d0) { private <T extends DeckBase> void editDeck(final Deck d0) {
@@ -479,7 +479,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
this.revalidate(); this.revalidate();
if (this.cmdDelete != null) { if (this.cmdDelete != null) {
this.cmdDelete.execute(); this.cmdDelete.run();
} }
} }
} }

View File

@@ -118,7 +118,7 @@ public class FDeckChooser extends JPanel {
lst.addMouseListener(madDecklist); lst.addMouseListener(madDecklist);
getBtnRandom().setCommand(new Command() { getBtnRandom().setCommand(new Command() {
@Override public void execute() { lst.setSelectedIndices(DeckgenUtil.randomSelectColors()); } }); @Override public void run() { lst.setSelectedIndices(DeckgenUtil.randomSelectColors()); } });
// Init basic two color deck // Init basic two color deck
lst.setSelectedIndices(new int[]{0, 1}); lst.setSelectedIndices(new int[]{0, 1});
@@ -140,7 +140,7 @@ public class FDeckChooser extends JPanel {
lst.removeMouseListener(madDecklist); lst.removeMouseListener(madDecklist);
getBtnRandom().setCommand(new Command() { getBtnRandom().setCommand(new Command() {
@Override public void execute() { DeckgenUtil.randomSelect(lst); } }); @Override public void run() { DeckgenUtil.randomSelect(lst); } });
// Init first in list // Init first in list
lst.setSelectedIndex(0); lst.setSelectedIndex(0);
@@ -161,7 +161,7 @@ public class FDeckChooser extends JPanel {
lst.addMouseListener(madDecklist); lst.addMouseListener(madDecklist);
getBtnRandom().setCommand(new Command() { getBtnRandom().setCommand(new Command() {
@Override public void execute() { DeckgenUtil.randomSelect(lst); } }); @Override public void run() { DeckgenUtil.randomSelect(lst); } });
// Init first in list // Init first in list
lst.setSelectedIndex(0); lst.setSelectedIndex(0);
@@ -189,7 +189,7 @@ public class FDeckChooser extends JPanel {
lst.addMouseListener(madDecklist); lst.addMouseListener(madDecklist);
getBtnRandom().setCommand(new Command() { getBtnRandom().setCommand(new Command() {
@Override public void execute() { DeckgenUtil.randomSelect(lst); } }); @Override public void run() { DeckgenUtil.randomSelect(lst); } });
// Init first in list // Init first in list
lst.setSelectedIndex(0); lst.setSelectedIndex(0);

View File

@@ -48,7 +48,7 @@ public class FHyperlink extends FLabel {
// overwrite whatever command is there -- we could chain them if we wanted to, though // overwrite whatever command is there -- we could chain them if we wanted to, though
cmdClick(new Command() { cmdClick(new Command() {
@Override @Override
public void execute() { public void run() {
if (browsingSupported) { if (browsingSupported) {
// open link in default browser // open link in default browser
new _LinkRunner(uri).execute(); new _LinkRunner(uri).execute();

View File

@@ -218,7 +218,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
this.addKeyListener(new KeyAdapter() { this.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(final KeyEvent e) { public void keyPressed(final KeyEvent e) {
if (e.getKeyChar() == ' ' || e.getKeyCode() == 10) { _doMouseAction(); } if (e.getKeyChar() == ' ' || e.getKeyCode() == 10 || e.getKeyCode() == KeyEvent.VK_ENTER) { _doMouseAction(); }
} }
}); });
@@ -267,7 +267,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
// Various variables used in image rendering. // Various variables used in image rendering.
private Image img; private Image img;
private Command cmdClick; private Runnable cmdClick;
private double iar; private double iar;
@@ -306,7 +306,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
if (cmdClick != null && isEnabled()) { if (cmdClick != null && isEnabled()) {
hovered = false; hovered = false;
repaintSelf(); repaintSelf();
cmdClick.execute(); cmdClick.run();
} }
} }
@@ -416,7 +416,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
} }
/** @return {@link forge.Command} */ /** @return {@link forge.Command} */
public Command getCommand() { public Runnable getCommand() {
return this.cmdClick; return this.cmdClick;
} }
@@ -439,7 +439,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
} }
/** @param c0 &emsp; {@link forge.Command} on click */ /** @param c0 &emsp; {@link forge.Command} on click */
public void setCommand(final Command c0) { public void setCommand(final Runnable c0) {
this.cmdClick = c0; this.cmdClick = c0;
} }

View File

@@ -97,7 +97,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
@Override @Override
public void mouseClicked(final MouseEvent evt) { public void mouseClicked(final MouseEvent evt) {
if (cmdClick != null) { cmdClick.execute(); } if (cmdClick != null) { cmdClick.run(); }
if (!selectable) { return; } if (!selectable) { return; }
if (selected) { setSelected(false); } if (selected) { setSelected(false); }

View File

@@ -65,7 +65,7 @@ public class ViewBazaarUI extends FPanel {
lbl.setCommand(new Command() { lbl.setCommand(new Command() {
@Override @Override
public void execute() { public void run() {
if (previousSelected != null) { previousSelected.setSelected(false); } if (previousSelected != null) { previousSelected.setSelected(false); }
lbl.setSelected(true); lbl.setSelected(true);
previousSelected = lbl; previousSelected = lbl;