Skip to content

Commit

Permalink
Merge pull request #430 from austintrose/deck_code_integration
Browse files Browse the repository at this point in the history
Integrate Sam's deck creation stuff into NewGameView the same as it works in CreateGameView.
  • Loading branch information
sfmailand committed May 4, 2014
2 parents 50f28bd + 41c8f5f commit ab8545c
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@
import javax.swing.event.DocumentListener;

import edu.wpi.cs.wpisuitetng.janeway.config.ConfigManager;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.controller.GetDeckController;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.controller.GetPlanningPokerGamesController;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.controller.GetPlanningPokerUserController;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.controller.UpdatePlanningPokerGameController;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.email.Mailer;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.im.InstantMessenger;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.models.Deck;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.models.DeckModel;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.models.PlanningPokerGame;
import edu.wpi.cs.wpisuitetng.modules.PlanningPoker.models.PlanningPokerUserModel;
import edu.wpi.cs.wpisuitetng.modules.requirementmanager.controller.GetRequirementsController;
Expand Down Expand Up @@ -113,6 +116,12 @@ public NewGameView(PlanningPokerGame game) {
Thread.sleep(150);
} catch (Exception e) {
}

GetDeckController.getInstance().retrieveDeck();
try {
Thread.sleep(150);
} catch (Exception e) {
}

// Populate list of requirements associated with this game.
this.thisGameRequirementsListModel = new DefaultListModel<>();
Expand All @@ -129,8 +138,11 @@ public NewGameView(PlanningPokerGame game) {
}
}

// Populate list of deck types.
this.deckTypeComboBoxModel = new DefaultComboBoxModel<String>(new String[]{"Default", "No Deck"});
// Populate list of deck types.
this.deckTypeComboBoxModel = new DefaultComboBoxModel<>();
for (Deck d : DeckModel.getInstance().getDecks()) {
this.deckTypeComboBoxModel.addElement(d.getDeckName());
}

// Run NetBeans-generated UI initialization code.
initComponents();
Expand Down Expand Up @@ -335,7 +347,12 @@ private void saveChangesButtonClicked() {
* @param deckName The deck type the user chose.
*/
private void deckChoiceClicked(String deckName) {
this.deckValues.setText(deckName.equals("Default") ? "[0, 1, 1, 2, 3, 5, 8]" : "N/A");
Deck selectedDeck = DeckModel.getInstance().getDeck(deckName);
if (selectedDeck.getDeckNumbers().isEmpty()) {
this.deckValues.setText("N/A");
} else {
this.deckValues.setText(selectedDeck.getDeckNumbers().toString());
}
}

/**
Expand Down

0 comments on commit ab8545c

Please sign in to comment.