From: <aki...@us...> - 2013-10-09 20:35:17
|
Revision: 9422 http://sourceforge.net/p/gridarta/code/9422 Author: akirschbaum Date: 2013-10-09 20:35:11 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Remove EditorFactory.newMainControl(). Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -44,7 +44,6 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; -import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; @@ -171,16 +170,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); - } - - /** - * {@inheritDoc} - */ - @Override public int getDoubleFaceOffset() { return isoMapSquareInfo.getYLen() - 1; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -42,7 +42,6 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; -import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; @@ -140,16 +139,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); - } - - /** - * {@inheritDoc} - */ - @Override public int getDoubleFaceOffset() { return 1; } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -44,7 +44,6 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; -import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; @@ -170,16 +169,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); - } - - /** - * {@inheritDoc} - */ - @Override public int getDoubleFaceOffset() { return isoMapSquareInfo.getYLen() - 1; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -96,17 +96,19 @@ private static final Category log = Logger.getLogger(DefaultMainControl.class); /** - * Creates a new instance. + * Loads map validators. * @param errorView the error view to add errors to * @param editorFactory the editor factory to use * @param projectSettings the project settings to use * @param gameObjectMatchers the game object matchers to use * @param archetypeTypeSet the archetype type set to use - * @param validators the map validators * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files + * @return the map validators */ - public DefaultMainControl(@NotNull final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + @NotNull + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> DelegatingMapValidator<G, A, R> loadValidators(@NotNull final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(validatorPreferences); final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); final ValidatorFactory<G, A, R> validatorFactory = new ValidatorFactory<G, A, R>(validatorPreferences, gameObjectMatchers, projectSettings, mapWriter); loadValidators(validators, validatorFactory, errorView); @@ -127,6 +129,7 @@ validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, paidItemMatcher)); } } + return validators; } @NotNull Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -87,20 +87,6 @@ public interface EditorFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * Creates a new {@link DefaultMainControl} instance. - * @param errorView the error view for reporting errors - * @param projectSettings the project settings to use - * @param gameObjectMatchers the game object matchers to use - * @param archetypeTypeSet the archetype type set to use - * @param validators the map validators - * @param validatorPreferences the validator preferences to use - * @param mapWriter the map writer for saving temporary maps - * @return the new instance - */ - @NotNull - DefaultMainControl<G, A, R> newMainControl(@NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); - - /** * Returns the offset for drawing double faces. * @return the offset */ Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 20:20:42 UTC (rev 9421) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 20:35:11 UTC (rev 9422) @@ -268,7 +268,6 @@ final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); final ValidatorPreferences validatorPreferences = new DefaultValidatorPreferences(); - final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(validatorPreferences); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); final XmlHelper xmlHelper; try { @@ -304,6 +303,7 @@ final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); final GameObjectMatchers gameObjectMatchers = DefaultMainControl.loadGameObjectMatchers(xmlHelper, errorView, projectSettings); + final DelegatingMapValidator<G, A, R> validators = DefaultMainControl.loadValidators(errorView, editorFactory, projectSettings, gameObjectMatchers, archetypeTypeSet, validatorPreferences, mapWriter); final Map<String, TreasureTreeNode> specialTreasureLists = DefaultMainControl.loadSpecialTreasureLists(errorView, xmlHelper.getDocumentBuilder(), projectSettings); final TreasureTree treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, projectSettings); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectSettings, archetypeTypeSet, xmlHelper); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |