Moved control accessors from ViewHome to ControlHome, added view accessors to ViewHome.

This commit is contained in:
Doublestrike
2012-02-19 02:24:19 +00:00
parent deaf07a9fa
commit 94f87284f2
5 changed files with 52 additions and 31 deletions

View File

@@ -1,5 +1,9 @@
package forge.control;
import forge.control.home.ControlConstructed;
import forge.control.home.ControlDraft;
import forge.control.home.ControlSealed;
import forge.control.home.ControlUtilities;
import forge.view.ViewHomeUI;
/**
@@ -23,4 +27,24 @@ public class ControlHomeUI {
public ViewHomeUI getView() {
return view;
}
/** @return ControlConstructed */
public ControlConstructed getControlConstructed() {
return view.getViewConstructed().getControl();
}
/** @return ControlDraft */
public ControlDraft getControlDraft() {
return view.getViewDraft().getControl();
}
/** @return ControlSealed */
public ControlSealed getControlSealed() {
return view.getViewSealed().getControl();
}
/** @return ControlUtilities */
public ControlUtilities getControlUtilities() {
return view.getViewUtilities().getControl();
}
}

View File

@@ -204,7 +204,7 @@ public class ControlSealed {
sealed.addAiDeck(sd.buildAIDeck(sDeck.toForgeCardList()));
AllZone.getDecks().getSealed().add(sealed);
view.getParentView().getUtilitiesControl().showDeckEditor(GameType.Sealed, sealed);
Singletons.getControl().getHomeControl().getControlUtilities().showDeckEditor(GameType.Sealed, sealed);
}

View File

@@ -15,6 +15,7 @@ import forge.GuiDownloadPrices;
import forge.GuiDownloadQuestImages;
import forge.GuiDownloadSetPicturesLQ;
import forge.GuiImportPicture;
import forge.Singletons;
import forge.error.BugzReporter;
import forge.game.GameType;
import forge.gui.deckeditor.DeckEditorBase;
@@ -171,8 +172,8 @@ public class ControlUtilities {
@Override
public void execute() {
view.getParentView().getConstructedControl().updateDeckLists();
//view.getParentView().getSealedController().updateDeckLists();
Singletons.getControl().getHomeControl().getControlConstructed().updateDeckLists();
//view.getParentView().getControlSealed().updateDeckLists();
}
};

View File

@@ -128,7 +128,7 @@ public class DraftingProcess extends DeckEditorBase<CardPrinted, DeckSet> {
ForgeProps.getLocalized(GuiBoosterDraft.CLOSE_MESSAGE), "", JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
DraftingProcess.this.dispose();
Singletons.getView().getHomeView().getDraftControl().updateHumanDecks();
Singletons.getControl().getHomeControl().getControlDraft().updateHumanDecks();
}
} // windowClosing()
});
@@ -337,7 +337,7 @@ public class DraftingProcess extends DeckEditorBase<CardPrinted, DeckSet> {
// close and open next screen
this.dispose();
Singletons.getView().getHomeView().getDraftControl().updateHumanDecks();
Singletons.getControl().getHomeControl().getControlDraft().updateHumanDecks();
} /* saveDraft() */

View File

@@ -31,10 +31,6 @@ import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.ControlHomeUI;
import forge.control.home.ControlConstructed;
import forge.control.home.ControlDraft;
import forge.control.home.ControlSealed;
import forge.control.home.ControlUtilities;
import forge.game.GameType;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
@@ -138,7 +134,7 @@ public class ViewHomeUI extends FPanel {
btnDeckEditor = new FButton();
btnDeckEditor.setAction(new AbstractAction() {
public void actionPerformed(ActionEvent arg0) {
ViewHomeUI.this.getUtilitiesControl().showDeckEditor(GameType.Constructed, null);
Singletons.getControl().getHomeControl().getControlUtilities().showDeckEditor(GameType.Constructed, null);
}
});
btnDeckEditor.setText("Deck Editor");
@@ -201,7 +197,7 @@ public class ViewHomeUI extends FPanel {
pnlContent.revalidate();
pnlContent.repaint();
this.getConstructedControl().updateDeckSelectionCheckboxes();
Singletons.getControl().getHomeControl().getControlConstructed().updateDeckSelectionCheckboxes();
Singletons.getModel().getPreferences().setPref(FPref.UI_HOMEMENU,
ForgePreferences.HomeMenus.constructed.toString());
@@ -297,26 +293,6 @@ public class ViewHomeUI extends FPanel {
Singletons.getModel().getPreferences().save();
}
/** @return ControlConstructed */
public ControlConstructed getConstructedControl() {
return constructed.getControl();
}
/** @return ControlDraft */
public ControlDraft getDraftControl() {
return draft.getControl();
}
/** @return ControlSealed */
public ControlSealed getSealedControl() {
return sealed.getControl();
}
/** @return ControlUtilities */
public ControlUtilities getUtilitiesControl() {
return utilities.getControl();
}
private void clearToggles() {
btnConstructed.setToggled(false);
btnSealed.setToggled(false);
@@ -327,6 +303,26 @@ public class ViewHomeUI extends FPanel {
btnUtilities.setToggled(false);
}
/** @return {@link forge.view.home.ViewConstructed} */
public ViewConstructed getViewConstructed() {
return constructed;
}
/** @return {@link forge.view.home.ViewDraft} */
public ViewDraft getViewDraft() {
return draft;
}
/** @return {@link forge.view.home.ViewSealed} */
public ViewSealed getViewSealed() {
return sealed;
}
/** @return {@link forge.view.home.ViewUtilities} */
public ViewUtilities getViewUtilities() {
return utilities;
}
/** */
public void resetQuest() {
quest = new ViewQuest(this);