Moved the "forge.view.swing" package into "forge.view".

This commit is contained in:
Doublestrike
2012-01-17 10:47:10 +00:00
parent f7dc3eac58
commit 00766363f9
7 changed files with 326 additions and 378 deletions

4
.gitattributes vendored
View File

@@ -11065,6 +11065,7 @@ src/main/java/forge/quest/gui/package-info.java svneol=native#text/plain
src/main/java/forge/quest/package-info.java svneol=native#text/plain src/main/java/forge/quest/package-info.java svneol=native#text/plain
src/main/java/forge/view/FView.java svneol=native#text/plain src/main/java/forge/view/FView.java svneol=native#text/plain
src/main/java/forge/view/GuiTopLevel.java -text src/main/java/forge/view/GuiTopLevel.java -text
src/main/java/forge/view/Main.java -text
src/main/java/forge/view/editor/EditorTopLevel.java -text src/main/java/forge/view/editor/EditorTopLevel.java -text
src/main/java/forge/view/editor/package-info.java svneol=native#text/plain src/main/java/forge/view/editor/package-info.java svneol=native#text/plain
src/main/java/forge/view/home/HomeTopLevel.java -text src/main/java/forge/view/home/HomeTopLevel.java -text
@@ -11092,9 +11093,6 @@ src/main/java/forge/view/match/ViewTopLevel.java -text
src/main/java/forge/view/match/ViewWinLose.java -text src/main/java/forge/view/match/ViewWinLose.java -text
src/main/java/forge/view/match/package-info.java svneol=native#text/plain src/main/java/forge/view/match/package-info.java svneol=native#text/plain
src/main/java/forge/view/package-info.java svneol=native#text/plain src/main/java/forge/view/package-info.java svneol=native#text/plain
src/main/java/forge/view/swing/ApplicationView.java svneol=native#text/plain
src/main/java/forge/view/swing/Main.java svneol=native#text/plain
src/main/java/forge/view/swing/package-info.java svneol=native#text/plain
src/main/java/forge/view/toolbox/CardFaceSymbols.java svneol=native#text/plain src/main/java/forge/view/toolbox/CardFaceSymbols.java svneol=native#text/plain
src/main/java/forge/view/toolbox/CardViewer.java -text src/main/java/forge/view/toolbox/CardViewer.java -text
src/main/java/forge/view/toolbox/DeckLister.java -text src/main/java/forge/view/toolbox/DeckLister.java -text

View File

@@ -246,7 +246,7 @@
</descriptorRefs> </descriptorRefs>
<archive> <archive>
<manifest> <manifest>
<mainClass>forge.view.swing.Main</mainClass> <mainClass>forge.view.Main</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest> </manifest>
<manifestEntries> <manifestEntries>
@@ -842,7 +842,7 @@
<errTitle>forge</errTitle> <errTitle>forge</errTitle>
<icon>${configSourceDirectory}/forge.ico</icon> <icon>${configSourceDirectory}/forge.ico</icon>
<classPath> <classPath>
<mainClass>forge.view.swing.Main</mainClass> <mainClass>forge.view.Main</mainClass>
<addDependencies>false</addDependencies> <addDependencies>false</addDependencies>
<preCp>anything</preCp> <preCp>anything</preCp>
</classPath> </classPath>
@@ -1012,7 +1012,7 @@
<mkdir dir="${project.build.directory}/res/cardsfolder" /> <mkdir dir="${project.build.directory}/res/cardsfolder" />
<zip destfile="${project.build.directory}/res/cardsfolder/cardsfolder.zip" basedir="${basedir}/res/cardsfolder" level="1" /> <zip destfile="${project.build.directory}/res/cardsfolder/cardsfolder.zip" basedir="${basedir}/res/cardsfolder" level="1" />
<taskdef name="jarbundler" classpathref="maven.runtime.classpath" classname="net.sourceforge.jarbundler.JarBundler" /> <taskdef name="jarbundler" classpathref="maven.runtime.classpath" classname="net.sourceforge.jarbundler.JarBundler" />
<jarbundler dir="${project.build.directory}/${project.build.finalName}-osx" name="${project.name}" version="${project.version}" mainclass="forge.view.swing.Main" icon="${basedir}/${configSourceDirectory}/Forge.icns" jvmversion="1.6+" vmoptions="-Xmx1024m" shortname="${project.name}" workingdirectory="$APP_PACKAGE/Contents/Resources/Java" jar="${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar"> <jarbundler dir="${project.build.directory}/${project.build.finalName}-osx" name="${project.name}" version="${project.version}" mainclass="forge.view.Main" icon="${basedir}/${configSourceDirectory}/Forge.icns" jvmversion="1.6+" vmoptions="-Xmx1024m" shortname="${project.name}" workingdirectory="$APP_PACKAGE/Contents/Resources/Java" jar="${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar">
<javafileset dir="${basedir}"> <javafileset dir="${basedir}">
<include name="*.properties" /> <include name="*.properties" />
<include name="res/**" /> <include name="res/**" />

View File

@@ -17,13 +17,86 @@
*/ */
package forge.view; package forge.view;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import net.slightlymagic.braids.util.UtilFunctions;
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
import com.esotericsoftware.minlog.Log;
import forge.AllZone;
import forge.ComputerAIGeneral;
import forge.ComputerAIInput;
import forge.Constant;
import forge.ImageCache;
import forge.control.ControlAllUI;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.model.FModel; import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.view.home.SplashFrame;
import forge.view.toolbox.CardFaceSymbols;
import forge.view.toolbox.FSkin;
/** /**
* Generic view (as in model-view-controller) interface for Forge. * The main view for Forge: a java swing application. All view class instances
* should be accessible from here.
*/ */
public interface FView { public class FView {
private transient SplashFrame splashFrame;
/**
* The splashFrame field is guaranteed to exist when this constructor exits.
*
* @param skin
* the skin
*/
public FView(final FSkin skin) {
// We must use invokeAndWait here to fulfill the constructor's
// contract.
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD
// by
// Braids
// on
// 8/18/11
// 11:37
// PM
@Override
public void run() {
FView.this.splashFrame = new SplashFrame(skin);
}
});
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on
// 8/18/11 11:37 PM
@Override
public void run() {
FView.this.splashFrame.setVisible(true);
}
});
}
/**
* Get the progress monitor for loading all cards at once.
*
* @return a progress monitor having only one phase; may be null
*/
public final BraidsProgressMonitor getCardLoadingProgressMonitor() {
BraidsProgressMonitor result;
if (this.splashFrame == null) {
result = null;
} else {
result = this.splashFrame.getMonitorModel();
}
return result;
}
/** /**
* Tell the view that the model has been bootstrapped, and its data is ready * Tell the view that the model has been bootstrapped, and its data is ready
@@ -32,12 +105,57 @@ public interface FView {
* @param model * @param model
* the model that has finished bootstrapping * the model that has finished bootstrapping
*/ */
void setModel(FModel model); public final void setModel(final FModel model) {
try {
/** final ForgePreferences preferences = model.getPreferences();
* Get the progress monitor for loading all cards at once.
* // FindBugs doesn't like the next line.
* @return a progress monitor having only one phase; may be null ImageCache.setScaleLargerThanOriginal(preferences.isScaleLargerThanOriginal());
*/
BraidsProgressMonitor getCardLoadingProgressMonitor(); } catch (final Exception exn) {
Log.error("Error loading preferences: " + exn);
}
// For the following two blocks, check if user has cancelled
// SplashFrame.
// Note: Error thrown sometimes because log file cannot be accessed
if (!this.splashFrame.getSplashHasBeenClosed()) {
AllZone.getCardFactory(); // forces preloading of all cards
}
if (!this.splashFrame.getSplashHasBeenClosed()) {
try {
CardFaceSymbols.loadImages();
Constant.Runtime.setGameType(GameType.Constructed);
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids
// on 8/7/11 1:07
// PM: this isn't a
// web app
@Override
public void run() {
AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral()));
// Enable only one of the following two lines.
// The second
// is useful for debugging.
FView.this.splashFrame.dispose();
// splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
FView.this.splashFrame = null;
AllZone.getSkin().loadFontAndImages();
GuiTopLevel g = new GuiTopLevel();
g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
AllZone.setDisplay(g);
g.getController().changeState(ControlAllUI.HOME_SCREEN);
}
});
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}
} // End if(splashHasBeenClosed)
} // End FView()
} }

View File

@@ -1,195 +1,194 @@
/* /*
* Forge: Play Magic: the Gathering. * Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team * Copyright (C) 2011 Forge Team
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package forge.view.swing; package forge.view;
import java.util.ArrayList; import java.util.ArrayList;
import forge.AllZone; import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.ConstantStringArrayList; import forge.ConstantStringArrayList;
import forge.FileUtil; import forge.FileUtil;
import forge.Singletons; import forge.Singletons;
import forge.error.ErrorViewer; import forge.error.ErrorViewer;
import forge.error.ExceptionHandler; import forge.error.ExceptionHandler;
import forge.model.FModel; import forge.model.FModel;
import forge.view.FView; import forge.view.toolbox.FSkin;
import forge.view.toolbox.FSkin;
/**
/** * Main class for Forge's swing application view.
* Main class for Forge's swing application view. */
*/ public final class Main {
public final class Main {
/**
/** * Do not instantiate.
* Do not instantiate. */
*/ private Main() {
private Main() { // intentionally blank
// intentionally blank }
}
/**
/** * main method for Forge's swing application view.
* main method for Forge's swing application view. *
* * @param args
* @param args * an array of {@link java.lang.String} objects.
* an array of {@link java.lang.String} objects. */
*/ public static void main(final String[] args) {
public static void main(final String[] args) { ExceptionHandler.registerErrorHandling();
ExceptionHandler.registerErrorHandling(); try {
try { final FModel model = new FModel(null);
final FModel model = new FModel(null); Singletons.setModel(model);
Singletons.setModel(model);
final FSkin skin = new FSkin(Singletons.getModel().getPreferences().getSkin());
final FSkin skin = new FSkin(model.getPreferences().getSkin()); final FView view = new FView(skin);
final FView view = new ApplicationView(skin); Singletons.setView(view);
Singletons.setView(view); AllZone.setSkin(skin);
AllZone.setSkin(skin);
// Need this soon after card factory is loaded
// Need this soon after card factory is loaded Main.loadDynamicGamedata();
Main.loadDynamicGamedata();
// TODO this code should go elsewhere, like wherever we start a new
// TODO this code should go elsewhere, like wherever we start a new // game.
// game. // It is only here to maintain semantic equality with the current
// It is only here to maintain semantic equality with the current // code base.
// code base.
model.resetGameState();
model.resetGameState();
view.setModel(model);
view.setModel(model);
} catch (final Throwable exn) {
} catch (final Throwable exn) { ErrorViewer.showError(exn);
ErrorViewer.showError(exn); }
} }
}
/**
/** * Load dynamic gamedata.
* Load dynamic gamedata. */
*/ public static void loadDynamicGamedata() {
public static void loadDynamicGamedata() { if (!Constant.CardTypes.LOADED[0]) {
if (!Constant.CardTypes.LOADED[0]) { final ArrayList<String> typeListFile = FileUtil.readFile("res/gamedata/TypeLists.txt");
final ArrayList<String> typeListFile = FileUtil.readFile("res/gamedata/TypeLists.txt");
ArrayList<String> tList = null;
ArrayList<String> tList = null;
Constant.CardTypes.CARD_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.CARD_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.SUPER_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.SUPER_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.BASIC_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.BASIC_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.LAND_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.LAND_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.CREATURE_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.CREATURE_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.INSTANT_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.INSTANT_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.SORCERY_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.SORCERY_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.ENCHANTMENT_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.ENCHANTMENT_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.ARTIFACT_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.ARTIFACT_TYPES[0] = new ConstantStringArrayList(); Constant.CardTypes.WALKER_TYPES[0] = new ConstantStringArrayList();
Constant.CardTypes.WALKER_TYPES[0] = new ConstantStringArrayList();
if (typeListFile.size() > 0) {
if (typeListFile.size() > 0) { for (int i = 0; i < typeListFile.size(); i++) {
for (int i = 0; i < typeListFile.size(); i++) { final String s = typeListFile.get(i);
final String s = typeListFile.get(i);
if (s.equals("[CardTypes]")) {
if (s.equals("[CardTypes]")) { tList = Constant.CardTypes.CARD_TYPES[0].getList();
tList = Constant.CardTypes.CARD_TYPES[0].getList(); }
}
else if (s.equals("[SuperTypes]")) {
else if (s.equals("[SuperTypes]")) { tList = Constant.CardTypes.SUPER_TYPES[0].getList();
tList = Constant.CardTypes.SUPER_TYPES[0].getList(); }
}
else if (s.equals("[BasicTypes]")) {
else if (s.equals("[BasicTypes]")) { tList = Constant.CardTypes.BASIC_TYPES[0].getList();
tList = Constant.CardTypes.BASIC_TYPES[0].getList(); }
}
else if (s.equals("[LandTypes]")) {
else if (s.equals("[LandTypes]")) { tList = Constant.CardTypes.LAND_TYPES[0].getList();
tList = Constant.CardTypes.LAND_TYPES[0].getList(); }
}
else if (s.equals("[CreatureTypes]")) {
else if (s.equals("[CreatureTypes]")) { tList = Constant.CardTypes.CREATURE_TYPES[0].getList();
tList = Constant.CardTypes.CREATURE_TYPES[0].getList(); }
}
else if (s.equals("[InstantTypes]")) {
else if (s.equals("[InstantTypes]")) { tList = Constant.CardTypes.INSTANT_TYPES[0].getList();
tList = Constant.CardTypes.INSTANT_TYPES[0].getList(); }
}
else if (s.equals("[SorceryTypes]")) {
else if (s.equals("[SorceryTypes]")) { tList = Constant.CardTypes.SORCERY_TYPES[0].getList();
tList = Constant.CardTypes.SORCERY_TYPES[0].getList(); }
}
else if (s.equals("[EnchantmentTypes]")) {
else if (s.equals("[EnchantmentTypes]")) { tList = Constant.CardTypes.ENCHANTMENT_TYPES[0].getList();
tList = Constant.CardTypes.ENCHANTMENT_TYPES[0].getList(); }
}
else if (s.equals("[ArtifactTypes]")) {
else if (s.equals("[ArtifactTypes]")) { tList = Constant.CardTypes.ARTIFACT_TYPES[0].getList();
tList = Constant.CardTypes.ARTIFACT_TYPES[0].getList(); }
}
else if (s.equals("[WalkerTypes]")) {
else if (s.equals("[WalkerTypes]")) { tList = Constant.CardTypes.WALKER_TYPES[0].getList();
tList = Constant.CardTypes.WALKER_TYPES[0].getList(); }
}
else if (s.length() > 1) {
else if (s.length() > 1) { tList.add(s);
tList.add(s); }
} }
} }
} Constant.CardTypes.LOADED[0] = true;
Constant.CardTypes.LOADED[0] = true; /*
/* * if (Constant.Runtime.DevMode[0]) {
* if (Constant.Runtime.DevMode[0]) { * System.out.println(Constant.CardTypes.cardTypes[0].list);
* System.out.println(Constant.CardTypes.cardTypes[0].list); * System.out.println(Constant.CardTypes.superTypes[0].list);
* System.out.println(Constant.CardTypes.superTypes[0].list); * System.out.println(Constant.CardTypes.basicTypes[0].list);
* System.out.println(Constant.CardTypes.basicTypes[0].list); * System.out.println(Constant.CardTypes.landTypes[0].list);
* System.out.println(Constant.CardTypes.landTypes[0].list); * System.out.println(Constant.CardTypes.creatureTypes[0].list);
* System.out.println(Constant.CardTypes.creatureTypes[0].list); * System.out.println(Constant.CardTypes.instantTypes[0].list);
* System.out.println(Constant.CardTypes.instantTypes[0].list); * System.out.println(Constant.CardTypes.sorceryTypes[0].list);
* System.out.println(Constant.CardTypes.sorceryTypes[0].list); * System.out.println(Constant.CardTypes.enchantmentTypes[0].list);
* System.out.println(Constant.CardTypes.enchantmentTypes[0].list); * System.out.println(Constant.CardTypes.artifactTypes[0].list);
* System.out.println(Constant.CardTypes.artifactTypes[0].list); * System.out.println(Constant.CardTypes.walkerTypes[0].list); }
* System.out.println(Constant.CardTypes.walkerTypes[0].list); } */
*/ }
}
if (!Constant.Keywords.LOADED[0]) {
if (!Constant.Keywords.LOADED[0]) { final ArrayList<String> nskwListFile = FileUtil.readFile("res/gamedata/NonStackingKWList.txt");
final ArrayList<String> nskwListFile = FileUtil.readFile("res/gamedata/NonStackingKWList.txt");
Constant.Keywords.NON_STACKING_LIST[0] = new ConstantStringArrayList();
Constant.Keywords.NON_STACKING_LIST[0] = new ConstantStringArrayList();
if (nskwListFile.size() > 1) {
if (nskwListFile.size() > 1) { for (int i = 0; i < nskwListFile.size(); i++) {
for (int i = 0; i < nskwListFile.size(); i++) { final String s = nskwListFile.get(i);
final String s = nskwListFile.get(i); if (s.length() > 1) {
if (s.length() > 1) { Constant.Keywords.NON_STACKING_LIST[0].getList().add(s);
Constant.Keywords.NON_STACKING_LIST[0].getList().add(s); }
} }
} }
} Constant.Keywords.LOADED[0] = true;
Constant.Keywords.LOADED[0] = true; /*
/* * if (Constant.Runtime.DevMode[0]) {
* if (Constant.Runtime.DevMode[0]) { * System.out.println(Constant.Keywords.NonStackingList[0].list); }
* System.out.println(Constant.Keywords.NonStackingList[0].list); } */
*/ }
}
/*
/* * if (!Constant.Color.loaded[0]) { ArrayList<String> lcListFile =
* if (!Constant.Color.loaded[0]) { ArrayList<String> lcListFile = * FileUtil.readFile("res/gamedata/LandColorList");
* FileUtil.readFile("res/gamedata/LandColorList"); *
* * if (lcListFile.size() > 1) { for (int i=0; i<lcListFile.size(); i++)
* if (lcListFile.size() > 1) { for (int i=0; i<lcListFile.size(); i++) * { String s = lcListFile.get(i); if (s.length() > 1)
* { String s = lcListFile.get(i); if (s.length() > 1) * Constant.Color.LandColor[0].map.add(s); } }
* Constant.Color.LandColor[0].map.add(s); } } * Constant.Keywords.loaded[0] = true; if (Constant.Runtime.DevMode[0])
* Constant.Keywords.loaded[0] = true; if (Constant.Runtime.DevMode[0]) * { System.out.println(Constant.Keywords.NonStackingList[0].list); } }
* { System.out.println(Constant.Keywords.NonStackingList[0].list); } } */
*/ }
} }
}

View File

@@ -1,164 +0,0 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.view.swing;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import net.slightlymagic.braids.util.UtilFunctions;
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
import com.esotericsoftware.minlog.Log;
import forge.AllZone;
import forge.ComputerAIGeneral;
import forge.ComputerAIInput;
import forge.Constant;
import forge.ImageCache;
import forge.control.ControlAllUI;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.view.FView;
import forge.view.GuiTopLevel;
import forge.view.home.SplashFrame;
import forge.view.toolbox.CardFaceSymbols;
import forge.view.toolbox.FSkin;
/**
* The main view for Forge: a java swing application. All view class instances
* should be accessible from here.
*/
public class ApplicationView implements FView {
private transient SplashFrame splashFrame;
/**
* The splashFrame field is guaranteed to exist when this constructor exits.
*
* @param skin
* the skin
*/
public ApplicationView(final FSkin skin) {
// We must use invokeAndWait here to fulfill the constructor's
// contract.
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD
// by
// Braids
// on
// 8/18/11
// 11:37
// PM
@Override
public void run() {
ApplicationView.this.splashFrame = new SplashFrame(skin);
}
});
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on
// 8/18/11 11:37 PM
@Override
public void run() {
ApplicationView.this.splashFrame.setVisible(true);
}
});
}
/*
* (non-Javadoc)
*
* @see forge.view.FView#getCardLoadingProgressMonitor()
*/
@Override
public final BraidsProgressMonitor getCardLoadingProgressMonitor() {
BraidsProgressMonitor result;
if (this.splashFrame == null) {
result = null;
} else {
result = this.splashFrame.getMonitorModel();
}
return result;
}
/*
* (non-Javadoc)
*
* @see forge.view.FView#setModel(forge.model.FModel)
*/
@Override
public final void setModel(final FModel model) {
try {
final ForgePreferences preferences = model.getPreferences();
// FindBugs doesn't like the next line.
ImageCache.setScaleLargerThanOriginal(preferences.isScaleLargerThanOriginal());
} catch (final Exception exn) {
Log.error("Error loading preferences: " + exn);
}
// For the following two blocks, check if user has cancelled
// SplashFrame.
// Note: Error thrown sometimes because log file cannot be accessed
if (!this.splashFrame.getSplashHasBeenClosed()) {
AllZone.getCardFactory(); // forces preloading of all cards
}
if (!this.splashFrame.getSplashHasBeenClosed()) {
try {
CardFaceSymbols.loadImages();
Constant.Runtime.setGameType(GameType.Constructed);
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids
// on 8/7/11 1:07
// PM: this isn't a
// web app
@Override
public void run() {
AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral()));
// Enable only one of the following two lines.
// The second
// is useful for debugging.
ApplicationView.this.splashFrame.dispose();
// splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
ApplicationView.this.splashFrame = null;
AllZone.getSkin().loadFontAndImages();
GuiTopLevel g = new GuiTopLevel();
g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
AllZone.setDisplay(g);
g.getController().changeState(ControlAllUI.HOME_SCREEN);
}
});
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}
} // End if(splashHasBeenClosed)
} // End ApplicationView()
}

View File

@@ -1,3 +0,0 @@
/** Primary swing implementation for Forge's View (as in model-view-controller). */
package forge.view.swing;

View File

@@ -17,7 +17,7 @@ import forge.card.cardfactory.LazyCardFactory;
import forge.card.cardfactory.PreloadingCardFactory; import forge.card.cardfactory.PreloadingCardFactory;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
import forge.view.swing.Main; import forge.view.Main;
//import net.slightlymagic.braids.testng.BraidsAssertFunctions; //import net.slightlymagic.braids.testng.BraidsAssertFunctions;