-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactoring] Command pattern for ControlDeskView.java
- Loading branch information
Showing
4 changed files
with
96 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
public class ControlDeskViewAddPartyCommand implements ButtonCommand { | ||
private ControlDeskView theView; | ||
|
||
public ControlDeskViewAddPartyCommand(ControlDeskView theView) { | ||
this.theView = theView; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
AddPartyView addPartyWin = new AddPartyView(theView, theView.getMaxMembers()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
public class ControlDeskViewAssignCommand implements ButtonCommand{ | ||
private ControlDeskView theView; | ||
|
||
public ControlDeskViewAssignCommand(ControlDeskView theView) { | ||
this.theView = theView; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
theView.getControlDesk().assignLane(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
public class ExitProgramCommand implements ButtonCommand{ | ||
|
||
private ControlDeskView theView; | ||
|
||
public ExitProgramCommand(ControlDeskView theView) { | ||
this.theView = theView; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
theView.getWin().dispose(); | ||
System.exit(0); | ||
} | ||
} |