From: <aki...@us...> - 2013-10-05 06:53:10
|
Revision: 9375 http://sourceforge.net/p/gridarta/code/9375 Author: akirschbaum Date: 2013-10-05 06:53:04 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Add private modifiers. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/Updater.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -155,7 +155,7 @@ * Creates a new instance as a copy of another map arch object. * @param mapArchObject the other map arch object */ - public MapArchObject(@NotNull final MapArchObject mapArchObject) { + private MapArchObject(@NotNull final MapArchObject mapArchObject) { super(mapArchObject); noSave = mapArchObject.noSave; noMagic = mapArchObject.noMagic; Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -57,7 +57,7 @@ * The name of the "glow_radius" attribute. */ @NotNull - public static final String GLOW_RADIUS = "glow_radius"; + private static final String GLOW_RADIUS = "glow_radius"; /** * The name of the "invisible" attribute. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -114,13 +114,13 @@ * Color for float values. */ @NotNull - public static final Color FLOAT_COLOR = new Color(19, 134, 0); + private static final Color FLOAT_COLOR = new Color(19, 134, 0); /** * Color for int values. */ @NotNull - public static final Color INT_COLOR = new Color(74, 70, 156); + private static final Color INT_COLOR = new Color(74, 70, 156); /** * The game object being modified. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -384,7 +384,7 @@ * @param directory the entry's directory * @param treeNode the tree node */ - public DeletedNode(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { + private DeletedNode(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { this.directory = directory; this.treeNode = treeNode; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -184,7 +184,7 @@ * @param directory the entry's directory * @param mapMenuEntry the entry */ - public Result(@NotNull final String directory, @NotNull final MapMenuEntry mapMenuEntry) { + private Result(@NotNull final String directory, @NotNull final MapMenuEntry mapMenuEntry) { this.directory = directory; this.mapMenuEntry = mapMenuEntry; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -245,7 +245,7 @@ * Creates a SelectionAction. * @param tool the tool to select with this action */ - SelectionAction(@NotNull final Tool<G, A, R> tool) { + private SelectionAction(@NotNull final Tool<G, A, R> tool) { this.tool = tool; ACTION_BUILDER.initAction(false, this, tool.getId()); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/Updater.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/Updater.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -313,7 +313,7 @@ * @param prefix Prefix for update information within the resource * bundle */ - VersionInfo(@NotNull final ResourceBundle bundle, @NotNull final String prefix) { + private VersionInfo(@NotNull final ResourceBundle bundle, @NotNull final String prefix) { this(bundle.getString(prefix + ".number"), bundle.getString(prefix + ".tstamp"), bundle.getString(prefix + ".developer")); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -47,7 +47,7 @@ * An empty array of <code>int</code>s. */ @NotNull - public static final int[] EMPTY_INT_ARRAY = new int[0]; + private static final int[] EMPTY_INT_ARRAY = new int[0]; /** * The logger for printing log messages. Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -43,7 +43,7 @@ * @param mapArchObject the other map arch object * @noinspection TypeMayBeWeakened */ - public TestMapArchObject(@NotNull final TestMapArchObject mapArchObject) { + private TestMapArchObject(@NotNull final TestMapArchObject mapArchObject) { super(mapArchObject); } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -63,7 +63,7 @@ * @return the new map cursor instance */ @NotNull - public static MapCursor<TestGameObject, TestMapArchObject, TestArchetype> createCursor(@NotNull final MapGrid grid) { + private static MapCursor<TestGameObject, TestMapArchObject, TestArchetype> createCursor(@NotNull final MapGrid grid) { final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final Size2D gridSize = grid.getSize(); final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(grid, mapModelCreator.newMapModel(gridSize.getWidth(), gridSize.getHeight())); Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -51,7 +51,7 @@ * The pattern that matches a single equal sign ("="). */ @NotNull - public static final Pattern PATTERN_EQUAL = Pattern.compile("="); + private static final Pattern PATTERN_EQUAL = Pattern.compile("="); /** * The Logger for printing log messages. Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -231,7 +231,7 @@ private boolean ignore; // while true, all ActionEvents get ignored - MenuActionListener(@NotNull final CFPythonPopup popup, @NotNull final ScriptEditControl control) { + private MenuActionListener(@NotNull final CFPythonPopup popup, @NotNull final ScriptEditControl control) { this.popup = popup; this.control = control; } Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -1753,7 +1753,7 @@ private int end; - CaretUndo(final int start, final int end) { + private CaretUndo(final int start, final int end) { this.start = start; this.end = end; } Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Replace.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Replace.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Replace.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -160,7 +160,7 @@ * Create a new instance. * @param textArea The text area to replace in. */ - public ReplaceDialog(final JEditTextArea textArea) { + private ReplaceDialog(final JEditTextArea textArea) { this.textArea = textArea; replaceButton.setDefaultCapable(true); setOptions(new Object[] { replaceButton, cancelButton, }); Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -312,7 +312,7 @@ * @param title Title for this CopyOutput * @param textArea JTextArea to append output to */ - CopyOutput(@NotNull final String title, @NotNull final JTextArea textArea) { + private CopyOutput(@NotNull final String title, @NotNull final JTextArea textArea) { this.title = title; appender = new Appender(textArea); } Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java 2013-10-05 06:46:26 UTC (rev 9374) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/SystemIcons.java 2013-10-05 06:53:04 UTC (rev 9375) @@ -69,7 +69,7 @@ * The name of the image for highlighting map squares that are affected by * nearby light emitting game objects. */ - public static final String SQUARE_LIGHT = SYSTEM_DIR + "light.png"; + private static final String SQUARE_LIGHT = SYSTEM_DIR + "light.png"; public static final String SQUARE_NO_FACE = SYSTEM_DIR + "no_face.png"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-05 07:38:36
|
Revision: 9377 http://sourceforge.net/p/gridarta/code/9377 Author: akirschbaum Date: 2013-10-05 07:38:31 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Do not automatically open the help dialog when the editor is started for the first time. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/src/model/src/main/java/net/sf/gridarta/model/settings/GlobalSettings.java trunk/src/model/src/test/java/net/sf/gridarta/model/settings/TestGlobalSettings.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/atrinik/ChangeLog 2013-10-05 07:38:31 UTC (rev 9377) @@ -1,3 +1,8 @@ +2013-10-05 Andreas Kirschbaum + + * Do not automatically open the help dialog when the editor is + started for the first time. + 2013-07-19 Andreas Kirschbaum * Add attribute_ordering section to types.xml. It specifies the Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/crossfire/ChangeLog 2013-10-05 07:38:31 UTC (rev 9377) @@ -1,3 +1,8 @@ +2013-10-05 Andreas Kirschbaum + + * Do not automatically open the help dialog when the editor is + started for the first time. + 2013-07-19 Andreas Kirschbaum * Add attribute_ordering section to types.xml. It specifies the Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/daimonin/ChangeLog 2013-10-05 07:38:31 UTC (rev 9377) @@ -1,3 +1,8 @@ +2013-10-05 Andreas Kirschbaum + + * Do not automatically open the help dialog when the editor is + started for the first time. + 2013-07-19 Andreas Kirschbaum * Add attribute_ordering section to types.xml. It specifies the Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-05 07:38:31 UTC (rev 9377) @@ -548,7 +548,7 @@ createAction("collectArches", "Tool", new CollectArchesAction<G, A, R>(globalSettings, resources, exiter, mainViewFrame)); createAction("reloadFaces", "Image,Tool", new ReloadFacesAction<G, A, R>(archetypeSet, faceObjectProviders)); createAction("validateMap", "Map,Tool", new ValidateMapAction<G, A, R>(validators, mapManager)); - final Action helpAction = createAction("showHelp", "Help", new ShowHelpAction(parent)); + createAction("showHelp", "Help", new ShowHelpAction(parent)); createAction("tipOfTheDay", "Help", new TipOfTheDayAction(parent)); createAction("newMap", "Map", new NewMapAction<G, A, R>(newMapDialogFactory)); createAction("goMap", "Map", new GoMapDialogManager<G, A, R>(parent, mapManager, mapViewsManager, globalSettings, exiter)); @@ -642,13 +642,6 @@ new ArchetypeValidator(animationObjects, faceObjects, errorView).validate(archetypeSet); new AnimationValidator(faceObjects, errorView).validate(animationObjects); - if (globalSettings.isAutoPopupDocumentation()) { - // do an automated help popup because the documentation version has increased - // (people won't notice the documentation otherwise - nobody expects a documentation in open source) - helpAction.actionPerformed(null); - globalSettings.setAutoPopupDocumentation(false); - } - final MapMenuPreferences recentMapMenuPreferences = new RecentMapMenuPreferences(); final MapMenuManager<G, A, R> recentMapMenuManager = new MapMenuManager<G, A, R>(recentMapMenuPreferences.getMapMenu(), mapViewsManager, fileControl, mapImageCache); final JMenu recentMenu = MenuUtils.getMenu(menuBar, "recent"); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2013-10-05 07:38:31 UTC (rev 9377) @@ -66,12 +66,6 @@ private static final String IMAGE_SET_KEY = "useImageSet"; /** - * The preferences key for storing the last known documentation version. - */ - @NotNull - private static final String DOCUMENTATION_VERSION_KEY = "docuVersion"; - - /** * Key for info whether the main window's toolbar is shown. */ @NotNull @@ -173,11 +167,6 @@ private String configSourceName; /** - * Time for an automated documentation popup. - */ - private boolean autoPopupDocumentation; - - /** * The the default directory for saving maps. */ @NotNull @@ -222,14 +211,6 @@ imageSet = preferences.get(IMAGE_SET_KEY, imageSetDefault); imageDirectory = mapsDirectory; configSourceName = preferences.get(CONFIG_SOURCE_KEY, ""); - final int documentationVersion = ActionBuilderUtils.getInt(ACTION_BUILDER, "docuVersion", 0); - if (documentationVersion > 0 && preferences.getInt(DOCUMENTATION_VERSION_KEY, 0) < documentationVersion) { - // remember to open documentation - autoPopupDocumentation = true; - // update documentation version right now, because we want the help popup only one time - preferences.putInt(DOCUMENTATION_VERSION_KEY, documentationVersion); - } - currentSaveMapDirectory = mapsDirectory.exists() ? mapsDirectory : new File(System.getProperty("user.dir")); } @@ -448,22 +429,6 @@ } /** - * {@inheritDoc} - */ - @Override - public boolean isAutoPopupDocumentation() { - return autoPopupDocumentation; - } - - /** - * {@inheritDoc} - */ - @Override - public void setAutoPopupDocumentation(final boolean autoPopupDocumentation) { - this.autoPopupDocumentation = autoPopupDocumentation; - } - - /** * Returns whether the main toolbar should be shown. * @return whether the main toolbar should be shown */ Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/settings/GlobalSettings.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/settings/GlobalSettings.java 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/settings/GlobalSettings.java 2013-10-05 07:38:31 UTC (rev 9377) @@ -112,10 +112,6 @@ */ void setCurrentSaveMapDirectory(@NotNull File currentSaveMapDirectory); - boolean isAutoPopupDocumentation(); - - void setAutoPopupDocumentation(boolean autoPopupDocumentation); - /** * Returns the pickmap directory. * @return the pickmap directory Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/settings/TestGlobalSettings.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/settings/TestGlobalSettings.java 2013-10-05 07:07:52 UTC (rev 9376) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/settings/TestGlobalSettings.java 2013-10-05 07:38:31 UTC (rev 9377) @@ -146,22 +146,6 @@ * {@inheritDoc} */ @Override - public boolean isAutoPopupDocumentation() { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setAutoPopupDocumentation(final boolean autoPopupDocumentation) { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @Override @NotNull public File getPickmapDir() { throw new AssertionError(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-05 15:14:08
|
Revision: 9379 http://sourceforge.net/p/gridarta/code/9379 Author: akirschbaum Date: 2013-10-05 15:14:01 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Move loading of autojoin lists from DefaultMainControl to GridartaEditor. 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -52,7 +52,6 @@ import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; -import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; @@ -182,8 +181,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -50,7 +50,6 @@ import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; -import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; @@ -152,8 +151,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -52,7 +52,6 @@ import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; -import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; @@ -182,8 +181,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -48,8 +48,6 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSetParser; import net.sf.gridarta.model.archetypetype.DefaultArchetypeAttributeFactory; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.autojoin.AutojoinListsParser; import net.sf.gridarta.model.configsource.ConfigSource; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.direction.Direction; @@ -171,7 +169,6 @@ * @param archetypeTypeSet the archetype type set to use * @param archetypeSet the archetype set to use * @param archetypeChooserModel the archetype chooser model to use - * @param autojoinLists the autojoin lists to use * @param mapManager the map manager * @param pluginModel the script model * @param validators the map validators @@ -183,7 +180,7 @@ * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -334,7 +331,6 @@ final File scriptsFile = new File(projectSettings.getMapsDirectory(), scriptsDir); final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); new PluginModelLoader<G, A, R>(pluginModelParser).loadPlugins(errorView, scriptsFile, pluginModel); - new AutojoinListsParser<G, A, R>(errorView, archetypeSet, autojoinLists).loadList(projectSettings.getConfigurationDirectory()); ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); } 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -37,7 +37,6 @@ import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; -import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -107,7 +106,6 @@ * @param archetypeTypeSet the archetype type set to use * @param archetypeSet the archetype set to use * @param archetypeChooserModel the archetype chooser model to use - * @param autojoinLists the autojoin lists to use * @param mapManager the map manager * @param pluginModel the script model * @param validators the map validators @@ -121,7 +119,7 @@ * @return the new instance */ @NotNull - DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull PluginModel<G, A, R> pluginModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull PluginModel<G, A, R> pluginModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); /** * Returns the offset for drawing double faces. 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-05 13:34:55 UTC (rev 9378) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-05 15:14:01 UTC (rev 9379) @@ -52,6 +52,7 @@ import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.autojoin.AutojoinListsParser; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; @@ -285,7 +286,8 @@ final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + new AutojoinListsParser<G, A, R>(errorView, archetypeSet, autojoinLists).loadList(projectSettings.getConfigurationDirectory()); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-05 15:22:53
|
Revision: 9380 http://sourceforge.net/p/gridarta/code/9380 Author: akirschbaum Date: 2013-10-05 15:22:47 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Move loading of editor scripts lists from DefaultMainControl to GridartaEditor. 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -181,8 +181,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -493,4 +493,13 @@ return new AtrinikServerActions(mapViewManager, fileControl, pathManager); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptsDir() { + return IGUIConstants.SCRIPTS_DIR; + } + } 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -151,8 +151,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -405,4 +405,13 @@ return null; // action not supported } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptsDir() { + return IGUIConstants.SCRIPTS_DIR; + } + } 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -181,8 +181,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -493,4 +493,13 @@ return null; // action not supported } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptsDir() { + return IGUIConstants.SCRIPTS_DIR; + } + } 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -19,7 +19,6 @@ package net.sf.gridarta.maincontrol; -import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -99,8 +98,6 @@ import net.sf.gridarta.model.validation.checks.ValidatorFactory; import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginModelLoader; -import net.sf.gridarta.plugin.PluginModelParser; import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.CommonConstants; @@ -156,7 +153,6 @@ * collect game objects spells * @param spellFile the spell file name to load or <code>null</code> to not * load numbered spells - * @param scriptsDir the plugin scripts directory * @param errorView the error view to add errors to * @param editorFactory the editor factory to use * @param forceReadFromFiles if set, read resources from individual files @@ -170,17 +166,15 @@ * @param archetypeSet the archetype set to use * @param archetypeChooserModel the archetype chooser model to use * @param mapManager the map manager - * @param pluginModel the script model * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param pluginParameterFactory the plugin parameter factory to use * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -328,9 +322,6 @@ } numberSpells.sort(); } - final File scriptsFile = new File(projectSettings.getMapsDirectory(), scriptsDir); - final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); - new PluginModelLoader<G, A, R>(pluginModelParser).loadPlugins(errorView, scriptsFile, pluginModel); ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); } 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -107,19 +107,17 @@ * @param archetypeSet the archetype set to use * @param archetypeChooserModel the archetype chooser model to use * @param mapManager the map manager - * @param pluginModel the script model * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param pluginParameterFactory the plugin parameter factory to use * @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(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull PluginModel<G, A, R> pluginModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); /** * Returns the offset for drawing double faces. @@ -406,4 +404,10 @@ @Nullable EditorAction newServerActions(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager); + /** + * Returns the default directory for editor scripts. + * @return the directory + */ + String getScriptsDir(); + } 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-05 15:14:01 UTC (rev 9379) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-05 15:22:47 UTC (rev 9380) @@ -99,6 +99,8 @@ import net.sf.gridarta.plugin.PluginExecException; import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; +import net.sf.gridarta.plugin.PluginModelLoader; +import net.sf.gridarta.plugin.PluginModelParser; import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.preferences.FilePreferencesFactory; @@ -286,7 +288,12 @@ final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, pluginModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + + final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); + final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); + new PluginModelLoader<G, A, R>(pluginModelParser).loadPlugins(errorView, scriptsFile, pluginModel); + new AutojoinListsParser<G, A, R>(errorView, archetypeSet, autojoinLists).loadList(projectSettings.getConfigurationDirectory()); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-05 15:34:10
|
Revision: 9381 http://sourceforge.net/p/gridarta/code/9381 Author: akirschbaum Date: 2013-10-05 15:34:06 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Replace parameter with return value. 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 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-05 15:22:47 UTC (rev 9380) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-05 15:34:06 UTC (rev 9381) @@ -283,8 +283,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { + public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { + final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker = new AttributeRangeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster_only", "system_monster", "monster"); if (monsterMatcher != null) { addAttributeRangeChecker(attributeRangeChecker, monsterMatcher, "level", "level", 0, 125); @@ -352,6 +354,7 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } + return attributeRangeChecker; } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { 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-05 15:22:47 UTC (rev 9380) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-05 15:34:06 UTC (rev 9381) @@ -258,8 +258,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { + public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { + final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker = new AttributeRangeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster"); if (monsterMatcher != null) { try { @@ -268,6 +270,7 @@ log.warn(ex.getMessage() + " for monster checker"); } } + return attributeRangeChecker; } /** 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-05 15:22:47 UTC (rev 9380) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-05 15:34:06 UTC (rev 9381) @@ -283,8 +283,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { + public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { + final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker = new AttributeRangeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster_only", "system_monster", "monster"); if (monsterMatcher != null) { addAttributeRangeChecker(attributeRangeChecker, monsterMatcher, "level", "level", 0, 125); @@ -352,6 +354,7 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } + return attributeRangeChecker; } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { 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-05 15:22:47 UTC (rev 9380) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-05 15:34:06 UTC (rev 9381) @@ -183,9 +183,10 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); + final DocumentBuilder documentBuilder = xmlHelper.getDocumentBuilder(); + + AttributeRangeChecker<G, A, R> attributeRangeChecker = null; final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); - final DocumentBuilder documentBuilder = xmlHelper.getDocumentBuilder(); try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, url); @@ -203,7 +204,7 @@ final ValidatorFactory<G, A, R> validatorFactory = new ValidatorFactory<G, A, R>(validatorPreferences, gameObjectMatchers, projectSettings, mapWriter); loadValidators(validators, validatorFactory, errorView); - editorFactory.initMapValidators(validators, gameObjectMatchersErrorViewCollector, projectSettings, gameObjectMatchers, attributeRangeChecker, validatorPreferences); + attributeRangeChecker = editorFactory.loadAttributeRangeChecker(validators, gameObjectMatchersErrorViewCollector, projectSettings, gameObjectMatchers, validatorPreferences); validators.addValidator(attributeRangeChecker); validators.addValidator(environmentChecker); } catch (final FileNotFoundException ex) { @@ -322,7 +323,9 @@ } numberSpells.sort(); } - ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); + if (attributeRangeChecker != null) { + ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); + } } /** 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-05 15:22:47 UTC (rev 9380) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-05 15:34:06 UTC (rev 9381) @@ -212,15 +212,15 @@ void initSmoothFaces(@NotNull FaceObjects faceObjects); /** - * Initializes the map validators. + * Loads the attribute range checker for map validation. * @param mapValidators the map validators that delegates to add to * @param errorViewCollector the error view collector to use * @param projectSettings the project settings instance * @param gameObjectMatchers the defined game object matchers - * @param attributeRangeChecker the attribute range checker to use * @param validatorPreferences the validator preferences to use */ - void initMapValidators(@NotNull DelegatingMapValidator<G, A, R> mapValidators, @NotNull ErrorViewCollector errorViewCollector, @NotNull ProjectSettings projectSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences); + @NotNull + AttributeRangeChecker<G, A, R> loadAttributeRangeChecker(@NotNull DelegatingMapValidator<G, A, R> mapValidators, @NotNull ErrorViewCollector errorViewCollector, @NotNull ProjectSettings projectSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences); /** * Creates a new {@link AbstractArchetypeParser} instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 17:44:42
|
Revision: 9386 http://sourceforge.net/p/gridarta/code/9386 Author: akirschbaum Date: 2013-10-08 17:44:36 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move check for null value into function. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java 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-08 17:43:13 UTC (rev 9385) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 17:44:36 UTC (rev 9386) @@ -282,9 +282,7 @@ } numberSpells.sort(); } - if (attributeRangeChecker != null) { - ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); - } + ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); } private void addArchetypes(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java 2013-10-08 17:43:13 UTC (rev 9385) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java 2013-10-08 17:44:36 UTC (rev 9386) @@ -53,6 +53,7 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Creates checks from {@link ArchetypeType ArchetypeTypes}. @@ -77,7 +78,11 @@ * @param environmentChecker the environment checker to add to * @param archetypeTypeSet the archetype type set to use */ - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final EnvironmentChecker<G, A, R> environmentChecker) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final EnvironmentChecker<G, A, R> environmentChecker) { + if (attributeRangeChecker == null) { + return; + } + final Set<Integer> allowsAllInvTypes = new HashSet<Integer>(); for (final ArchetypeType archetypeType : archetypeTypeSet) { if (archetypeType.isAllowsAllInv()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 18:07:07
|
Revision: 9392 http://sourceforge.net/p/gridarta/code/9392 Author: akirschbaum Date: 2013-10-08 18:06:54 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move creation of XmlHelper from DefaultMainControl to GridartaEditor. 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-08 17:53:57 UTC (rev 9391) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -105,6 +105,7 @@ import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.actions.AtrinikServerActions; import net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory; @@ -181,8 +182,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** 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-08 17:53:57 UTC (rev 9391) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -101,6 +101,7 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.crossfire.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -151,8 +152,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** 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-08 17:53:57 UTC (rev 9391) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -105,6 +105,7 @@ import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -181,8 +182,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); } /** 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-08 17:53:57 UTC (rev 9391) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -25,11 +25,9 @@ import java.net.URL; import java.util.Collections; import java.util.Map; -import java.util.MissingResourceException; import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.DefaultScriptArchEditor; @@ -142,6 +140,7 @@ /** * Creates a new instance. + * @param xmlHelper the xml helper instance for loading XML files * @param scriptFileFilter the file filter for script files * @param scriptExtension the file extension for script files * @param scriptName the display name for script files @@ -170,18 +169,9 @@ * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { - final XmlHelper xmlHelper; - try { - xmlHelper = new XmlHelper(); - } catch (final ParserConfigurationException ex) { - log.fatal("Cannot create XML parser: " + ex.getMessage()); - //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException - throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); - } - + public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); AttributeRangeChecker<G, A, R> attributeRangeChecker = null; - final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, url); @@ -207,6 +197,7 @@ validators.addValidator(attributeRangeChecker); } validators.addValidator(environmentChecker); + ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); final GameObjectMatcher shopSquareMatcher = gameObjectMatchers.getMatcher("system_shop_square", "shop_square"); if (shopSquareMatcher != null) { final GameObjectMatcher noSpellsMatcher = gameObjectMatchers.getMatcher("system_no_spells", "no_spells"); @@ -231,7 +222,6 @@ loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); loadArchetypeSpells(spellType, gameObjectFactory, archetypeSet, gameObjectSpells); loadSpellFile(spellFile, errorView, projectSettings, numberSpells, xmlHelper); - ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); } @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-08 17:53:57 UTC (rev 9391) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -83,6 +83,7 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.XmlHelper; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -95,6 +96,7 @@ /** * Creates a new {@link DefaultMainControl} instance. + * @param xmlHelper the xml helper instance for loading XML files * @param forceReadFromFiles whether the current config source should be * ignored * @param errorView the error view for reporting errors @@ -117,7 +119,7 @@ * @return the new instance */ @NotNull - DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(@NotNull XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); /** * Returns the offset for drawing double faces. 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-08 17:53:57 UTC (rev 9391) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 18:06:54 UTC (rev 9392) @@ -32,6 +32,7 @@ import java.util.ResourceBundle; import java.util.prefs.Preferences; import javax.swing.SwingUtilities; +import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.MainControl; import net.sf.gridarta.commands.BatchPngCommand; import net.sf.gridarta.commands.CollectArchesCommand; @@ -108,6 +109,7 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.utils.XmlHelper; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; @@ -288,8 +290,17 @@ final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + final XmlHelper xmlHelper; + try { + xmlHelper = new XmlHelper(); + } catch (final ParserConfigurationException ex) { + log.fatal("Cannot create XML parser: " + ex.getMessage()); + //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException + throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); + } + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); new PluginModelLoader<G, A, R>(pluginModelParser).loadPlugins(errorView, scriptsFile, pluginModel); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 18:19:14
|
Revision: 9394 http://sourceforge.net/p/gridarta/code/9394 Author: akirschbaum Date: 2013-10-08 18:19:08 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move code from DefaultMainControl to GridartaEditor. 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -128,6 +128,7 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * An {@link EditorFactory} that creates Crossfire objects. @@ -182,8 +183,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", 0, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -506,4 +507,13 @@ return IGUIConstants.SCRIPTS_DIR; } + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getSpellFile() { + return IGUIConstants.SPELL_FILE; + } + } 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -152,8 +152,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -418,4 +418,13 @@ return IGUIConstants.SCRIPTS_DIR; } + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getSpellFile() { + return null; + } + } 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -182,8 +182,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); } /** @@ -506,4 +506,13 @@ return IGUIConstants.SCRIPTS_DIR; } + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getSpellFile() { + return IGUIConstants.SPELL_FILE; + } + } 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -146,8 +146,6 @@ * @param scriptName the display name for script files * @param spellType the object id for spell objects or <code>0</code> to not * collect game objects spells - * @param spellFile the spell file name to load or <code>null</code> to not - * load numbered spells * @param errorView the error view to add errors to * @param editorFactory the editor factory to use * @param forceReadFromFiles if set, read resources from individual files @@ -164,12 +162,11 @@ * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources - * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); AttributeRangeChecker<G, A, R> attributeRangeChecker = null; try { @@ -221,7 +218,6 @@ scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); loadArchetypeSpells(spellType, gameObjectFactory, archetypeSet, gameObjectSpells); - loadSpellFile(spellFile, errorView, projectSettings, numberSpells, xmlHelper); } @NotNull @@ -274,9 +270,11 @@ } } - private static void loadSpellFile(@Nullable final String spellFile, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final XmlHelper xmlHelper) { + @NotNull + public static Spells<NumberSpell> loadSpellFile(@Nullable final String spellFile, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final XmlHelper xmlHelper) { + @NotNull final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); if (spellFile == null) { - return; + return numberSpells; } try { @@ -293,6 +291,7 @@ errorView.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, spellFile + ": " + ex.getMessage()); } numberSpells.sort(); + return numberSpells; } private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addArchetypes(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -112,14 +112,13 @@ * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources - * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use * @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 XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(@NotNull XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); /** * Returns the offset for drawing double faces. @@ -413,4 +412,11 @@ */ String getScriptsDir(); + /** + * Returns the spell file name to load. + * @return the spell file name or {@code null} to not load numbered spells + */ + @Nullable + String getSpellFile(); + } 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-08 18:10:48 UTC (rev 9393) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 18:19:08 UTC (rev 9394) @@ -287,7 +287,6 @@ final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, projectSettings); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final AbstractResources<G, A, R> resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); - final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); @@ -299,7 +298,9 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, validatorPreferences, mapWriter); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); + final Spells<NumberSpell> numberSpells = + DefaultMainControl.loadSpellFile(editorFactory.getSpellFile(), errorView, projectSettings, xmlHelper); final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 18:26:28
|
Revision: 9395 http://sourceforge.net/p/gridarta/code/9395 Author: akirschbaum Date: 2013-10-08 18:26:25 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move code from DefaultMainControl to GridartaEditor. 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-08 18:19:08 UTC (rev 9394) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -183,8 +183,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", 0, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); } /** @@ -516,4 +516,12 @@ return IGUIConstants.SPELL_FILE; } + /** + * {@inheritDoc} + */ + @Override + public int getSpellType() { + return 0; + } + } 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-08 18:19:08 UTC (rev 9394) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -152,8 +152,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); } /** @@ -427,4 +427,12 @@ return null; } + /** + * {@inheritDoc} + */ + @Override + public int getSpellType() { + return Archetype.TYPE_SPELL; + } + } 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-08 18:19:08 UTC (rev 9394) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -182,8 +182,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); } /** @@ -515,4 +515,12 @@ return IGUIConstants.SPELL_FILE; } + /** + * {@inheritDoc} + */ + @Override + public int getSpellType() { + return 0; + } + } 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-08 18:19:08 UTC (rev 9394) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -144,8 +144,6 @@ * @param scriptFileFilter the file filter for script files * @param scriptExtension the file extension for script files * @param scriptName the display name for script files - * @param spellType the object id for spell objects or <code>0</code> to not - * collect game objects spells * @param errorView the error view to add errors to * @param editorFactory the editor factory to use * @param forceReadFromFiles if set, read resources from individual files @@ -162,11 +160,10 @@ * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources - * @param gameObjectSpells the game object spells to use * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); AttributeRangeChecker<G, A, R> attributeRangeChecker = null; try { @@ -217,7 +214,6 @@ scriptedEventEditor.setScriptArchEditor(scriptArchEditor); scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); - loadArchetypeSpells(spellType, gameObjectFactory, archetypeSet, gameObjectSpells); } @NotNull @@ -263,11 +259,14 @@ } } - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadArchetypeSpells(final int spellType, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells) { + @NotNull + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Spells<GameObjectSpell<G, A, R>> loadArchetypeSpells(final int spellType, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); if (spellType != 0) { new ArchetypeSetSpellLoader<G, A, R>(gameObjectFactory).load(archetypeSet, spellType, gameObjectSpells); gameObjectSpells.sort(); } + return gameObjectSpells; } @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-08 18:19:08 UTC (rev 9394) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -112,13 +112,12 @@ * @param validators the map validators * @param scriptedEventEditor the scripted event editor * @param resources the resources - * @param gameObjectSpells the game object spells to use * @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 XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(@NotNull XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); /** * Returns the offset for drawing double faces. @@ -419,4 +418,10 @@ @Nullable String getSpellFile(); + /** + * Returns the archetype type for game object spells. + * @return the archetype type or {@code 0} to not load gameo object spells + */ + int getSpellType(); + } 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-08 18:19:08 UTC (rev 9394) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 18:26:25 UTC (rev 9395) @@ -287,7 +287,6 @@ final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, projectSettings); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final AbstractResources<G, A, R> resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); - final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); final XmlHelper xmlHelper; @@ -298,9 +297,9 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, gameObjectSpells, validatorPreferences, mapWriter); - final Spells<NumberSpell> numberSpells = - DefaultMainControl.loadSpellFile(editorFactory.getSpellFile(), errorView, projectSettings, xmlHelper); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, mode == GridartaRunMode.COLLECT_ARCHES, errorView, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); + final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = DefaultMainControl.loadArchetypeSpells(editorFactory.getSpellType(), gameObjectFactory, archetypeSet); + final Spells<NumberSpell> numberSpells = DefaultMainControl.loadSpellFile(editorFactory.getSpellFile(), errorView, projectSettings, xmlHelper); final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 21:00:52
|
Revision: 9404 http://sourceforge.net/p/gridarta/code/9404 Author: akirschbaum Date: 2013-10-08 21:00:49 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move code from DefaultMainControl to GridartaEditor. 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-08 20:15:38 UTC (rev 9403) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 21:00:49 UTC (rev 9404) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; +import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.dialog.prefs.AppPreferences; @@ -41,6 +42,7 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; +import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; @@ -92,6 +94,7 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -183,8 +186,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); } /** @@ -476,8 +479,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, getScriptExtension(), true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** @@ -524,4 +527,31 @@ return 0; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getScriptFileFilter() { + return GuiFileFilters.pythonFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptExtension() { + return ".py"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptName() { + return "Python"; + } + } 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-08 20:15:38 UTC (rev 9403) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 21:00:49 UTC (rev 9404) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.crossfire.maincontrol; import java.awt.Component; +import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.dialog.prefs.AppPreferences; @@ -39,6 +40,7 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; +import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; @@ -88,6 +90,7 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -152,8 +155,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.pythonFileFilter, ".py", "Python", errorView, this, false, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); } /** @@ -384,8 +387,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, getScriptExtension(), false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** @@ -435,4 +438,31 @@ return Archetype.TYPE_SPELL; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getScriptFileFilter() { + return GuiFileFilters.pythonFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptExtension() { + return ".py"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptName() { + return "Python"; + } + } 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-08 20:15:38 UTC (rev 9403) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 21:00:49 UTC (rev 9404) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; +import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.dialog.prefs.AppPreferences; @@ -41,6 +42,7 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; +import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; @@ -92,6 +94,7 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -182,8 +185,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(xmlHelper, GuiFileFilters.luaFileFilter, ".lua", "Lua", errorView, this, forceReadFromFiles, projectSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, mapManager, validators, scriptedEventEditor, resources, validatorPreferences, mapWriter); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); } /** @@ -475,8 +478,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, getScriptExtension(), true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** @@ -523,4 +526,31 @@ return 0; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getScriptFileFilter() { + return GuiFileFilters.luaFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptExtension() { + return ".lua"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getScriptName() { + return "Lua"; + } + } 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-08 20:15:38 UTC (rev 9403) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 21:00:49 UTC (rev 9404) @@ -71,7 +71,6 @@ import net.sf.gridarta.model.match.GameObjectMatchersParser; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchUtils; -import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.spells.ArchetypeSetSpellLoader; @@ -80,7 +79,6 @@ import net.sf.gridarta.model.spells.Spells; import net.sf.gridarta.model.spells.XMLSpellLoader; import net.sf.gridarta.model.treasurelist.TreasureListsParser; -import net.sf.gridarta.model.treasurelist.TreasureLoader; import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.treasurelist.TreasureTreeNode; import net.sf.gridarta.model.validation.DelegatingMapValidator; @@ -125,44 +123,19 @@ @NotNull private static final Category log = Logger.getLogger(DefaultMainControl.class); - @NotNull - private final TreasureTree treasureTree; - - @NotNull - private final ScriptArchEditor<G, A, R> scriptArchEditor; - - @NotNull - private final ScriptArchDataUtils<G, A, R> scriptArchDataUtils; - - @NotNull - private final ScriptArchUtils scriptArchUtils; - /** * Creates a new instance. * @param xmlHelper the xml helper instance for loading XML files - * @param scriptFileFilter the file filter for script files - * @param scriptExtension the file extension for script files - * @param scriptName the display name for script files * @param errorView the error view to add errors to * @param editorFactory the editor factory to use - * @param forceReadFromFiles if set, read resources from individual files - * ignoring the user's settings * @param projectSettings the project settings to use - * @param configSourceFactory the config source factory to use - * @param pathManager the path manager to use * @param gameObjectMatchers the game object matchers to use - * @param gameObjectFactory the game object factory to use * @param archetypeTypeSet the archetype type set to use - * @param archetypeSet the archetype set to use - * @param archetypeChooserModel the archetype chooser model to use - * @param mapManager the map manager * @param validators the map validators - * @param scriptedEventEditor the scripted event editor - * @param resources the resources * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final XmlHelper xmlHelper, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final ProjectSettings projectSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter) { + public DefaultMainControl(@NotNull final XmlHelper xmlHelper, 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) { final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); AttributeRangeChecker<G, A, R> attributeRangeChecker = null; try { @@ -204,18 +177,10 @@ validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, paidItemMatcher)); } } - final Map<String, TreasureTreeNode> specialTreasureLists = loadSpecialTreasureLists(errorView, xmlHelper.getDocumentBuilder(), projectSettings); - final ConfigSource configSource = forceReadFromFiles ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); - treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, projectSettings); - scriptArchUtils = loadScriptArchUtils(errorView, editorFactory, projectSettings, archetypeTypeSet, xmlHelper); - loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); - final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); - scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, scriptExtension, scriptName, scriptArchUtils, scriptFileFilter, projectSettings, mapManager, pathManager); - scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); } @NotNull - private ScriptArchUtils loadScriptArchUtils(@NotNull final ErrorView errorView, final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final XmlHelper xmlHelper) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> ScriptArchUtils loadScriptArchUtils(@NotNull final ErrorView errorView, final EditorFactory<G, A, R> editorFactory, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final XmlHelper xmlHelper) { final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); @@ -245,7 +210,7 @@ return editorFactory.newScriptArchUtils(eventTypeSet); } - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractResources<G, A, R> resources, @NotNull final ConfigSource configSource) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AbstractResources<G, A, R> resources, @NotNull final ConfigSource configSource) { final long timeStart = System.currentTimeMillis(); if (log.isInfoEnabled()) { log.info("Start to load archetypes..."); @@ -306,7 +271,7 @@ } @NotNull - private static Map<String, TreasureTreeNode> loadSpecialTreasureLists(@NotNull final ErrorView errorView, @NotNull final DocumentBuilder documentBuilder, @NotNull final ProjectSettings projectSettings) { + public static Map<String, TreasureTreeNode> loadSpecialTreasureLists(@NotNull final ErrorView errorView, @NotNull final DocumentBuilder documentBuilder, @NotNull final ProjectSettings projectSettings) { Map<String, TreasureTreeNode> specialTreasureLists; try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), "TreasureLists.xml"); @@ -403,6 +368,7 @@ * @param undefinedSpellIndex the index for no spell * @param archetypeTypeSet the archetype type set * @param mapArchObjectFactory the map arch object factory to use + * @param treasureTree the treasure tree * @param mapReaderFactory the map reader factory to use * @param validators the map validators * @param gameObjectMatchers the game object matchers @@ -413,6 +379,9 @@ * @param allowRandomMapParameters whether exit paths may point to random * map parameters * @param scriptedEventEditor the scripted event editor + * @param scriptArchDataUtils the script arch data utils + * @param scriptArchUtils the script arch utils + * @param scriptArchEditor the script arch editor * @param directionMap maps relative direction to map window direction * @param resources the resources * @param gameObjectSpells the game object spells to use @@ -420,7 +389,7 @@ * @param pluginParameterFactory the plugin parameter factory to use * @return the new instance */ - public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final Direction[] directionMap, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final Direction[] directionMap, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, GuiFileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, lockedItemsTypeNumbers, scriptsDir, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } 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-08 20:15:38 UTC (rev 9403) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 21:00:49 UTC (rev 9404) @@ -20,6 +20,7 @@ package net.sf.gridarta.maincontrol; import java.awt.Component; +import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; @@ -29,6 +30,7 @@ import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; +import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; @@ -73,6 +75,7 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -97,27 +100,17 @@ /** * Creates a new {@link DefaultMainControl} instance. * @param xmlHelper the xml helper instance for loading XML files - * @param forceReadFromFiles whether the current config source should be - * ignored * @param errorView the error view for reporting errors * @param projectSettings the project settings to use - * @param configSourceFactory the config source factory to use - * @param pathManager the path manager to use * @param gameObjectMatchers the game object matchers to use - * @param gameObjectFactory the game object factory to use * @param archetypeTypeSet the archetype type set to use - * @param archetypeSet the archetype set to use - * @param archetypeChooserModel the archetype chooser model to use - * @param mapManager the map manager * @param validators the map validators - * @param scriptedEventEditor the scripted event editor - * @param resources the resources * @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 XmlHelper xmlHelper, boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull ProjectSettings projectSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull ValidatorPreferences validatorPreferences, @NotNull MapWriter<G, A, R> mapWriter); + DefaultMainControl<G, A, R> newMainControl(@NotNull XmlHelper xmlHelper, @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. @@ -361,6 +354,7 @@ * @param systemIcons the system icons for creating icons * @param archetypeTypeSet the archetype type set * @param mapArchObjectFactory the map arch object factory to use + * @param treasureTree the treasure tree * @param mapReaderFactory the map reader factory to use * @param validators the map validators * @param gameObjectMatchers the game object matchers @@ -368,6 +362,9 @@ * @param animationObjects the animation objects * @param archetypeChooserModel the archetype chooser model * @param scriptedEventEditor the scripted event editor + * @param scriptArchDataUtils the script arch data utils + * @param scriptArchUtils the script arch utils + * @param scriptArchEditor the script arch editor * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use @@ -375,7 +372,7 @@ * @return the new instance */ @NotNull - GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull PluginExecutor<G, A, R> pluginExecutor, @NotNull PluginParameters pluginParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapModelFactory<G, A, R> mapModelFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull ProjectSettings projectSettings, @NotNull EditorSettings editorSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull PluginModel<G, A, R> pluginModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); + GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull PluginExecutor<G, A, R> pluginExecutor, @NotNull PluginParameters pluginParameters, @No... [truncated message content] |
From: <aki...@us...> - 2013-10-08 21:11:29
|
Revision: 9405 http://sourceforge.net/p/gridarta/code/9405 Author: akirschbaum Date: 2013-10-08 21:11:26 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Remove DefaultMainControl.createGUIMainControl(). 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 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-08 21:00:49 UTC (rev 9404) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 21:11:26 UTC (rev 9405) @@ -480,7 +480,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, getScriptExtension(), true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(true, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, false, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new SubDirectoryCacheFiles(".dedit"), gameObjectSpells, numberSpells, -1, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** 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-08 21:00:49 UTC (rev 9404) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 21:11:26 UTC (rev 9405) @@ -388,7 +388,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, getScriptExtension(), false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(false, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, true, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), gameObjectSpells, numberSpells, 0, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -407,8 +407,7 @@ * {@inheritDoc} */ @Nullable - @Override - public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { + @Override public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { return null; // action not supported } 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-08 21:00:49 UTC (rev 9404) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 21:11:26 UTC (rev 9405) @@ -479,7 +479,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, getScriptExtension(), true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, pluginModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(true, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, false, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new SubDirectoryCacheFiles(".dedit"), gameObjectSpells, numberSpells, -1, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** 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-08 21:00:49 UTC (rev 9404) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 21:11:26 UTC (rev 9405) @@ -25,15 +25,7 @@ import java.net.URL; import java.util.Collections; import java.util.Map; -import javax.swing.ImageIcon; -import javax.swing.filechooser.FileFilter; import javax.xml.parsers.DocumentBuilder; -import net.sf.gridarta.gui.filter.FilterControl; -import net.sf.gridarta.gui.map.renderer.RendererFactory; -import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; -import net.sf.gridarta.gui.scripts.ScriptedEventEditor; -import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypeset.ArchetypeSet; @@ -45,33 +37,19 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeSetParser; import net.sf.gridarta.model.archetypetype.DefaultArchetypeAttributeFactory; import net.sf.gridarta.model.configsource.ConfigSource; -import net.sf.gridarta.model.configsource.ConfigSourceFactory; -import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; -import net.sf.gridarta.model.io.CacheFiles; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.MapWriter; -import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; -import net.sf.gridarta.model.mapmanager.AbstractMapManager; -import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; -import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.GameObjectMatchersParser; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchUtils; -import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.spells.ArchetypeSetSpellLoader; import net.sf.gridarta.model.spells.GameObjectSpell; @@ -79,7 +57,6 @@ import net.sf.gridarta.model.spells.Spells; import net.sf.gridarta.model.spells.XMLSpellLoader; import net.sf.gridarta.model.treasurelist.TreasureListsParser; -import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.treasurelist.TreasureTreeNode; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.NoSuchValidatorException; @@ -90,15 +67,9 @@ import net.sf.gridarta.model.validation.checks.PaidItemShopSquareChecker; import net.sf.gridarta.model.validation.checks.ShopSquareChecker; import net.sf.gridarta.model.validation.checks.ValidatorFactory; -import net.sf.gridarta.plugin.PluginExecutor; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.CommonConstants; -import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.StringUtils; -import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.utils.XmlHelper; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -330,67 +301,4 @@ } } - /** - * Creates a new {@link GUIMainControl} instance. - * @param scriptFileFilter the file filter for script files - * @param scriptExtension the file extension for script files - * @param createDirectionPane whether the direction panel should be created - * @param mapManager the map manager - * @param pickmapManager the pickmap manager - * @param archetypeSet the archetype set - * @param mapModelFactory the map model factory - * @param compassIcon the icon to display in the selected square view; - * <code>null</code> to not show an icon - * @param gridartaJarFilename the filename of the editor's .jar file - * @param lockedItemsTypeNumbers the type numbers of game objects being - * locked items - * @param autoValidatorDefault whether the auto validator is enabled by - * default - * @param spellFile the spell file to load; <code>null</code> to not load a - * spell file - * @param editorFactory the editor factory to use - * @param errorView the error view to add errors to - * @param cacheFiles the cache files for icon and preview images - * @param configSourceFactory the config source factory to use - * @param rendererFactory the renderer factory - * @param filterControl the filter control to use - * @param pluginExecutor the script executor to use - * @param pluginParameters the script parameters to use - * @param faceObjects the face objects - * @param projectSettings the project settings - * @param editorSettings the editor settings - * @param mapViewSettings the map view settings - * @param faceObjectProviders the face object providers - * @param pathManager the path manager - * @param topmostInsertionMode the "topmost" insertion mode - * @param gameObjectFactory the game object factory - * @param systemIcons the system icons for creating icons - * @param undefinedSpellIndex the index for no spell - * @param archetypeTypeSet the archetype type set - * @param mapArchObjectFactory the map arch object factory to use - * @param treasureTree the treasure tree - * @param mapReaderFactory the map reader factory to use - * @param validators the map validators - * @param gameObjectMatchers the game object matchers - * @param scriptsDir the plugin scripts directory - * @param pluginModel the script model - * @param animationObjects the animation objects - * @param archetypeChooserModel the archetype chooser model - * @param allowRandomMapParameters whether exit paths may point to random - * map parameters - * @param scriptedEventEditor the scripted event editor - * @param scriptArchDataUtils the script arch data utils - * @param scriptArchUtils the script arch utils - * @param scriptArchEditor the script arch editor - * @param directionMap maps relative direction to map window direction - * @param resources the resources - * @param gameObjectSpells the game object spells to use - * @param numberSpells the number spells to use - * @param pluginParameterFactory the plugin parameter factory to use - * @return the new instance - */ - public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final Direction[] directionMap, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { - return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, GuiFileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, lockedItemsTypeNumbers, scriptsDir, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 21:25:12
|
Revision: 9406 http://sourceforge.net/p/gridarta/code/9406 Author: akirschbaum Date: 2013-10-08 21:25:06 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Unify EditorFactory implementations. 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/EditorFactory.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-08 21:11:26 UTC (rev 9405) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 21:25:06 UTC (rev 9406) @@ -67,6 +67,7 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.AbstractArchetypeParser; +import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; @@ -480,7 +481,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(true, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, false, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new SubDirectoryCacheFiles(".dedit"), gameObjectSpells, numberSpells, -1, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -554,4 +555,46 @@ return "Python"; } + /** + * {@inheritDoc} + */ + @Override + public boolean isCreateDirectionPane() { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public int getUndefinedSpellIndex() { + return -1; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public CacheFiles getCacheFiles() { + return new SubDirectoryCacheFiles(".dedit"); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Direction[] getDirectionMap() { + return new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAllowRandomMapParameters() { + return false; + } + } 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-08 21:11:26 UTC (rev 9405) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 21:25:06 UTC (rev 9406) @@ -62,6 +62,7 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractArchetypeParser; +import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.DirectoryCacheFiles; import net.sf.gridarta.model.io.GameObjectParser; @@ -388,7 +389,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(false, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, true, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), gameObjectSpells, numberSpells, 0, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -464,4 +465,46 @@ return "Python"; } + /** + * {@inheritDoc} + */ + @Override + public boolean isCreateDirectionPane() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public int getUndefinedSpellIndex() { + return 0; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public CacheFiles getCacheFiles() { + return new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Direction[] getDirectionMap() { + return new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAllowRandomMapParameters() { + return true; + } + } 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-08 21:11:26 UTC (rev 9405) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 21:25:06 UTC (rev 9406) @@ -67,6 +67,7 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.AbstractArchetypeParser; +import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; @@ -479,7 +480,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(true, mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, false, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, new SubDirectoryCacheFiles(".dedit"), gameObjectSpells, numberSpells, -1, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -553,4 +554,46 @@ return "Lua"; } + /** + * {@inheritDoc} + */ + @Override + public boolean isCreateDirectionPane() { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public int getUndefinedSpellIndex() { + return -1; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public CacheFiles getCacheFiles() { + return new SubDirectoryCacheFiles(".dedit"); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Direction[] getDirectionMap() { + return new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAllowRandomMapParameters() { + return false; + } + } 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-08 21:11:26 UTC (rev 9405) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 21:25:06 UTC (rev 9406) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.configsource.ConfigSourceFactory; +import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; @@ -49,6 +50,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractArchetypeParser; +import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; @@ -442,4 +444,36 @@ @NotNull String getScriptName(); + /** + * Returns whether the direction panel should be created. + * @return whether the direction panel should be created + */ + boolean isCreateDirectionPane(); + + /** + * Returns the index for "no spell". + * @return tne index + */ + int getUndefinedSpellIndex(); + + /** + * Returns the cache files for icon and preview images. + * @return the cache files + */ + @NotNull + CacheFiles getCacheFiles(); + + /** + * Returns a map of relative direction to map window direction. + * @return the map + */ + @NotNull + Direction[] getDirectionMap(); + + /** + * Returns whether exit paths may point to random map parameters. + * @return whether exit paths may point to random map parameters + */ + boolean isAllowRandomMapParameters(); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 21:45:05
|
Revision: 9411 http://sourceforge.net/p/gridarta/code/9411 Author: akirschbaum Date: 2013-10-08 21:45:01 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Move code from DefaultMainControl to GridartaEditor. 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-08 21:36:56 UTC (rev 9410) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -109,7 +109,6 @@ import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.actions.AtrinikServerActions; import net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory; @@ -187,8 +186,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); + 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); } /** 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-08 21:36:56 UTC (rev 9410) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -105,7 +105,6 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.crossfire.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -156,8 +155,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); + 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); } /** 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-08 21:36:56 UTC (rev 9410) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -109,7 +109,6 @@ import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; @@ -186,8 +185,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(@NotNull final XmlHelper xmlHelper, @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>(xmlHelper, errorView, this, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); + 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); } /** 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-08 21:36:56 UTC (rev 9410) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -97,7 +97,6 @@ /** * Creates a new instance. - * @param xmlHelper the xml helper instance for loading XML files * @param errorView the error view to add errors to * @param editorFactory the editor factory to use * @param projectSettings the project settings to use @@ -107,13 +106,8 @@ * @param validatorPreferences the validator preferences to use * @param mapWriter the map writer for writing temporary map files */ - public DefaultMainControl(@NotNull final XmlHelper xmlHelper, 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) { + 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) { final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); - try { - loadGameObjectMatchers(xmlHelper, errorView, projectSettings, gameObjectMatchers); - } catch (final FileNotFoundException ex) { - errorView.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, "GameObjectMatchers.xml: " + ex.getMessage()); - } final ValidatorFactory<G, A, R> validatorFactory = new ValidatorFactory<G, A, R>(validatorPreferences, gameObjectMatchers, projectSettings, mapWriter); loadValidators(validators, validatorFactory, errorView); final AttributeRangeChecker<G, A, R> attributeRangeChecker = editorFactory.loadAttributeRangeChecker(validators, new ErrorViewCollector(errorView, new File("GameObjectMatchers.xml")), projectSettings, gameObjectMatchers, validatorPreferences); @@ -135,8 +129,16 @@ } } - private void loadGameObjectMatchers(@NotNull final XmlHelper xmlHelper, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers) throws FileNotFoundException { - final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); + @NotNull + public static GameObjectMatchers loadGameObjectMatchers(@NotNull final XmlHelper xmlHelper, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings) { + final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); + final URL url; + try { + url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); + } catch (final FileNotFoundException ex) { + errorView.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, "GameObjectMatchers.xml: " + ex.getMessage()); + return gameObjectMatchers; + } final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, url); try { xmlHelper.getDocumentBuilder().setErrorHandler(new ErrorViewCollectorErrorHandler(gameObjectMatchersErrorViewCollector, ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID)); @@ -149,6 +151,7 @@ } catch (final IOException ex) { gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); } + return gameObjectMatchers; } @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-08 21:36:56 UTC (rev 9410) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -88,7 +88,6 @@ import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.utils.XmlHelper; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -101,7 +100,6 @@ /** * Creates a new {@link DefaultMainControl} instance. - * @param xmlHelper the xml helper instance for loading XML files * @param errorView the error view for reporting errors * @param projectSettings the project settings to use * @param gameObjectMatchers the game object matchers to use @@ -112,7 +110,7 @@ * @return the new instance */ @NotNull - DefaultMainControl<G, A, R> newMainControl(@NotNull XmlHelper xmlHelper, @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); + 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. 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-08 21:36:56 UTC (rev 9410) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 21:45:01 UTC (rev 9411) @@ -257,7 +257,6 @@ final EditorSettings editorSettings = new DefaultEditorSettings(); final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); final PathManager pathManager = new PathManager(projectSettings); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); editorFactory.initSmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); @@ -302,7 +301,8 @@ throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } final ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(xmlHelper, errorView, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, validatorPreferences, mapWriter); + final GameObjectMatchers gameObjectMatchers = DefaultMainControl.loadGameObjectMatchers(xmlHelper, errorView, projectSettings); + final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(errorView, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, 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. |
From: <aki...@us...> - 2013-10-08 21:56:05
|
Revision: 9413 http://sourceforge.net/p/gridarta/code/9413 Author: akirschbaum Date: 2013-10-08 21:55:59 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Do not create partially initialized AutojoinLists instances. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 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-08 21:47:05 UTC (rev 9412) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 21:55:59 UTC (rev 9413) @@ -281,7 +281,6 @@ final DefaultMapReaderFactory<G, A, R> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, mapViewSettings); final ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(mapViewSettings); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(); final ValidatorPreferences validatorPreferences = new DefaultValidatorPreferences(); @@ -308,7 +307,7 @@ final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, projectSettings, archetypeTypeSet, xmlHelper); DefaultMainControl.loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); - new AutojoinListsParser<G, A, R>(errorView, archetypeSet, autojoinLists).loadList(projectSettings.getConfigurationDirectory()); + final AutojoinLists<G, A, R> autojoinLists = AutojoinListsParser.loadList(errorView, archetypeSet, mapViewSettings, projectSettings.getConfigurationDirectory()); final MapModelFactory<G, A, R> mapModelFactory = new MapModelFactory<G, A, R>(archetypeChooserModel, autojoinLists, mapViewSettings, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); final MapControlFactory<G, A, R> mapControlFactory = editorFactory.newMapControlFactory(mapWriter, projectSettings, mapModelFactory); final AbstractMapManager<G, A, R> mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, projectSettings, faceObjectProviders); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2013-10-08 21:47:05 UTC (rev 9412) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2013-10-08 21:55:59 UTC (rev 9413) @@ -35,6 +35,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; @@ -43,7 +44,7 @@ * Loader for {@link AutojoinLists} instances from files. * @author Andreas Kirschbaum */ -public class AutojoinListsParser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class AutojoinListsParser { /** * The file defining autojoin lists. @@ -51,40 +52,21 @@ private static final String FILENAME = "autojoin.txt"; /** - * The {@link ErrorView} for reporting errors. - */ - @NotNull - private final ErrorView errorView; - - /** - * The {@link ArchetypeSet} for looking up archetypes. - */ - @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; - - /** - * The {@link AutojoinLists} instance to update. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - - /** * Creates a new instance. - * @param errorView the error view for reporting errors - * @param archetypeSet the archetype set for looking up archetypes - * @param autojoinLists the autojoin lists instance to update */ - public AutojoinListsParser(@NotNull final ErrorView errorView, final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists) { - this.errorView = errorView; - this.archetypeSet = archetypeSet; - this.autojoinLists = autojoinLists; + private AutojoinListsParser() { } /** * Loads all the autojoin lists from the data file. + * @param errorView the error view for reporting errors + * @param archetypeSet the archetype set for looking up archetypes + * @param mapViewSettings the map view settings instance * @param baseDir the base directory to load autojoin info from + * @return the loaded autojoin lists */ - public void loadList(@NotNull final File baseDir) { + @NotNull + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> AutojoinLists<G, A, R> loadList(@NotNull final ErrorView errorView, final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapViewSettings mapViewSettings, @NotNull final File baseDir) { try { final URL url = IOUtils.getResource(baseDir, FILENAME); try { @@ -94,7 +76,7 @@ try { final BufferedReader stream = new BufferedReader(reader); try { - loadList(url, stream); + return loadList(errorView, archetypeSet, mapViewSettings, url, stream); } finally { stream.close(); } @@ -110,15 +92,23 @@ } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.AUTOJOIN_FILE_INVALID, FILENAME + ": " + ex.getMessage()); } + + return new AutojoinLists<G, A, R>(mapViewSettings); } /** * Loads all the autojoin lists from the data file. + * @param errorView the error view for reporting errors + * @param archetypeSet the archetype set for looking up archetypes + * @param mapViewSettings the map view settings instance * @param url the source location for error messages * @param bufferedReader the reader to read from + * @return the loaded autojoin lists * @throws IOException if an I/O error occurs */ - private void loadList(@NotNull final URL url, @NotNull final BufferedReader bufferedReader) throws IOException { + @NotNull + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> AutojoinLists<G, A, R> loadList(@NotNull final ErrorView errorView, final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapViewSettings mapViewSettings, @NotNull final URL url, @NotNull final BufferedReader bufferedReader) throws IOException { + final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(mapViewSettings); boolean sectionFlag = false; // true while section (start ... end) read; XXX: replace flag with control flow final List<List<R>> archetypes = new ArrayList<List<R>>(AutojoinList.SIZE); final StringBuilder undefinedArchetypes = new StringBuilder(); @@ -175,6 +165,7 @@ } } } + return autojoinLists; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-08 22:12:15
|
Revision: 9416 http://sourceforge.net/p/gridarta/code/9416 Author: akirschbaum Date: 2013-10-08 22:12:11 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Do not create partially initialized PluginModel instances. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-08 22:05:05 UTC (rev 9415) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-08 22:12:11 UTC (rev 9416) @@ -112,9 +112,6 @@ @NotNull private final PluginModelParser<G, A, R> pluginModelParser; - @NotNull - private final PluginModelLoader<G, A, R> pluginModelLoader; - /** * The {@link PluginModelListener} attached to {@link #pluginModel}. */ @@ -165,7 +162,6 @@ this.pluginModel = pluginModel; this.pluginExecutor = pluginExecutor; pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); - pluginModelLoader = new PluginModelLoader<G, A, R>(pluginModelParser); view = new PluginView<G, A, R>(this, pluginModel, pluginParameterViewFactory, systemIcons); pluginModel.addPluginModelListener(pluginModelListener); } @@ -189,7 +185,7 @@ FileChooserUtils.sanitizeCurrentDirectory(choose); if (choose.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { try { - pluginModel.addPlugin(pluginModelLoader.loadXML(choose.getSelectedFile())); + pluginModel.addPlugin(PluginModelLoader.loadXML(pluginModelParser, choose.getSelectedFile())); } catch (final IOException ex) { log.warn("can't load plugin: " + ex.getMessage()); } catch (final JDOMException ex) { 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-08 22:05:05 UTC (rev 9415) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 22:12:11 UTC (rev 9416) @@ -289,7 +289,6 @@ final DefaultMapReaderFactory<G, A, R> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, mapViewSettings); final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); - final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(); final ValidatorPreferences validatorPreferences = new DefaultValidatorPreferences(); final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(validatorPreferences); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); @@ -322,7 +321,7 @@ final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); - new PluginModelLoader<G, A, R>(pluginModelParser).loadPlugins(errorView, scriptsFile, pluginModel); + final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginModelParser, errorView, scriptsFile); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2013-10-08 22:05:05 UTC (rev 9415) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2013-10-08 22:12:11 UTC (rev 9416) @@ -48,30 +48,25 @@ private static final Category log = Logger.getLogger(PluginModelLoader.class); /** - * The {@link PluginModelParser} to use. + * Private constructor to prevent instantiation. */ - @NotNull - private final PluginModelParser<G, A, R> pluginModelParser; - - /** - * Creates a new instance. - * @param pluginModelParser the plugin model parser to use - */ - public PluginModelLoader(@NotNull final PluginModelParser<G, A, R> pluginModelParser) { - this.pluginModelParser = pluginModelParser; + private PluginModelLoader() { } /** * Load all files as plugins from the given directory. + * @param pluginModelParser the plugin model parser to use * @param errorView the error view for reporting errors * @param pluginsDir the directory to load - * @param pluginModel the plugin mode to add to + * @return the loaded plugin model */ - public void loadPlugins(@NotNull final ErrorView errorView, @NotNull final File pluginsDir, @NotNull final PluginModel<G, A, R> pluginModel) { + @NotNull + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> PluginModel<G, A, R> loadPlugins(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final ErrorView errorView, @NotNull final File pluginsDir) { + final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(); final File[] files = pluginsDir.listFiles(); if (files == null) { errorView.addWarning(ErrorViewCategory.SCRIPTS_DIR_INVALID, pluginsDir + ": directory not readable"); - return; + return pluginModel; } final int pluginCount = pluginModel.getPluginCount(); @@ -79,7 +74,7 @@ final String name = pluginFile.getName(); if (!name.startsWith(".") && !name.endsWith("~") && pluginFile.isFile()) { try { - final Plugin<G, A, R> plugin = loadXML(pluginFile); + final Plugin<G, A, R> plugin = loadXML(pluginModelParser, pluginFile); if (pluginModel.getPlugin(plugin.getName()) != null) { errorView.addWarning(ErrorViewCategory.SCRIPTS_FILE_INVALID, pluginFile + ": duplicate plugin '" + plugin.getName() + "'"); } else { @@ -98,16 +93,17 @@ if (log.isInfoEnabled()) { log.info("Loaded " + (pluginModel.getPluginCount() - pluginCount) + " plugins from '" + pluginsDir + "'."); } + return pluginModel; } - public Plugin<G, A, R> loadXML(@NotNull final File file) throws IOException, JDOMException { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Plugin<G, A, R> loadXML(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final File file) throws IOException, JDOMException { final SAXBuilder builder = new SAXBuilder(false); /*non validating*/ final Document d = builder.build(file); - return loadXML(d, file); + return loadXML(pluginModelParser, d, file); } @NotNull - private Plugin<G, A, R> loadXML(final Document doc, @Nullable final File file) throws IOException { + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Plugin<G, A, R> loadXML(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final Document doc, @Nullable final File file) throws IOException { if (!doc.hasRootElement()) { throw new IOException("plugin file is empty"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-09 19:39:34
|
Revision: 9418 http://sourceforge.net/p/gridarta/code/9418 Author: akirschbaum Date: 2013-10-09 19:39:29 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Remove redundant parameters. 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/GUIMainControl.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-08 22:18:18 UTC (rev 9417) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-09 19:39:29 UTC (rev 9418) @@ -480,7 +480,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** 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-08 22:18:18 UTC (rev 9417) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 19:39:29 UTC (rev 9418) @@ -388,7 +388,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** 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-08 22:18:18 UTC (rev 9417) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-09 19:39:29 UTC (rev 9418) @@ -479,7 +479,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(isCreateDirectionPane(), mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, getScriptExtension(), validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, isAllowRandomMapParameters(), getDirectionMap(), this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, getCacheFiles(), gameObjectSpells, numberSpells, getUndefinedSpellIndex(), systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-08 22:18:18 UTC (rev 9417) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-09 19:39:29 UTC (rev 9418) @@ -179,7 +179,6 @@ import net.sf.gridarta.model.archetypeset.ArchetypeValidator; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.configsource.ConfigSourceFactory; -import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.DefaultExitConnectorModel; @@ -189,7 +188,6 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; -import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.MapReaderFactory; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -319,7 +317,6 @@ /** * Creates a new instance. - * @param createDirectionPane whether the direction panel should be created * @param mapManager the map manager instance * @param pickmapManager the pickmap manager instance * @param archetypeSet the archetype set instance @@ -336,7 +333,6 @@ * @param gridartaJarFilename the filename of the editor's .jar file * @param mapFileFilter the file filter for map files * @param scriptFileFilter the file filter for script files - * @param scriptExtension the file extension for script files * @param validators the map validators * @param resources the resources to collect * @param gameObjectMatchers the game object matchers instance @@ -353,19 +349,14 @@ * @param scriptArchUtils the script arch utils instance * @param autoValidatorDefault whether the auto validator is enabled by * @param spellFile the spell file instance - * @param allowRandomMapParameters whether exit paths may point to random - * map parameters - * @param directionMap maps relative direction to map window direction * @param editorFactory the editor factory instance * @param faceObjectProviders the face object providers for looking up * faces * @param pluginParameterFactory the plugin parameter factory instance * @param gameObjectFactory the game object factory instance * @param pathManager the path manager for converting path names - * @param cacheFiles the cache files for icon and preview images * @param gameObjectSpells the game object spells instance * @param numberSpells the numbered spells instance - * @param undefinedSpellIndex the index for "no spell" * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance * @param topmostInsertionMode the "topmost" insertion mode instance @@ -374,11 +365,11 @@ * @param pluginExecutor the script executor instance * @param pluginParameters the script parameters instance */ - public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final Direction[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters) { + public GUIMainControl(@NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters) { this.archetypeSet = archetypeSet; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, mapManager, pickmapManager); - this.scriptExtension = scriptExtension; + scriptExtension = editorFactory.getScriptExtension(); final DisplayMode<G, A, R> displayModeGameObjectNames = new DisplayNameCellRenderer<G, A, R>(faceObjectProviders); final DisplayMode<G, A, R> displayModeArchetypeNames = new ArchetypeNameCellRenderer<G, A, R>(faceObjectProviders); final DisplayMode<G, A, R> displayModeIconsOnly = new ArchetypeIconCellRenderer<G, A, R>(faceObjectProviders); @@ -391,7 +382,7 @@ final AppPreferencesModel appPreferencesModel = editorFactory.createAppPreferencesModel(); final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); final StatusBar<G, A, R> statusBar = new StatusBar<G, A, R>(mapManager, mapViewManager, archetypeSet, faceObjects); - final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(mapManager, systemIcons.getDefaultIcon(), systemIcons.getDefaultPreview(), rendererFactory, cacheFiles); + final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(mapManager, systemIcons.getDefaultIcon(), systemIcons.getDefaultPreview(), rendererFactory, editorFactory.getCacheFiles()); final MapDesktop<G, A, R> mapDesktop = new MapDesktop<G, A, R>(mapViewManager, mapManager, mapImageCache, mapViewsManager); final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(projectSettings.getPickmapDir()); final ImageIcon icon = systemIcons.getAppIcon(); @@ -405,7 +396,7 @@ final CFTreasureListTree treasureListTree = new CFTreasureListTree(treasureTree, parent, archetypeSet, faceObjectProviders, systemIcons); final ImageIcon noFaceSquareIcon = systemIcons.getNoFaceSquareIcon(); final ImageIcon unknownSquareIcon = systemIcons.getUnknownSquareIcon(); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, parent, treasureListTree, faceObjectProviders, animationObjects, projectSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, noFaceSquareIcon, unknownSquareIcon, mapManager); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, parent, treasureListTree, faceObjectProviders, animationObjects, projectSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, editorFactory.getUndefinedSpellIndex(), treasureTree, noFaceSquareIcon, unknownSquareIcon, mapManager); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("system_wall", "wall"); @@ -434,8 +425,8 @@ final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectSettings, mapManager, mapPathNormalizer); final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(mapManager, exiter); final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); - final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, directionMap, mapPathNormalizer, fileControl, mapViewsManager); - final EditorAction mapActions = new MapActions<G, A, R>(parent, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); + final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, editorFactory.getDirectionMap(), mapPathNormalizer, fileControl, mapViewsManager); + final EditorAction mapActions = new MapActions<G, A, R>(parent, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); final File scriptsFile = new File(projectSettings.getMapsDirectory(), scriptsDir); updaterManager = new UpdaterManager(exiter, mapManager, parent, gridartaJarFilename); @@ -452,8 +443,8 @@ final Action displayGameObjectNamesAction = createAction("displayGameObjectNames", "Archetype Chooser", new DisplayGameObjectNamesAction<G, A, R>(archetypeChooserModel, displayModeArchetypeNames)); final Action displayArchetypeNamesAction = createAction("displayArchetypeNames", "Archetype Chooser", new DisplayArchetypeNamesAction<G, A, R>(archetypeChooserModel, displayModeGameObjectNames)); final Action displayIconsOnlyAction = createAction("displayIconsOnly", "Archetype Chooser", new DisplayIconsOnlyAction<G, A, R>(archetypeChooserModel, displayModeIconsOnly)); - final ArchetypeChooserView<G, A, R> archetypeChooserView = new ArchetypeChooserView<G, A, R>(createDirectionPane, archetypeChooserModel, faceObjectProviders, displayGameObjectNamesAction, displayArchetypeNamesAction, displayIconsOnlyAction, displayModeGameObjectNames, displayModeArchetypeNames, displayModeIconsOnly); - final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(archetypeChooserModel, archetypeChooserView, createDirectionPane, faceObjectProviders); + final ArchetypeChooserView<G, A, R> archetypeChooserView = new ArchetypeChooserView<G, A, R>(editorFactory.isCreateDirectionPane(), archetypeChooserModel, faceObjectProviders, displayGameObjectNamesAction, displayArchetypeNamesAction, displayIconsOnlyAction, displayModeGameObjectNames, displayModeArchetypeNames, displayModeIconsOnly); + final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(archetypeChooserModel, archetypeChooserView, editorFactory.isCreateDirectionPane(), faceObjectProviders); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, archetypeChooserModel, pickmapChooserModel, archetypeTypeSet); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareModel, objectChooser, pickmapSettings, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, gameObjectFactory); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-09 20:02:49
|
Revision: 9419 http://sourceforge.net/p/gridarta/code/9419 Author: akirschbaum Date: 2013-10-09 20:02:44 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Remove some parameters from GUIMainControl's contructor. 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/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.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 19:39:29 UTC (rev 9418) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-09 20:02:44 UTC (rev 9419) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; +import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -480,7 +481,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -596,4 +597,47 @@ return false; } + /** + * {@inheritDoc} + */ + @Override + public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { + return guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getGridartaJarFilename() { + return "AtrinikEditor.jar"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getMapFileFilter() { + return GuiFileFilters.mapFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public int[] getLockedItemsTypeNumbers() { + return new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAutoValidatorDefault() { + return PREFERENCES_VALIDATOR_AUTO_DEFAULT; + } + } 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 19:39:29 UTC (rev 9418) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 20:02:44 UTC (rev 9419) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.crossfire.maincontrol; import java.awt.Component; +import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -388,7 +389,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, null, "CrossfireEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.pythonFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -506,4 +507,47 @@ return true; } + /** + * {@inheritDoc} + */ + @Override + public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { + return null; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getGridartaJarFilename() { + return "CrossfireEditor.jar"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getMapFileFilter() { + return GuiFileFilters.mapFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public int[] getLockedItemsTypeNumbers() { + return new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAutoValidatorDefault() { + return PREFERENCES_VALIDATOR_AUTO_DEFAULT; + } + } 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 19:39:29 UTC (rev 9418) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-09 20:02:44 UTC (rev 9419) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.IOException; import java.net.URL; +import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -479,7 +480,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", GuiFileFilters.mapFileFilter, GuiFileFilters.luaFileFilter, validators, resources, gameObjectMatchers, errorView, new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, IGUIConstants.SCRIPTS_DIR, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } /** @@ -595,4 +596,47 @@ return false; } + /** + * {@inheritDoc} + */ + @Override + public ImageIcon getCompassIcon(@NotNull final GUIUtils guiUtils) { + return guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getGridartaJarFilename() { + return "DaimoninEditor.jar"; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FileFilter getMapFileFilter() { + return GuiFileFilters.mapFileFilter; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public int[] getLockedItemsTypeNumbers() { + return new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAutoValidatorDefault() { + return PREFERENCES_VALIDATOR_AUTO_DEFAULT; + } + } 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 19:39:29 UTC (rev 9418) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-09 20:02:44 UTC (rev 9419) @@ -20,6 +20,7 @@ package net.sf.gridarta.maincontrol; import java.awt.Component; +import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; @@ -474,4 +475,39 @@ */ boolean isAllowRandomMapParameters(); + /** + * Returns the icon to display in the selected square view. + * @param guiUtils the gui utils for creating icons + * @return the icon or {@code null} to display no icon + */ + @Nullable + ImageIcon getCompassIcon(@NotNull GUIUtils guiUtils); + + /** + * Returns the filename of the editor's .jar file. + * @return the filename + */ + @NotNull + String getGridartaJarFilename(); + + /** + * Returns the file filter for map files. + * @return the file filter for map files + */ + @NotNull + FileFilter getMapFileFilter(); + + /** + * Returns the type numbers of game objects being locked items. + * @return the type numbers + */ + @NotNull + int[] getLockedItemsTypeNumbers(); + + /** + * Returns whether the auto validator is enabled by default. + * @return whether the auto validator is enabled by default + */ + boolean isAutoValidatorDefault(); + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-09 19:39:29 UTC (rev 9418) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-09 20:02:44 UTC (rev 9419) @@ -32,7 +32,6 @@ import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; -import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; import net.sf.gridarta.action.AddBookmarkAction; import net.sf.gridarta.action.AddToSelectionAction; @@ -225,6 +224,7 @@ import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; @@ -329,17 +329,11 @@ * @param mapArchObjectFactory the map arch object factory instance * @param treasureTree the treasure tree instance * @param archetypeTypeSet the archetype type set instance - * @param compassIcon the icon to display in the selected square view; - * @param gridartaJarFilename the filename of the editor's .jar file - * @param mapFileFilter the file filter for map files - * @param scriptFileFilter the file filter for script files * @param validators the map validators * @param resources the resources to collect * @param gameObjectMatchers the game object matchers instance * @param errorView the error view for reporting errors - * @param lockedItemsTypeNumbers the type numbers of game objects being - * locked items - * @param scriptsDir the plugin scripts directory + * @param guiUtils the gui utils for creating icons * @param pluginModel the script model instance * @param archetypeChooserModel the archetype chooser model instance * @param animationObjects the animation objects instance @@ -347,8 +341,6 @@ * @param scriptedEventEditor the scripted event editor instance * @param scriptArchDataUtils the script arch data utils instance * @param scriptArchUtils the script arch utils instance - * @param autoValidatorDefault whether the auto validator is enabled by - * @param spellFile the spell file instance * @param editorFactory the editor factory instance * @param faceObjectProviders the face object providers for looking up * faces @@ -365,7 +357,7 @@ * @param pluginExecutor the script executor instance * @param pluginParameters the script parameters instance */ - public GUIMainControl(@NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters) { + public GUIMainControl(@NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters) { this.archetypeSet = archetypeSet; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, mapManager, pickmapManager); @@ -378,6 +370,7 @@ final ImageCreator<G, A, R> imageCreator = new ImageCreator<G, A, R>(mapManager, rendererFactory); final VolatileSettings volatileSettings = new DefaultVolatileSettings(projectSettings.getMapsDirectory()); final ImageCreator2<G, A, R> imageCreator2 = new ImageCreator2<G, A, R>(volatileSettings, imageCreator); + final String spellFile = editorFactory.getSpellFile(); final SpellsUtils spellUtils = spellFile != null ? new SpellsUtils(spellFile) : null; final AppPreferencesModel appPreferencesModel = editorFactory.createAppPreferencesModel(); final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); @@ -396,7 +389,7 @@ final CFTreasureListTree treasureListTree = new CFTreasureListTree(treasureTree, parent, archetypeSet, faceObjectProviders, systemIcons); final ImageIcon noFaceSquareIcon = systemIcons.getNoFaceSquareIcon(); final ImageIcon unknownSquareIcon = systemIcons.getUnknownSquareIcon(); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, parent, treasureListTree, faceObjectProviders, animationObjects, projectSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, editorFactory.getUndefinedSpellIndex(), treasureTree, noFaceSquareIcon, unknownSquareIcon, mapManager); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, parent, treasureListTree, faceObjectProviders, animationObjects, projectSettings, editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), faceObjects, gameObjectSpells, numberSpells, editorFactory.getUndefinedSpellIndex(), treasureTree, noFaceSquareIcon, unknownSquareIcon, mapManager); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("system_wall", "wall"); @@ -407,13 +400,13 @@ final CopyBuffer<G, A, R> copyBuffer = new CopyBuffer<G, A, R>(mapViewSettings, gameObjectFactory, mapArchObjectFactory, mapModelFactory, insertionModeSet); final FindDialogManager<G, A, R> findDialogManager = new FindDialogManager<G, A, R>(parent, mapViewManager); final Exiter exiter = new DefaultExiter(parent); - scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); + scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectSettings.getMapsDirectory(), preferences, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); scriptEditControl.setTextAreaDefaults(textAreaDefaults); scriptedEventEditor.setScriptEditControl(scriptEditControl); scriptArchEditor.setScriptEditControl(scriptEditControl); - fileControl = new DefaultFileControl<G, A, R>(projectSettings, volatileSettings, mapImageCache, mapManager, mapViewsManager, parent, GuiFileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); + fileControl = new DefaultFileControl<G, A, R>(projectSettings, volatileSettings, mapImageCache, mapManager, mapViewsManager, parent, GuiFileFilters.mapFileFilter, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); pickmapChooserControl.setFileControl(fileControl); mapViewsManager.setFileControl(fileControl); final GameObjectMatcher monsterMatcherTmp = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); @@ -424,12 +417,12 @@ final MapPathNormalizer mapPathNormalizer = new MapPathNormalizer(projectSettings); final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectSettings, mapManager, mapPathNormalizer); final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(mapManager, exiter); - final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); + final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, editorFactory.getLockedItemsTypeNumbers()); final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, editorFactory.getDirectionMap(), mapPathNormalizer, fileControl, mapViewsManager); final EditorAction mapActions = new MapActions<G, A, R>(parent, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); - final File scriptsFile = new File(projectSettings.getMapsDirectory(), scriptsDir); - updaterManager = new UpdaterManager(exiter, mapManager, parent, gridartaJarFilename); + final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); + updaterManager = new UpdaterManager(exiter, mapManager, parent, editorFactory.getGridartaJarFilename()); final TextEditorTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, archetypeTypeSet); final EditorAction undoControl = new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, pickmapSettings, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); @@ -592,7 +585,7 @@ mainViewFrame.add(new MainToolbar(editorSettings).getComponent(), BorderLayout.NORTH); mainViewFrame.add(statusBar, BorderLayout.SOUTH); mainView.addTab(gameObjectTab); - mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, compassIcon, faceObjectProviders, unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); + mainView.addTab(new Tab("selectedSquare", new SelectedSquareView<G, A, R>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, editorFactory.getCompassIcon(guiUtils), faceObjectProviders, unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction), Location.RIGHT, false, 1, true)); mainView.addTab(new Tab("tools", toolPalette, Location.LEFT, false, 2, false)); mainView.addTab(new Tab("objects", objectChooser, Location.LEFT, false, 3, true)); final JMenu windowMenu = MenuUtils.getMenu(menuBar, "window"); @@ -677,7 +670,7 @@ new RecentManager<G, A, R>(mapManager, recentMapMenuPreferences); //noinspection ResultOfObjectAllocationIgnored - new AutoValidator<G, A, R>(validators, autoValidatorDefault, delayedMapModelListenerManager); + new AutoValidator<G, A, R>(validators, editorFactory.isAutoValidatorDefault(), delayedMapModelListenerManager); mapManager.setFileControl(fileControl); shortcutsManager.loadShortcuts(); delayedMapModelListenerManager.start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-09 20:20:48
|
Revision: 9421 http://sourceforge.net/p/gridarta/code/9421 Author: akirschbaum Date: 2013-10-09 20:20:42 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Remove EditorFactory.createGUIMainControl(). 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/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:04:13 UTC (rev 9420) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) @@ -43,14 +43,11 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; -import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; @@ -69,7 +66,6 @@ import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.CacheFiles; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; import net.sf.gridarta.model.io.MapWriter; @@ -77,10 +73,8 @@ import net.sf.gridarta.model.io.SubDirectoryCacheFiles; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmanager.AbstractMapManager; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -93,18 +87,10 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.model.spells.GameObjectSpell; -import net.sf.gridarta.model.spells.NumberSpell; -import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; -import net.sf.gridarta.plugin.PluginExecutor; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; @@ -480,15 +466,6 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } 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:04:13 UTC (rev 9420) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) @@ -41,14 +41,11 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; -import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; @@ -64,7 +61,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.CacheFiles; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.DirectoryCacheFiles; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; @@ -72,10 +68,8 @@ import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmanager.AbstractMapManager; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -89,18 +83,10 @@ import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.smoothface.SmoothFaces; -import net.sf.gridarta.model.spells.GameObjectSpell; -import net.sf.gridarta.model.spells.NumberSpell; -import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; -import net.sf.gridarta.plugin.PluginExecutor; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.ConfigFileUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; @@ -388,15 +374,6 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { if (smoothFaces == null) { throw new IllegalStateException(); 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:04:13 UTC (rev 9420) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) @@ -43,14 +43,11 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.maincontrol.DefaultMainControl; import net.sf.gridarta.maincontrol.EditorFactory; -import net.sf.gridarta.maincontrol.GUIMainControl; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; @@ -69,7 +66,6 @@ import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.CacheFiles; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; import net.sf.gridarta.model.io.MapWriter; @@ -77,10 +73,8 @@ import net.sf.gridarta.model.io.SubDirectoryCacheFiles; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmanager.AbstractMapManager; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -93,18 +87,10 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.model.spells.GameObjectSpell; -import net.sf.gridarta.model.spells.NumberSpell; -import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; -import net.sf.gridarta.plugin.PluginExecutor; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.GuiFileFilters; @@ -479,15 +465,6 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final PluginExecutor<GameObject, MapArchObject, Archetype> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<GameObject, MapArchObject, Archetype> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final ScriptArchDataUtils<GameObject, MapArchObject, Archetype> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<GameObject, MapArchObject, Archetype> scriptArchEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return new GUIMainControl<GameObject, MapArchObject, Archetype>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, this, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } 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:04:13 UTC (rev 9420) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-09 20:20:42 UTC (rev 9421) @@ -31,12 +31,10 @@ import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; -import net.sf.gridarta.gui.scripts.ScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -52,7 +50,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractArchetypeParser; import net.sf.gridarta.model.io.CacheFiles; -import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; import net.sf.gridarta.model.io.MapArchObjectParserFactory; @@ -61,10 +58,8 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmanager.AbstractMapManager; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -75,17 +70,9 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.model.spells.GameObjectSpell; -import net.sf.gridarta.model.spells.NumberSpell; -import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.plugin.PluginExecutor; -import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; @@ -331,51 +318,6 @@ PreferencesGroup createPreferencesGroup(@NotNull ProjectSettings projectSettings, @NotNull EditorSettings editorSettings, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull AppPreferencesModel appPreferencesModel, @NotNull ExitConnectorModel exitConnectorModel, @NotNull ConfigSourceFactory configSourceFactory); /** - * Creates a new {@link GUIMainControl} instance. - * @param mainControl the main control to use - * @param errorView the error view to add errors to - * @param guiUtils the gui utils for creating icons - * @param configSourceFactory the config source factory - * @param rendererFactory the renderer factory - * @param filterControl the filter control - * @param pluginExecutor the script executor to use - * @param pluginParameters the script parameters to use - * @param mapManager the map manager - * @param pickmapManager the pickmap manager - * @param mapModelFactory the map model factory - * @param archetypeSet the archetype set - * @param faceObjects the face objects - * @param projectSettings the project settings - * @param editorSettings the editor settings - * @param mapViewSettings the map view settings - * @param faceObjectProviders the face object providers - * @param pathManager the path manager - * @param topmostInsertionMode the "topmost" insertion mode - * @param gameObjectFactory the game object factory - * @param systemIcons the system icons for creating icons - * @param archetypeTypeSet the archetype type set - * @param mapArchObjectFactory the map arch object factory to use - * @param treasureTree the treasure tree - * @param mapReaderFactory the map reader factory to use - * @param validators the map validators - * @param gameObjectMatchers the game object matchers - * @param pluginModel the script model - * @param animationObjects the animation objects - * @param archetypeChooserModel the archetype chooser model - * @param scriptedEventEditor the scripted event editor - * @param scriptArchDataUtils the script arch data utils - * @param scriptArchUtils the script arch utils - * @param scriptArchEditor the script arch editor - * @param resources the resources - * @param numberSpells the number spells to use - * @param gameObjectSpells the game object spells to use - * @param pluginParameterFactory the plugin parameter factory to use - * @return the new instance - */ - @NotNull - GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull PluginExecutor<G, A, R> pluginExecutor, @NotNull PluginParameters pluginParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapModelFactory<G, A, R> mapModelFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull ProjectSettings projectSettings, @NotNull EditorSettings editorSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull TreasureTree treasureTree, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull PluginModel<G, A, R> pluginModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); - - /** * Creates a new {@link AbstractResources} instance. * @param gameObjectParser the game object parser to use * @param archetypeSet the archetype set to use 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:04:13 UTC (rev 9420) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 20:20:42 UTC (rev 9421) @@ -304,7 +304,6 @@ final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); final GameObjectMatchers gameObjectMatchers = DefaultMainControl.loadGameObjectMatchers(xmlHelper, errorView, projectSettings); - final DefaultMainControl<G, A, R> mainControl = editorFactory.newMainControl(errorView, projectSettings, gameObjectMatchers, archetypeTypeSet, validators, 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); @@ -343,7 +342,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, mainControl, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, pluginModel, animationObjects, archetypeChooserModel, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, pluginModel, animationObjects, archetypeChooserModel, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); break; case BATCH_PNG: @@ -430,7 +429,6 @@ /** * Run in normal mode. * @param args the files to open - * @param mainControl the main control to use * @param editorFactory the editor factory to use * @param errorView the error view to add errors to * @param guiUtils the gui utils to use @@ -471,13 +469,13 @@ * @param pluginParameterFactory the plugin parameter factory to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final DefaultMainControl<G, A, R> mainControl, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, pluginModel, animationObjects, archetypeChooserModel, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); + guiMainControl[0] = new GUIMainControl<G, A, R>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <aki...@us...> - 2013-10-09 21:49:09
|
Revision: 9427 http://sourceforge.net/p/gridarta/code/9427 Author: akirschbaum Date: 2013-10-09 21:49:04 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Simplify ArchetypeTypeSet loading code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 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 21:30:39 UTC (rev 9426) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 21:49:04 UTC (rev 9427) @@ -157,7 +157,8 @@ return gameObjectMatchers; } - public static void loadArchetypeTypeSet(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final XmlHelper xmlHelper) { + @NotNull + public static ArchetypeTypeSet loadArchetypeTypeSet(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final XmlHelper xmlHelper) { final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); @@ -166,14 +167,15 @@ final ErrorViewCollector typesErrorViewCollector = new ErrorViewCollector(errorView, url); xmlHelper.getDocumentBuilder().setErrorHandler(new ErrorViewCollectorErrorHandler(typesErrorViewCollector, ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID)); try { - final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeSet, archetypeTypeParser); - archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, new InputSource(url.toString())); + final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeParser); + return archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, new InputSource(url.toString())); } finally { xmlHelper.getDocumentBuilder().setErrorHandler(null); } } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } + return new ArchetypeTypeSet(); } @NotNull 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 21:30:39 UTC (rev 9426) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 21:49:04 UTC (rev 9427) @@ -259,9 +259,7 @@ editorFactory.initSmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects, systemIcons); - final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final AnimationObjects animationObjects = new DefaultAnimationObjects(); - final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); @@ -279,6 +277,8 @@ } final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); + final ArchetypeTypeSet archetypeTypeSet = DefaultMainControl.loadArchetypeTypeSet(errorView, projectSettings, xmlHelper); + final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final PathManager pathManager = new PathManager(projectSettings); final ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); @@ -303,7 +303,6 @@ final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); final GameObjectMatchers gameObjectMatchers = DefaultMainControl.loadGameObjectMatchers(xmlHelper, errorView, projectSettings); - DefaultMainControl.loadArchetypeTypeSet(errorView, projectSettings, archetypeTypeSet, xmlHelper); 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); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2013-10-09 21:30:39 UTC (rev 9426) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2013-10-09 21:49:04 UTC (rev 9427) @@ -59,12 +59,6 @@ private final DocumentBuilder documentBuilder; /** - * The {@link ArchetypeTypeSet} to update. - */ - @NotNull - private final ArchetypeTypeSet archetypeTypeSet; - - /** * The {@link ArchetypeTypeParser} }to use. */ @NotNull @@ -73,12 +67,10 @@ /** * Creates a new instance. * @param documentBuilder the document builder to use - * @param archetypeTypeSet the archetype type set to update * @param archetypeTypeParser the archetype type parser to use */ - public ArchetypeTypeSetParser(@NotNull final DocumentBuilder documentBuilder, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeTypeParser archetypeTypeParser) { + public ArchetypeTypeSetParser(@NotNull final DocumentBuilder documentBuilder, @NotNull final ArchetypeTypeParser archetypeTypeParser) { this.documentBuilder = documentBuilder; - this.archetypeTypeSet = archetypeTypeSet; this.archetypeTypeParser = archetypeTypeParser; } @@ -87,19 +79,21 @@ * @param errorViewCollector the error view collector for reporting errors * @param inputSource the input source providing the contents of the * types.xml file + * @return the loaded archetype types */ - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final InputSource inputSource) { + @NotNull + public ArchetypeTypeSet loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final InputSource inputSource) { final Document doc; try { doc = documentBuilder.parse(inputSource); } catch (final SAXException e) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "parsing error: " + e.getMessage()); - return; + return new ArchetypeTypeSet(); } catch (final IOException e) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, e.getMessage()); - return; + return new ArchetypeTypeSet(); } - loadTypesFromXML(errorViewCollector, inputSource.getSystemId(), doc); + return loadTypesFromXML(errorViewCollector, inputSource.getSystemId(), doc); } /** @@ -108,32 +102,37 @@ * @param filename the filename of the types.xml file for error messages * @param document the document containing the contents of the types.xml * file + * @return the loaded archetype types */ - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { + @NotNull + public ArchetypeTypeSet loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { + final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final Element rootElement = document.getDocumentElement(); - parseBitmasks(XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_BITMASKS), errorViewCollector); - parseLists(XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_LISTS), errorViewCollector); + parseBitmasks(archetypeTypeSet, XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_BITMASKS), errorViewCollector); + parseLists(archetypeTypeSet, XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_LISTS), errorViewCollector); final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_IGNORELISTS), errorViewCollector); - parseAttributeOrder(NodeListIterator.getFirstChild(rootElement, Constants.XML_ELEMENT_ATTRIBUTE_ORDER), errorViewCollector); - final ArchetypeType defaultArchetypeType = parseDefaultType(XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_DEFAULT_TYPE), errorViewCollector, ignorelistsDefinition); + parseAttributeOrder(archetypeTypeSet, NodeListIterator.getFirstChild(rootElement, Constants.XML_ELEMENT_ATTRIBUTE_ORDER), errorViewCollector); + final ArchetypeType defaultArchetypeType = parseDefaultType(archetypeTypeSet, XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_DEFAULT_TYPE), errorViewCollector, ignorelistsDefinition); final Iterator<Element> typeElements = new NodeListIterator<Element>(rootElement, Constants.XML_ELEMENT_TYPE); while (typeElements.hasNext()) { - parseTypes(typeElements.next(), errorViewCollector, defaultArchetypeType, ignorelistsDefinition); + parseTypes(archetypeTypeSet, typeElements.next(), errorViewCollector, defaultArchetypeType, ignorelistsDefinition); } if (log.isInfoEnabled()) { log.info("Loaded " + archetypeTypeSet.getArchetypeTypeCount() + " types from '" + filename + "\'"); } + return archetypeTypeSet; } /** * Parses the {@link Constants#XML_ELEMENT_BITMASKS} section of a types.xml * file. + * @param archetypeTypeSet the archetype types being loaded * @param bitmasksElement the element to parse * @param errorViewCollector the error view collector for reporting errors */ - private void parseBitmasks(@NotNull final Element bitmasksElement, @NotNull final ErrorViewCollector errorViewCollector) { + private static void parseBitmasks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Element bitmasksElement, @NotNull final ErrorViewCollector errorViewCollector) { final Iterator<Element> bitmaskIterator = new NodeListIterator<Element>(bitmasksElement, Constants.XML_ELEMENT_BITMASK); while (bitmaskIterator.hasNext()) { final Element bitmaskElement = bitmaskIterator.next(); @@ -254,23 +253,25 @@ /** * Parses the {@link Constants#XML_ELEMENT_LISTS} section of a types.xml * file. + * @param archetypeTypeSet the archetype types being loaded * @param listsElement the element to parse * @param errorViewCollector the error view collector for reporting errors */ - private void parseLists(@NotNull final Element listsElement, @NotNull final ErrorViewCollector errorViewCollector) { + private static void parseLists(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Element listsElement, @NotNull final ErrorViewCollector errorViewCollector) { final Iterator<Element> listIterator = new NodeListIterator<Element>(listsElement, Constants.XML_ELEMENT_LIST); while (listIterator.hasNext()) { - parseList(listIterator.next(), errorViewCollector); + parseList(archetypeTypeSet, listIterator.next(), errorViewCollector); } } /** * Parses an {@link Constants#XML_ELEMENT_LIST} section of a types.xml file - * and adds it to {@link #archetypeTypeSet}. + * and adds it to {@code archetypeTypeSet}. + * @param archetypeTypeSet the archetype types being loaded * @param listElement the element to parse * @param errorViewCollector the error view collector for reporting errors */ - private void parseList(@NotNull final Element listElement, @NotNull final ErrorViewCollector errorViewCollector) { + private static void parseList(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Element listElement, @NotNull final ErrorViewCollector errorViewCollector) { final ArchetypeTypeList list = new ArchetypeTypeList(); final Iterator<Element> listentryIterator = new NodeListIterator<Element>(listElement, Constants.XML_ELEMENT_LISTENTRY); while (listentryIterator.hasNext()) { @@ -324,10 +325,11 @@ /** * Parses the {@link Constants#XML_ELEMENT_ATTRIBUTE_ORDER} section of a * types.xml file. + * @param archetypeTypeSet the archetype types being loaded * @param attributeOrderElement the element to parse or {@code null} * @param errorViewCollector the error view collector for reporting errors */ - private void parseAttributeOrder(@Nullable final Node attributeOrderElement, @NotNull final ErrorViewCollector errorViewCollector) { + private static void parseAttributeOrder(@NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final Node attributeOrderElement, @NotNull final ErrorViewCollector errorViewCollector) { if (attributeOrderElement != null) { for (final String value : StringUtils.PATTERN_WHITESPACE_NEWLINE.split(attributeOrderElement.getTextContent())) { if (!value.isEmpty()) { @@ -377,26 +379,28 @@ /** * Parses the {@link Constants#XML_ELEMENT_DEFAULT_TYPE} element of a * types.xml file. + * @param archetypeTypeSet the archetype types being loaded * @param defaultTypeElement the element to parse * @param errorViewCollector the error view collector for reporting errors * @param ignorelistsDefinition the contents of the "ignorelists" section * @return the default type */ @NotNull - private ArchetypeType parseDefaultType(@NotNull final Element defaultTypeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + private ArchetypeType parseDefaultType(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Element defaultTypeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { return archetypeTypeParser.loadAttributeList(defaultTypeElement, errorViewCollector, null, archetypeTypeSet, ignorelistsDefinition, true); } /** * Parses an {@link Constants#XML_ELEMENT_TYPE} element of a types.xml * file. + * @param archetypeTypeSet the archetype types being loaded * @param typeElement the type element to parse * @param errorViewCollector the error view collector for reporting errors * @param defaultArchetypeType the default archetype type to copy attributes * from * @param ignorelistsDefinition the contents of the "ignorelists" section */ - private void parseTypes(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeType defaultArchetypeType, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + private void parseTypes(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeType defaultArchetypeType, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { if (!typeElement.getAttribute(Constants.XML_TYPE_AVAILABLE).equals("no")) { archetypeTypeSet.addArchetypeType(archetypeTypeParser.loadAttributeList(typeElement, errorViewCollector, defaultArchetypeType, archetypeTypeSet, ignorelistsDefinition, false)); } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2013-10-09 21:30:39 UTC (rev 9426) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2013-10-09 21:49:04 UTC (rev 9427) @@ -231,8 +231,7 @@ */ @NotNull private ArchetypeTypeSet loadArchetypeTypeSet(@NotNull final String name) throws ParserConfigurationException { - final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); - final ArchetypeTypeSetParser parser = createArchetypeTypeSetParser(archetypeTypeSet); + final ArchetypeTypeSetParser parser = createArchetypeTypeSetParser(); final InputStream typesXml = getClass().getResourceAsStream("ArchetypeTypeSetParserTest-" + name + "-types.xml"); System.out.println("ArchetypeTypeSetParserTest-" + name + "-types.xml"); @@ -240,23 +239,21 @@ final InputSource inputSource = new InputSource(typesXml); inputSource.setSystemId("types.dtd"); - parser.loadTypesFromXML(errorViewCollector, inputSource); - return archetypeTypeSet; + return parser.loadTypesFromXML(errorViewCollector, inputSource); } /** * Creates a new {@link ArchetypeTypeSetParser} instance. - * @param archetypeTypeSet the archetype type set to modify * @return the archetype type set parser instance * @throws ParserConfigurationException if the parser cannot be created */ @NotNull - private static ArchetypeTypeSetParser createArchetypeTypeSetParser(@NotNull final ArchetypeTypeSet archetypeTypeSet) throws ParserConfigurationException { + private static ArchetypeTypeSetParser createArchetypeTypeSetParser() throws ParserConfigurationException { final XmlHelper xmlHelper = new XmlHelper(); final ArchetypeAttributeFactory archetypeAttributeFactory = new TestArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); - return new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeSet, archetypeTypeParser); + return new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeParser); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-13 19:40:08
|
Revision: 9428 http://sourceforge.net/p/gridarta/code/9428 Author: akirschbaum Date: 2013-10-13 19:40:04 +0000 (Sun, 13 Oct 2013) Log Message: ----------- Remove ConfigSourceFactory.getFilesConfigSource(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/ConfigSourceFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 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 21:49:04 UTC (rev 9427) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-13 19:40:04 UTC (rev 9428) @@ -280,7 +280,7 @@ final ArchetypeTypeSet archetypeTypeSet = DefaultMainControl.loadArchetypeTypeSet(errorView, projectSettings, xmlHelper); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final PathManager pathManager = new PathManager(projectSettings); - final ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); + final ConfigSource configSource = configSourceFactory.getConfigSource(mode == GridartaRunMode.COLLECT_ARCHES ? "ARCH_DIRECTORY" : projectSettings.getConfigSourceName()); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(projectSettings, archetypeFactory); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet, archetypeTypeSet); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/ConfigSourceFactory.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/ConfigSourceFactory.java 2013-10-09 21:49:04 UTC (rev 9427) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/ConfigSourceFactory.java 2013-10-13 19:40:04 UTC (rev 9428) @@ -45,13 +45,6 @@ ConfigSource getConfigSource(@NotNull String name); /** - * Returns the {@link ConfigSource} that reads individual files. - * @return the configuration source that reads individual files - */ - @NotNull - ConfigSource getFilesConfigSource(); - - /** * Returns the default {@link ConfigSource}. * @return the default configuration source */ Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 2013-10-09 21:49:04 UTC (rev 9427) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 2013-10-13 19:40:04 UTC (rev 9428) @@ -121,15 +121,6 @@ */ @NotNull @Override - public ConfigSource getFilesConfigSource() { - return getConfigSource("ARCH_DIRECTORY"); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public ConfigSource getDefaultConfigSource() { return configSources.get(0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-13 19:55:45
|
Revision: 9429 http://sourceforge.net/p/gridarta/code/9429 Author: akirschbaum Date: 2013-10-13 19:55:38 +0000 (Sun, 13 Oct 2013) Log Message: ----------- Remove EditorFactory.initSmoothFaces(). 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/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.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-13 19:40:04 UTC (rev 9428) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -86,6 +86,7 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -258,13 +259,6 @@ /** * {@inheritDoc} */ - @Override - public void initSmoothFaces(@NotNull final FaceObjects faceObjects) { - } - - /** - * {@inheritDoc} - */ @NotNull @Override public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { @@ -351,7 +345,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings, @NotNull final SmoothFaces smoothFaces) { try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), IGUIConstants.ARCHDEF_FILE); multiPositionData.load(errorView, url); @@ -402,7 +396,7 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(systemIcons), gameObjectParser, systemIcons); } @@ -456,7 +450,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SmoothFaces smoothFaces) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } 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-13 19:40:04 UTC (rev 9428) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -131,12 +131,6 @@ private static final Category log = Logger.getLogger(DefaultEditorFactory.class); /** - * The {@link SmoothFaces} instance. - */ - @Nullable - private SmoothFaces smoothFaces; - - /** * {@inheritDoc} */ @Override @@ -228,17 +222,6 @@ /** * {@inheritDoc} */ - @Override - public void initSmoothFaces(@NotNull final FaceObjects faceObjects) { - if (smoothFaces != null) { - throw new IllegalStateException(); - } - smoothFaces = new SmoothFaces(faceObjects); - } - - /** - * {@inheritDoc} - */ @NotNull @Override public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { @@ -258,10 +241,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings) { - if (smoothFaces == null) { - throw new IllegalStateException(); - } + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings, @NotNull final SmoothFaces smoothFaces) { return new ArchetypeParser(gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, smoothFaces); } @@ -306,11 +286,8 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { final GridMapSquarePainter gridMapSquarePainter = new GridMapSquarePainter(systemIcons); - if (smoothFaces == null) { - throw new IllegalStateException(); - } return new DefaultRendererFactory(mapViewSettings, filterControl, smoothFaces, gridMapSquarePainter, gameObjectParser, faceObjectProviders, systemIcons); } @@ -364,10 +341,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { - if (smoothFaces == null) { - throw new IllegalStateException(); - } + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SmoothFaces smoothFaces) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, smoothFaces, archFaceProvider, faceObjectProviders); } 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-13 19:40:04 UTC (rev 9428) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -86,6 +86,7 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -257,13 +258,6 @@ /** * {@inheritDoc} */ - @Override - public void initSmoothFaces(@NotNull final FaceObjects faceObjects) { - } - - /** - * {@inheritDoc} - */ @NotNull @Override public AttributeRangeChecker<GameObject, MapArchObject, Archetype> loadAttributeRangeChecker(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ValidatorPreferences validatorPreferences) { @@ -350,7 +344,7 @@ * {@inheritDoc} */ @Override - public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings) { + public ArchetypeParser newArchetypeParser(@NotNull final ErrorView errorView, final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, final AnimationObjects animationObjects, final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ProjectSettings projectSettings, @NotNull final SmoothFaces smoothFaces) { try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), IGUIConstants.ARCHDEF_FILE); multiPositionData.load(errorView, url); @@ -401,7 +395,7 @@ */ @NotNull @Override - public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public RendererFactory<GameObject, MapArchObject, Archetype> newRendererFactory(@NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons, @NotNull final SmoothFaces smoothFaces) { return new DefaultRendererFactory(mapViewSettings, filterControl, multiPositionData, isoMapSquareInfo, new GridMapSquarePainter(systemIcons), gameObjectParser, systemIcons); } @@ -455,7 +449,7 @@ */ @NotNull @Override - public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders) { + public AbstractResources<GameObject, MapArchObject, Archetype> newResources(@NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SmoothFaces smoothFaces) { return new DefaultResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); } 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-13 19:40:04 UTC (rev 9428) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -70,6 +70,7 @@ import net.sf.gridarta.model.scripts.ScriptedEventFactory; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; @@ -173,12 +174,6 @@ boolean getIncludeFaceNumbers(); /** - * Initializes smoothing information. - * @param faceObjects the face objects to use - */ - void initSmoothFaces(@NotNull FaceObjects faceObjects); - - /** * Loads the attribute range checker for map validation. * @param mapValidators the map validators that delegates to add to * @param errorViewCollector the error view collector to use @@ -198,9 +193,10 @@ * @param archetypeSet the archetype set to use * @param gameObjectFactory the game object factory to use * @param projectSettings the project settings to use + * @param smoothFaces the smooth faces to use * @return the new instance */ - AbstractArchetypeParser<G, A, R, ?> newArchetypeParser(@NotNull ErrorView errorView, GameObjectParser<G, A, R> gameObjectParser, AnimationObjects animationObjects, ArchetypeSet<G, A, R> archetypeSet, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ProjectSettings projectSettings); + AbstractArchetypeParser<G, A, R, ?> newArchetypeParser(@NotNull ErrorView errorView, GameObjectParser<G, A, R> gameObjectParser, AnimationObjects animationObjects, ArchetypeSet<G, A, R> archetypeSet, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ProjectSettings projectSettings, @NotNull SmoothFaces smoothFaces); /** * Creates a new {@link ScriptArchUtils} instance. @@ -248,10 +244,11 @@ * @param faceObjectProviders the face object providers for looking up * faces * @param systemIcons the system icons for creating icons + * @param smoothFaces the smooth faces to use * @return the new instance */ @NotNull - RendererFactory<G, A, R> newRendererFactory(@NotNull MapViewSettings mapViewSettings, @NotNull FilterControl<G, A, R> filterControl, @NotNull GameObjectParser<G, A, R> gameObjectParser, @NotNull FaceObjectProviders faceObjectProviders, @NotNull SystemIcons systemIcons); + RendererFactory<G, A, R> newRendererFactory(@NotNull MapViewSettings mapViewSettings, @NotNull FilterControl<G, A, R> filterControl, @NotNull GameObjectParser<G, A, R> gameObjectParser, @NotNull FaceObjectProviders faceObjectProviders, @NotNull SystemIcons systemIcons, @NotNull SmoothFaces smoothFaces); /** * Creates a new {@link MapViewFactory} instance. @@ -314,10 +311,11 @@ * @param archFaceProvider the arch face provider to use * @param faceObjectProviders the face object providers for looking up * faces + * @param smoothFaces the smooth faces to use * @return the new instance */ @NotNull - AbstractResources<G, A, R> newResources(@NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders); + AbstractResources<G, A, R> newResources(@NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull SmoothFaces smoothFaces); /** * Creates the "open in client" action. Does nothing if this editor does not 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-13 19:40:04 UTC (rev 9428) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -97,6 +97,7 @@ import net.sf.gridarta.model.settings.DefaultEditorSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; @@ -256,7 +257,7 @@ final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final EditorSettings editorSettings = new DefaultEditorSettings(); final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); - editorFactory.initSmoothFaces(faceObjects); + final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects, systemIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects(); @@ -285,8 +286,8 @@ final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(projectSettings, archetypeFactory); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet, archetypeTypeSet); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); - final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, projectSettings); - final AbstractResources<G, A, R> resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); + final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, projectSettings, smoothFaces); + final AbstractResources<G, A, R> resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders, smoothFaces); DefaultMainControl.loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); faceObjectProviders.addFaceObjectProvidersListener(new FaceObjectProvidersListener() { @@ -324,7 +325,7 @@ final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginModelParser, errorView, scriptsFile); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons, smoothFaces); final PluginParameters pluginParameters = new PluginParameters(); pluginParameters.addPluginParameter("archetypeSet", archetypeSet); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-13 19:40:04 UTC (rev 9428) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-13 19:55:38 UTC (rev 9429) @@ -31,7 +31,9 @@ import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; @@ -57,6 +59,7 @@ import net.sf.gridarta.model.settings.DefaultEditorSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -111,7 +114,9 @@ final Set<NamedGameObjectMatcher> matchers = new HashSet<NamedGameObjectMatcher>(); final NamedFilter defaultNamedFilterList = new NamedFilter(matchers); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); + final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); + final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons, smoothFaces); return new ImageCreator<G, A, R>(mapManager, rendererFactory); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-14 18:54:32
|
Revision: 9431 http://sourceforge.net/p/gridarta/code/9431 Author: akirschbaum Date: 2013-10-14 18:54:27 +0000 (Mon, 14 Oct 2013) Log Message: ----------- Clean up plugin related code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ParameterTypeEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginController.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -21,7 +21,6 @@ import java.awt.Component; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import javax.swing.Action; import javax.swing.JFileChooser; @@ -33,15 +32,8 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.Plugin; -import net.sf.gridarta.plugin.PluginConsole; -import net.sf.gridarta.plugin.PluginExecException; -import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; -import net.sf.gridarta.plugin.PluginModelLoader; -import net.sf.gridarta.plugin.PluginModelParser; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.FileChooserUtils; @@ -50,13 +42,6 @@ import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.action.ReflectionAction; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -68,12 +53,6 @@ public class PluginController<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * The Logger for printing log messages. - */ - @NotNull - private static final Category log = Logger.getLogger(PluginController.class); - - /** * Action Builder. */ @NotNull @@ -83,18 +62,9 @@ private final PluginModel<G, A, R> pluginModel; @NotNull - private final PluginExecutor<G, A, R> pluginExecutor; - - @NotNull private final PluginView<G, A, R> view; /** - * The plugin parameters to use. - */ - @NotNull - private final PluginParameters pluginParameters; - - /** * The parent component for dialog boxes. */ @NotNull @@ -109,9 +79,6 @@ @Nullable private File pluginsDir; - @NotNull - private final PluginModelParser<G, A, R> pluginModelParser; - /** * The {@link PluginModelListener} attached to {@link #pluginModel}. */ @@ -132,14 +99,14 @@ final String filterName = "(s)" + plugin.getName(); if (plugin.isFilter()) { - final Filter<?, ?> filter = plugin.getPluginAsFilter(pluginParameters); + final Filter<?, ?> filter = pluginModel.getPluginAsFilter(plugin); if (filter != null) { filterControl.addFilter(filterName, filter); } } if (plugin.isAutoBoot()) { - plugin.runPlugin(pluginParameters); + pluginModel.runPlugin(plugin); } } @@ -154,14 +121,11 @@ /** * Creates a new instance. */ - public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginParameters pluginParameters, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final SystemIcons systemIcons) { + public PluginController(@NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final Component parent, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final File pluginsDir, @NotNull final SystemIcons systemIcons) { this.parent = parent; this.filterControl = filterControl; - this.pluginParameters = pluginParameters; + this.pluginModel = pluginModel; this.pluginsDir = pluginsDir; - this.pluginModel = pluginModel; - this.pluginExecutor = pluginExecutor; - pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); view = new PluginView<G, A, R>(this, pluginModel, pluginParameterViewFactory, systemIcons); pluginModel.addPluginModelListener(pluginModelListener); } @@ -184,13 +148,7 @@ choose.setDialogTitle("import plugin"); FileChooserUtils.sanitizeCurrentDirectory(choose); if (choose.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { - try { - pluginModel.addPlugin(PluginModelLoader.loadXML(pluginModelParser, choose.getSelectedFile())); - } catch (final IOException ex) { - log.warn("can't load plugin: " + ex.getMessage()); - } catch (final JDOMException ex) { - log.warn("can't parse plugin: " + ex.getMessage()); - } + pluginModel.addPlugin(choose.getSelectedFile()); } } @@ -229,7 +187,7 @@ try { final File file = plugin.getFile(); if (file != null) { - savePlugin(plugin, file); + pluginModel.savePlugin(plugin, file); } else { if (!savePluginAs(plugin, true)) { return false; @@ -269,7 +227,7 @@ pluginsDir = file.getParentFile(); try { - savePlugin(plugin, file); + pluginModel.savePlugin(plugin, file); } catch (final IOException ex) { return false; } @@ -277,25 +235,6 @@ return true; } - /** - * Saves a plugin to a given file. - * @param plugin the plugin to save - * @param file the file to save to - * @throws IOException if the file cannot be saved - */ - private void savePlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final File file) throws IOException { - final FileOutputStream fos = new FileOutputStream(file); - try { - final Element root = pluginModelParser.toXML(plugin); - final Document d = new Document(root); - final XMLOutputter out = new XMLOutputter(); - out.setFormat(Format.getPrettyFormat()); - out.output(d, fos); - } finally { - fos.close(); - } - } - public void runPlugin(@NotNull final Plugin<G, A, R> plugin) { final Plugin<G, A, R> clonedPlugin = plugin.clonePlugin(); @@ -303,12 +242,7 @@ return; } - final PluginConsole console = view.createConsole(clonedPlugin.getName()); - try { - pluginExecutor.doRunPlugin(clonedPlugin, console); // XXX: drops Thread - } catch (final PluginExecException ex) { - console.print(ex.getMessage()); - } + pluginModel.doRunPlugin(clonedPlugin, view.createConsole(clonedPlugin.getName())); // XXX: drops thread } @ActionMethod Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -60,7 +60,6 @@ import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.parameter.NoSuchParameterException; import net.sf.gridarta.plugin.parameter.PluginParameter; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.SystemIcons; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -92,7 +91,7 @@ private final RSyntaxTextArea code; @NotNull - private final PluginParameterFactory<G, A, R> pluginParameterFactory; + private final PluginModel<G, A, R> pluginModel; @NotNull private final Plugin<G, A, R> plugin; @@ -166,8 +165,8 @@ * @param pluginController the associated script control instance * @param systemIcons the system icons for creating icons */ - public PluginEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final Plugin<G, A, R> plugin, @NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { - this.pluginParameterFactory = pluginParameterFactory; + public PluginEditor(@NotNull final Plugin<G, A, R> plugin, @NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { + this.pluginModel = pluginModel; this.plugin = plugin; this.pluginParameterViewFactory = pluginParameterViewFactory; final JTabbedPane tabs = new JTabbedPane(); @@ -409,7 +408,7 @@ return existingParameterTypeEditor; } - final ParameterTypeEditor<G, A, R> newParameterTypeEditor = new ParameterTypeEditor<G, A, R>(pluginParameterFactory, plugin, param); + final ParameterTypeEditor<G, A, R> newParameterTypeEditor = new ParameterTypeEditor<G, A, R>(pluginModel, plugin, param); paramTypeEditors.put(param, newParameterTypeEditor); newTableComponent(newParameterTypeEditor); return newParameterTypeEditor; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManager.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -48,29 +48,30 @@ import net.sf.gridarta.plugin.Plugin; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class PluginManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JFrame { + @NotNull private final JList scripts; + @NotNull private final CardLayout scriptLayout = new CardLayout(); + @NotNull private final Container scriptPanel = new JPanel(scriptLayout); + @NotNull private final PluginController<G, A, R> pluginController; @NotNull private final PluginModel<G, A, R> pluginModel; + @NotNull private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; - @NotNull - private final PluginParameterFactory<G, A, R> pluginParameterFactory; - /** * The {@link SystemIcons} for creating icons. */ @@ -79,6 +80,7 @@ //TODO fix a memory leak. If a script is remove, it stays in hash map along with it's visual component + @NotNull private final Map<Plugin<G, A, R>, PluginEditor<G, A, R>> components = new HashMap<Plugin<G, A, R>, PluginEditor<G, A, R>>(); private static final long serialVersionUID = 1L; @@ -89,12 +91,11 @@ * on * @param systemIcons the system icons for creating icons */ - public PluginManager(final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final SystemIcons systemIcons) { + public PluginManager(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { super("Editor plugins management"); this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; - this.pluginParameterFactory = pluginParameterFactory; this.systemIcons = systemIcons; getContentPane().setLayout(new BorderLayout()); final Container left = new JPanel(new BorderLayout()); @@ -173,12 +174,11 @@ public void actionPerformed(final ActionEvent e) { final String name = JOptionPane.showInputDialog(scripts, "Name of the new Beanshell plugin?"); if (name != null) { - final Plugin<G, A, R> plugin = new Plugin<G, A, R>(name, pluginParameterFactory); - plugin.setCode("//input your beanshell Code"); - if (PluginManager.this.pluginModel.addPlugin(plugin)) { + final Plugin<G, A, R> plugin = PluginManager.this.pluginModel.newPlugin(name, "//input your beanshell Code"); + if (plugin == null) { + JOptionPane.showMessageDialog(scripts, "The script " + name + " already exists.", "Error", JOptionPane.WARNING_MESSAGE); + } else { showScript(plugin); - } else { - JOptionPane.showMessageDialog(scripts, "The script " + name + " already exists.", "Error", JOptionPane.WARNING_MESSAGE); } } } @@ -225,7 +225,7 @@ PluginEditor<G, A, R> pluginEditor = components.get(plugin); if (pluginEditor == null) { - pluginEditor = new PluginEditor<G, A, R>(pluginParameterFactory, plugin, pluginController, pluginModel, pluginParameterViewFactory, systemIcons); + pluginEditor = new PluginEditor<G, A, R>(plugin, pluginController, pluginModel, pluginParameterViewFactory, systemIcons); components.put(plugin, pluginEditor); scriptPanel.add(pluginEditor, Integer.toString(pluginEditor.hashCode())); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginManagerFactory.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -26,37 +26,40 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class PluginManagerFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** * Action Builder to create Actions. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The synchronization object. */ + @NotNull private final Object sync = new Object(); + @Nullable private Window scriptManager; + @NotNull private final PluginController<G, A, R> pluginController; + @NotNull private final PluginModel<G, A, R> pluginModel; + @NotNull private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; - @NotNull - private final PluginParameterFactory<G, A, R> pluginParameterFactory; - /** * The {@link SystemIcons} for creating icons. */ @@ -67,11 +70,10 @@ * Creates a new instance. * @param systemIcons the system icons for creating icons */ - public PluginManagerFactory(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final SystemIcons systemIcons) { + public PluginManagerFactory(@NotNull final PluginController<G, A, R> pluginController, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory, @NotNull final SystemIcons systemIcons) { this.pluginController = pluginController; this.pluginModel = pluginModel; this.pluginParameterViewFactory = pluginParameterViewFactory; - this.pluginParameterFactory = pluginParameterFactory; this.systemIcons = systemIcons; } @@ -79,7 +81,7 @@ public void editPlugins() { synchronized (sync) { if (scriptManager == null) { - scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, pluginParameterFactory, systemIcons); + scriptManager = new PluginManager<G, A, R>(pluginController, pluginModel, pluginParameterViewFactory, systemIcons); } scriptManager.pack(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ParameterTypeEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ParameterTypeEditor.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ParameterTypeEditor.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -26,9 +26,9 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.Plugin; +import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.parameter.NoSuchParameterException; import net.sf.gridarta.plugin.parameter.PluginParameter; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -67,8 +67,8 @@ }; - public ParameterTypeEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final Plugin<G, A, R> plugin, @NotNull final PluginParameter<G, A, R> parameter) { - super(pluginParameterFactory.getTypes()); + public ParameterTypeEditor(@NotNull final PluginModel<G, A, R> pluginModel, @NotNull final Plugin<G, A, R> plugin, @NotNull final PluginParameter<G, A, R> parameter) { + super(pluginModel.getTypes()); this.parameter = parameter; this.plugin = plugin; setSelectedItem(parameter.getParameterType()); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -214,10 +214,7 @@ import net.sf.gridarta.model.spells.Spells; import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.validation.DelegatingMapValidator; -import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; -import net.sf.gridarta.plugin.PluginParameters; -import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; import net.sf.gridarta.updater.UpdaterManager; @@ -334,7 +331,7 @@ * @param gameObjectMatchers the game object matchers instance * @param errorView the error view for reporting errors * @param guiUtils the gui utils for creating icons - * @param pluginModel the script model instance + * @param pluginModel the plugin model instance * @param archetypeChooserModel the archetype chooser model instance * @param animationObjects the animation objects instance * @param scriptArchEditor the script arch editor instance @@ -344,7 +341,6 @@ * @param editorFactory the editor factory instance * @param faceObjectProviders the face object providers for looking up * faces - * @param pluginParameterFactory the plugin parameter factory instance * @param gameObjectFactory the game object factory instance * @param pathManager the path manager for converting path names * @param gameObjectSpells the game object spells instance @@ -354,10 +350,8 @@ * @param topmostInsertionMode the "topmost" insertion mode instance * @param rendererFactory the renderer factory instance * @param filterControl the filter control instance - * @param pluginExecutor the script executor instance - * @param pluginParameters the script parameters instance */ - public GUIMainControl(@NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters) { + public GUIMainControl(@NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.archetypeSet = archetypeSet; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, mapManager, pickmapManager); @@ -445,7 +439,7 @@ newMapDialogFactory.setObjectChooser(objectChooser); final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(parent, copyBuffer, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager, faceObjectProviders); - final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, pluginParameters, parent, pluginParameterViewFactory, scriptsFile, pluginModel, pluginParameterFactory, pluginExecutor, systemIcons); + final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, pluginModel, parent, pluginParameterViewFactory, scriptsFile, systemIcons); final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, insertionModeSet); final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager); final Action moveSquareDownAction = createAction("moveSquareDown", "Selected Square View", new MoveSquareDownAction<G, A, R>(selectedSquareModel, mapManager)); @@ -486,7 +480,7 @@ createToggleAction("smoothing", "Map Navigation", mapActions); createToggleAction("doubleFaces", "Map Navigation", mapActions); createToggleAction("tileShow", "Map Navigation", mapActions); - createAction("editPlugins", "Plugin", new PluginManagerFactory<G, A, R>(pluginControl, pluginModel, pluginParameterViewFactory, pluginParameterFactory, systemIcons)); + createAction("editPlugins", "Plugin", new PluginManagerFactory<G, A, R>(pluginControl, pluginModel, pluginParameterViewFactory, systemIcons)); createAction("savePlugins", "Plugin", pluginControl); createAction("importPlugin", "Plugin", pluginControl); createAction("update", "Tool", updaterManager); 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-13 19:59:09 UTC (rev 9430) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -107,12 +107,9 @@ import net.sf.gridarta.model.validation.DefaultValidatorPreferences; import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; -import net.sf.gridarta.plugin.PluginExecException; -import net.sf.gridarta.plugin.PluginExecutor; import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelLoader; import net.sf.gridarta.plugin.PluginModelParser; -import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.gridarta.utils.ConfigFileUtils; @@ -267,7 +264,6 @@ final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); final ValidatorPreferences validatorPreferences = new DefaultValidatorPreferences(); - final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -314,36 +310,35 @@ final MapControlFactory<G, A, R> mapControlFactory = editorFactory.newMapControlFactory(mapWriter, projectSettings, mapModelFactory); final AbstractMapManager<G, A, R> mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, projectSettings, faceObjectProviders); final MapManager<G, A, R> pickmapManager = new DefaultPickmapManager<G, A, R>(mapReaderFactory, mapControlFactory, projectSettings, faceObjectProviders); - final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); final ScriptArchEditor<G, A, R> scriptArchEditor = new ScriptArchEditor<G, A, R>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectSettings, mapManager, pathManager); final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = DefaultMainControl.loadArchetypeSpells(editorFactory.getSpellType(), gameObjectFactory, archetypeSet); final Spells<NumberSpell> numberSpells = DefaultMainControl.loadSpellFile(editorFactory.getSpellFile(), errorView, projectSettings, xmlHelper); - final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); final File scriptsFile = new File(projectSettings.getMapsDirectory(), editorFactory.getScriptsDir()); - final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginModelParser, errorView, scriptsFile); final NamedFilter defaultNamedFilterList = new NamedFilter(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons, smoothFaces); - final PluginParameters pluginParameters = new PluginParameters(); - pluginParameters.addPluginParameter("archetypeSet", archetypeSet); - pluginParameters.addPluginParameter("projectSettings", projectSettings); - pluginParameters.addPluginParameter("globalSettings", projectSettings); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" - pluginParameters.addPluginParameter("mapManager", mapManager); - pluginParameters.addPluginParameter("validators", validators); - pluginParameters.addPluginParameter("rendererFactory", rendererFactory); - pluginParameters.addPluginParameter("gameObjectMatchers", gameObjectMatchers); - final PluginExecutor<G, A, R> pluginExecutor = new PluginExecutor<G, A, R>(pluginModel, pluginParameters); + final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); + final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); + final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); + final PluginModel<G, A, R> pluginModel = PluginModelLoader.loadPlugins(pluginParameterFactory, pluginModelParser, errorView, scriptsFile); + pluginModel.addPluginParameter("archetypeSet", archetypeSet); + pluginModel.addPluginParameter("projectSettings", projectSettings); + pluginModel.addPluginParameter("globalSettings", projectSettings); // XXX: for compatibility with existing scripts; should be replaced with "projectSettings" + pluginModel.addPluginParameter("mapManager", mapManager); + pluginModel.addPluginParameter("validators", validators); + pluginModel.addPluginParameter("rendererFactory", rendererFactory); + pluginModel.addPluginParameter("gameObjectMatchers", gameObjectMatchers); if (plugin != null) { - returnCode = runPlugin(plugin, errorView, args2, pluginExecutor); + returnCode = runPlugin(plugin, errorView, args2, pluginModel); } else { try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginExecutor, pluginParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, pluginModel, animationObjects, archetypeChooserModel, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); + returnCode = runNormal(args2, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, pluginModel, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, treasureTree, mapReaderFactory, validators, gameObjectMatchers, animationObjects, archetypeChooserModel, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, scriptArchEditor, resources, numberSpells, gameObjectSpells); break; case BATCH_PNG: @@ -383,21 +378,13 @@ * @param plugin the name of the plugin to run * @param errorView the error view to add errors to * @param args the arguments for the plugin - * @param pluginExecutor the plugin executor to use + * @param pluginModel the plugin model to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runPlugin(@NotNull final String plugin, final ErrorView errorView, final Iterable<String> args, @NotNull final PluginExecutor<G, A, R> pluginExecutor) { + private int runPlugin(@NotNull final String plugin, final ErrorView errorView, final Iterable<String> args, @NotNull final PluginModel<G, A, R> pluginModel) { checkForErrors(errorView); waitDialog(errorView); - - try { - pluginExecutor.executePlugin(plugin, args); - } catch (final PluginExecException ex) { - System.err.println(ex.getMessage()); - return 1; - } - - return 0; + return pluginModel.executePlugin(plugin, args); } /** @@ -436,8 +423,7 @@ * @param configSourceFactory the config source factory to use * @param rendererFactory the renderer factory to use * @param filterControl the filter control to use - * @param pluginExecutor the plugin executor to use - * @param pluginParameters the plugin parameters to use + * @param pluginModel the plugin model to use * @param mapManager the map manager to use * @param pickmapManager the pickmap manager to use * @param mapModelFactory the map model factory to use @@ -457,7 +443,6 @@ * @param mapReaderFactory the map reader factory to use * @param validators the map validators * @param gameObjectMatchers the game object matchers - * @param pluginModel the plugin model * @param animationObjects the animation objects * @param archetypeChooserModel the archetype chooser model * @param scriptedEventEditor the scripted event editor @@ -467,16 +452,15 @@ * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param pluginParameterFactory the plugin parameter factory to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginExecutor<G, A, R> pluginExecutor, @NotNull final PluginParameters pluginParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { @Override public void run() { - guiMainControl[0] = new GUIMainControl<G, A, R>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, pluginExecutor, pluginParameters); + guiMainControl[0] = new GUIMainControl<G, A, R>(mapManager, pickmapManager, archetypeSet, faceObjects, projectSettings, editorSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, validators, resources, gameObjectMatchers, errorView, guiUtils, pluginModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchDataUtils, scriptArchUtils, editorFactory, faceObjectProviders, gameObjectFactory, pathManager, gameObjectSpells, numberSpells, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl); } }; Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -35,6 +35,7 @@ import net.sf.gridarta.plugin.parameter.PluginParameter; import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Allows execution of {@link Plugin Plugins}. @@ -68,12 +69,13 @@ * Executes an editor plugin. * @param plugin the plugin name to execute * @param params the plugin parameters - * @throws PluginExecException if an error occurs + * @return whether an error occurred */ - public void executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> params) throws PluginExecException { + public int executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> params) { final Plugin<G, A, R> modelTemplate = pluginModel.getPlugin(plugin); if (modelTemplate == null) { - throw new PluginExecException("plugin " + plugin + " does not exist"); + System.err.println("plugin " + plugin + " does not exist"); + return 1; } final Plugin<G, A, R> clonedPlugin = modelTemplate.clonePlugin(); @@ -81,7 +83,8 @@ for (final String param : params) { final String[] tmp = StringUtils.PATTERN_EQUAL.split(param, 2); if (tmp.length != 2) { - throw new PluginExecException("syntax error: " + param); + System.err.println("syntax error: " + param); + return 1; } final int index = clonedPlugin.getParameter(tmp[0]); @@ -93,7 +96,8 @@ sb.append(parameter.getName()); firstParameter = false; } - throw new PluginExecException("plugin " + plugin + " has no parameter " + tmp[0] + "; available parameters:" + sb); + System.err.println("plugin " + plugin + " has no parameter " + tmp[0] + "; available parameters:" + sb); + return 1; } final PluginParameter<G, A, R> parameter; @@ -103,7 +107,8 @@ throw new AssertionError(ex); } if (!parameter.setStringValue(tmp[1])) { - throw new PluginExecException("invalid value " + tmp[1] + " for parameter " + tmp[0]); + System.out.println("invalid value " + tmp[1] + " for parameter " + tmp[0]); + return 1; } } @@ -141,17 +146,24 @@ }; final BshThread<G, A, R> pluginThread = doRunPlugin(clonedPlugin, console); + if (pluginThread == null) { + return 1; + } try { pluginThread.join(); - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { pluginThread.interrupt(); Thread.currentThread().interrupt(); - throw new PluginExecException("interrupted", ex); + System.out.println("interrupted"); + return 1; } if (!pluginThread.isSuccess()) { - throw new PluginExecException("plugin failed"); + System.err.println("plugin failed"); + return 1; } + + return 0; } /** @@ -159,11 +171,10 @@ * set. * @param plugin the plugin model * @param console the console to use - * @return the plugin thread - * @throws PluginExecException if an error occurs + * @return the thread executing the script */ - @NotNull - public BshThread<G, A, R> doRunPlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final ConsoleInterface console) throws PluginExecException { + @Nullable + public BshThread<G, A, R> doRunPlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final ConsoleInterface console) { final Interpreter runner = new Interpreter(); runner.setConsole(console); try { @@ -183,9 +194,11 @@ } finally { charArrayWriter.close(); } - throw new PluginExecException("target error: " + charArrayWriter, ex); + console.print("target error: " + charArrayWriter); + return null; } catch (final EvalError ex) { - throw new PluginExecException("evaluation error: " + ex.getMessage(), ex); + console.print("evaluation error: " + ex.getMessage()); + return null; } final BshThread<G, A, R> pluginThread = new BshThread<G, A, R>(plugin.getName(), plugin, runner); pluginThread.start(); Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -19,14 +19,27 @@ package net.sf.gridarta.plugin; +import bsh.ConsoleInterface; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EventListenerList2; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,9 +49,24 @@ */ public class PluginModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<Plugin<G, A, R>> { + /** + * The Logger for printing log messages. + */ @NotNull + private static final Category log = Logger.getLogger(PluginModel.class); + + @NotNull + private final PluginParameterFactory<G, A, R> pluginParameterFactory; + + @NotNull + private final PluginModelParser<G, A, R> pluginModelParser; + + @NotNull private final Map<String, Plugin<G, A, R>> plugins = new TreeMap<String, Plugin<G, A, R>>(); + @NotNull + private final PluginParameters pluginParameters = new PluginParameters(); + /** * The {@link PluginModelListener PluginModelListeners} to inform of * changes. @@ -46,6 +74,11 @@ @NotNull private final EventListenerList2<PluginModelListener<G, A, R>> listeners = new EventListenerList2<PluginModelListener<G, A, R>>(PluginModelListener.class); + public PluginModel(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final PluginModelParser<G, A, R> pluginModelParser) { + this.pluginParameterFactory = pluginParameterFactory; + this.pluginModelParser = pluginModelParser; + } + @Nullable public Plugin<G, A, R> getPlugin(@NotNull final String name) { return plugins.get(name); @@ -83,6 +116,16 @@ return true; } + public void addPlugin(@NotNull final File file) { + try { + addPlugin(PluginModelLoader.loadXML(pluginModelParser, file)); + } catch (final IOException ex) { + log.warn("can't load plugin: " + ex.getMessage()); + } catch (final JDOMException ex) { + log.warn("can't parse plugin: " + ex.getMessage()); + } + } + public void removePlugin(@NotNull final Plugin<G, A, R> plugin) { if (!plugins.containsKey(plugin.getName())) { throw new IllegalArgumentException(); @@ -94,6 +137,26 @@ } /** + * Saves a plugin to a given file. + * @param plugin the plugin to save + * @param file the file to save to + * @throws IOException if the file cannot be saved + */ + public void savePlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final File file) throws IOException { + final FileOutputStream fos = new FileOutputStream(file); + try { + final Element root = pluginModelParser.toXML(plugin); + final Document d = new Document(root); + final XMLOutputter out = new XMLOutputter(); + out.setFormat(Format.getPrettyFormat()); + out.output(d, fos); + } finally { + fos.close(); + } + } + + + /** * Adds a listener to be informed of changes. * @param listener the listener */ @@ -163,4 +226,39 @@ firePluginRegisteredEvent(plugin); } + public void addPluginParameter(@NotNull final String name, @NotNull final Object value) { + pluginParameters.addPluginParameter(name, value); + } + + @Nullable + public Filter<?, ?> getPluginAsFilter(@NotNull final Plugin<G, A, R> plugin) { + return plugin.getPluginAsFilter(pluginParameters); + } + + + public void runPlugin(@NotNull final Plugin<G, A, R> plugin) { + plugin.runPlugin(pluginParameters); + } + + public int executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> args) { + return new PluginExecutor<G, A, R>(this, pluginParameters).executePlugin(plugin, args); + } + + @Nullable + public BshThread<G, A, R> doRunPlugin(@NotNull final Plugin<G, A, R> plugin, @NotNull final ConsoleInterface console) { + return new PluginExecutor<G, A, R>(this, pluginParameters).doRunPlugin(plugin, console); + } + + @NotNull + public String[] getTypes() { + return pluginParameterFactory.getTypes(); + } + + @Nullable + public Plugin<G, A, R> newPlugin(@NotNull final String name, @NotNull final String code) { + final Plugin<G, A, R> plugin = new Plugin<G, A, R>(name, pluginParameterFactory); + plugin.setCode(code); + return addPlugin(plugin) ? plugin : null; + } + } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2013-10-13 19:59:09 UTC (rev 9430) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2013-10-14 18:54:27 UTC (rev 9431) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jdom.Document; @@ -61,8 +62,8 @@ * @return the loaded plugin model */ @NotNull - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> PluginModel<G, A, R> loadPlugins(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final ErrorView errorView, @NotNull final File pluginsDir) { - final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(); + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> PluginModel<G, A, R> loadPlugins(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final ErrorView errorView, @NotNull final File pluginsDir) { + final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(pluginParameterFactory, pluginModelParser); final File[] files = pluginsDir.listFiles(); if (files == null) { errorView.addWarning(ErrorViewCategory.SCRIPTS_DIR_INVALID, pluginsDir + ": directory not readable"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-15 16:08:18
|
Revision: 9433 http://sourceforge.net/p/gridarta/code/9433 Author: akirschbaum Date: 2013-10-15 16:08:08 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Remove dependency AutojoinLists -> MapViewSettings. 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/action/InsertArchAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/InsertionTool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java trunk/src/model/src/test/java/net/sf/gridarta/model/autojoin/AutojoinListsTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.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-14 21:08:54 UTC (rev 9432) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -405,8 +405,8 @@ */ @NotNull @Override - public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager) { - return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen(), pathManager); + public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager, @NotNull final MapViewSettings mapViewSettings) { + return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen(), pathManager, mapViewSettings); } /** 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-14 21:08:54 UTC (rev 9432) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -296,8 +296,8 @@ */ @NotNull @Override - public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager) { - return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, IGUIConstants.SQUARE_WIDTH, IGUIConstants.SQUARE_HEIGHT, pathManager); + public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager, @NotNull final MapViewSettings mapViewSettings) { + return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, IGUIConstants.SQUARE_WIDTH, IGUIConstants.SQUARE_HEIGHT, pathManager, mapViewSettings); } /** 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-14 21:08:54 UTC (rev 9432) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -404,8 +404,8 @@ */ @NotNull @Override - public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager) { - return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen(), pathManager); + public MapViewFactory<GameObject, MapArchObject, Archetype> newMapViewFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final PathManager pathManager, @NotNull final MapViewSettings mapViewSettings) { + return new DefaultMapViewFactory<GameObject, MapArchObject, Archetype>(rendererFactory, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen(), pathManager, mapViewSettings); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/InsertArchAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/InsertArchAction.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/InsertArchAction.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcursor.MapCursor; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; @@ -45,6 +46,12 @@ private final ObjectChooser<G, A, R> objectChooser; /** + * The {@link MapViewSettings} instance for looking up options. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * The {@link Action} associated with this editor action. Set to {@code * null} if no action is associated. */ @@ -55,10 +62,12 @@ * Creates a new instance. * @param mapViewManager the map view manager * @param objectChooser the object chooser + * @param mapViewSettings the map view settings instance for looking up options */ - public InsertArchAction(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public InsertArchAction(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapViewSettings mapViewSettings) { super(mapViewManager); this.objectChooser = objectChooser; + this.mapViewSettings = mapViewSettings; } /** @@ -85,7 +94,7 @@ private boolean doInsertArch(final boolean performAction) { final MapCursor<G, A, R> mapCursor = getActiveMapCursor(); final BaseObject<G, A, R, ?> gameObject = objectChooser.getSelection(); - return mapCursor != null && gameObject != null && mapCursor.insertGameObject(performAction, gameObject, false, true); + return mapCursor != null && gameObject != null && mapCursor.insertGameObject(performAction, gameObject, false, mapViewSettings.isAutojoin()); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -69,17 +70,25 @@ private final PathManager pathManager; /** + * The {@link MapViewSettings} instance. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * Creates a new instance. * @param rendererFactory the renderer factory to use * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param pathManager the path manager for converting path names + * @param mapViewSettings the map view settings instance */ - public DefaultMapViewFactory(@NotNull final RendererFactory<G, A, R> rendererFactory, final int xScrollDistance, final int yScrollDistance, @NotNull final PathManager pathManager) { + public DefaultMapViewFactory(@NotNull final RendererFactory<G, A, R> rendererFactory, final int xScrollDistance, final int yScrollDistance, @NotNull final PathManager pathManager, @NotNull final MapViewSettings mapViewSettings) { this.rendererFactory = rendererFactory; this.xScrollDistance = xScrollDistance; this.yScrollDistance = yScrollDistance; this.pathManager = pathManager; + this.mapViewSettings = mapViewSettings; } /** @@ -92,7 +101,7 @@ final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); final AbstractMapRenderer<G, A, R> renderer = mapControl.isPickmap() ? rendererFactory.newPickmapRenderer(mapModel, mapGrid) : rendererFactory.newMapRenderer(mapModel, mapGrid); renderer.setFocusable(true); - final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, pathManager, mapGrid, new MapCursor<G, A, R>(mapGrid, mapModel), renderer, viewPosition, xScrollDistance, yScrollDistance); + final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, pathManager, mapGrid, new MapCursor<G, A, R>(mapGrid, mapModel, mapViewSettings), renderer, viewPosition, xScrollDistance, yScrollDistance); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesControl.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesControl.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -52,6 +52,7 @@ import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapmodel.MapTransactionListener; import net.sf.gridarta.model.mapmodel.SavedSquares; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.utils.EventListenerList2; import net.sf.gridarta.utils.Size2D; @@ -105,6 +106,12 @@ private final GameObjectFactory<G, A, R> gameObjectFactory; /** + * The {@link MapViewSettings} instance. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * The main panel. */ @NotNull @@ -371,14 +378,16 @@ * @param selectedSquareModel the selected square model instance * @param gameObjectFactory the game object factory for creating new game * objects + * @param mapViewSettings the map view settings instance */ - public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory) { + public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final MapViewSettings mapViewSettings) { super(new BorderLayout()); this.gameObjectAttributesModel = gameObjectAttributesModel; this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.objectChooser = objectChooser; this.selectedSquareModel = selectedSquareModel; this.gameObjectFactory = gameObjectFactory; + this.mapViewSettings = mapViewSettings; final Container mapArchPanel = new JPanel(); mapArchPanel.setLayout(new BorderLayout()); @@ -576,9 +585,9 @@ final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Add to environment"); // TODO; I18N/L10N try { - final G insertedGameObject = mapModel.insertArchToMap(baseObject, prevGameObject, mapSquare.getMapLocation(), true); + final G insertedGameObject = mapModel.insertArchToMap(baseObject, prevGameObject, mapSquare.getMapLocation(), mapViewSettings.isAutojoin()); if (insertedGameObject != null) { - mapModel.removeGameObject(prevGameObject, true); + mapModel.removeGameObject(prevGameObject, mapViewSettings.isAutojoin()); insertedGameObject.addLast(prevGameObject); selectedSquareModel.setSelectedGameObject(insertedGameObject); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -110,6 +110,12 @@ private final ObjectChooser<G, A, R> objectChooser; /** + * The {@link MapViewSettings} instance. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * The {@link DefaultListModel} of {@link #list}. */ @NotNull @@ -311,6 +317,7 @@ this.selectedSquareModel = selectedSquareModel; this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.objectChooser = objectChooser; + this.mapViewSettings = mapViewSettings; setLayout(new BorderLayout()); @@ -472,7 +479,7 @@ if (gameObject != null) { final MapCursor<G, A, R> mapCursor = this.mapCursor; if (mapCursor != null) { - mapCursor.insertGameObject(true, gameObject, index >= model.getSize(), true); + mapCursor.insertGameObject(true, gameObject, index >= model.getSize(), mapViewSettings.isAutojoin()); } } setSelectedIndex(index); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -347,7 +347,7 @@ mapModel.beginTransaction("Delete Object"); try { for (final G gameObjectToDelete : gameObjectsToDelete) { - mapModel.removeGameObject(gameObjectToDelete, true); + mapModel.removeGameObject(gameObjectToDelete, mapViewSettings.isAutojoin()); } } finally { mapModel.endTransaction(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/InsertionTool.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/InsertionTool.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/InsertionTool.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -39,6 +39,7 @@ import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.InsertionModeSet; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.pickmapsettings.PickmapSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.japi.swing.action.ActionBuilder; @@ -113,18 +114,26 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** + * The {@link MapViewSettings} to use. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * Create a BasicAbstractTool. * @param selectedSquareModel the selected square model * @param objectChooser the ObjectChooser to use * @param pickmapSettings the pickmap settings to use * @param insertionModeSet the insertion mode set to use + * @param mapViewSettings the map view settings to use */ - public InsertionTool(@NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapSettings pickmapSettings, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public InsertionTool(@NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapSettings pickmapSettings, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final MapViewSettings mapViewSettings) { super("insertion"); this.selectedSquareModel = selectedSquareModel; this.objectChooser = objectChooser; this.pickmapSettings = pickmapSettings; this.insertionModeSet = insertionModeSet; + this.mapViewSettings = mapViewSettings; } /** @@ -225,7 +234,7 @@ throw new AssertionError(); } final BaseObject<G, A, R, ?> selectedArchetype = objectChooser.getSelection(); - insertedObject = selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, p, isPressed || modeIndex == MODE_AUTO, true, insertionMode); + insertedObject = selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, p, isPressed || modeIndex == MODE_AUTO, mapViewSettings.isAutojoin(), insertionMode); } selectedSquareModel.setSelectedGameObject(insertedObject); } finally { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -124,7 +124,7 @@ addTool(new VoidTool<G, A, R>(), defaultTool); addTool(new SelectionTool<G, A, R>(objectChooser, insertionModeSet), defaultTool); addTool(new DeletionTool<G, A, R>(mapViewSettings, objectChooser, pickmapSettings, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher), defaultTool); - addTool(new InsertionTool<G, A, R>(selectedSquareModel, objectChooser, pickmapSettings, insertionModeSet), defaultTool); + addTool(new InsertionTool<G, A, R>(selectedSquareModel, objectChooser, pickmapSettings, insertionModeSet, mapViewSettings), defaultTool); } /** 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-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -135,10 +135,12 @@ * Creates a new {@link MapViewFactory} instance. * @param rendererFactory the renderer factory to use * @param pathManager the path manager for converting path names + * @param mapViewSettings the map view settings to pass to the created map + * view factories * @return the new instance */ @NotNull - MapViewFactory<G, A, R> newMapViewFactory(@NotNull RendererFactory<G, A, R> rendererFactory, @NotNull PathManager pathManager); + MapViewFactory<G, A, R> newMapViewFactory(@NotNull RendererFactory<G, A, R> rendererFactory, @NotNull PathManager pathManager, @NotNull MapViewSettings mapViewSettings); /** * Creates a new {@link AppPreferencesModel} instance. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -313,7 +313,7 @@ */ public GUIMainControl(@NotNull final ProjectModel<G, A, R> projectModel, @NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final PluginModel<G, A, R> pluginModel, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final PathManager pathManager, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl) { this.projectModel = projectModel; - final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); + final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager, projectModel.getMapViewSettings()); mapViewsManager = new MapViewsManager<G, A, R>(projectModel.getMapViewSettings(), mapViewFactory, projectModel.getMapManager(), projectModel.getPickmapManager()); scriptExtension = editorFactory.getScriptExtension(); final DisplayMode<G, A, R> displayModeGameObjectNames = new DisplayNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); @@ -394,7 +394,7 @@ final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(projectModel.getArchetypeChooserModel(), archetypeChooserView, editorFactory.isCreateDirectionPane(), projectModel.getFaceObjectProviders()); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, projectModel.getArchetypeChooserModel(), pickmapChooserModel, projectModel.getArchetypeTypeSet()); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(projectModel.getMapViewSettings(), selectedSquareModel, objectChooser, pickmapSettings, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); - final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, projectModel.getMapManager(), selectedSquareModel, projectModel.getGameObjectFactory()); + final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, projectModel.getMapManager(), selectedSquareModel, projectModel.getGameObjectFactory(), projectModel.getMapViewSettings()); final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, false, 0, true); newMapDialogFactory.setObjectChooser(objectChooser); final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(parent, copyBuffer, objectChooser, mapViewManager, projectModel.getFaceObjectProviders(), insertionModeSet); @@ -516,7 +516,7 @@ createAction("subFromSelection", "Map Cursor,Map/Selection", new SubFromSelectionAction<G, A, R>(mapViewManager)); createAction("startStopDrag", "Map Cursor,Map/Selection", new StartStopDragAction<G, A, R>(mapViewManager)); createAction("releaseDrag", "Map Cursor,Map/Selection", new ReleaseDragAction<G, A, R>(mapViewManager)); - createAction("insertArch", "Map Cursor,Map", new InsertArchAction<G, A, R>(mapViewManager, objectChooser)); + createAction("insertArch", "Map Cursor,Map", new InsertArchAction<G, A, R>(mapViewManager, objectChooser, projectModel.getMapViewSettings())); createAction("deleteArch", "Map Cursor,Map", new DeleteArchAction<G, A, R>(mapViewManager)); createAction("selectArchAbove", "Map Cursor,Selected Square View", new SelectArchBelowAction<G, A, R>(mapViewManager)); createAction("selectArchBelow", "Map Cursor,Selected Square View", new SelectArchAboveAction<G, A, R>(mapViewManager)); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -99,7 +99,7 @@ final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, mapViewSettings); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(mapViewSettings); + final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); final ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); final InsertionMode<G, A, R> topmostInsertionMode = new TopmostInsertionMode<G, A, R>(); final MapModelFactory<G, A, R> mapModelFactory = new MapModelFactory<G, A, R>(archetypeChooserModel, autojoinLists, mapViewSettings, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); Modified: trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java =================================================================== --- trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -76,7 +76,7 @@ // select + cut final CopyBuffer<TestGameObject, TestMapArchObject, TestArchetype> copyBuffer = TestMapControlCreatorUtils.newCopyBuffer(testMapControlCreator); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = TestMapControlCreatorUtils.newMapView(mapControl); + final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = TestMapControlCreatorUtils.newMapView(mapControl, testMapControlCreator.getMapModelCreator().getMapViewSettings()); mapView.getMapGrid().select(new Point(1, 1), SelectionMode.ADD); copyBuffer.cut(mapView, new Rectangle(1, 1, 1, 1)); Modified: trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,6 +38,21 @@ public class TestMapViewFactory implements MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> { /** + * The {@link MapViewSettings} to pass to the created map view factories. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** + * Creates a new instance. + * @param mapViewSettings the map view settings instance to pass to the + * created map view factories + */ + public TestMapViewFactory(@NotNull final MapViewSettings mapViewSettings) { + this.mapViewSettings = mapViewSettings; + } + + /** * {@inheritDoc} */ @NotNull @@ -44,7 +60,7 @@ public MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @Nullable final Point viewPosition, final int viewCounter) { final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - return new TestMapView(mapControl, mapGrid, new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(mapGrid, mapModel)); + return new TestMapView(mapControl, mapGrid, new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(mapGrid, mapModel, mapViewSettings)); } } Modified: trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -41,6 +41,7 @@ import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; /** @@ -58,13 +59,14 @@ /** * Creates a new {@link MapView} instance. * @param mapControl the associated map control + * @param mapViewSettings the map view settings instance to use * @return the map view instance */ @NotNull - public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { + public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final MapViewSettings mapViewSettings) { final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - return new TestMapView(mapControl, mapGrid, new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(mapGrid, mapModel)); + return new TestMapView(mapControl, mapGrid, new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(mapGrid, mapModel, mapViewSettings)); } /** @@ -85,7 +87,7 @@ */ @NotNull public static MapViewsManager<TestGameObject, TestMapArchObject, TestArchetype> newMapViewsManager(@NotNull final TestMapControlCreator mapControlCreator) { - final MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> mapViewFactory = new TestMapViewFactory(); + final MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> mapViewFactory = new TestMapViewFactory(mapControlCreator.getMapModelCreator().getMapViewSettings()); return new MapViewsManager<TestGameObject, TestMapArchObject, TestArchetype>(mapControlCreator.getMapModelCreator().getMapViewSettings(), mapViewFactory, mapControlCreator.getMapManager(), mapControlCreator.getPickmapManager()); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinLists.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinLists.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinLists.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -48,20 +47,6 @@ private final Map<Archetype<G, A, R>, AutojoinList<G, A, R>> autojoinLists = new IdentityHashMap<Archetype<G, A, R>, AutojoinList<G, A, R>>(); /** - * The {@link MapViewSettings} to use. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** - * Creates a new instance. - * @param mapViewSettings the map view settings to use - */ - public AutojoinLists(@NotNull final MapViewSettings mapViewSettings) { - this.mapViewSettings = mapViewSettings; - } - - /** * Adds a new autojoin list. * @param autojoinList the autojoin list to add * @throws IllegalAutojoinListException if the autojoin list cannot be @@ -95,10 +80,6 @@ */ @NotNull public InsertionResult<G, A, R> joinInsert(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final R archetype) { - if (!mapViewSettings.isAutojoin()) { - return new InsertionResult<G, A, R>(null, archetype); - } - if (archetype.isMulti()) { return new InsertionResult<G, A, R>(null, archetype); } @@ -188,10 +169,6 @@ * @param mapModel Data model of the map */ public void joinDelete(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final R archetype) { - if (!mapViewSettings.isAutojoin()) { - return; - } - if (archetype.isMulti()) { return; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -76,7 +76,7 @@ try { final BufferedReader stream = new BufferedReader(reader); try { - return loadList(errorView, archetypeSet, mapViewSettings, url, stream); + return loadList(errorView, archetypeSet, url, stream); } finally { stream.close(); } @@ -93,22 +93,21 @@ errorView.addWarning(ErrorViewCategory.AUTOJOIN_FILE_INVALID, FILENAME + ": " + ex.getMessage()); } - return new AutojoinLists<G, A, R>(mapViewSettings); + return new AutojoinLists<G, A, R>(); } /** * Loads all the autojoin lists from the data file. * @param errorView the error view for reporting errors * @param archetypeSet the archetype set for looking up archetypes - * @param mapViewSettings the map view settings instance * @param url the source location for error messages * @param bufferedReader the reader to read from * @return the loaded autojoin lists * @throws IOException if an I/O error occurs */ @NotNull - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> AutojoinLists<G, A, R> loadList(@NotNull final ErrorView errorView, final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapViewSettings mapViewSettings, @NotNull final URL url, @NotNull final BufferedReader bufferedReader) throws IOException { - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(mapViewSettings); + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> AutojoinLists<G, A, R> loadList(@NotNull final ErrorView errorView, final ArchetypeSet<G, A, R> archetypeSet, @NotNull final URL url, @NotNull final BufferedReader bufferedReader) throws IOException { + final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); boolean sectionFlag = false; // true while section (start ... end) read; XXX: replace flag with control flow final List<List<R>> archetypes = new ArrayList<List<R>>(AutojoinList.SIZE); final StringBuilder undefinedArchetypes = new StringBuilder(); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.mapgrid.SelectionMode; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -90,6 +91,12 @@ private final MapModel<G, A, R> mapModel; /** + * The {@link MapViewSettings} for querying options. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * Used to test if coordinates are on the map. Created by MapGrid. */ @NotNull @@ -164,10 +171,12 @@ * construction. * @param mapGrid Cursor is bound to this grid * @param mapModel the map model of this cursor + * @param mapViewSettings the map view settings for querying options */ - public MapCursor(@NotNull final MapGrid mapGrid, @NotNull final MapModel<G, A, R> mapModel) { + public MapCursor(@NotNull final MapGrid mapGrid, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapViewSettings mapViewSettings) { this.mapGrid = mapGrid; this.mapModel = mapModel; + this.mapViewSettings = mapViewSettings; mapRec = mapGrid.getMapRec(); final MapGridListener mapGridListener = new MapGridListener() { @@ -692,7 +701,7 @@ mapModel.beginTransaction("Delete"); // TODO; I18N/L10N try { G nextGameObject = mapSquare.getNext(gameObject); - mapModel.removeGameObject(gameObject, true); + mapModel.removeGameObject(gameObject, mapViewSettings.isAutojoin()); if (nextGameObject == null) { nextGameObject = mapSquare.getFirst(); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -311,8 +311,7 @@ * @param baseObject the base object * @param pos the insert-location on this map * @param allowMany whether duplicates are allowed - * @param join if set, auto-joining is supported; autojoining is only done - * if enabled in the main control + * @param join whether to auto-join the inserted game object * @param insertionMode the insertion mode to use * @return the inserted game object or <code>null</code> if nothing was * inserted Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/autojoin/AutojoinListsTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -98,8 +98,6 @@ testMapModelHelper.insertArchetype(mapModel, 1, 0, a1, false); testMapModelHelper.insertArchetype(mapModel, 0, 1, a8, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // insert using autojoin testMapModelHelper.insertArchetype(mapModel, 1, 1, a0, true); TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a9|"); @@ -117,9 +115,8 @@ testMapModelHelper.insertArchetype(mapModel, 2, 1, a6, true); TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a11|a8"); - // insert using autojoin but disabled autojoin globally - mapModelCreator.getMapViewSettings().setAutojoin(false); - testMapModelHelper.insertArchetype(mapModel, 2, 0, a6, true); + // insert without autojoin + testMapModelHelper.insertArchetype(mapModel, 2, 0, a6, false); TestMapModelHelper.checkMapContents(mapModel, "|a5|a6", "a10|a11|a8"); } @@ -148,17 +145,14 @@ final TestGameObject g21 = testMapModelHelper.insertArchetype(mapModel, 2, 1, a8, false); // remove using autojoin - mapModelCreator.getMapViewSettings().setAutojoin(true); mapModel.removeGameObject(g21, true); TestMapModelHelper.checkMapContents(mapModel, "|a4|", "a10|a9|"); - // remove using autojoin but globally disabled - mapModelCreator.getMapViewSettings().setAutojoin(false); - mapModel.removeGameObject(g10, true); + // remove without autojoin + mapModel.removeGameObject(g10, false); TestMapModelHelper.checkMapContents(mapModel, "||", "a10|a9|"); // remove using autojoin - mapModelCreator.getMapViewSettings().setAutojoin(true); mapModel.removeGameObject(g01, true); TestMapModelHelper.checkMapContents(mapModel, "||", "|a1|"); } @@ -189,8 +183,6 @@ testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // insert using autojoin testMapModelHelper.insertArchetype(mapModel, 1, 0, a0, true); TestMapModelHelper.checkMapContents(mapModel, "b5|a6|b10", "a3|a9|"); @@ -221,8 +213,6 @@ testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // insert using autojoin testMapModelHelper.insertArchetype(mapModel, 1, 0, b10, true); TestMapModelHelper.checkMapContents(mapModel, "b5|b10|b10", "a3|a8|"); @@ -253,8 +243,6 @@ testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // insert using autojoin testMapModelHelper.insertArchetype(mapModel, 1, 0, b5, true); TestMapModelHelper.checkMapContents(mapModel, "b5|b5|b10", "a3|a9|"); @@ -284,8 +272,6 @@ testMapModelHelper.insertArchetype(mapModel, 2, 0, a10, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // remove using autojoin mapModel.removeGameObject(g10, true); TestMapModelHelper.checkMapContents(mapModel, "a8||a2", "|a11|"); @@ -316,8 +302,6 @@ testMapModelHelper.insertArchetype(mapModel, 2, 0, b5, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // remove using autojoin mapModel.removeGameObject(g10, true); TestMapModelHelper.checkMapContents(mapModel, "b10||b5", "|a10|"); @@ -346,8 +330,6 @@ testMapModelHelper.insertArchetype(mapModel, 2, 0, b10, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - // remove using autojoin mapModel.removeGameObject(g10, true); TestMapModelHelper.checkMapContents(mapModel, "b10||b10", "|a11|"); @@ -380,8 +362,6 @@ testMapModelHelper.insertArchetype(mapModel, 2, 1, a5, false); testMapModelHelper.insertArchetype(mapModel, 1, 2, b5, false); - mapModelCreator.getMapViewSettings().setAutojoin(true); - try { testMapModelHelper.insertArchetype(mapModel, 1, 1, a10, true); Assert.fail(); @@ -423,8 +403,6 @@ } } - mapModelCreator.getMapViewSettings().setAutojoin(true); - TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|a10|a10", "a10|a10|a10"); testMapModelHelper.insertArchetype(mapModel, 1, 1, b5, true); // replace main->alt TestMapModelHelper.checkMapContents(mapModel, "a10|a14|a10", "a8|b5|a2", "a10|a11|a10"); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -50,6 +50,7 @@ import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.mapmodel.TestMapModelHelper; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; import net.sf.gridarta.model.settings.ProjectSettings; @@ -156,12 +157,13 @@ exitMatcher = new ExitMatcher<TestGameObject, TestMapArchObject, TestArchetype>(exitGameObjectMatcher); mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); gameObjectParser = mapModelCreator.newGameObjectParser(); - mapReaderFactory = new TestMapReaderFactory(mapArchObjectParserFactory, mapArchObjectFactory, gameObjectParser, mapModelCreator.getMapViewSettings()); + final TestMapViewSettings mapViewSettings = new TestMapViewSettings(); + mapReaderFactory = new TestMapReaderFactory(mapArchObjectParserFactory, mapArchObjectFactory, gameObjectParser, mapViewSettings); projectSettings = new TestProjectSettings(); mapWriter = new DefaultMapWriter<TestGameObject, TestMapArchObject, TestArchetype>(mapArchObjectParserFactory, gameObjectParser); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); pathManager = new PathManager(projectSettings); - mapModelFactory = new MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype>(archetypeChooserModel, mapModelCreator.getAutojoinLists(), mapModelCreator.getMapViewSettings(), mapModelCreator.getGameObjectFactory(), mapModelCreator.getGameObjectMatchers(), mapModelCreator.getTopmostInsertionMode()); + mapModelFactory = new MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype>(archetypeChooserModel, mapModelCreator.getAutojoinLists(), mapViewSettings, mapModelCreator.getGameObjectFactory(), mapModelCreator.getGameObjectMatchers(), mapModelCreator.getTopmostInsertionMode()); mapControlFactory = new TestMapControlFactory(mapWriter, projectSettings, mapModelFactory); final AbstractMapManager<TestGameObject, TestMapArchObject, TestArchetype> tmpMapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype>(mapReaderFactory, mapControlFactory, projectSettings, mapModelCreator.getFaceObjectProviders()); tmpMapManager.setFileControl(fileControl); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.mapgrid.SelectionMode; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; +import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -66,7 +67,7 @@ private static MapCursor<TestGameObject, TestMapArchObject, TestArchetype> createCursor(@NotNull final MapGrid grid) { final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final Size2D gridSize = grid.getSize(); - final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(grid, mapModelCreator.newMapModel(gridSize.getWidth(), gridSize.getHeight())); + final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(grid, mapModelCreator.newMapModel(gridSize.getWidth(), gridSize.getHeight()), new TestMapViewSettings()); cursor.addMapCursorListener(listener); Assert.assertFalse("MapCursor has to be disabled when created.", cursor.isActive()); listener.changedPosCounter = 0; Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2013-10-14 21:08:54 UTC (rev 9432) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2013-10-15 16:08:08 UTC (rev 9433) @@ -140,7 +140,7 @@ * @param createIcons whether to create icon instances */ public TestMapModelCreator(final boolean createIcons) { - autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); + autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); final GUIUtils guiUtils = new GUIUtils(); if (createIcons) { final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-15 18:12:32
|
Revision: 9434 http://sourceforge.net/p/gridarta/code/9434 Author: akirschbaum Date: 2013-10-15 18:12:21 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -19,13 +19,11 @@ package net.sf.gridarta.var.atrinik.model.gameobject; -import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.DefaultIsoGameObject; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -107,6 +105,14 @@ /** * {@inheritDoc} */ + @Override + public boolean isDrawDouble(final boolean drawDoubleFaces) { + return getAttributeInt(DRAW_DOUBLE_ALWAYS) != 0 || (drawDoubleFaces && getAttributeInt(DRAW_DOUBLE) != 0); + } + + /** + * {@inheritDoc} + */ @NotNull @Override public GameObject clone() { @@ -138,29 +144,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { - final boolean drawDouble = getAttributeInt(DRAW_DOUBLE_ALWAYS) != 0 || (mapViewSettings.isDoubleFaces() && getAttributeInt(DRAW_DOUBLE) != 0); - if (mapViewSettings.isAlphaType(getEditType())) { - if (drawDouble) { - return getTransparentDoubleImage(); - } else { - return getTransparentImage(); - } - } else { - if (drawDouble) { - return getDoubleImage(); - } else { - return getNormalImage(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override public int getLightRadius() { return getAttributeInt(GLOW_RADIUS); } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -19,13 +19,11 @@ package net.sf.gridarta.var.daimonin.model.gameobject; -import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.DefaultIsoGameObject; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -109,6 +107,14 @@ /** * {@inheritDoc} */ + @Override + public boolean isDrawDouble(final boolean drawDoubleFaces) { + return drawDoubleFaces; + } + + /** + * {@inheritDoc} + */ @NotNull @Override public GameObject clone() { @@ -140,28 +146,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { - if (mapViewSettings.isAlphaType(getEditType())) { - if (mapViewSettings.isDoubleFaces()) { - return getTransparentDoubleImage(); - } else { - return getTransparentImage(); - } - } else { - if (mapViewSettings.isDoubleFaces()) { - return getDoubleImage(); - } else { - return getNormalImage(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override public int getLightRadius() { final int attributeInt = Math.abs(getAttributeInt(GLOW_RADIUS)); return LIGHT_MASK_WIDTH[Math.min(attributeInt, LIGHT_MASK_WIDTH.length - 1)]; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -36,7 +36,6 @@ import net.sf.gridarta.model.baseobject.Attributes; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.DefaultIsoGameObject; -import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; @@ -61,7 +60,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>. * @author Andreas Kirschbaum */ -public abstract class AbstractIsoMapRenderer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapRenderer<G, A, R> { +public abstract class AbstractIsoMapRenderer<G extends DefaultIsoGameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapRenderer<G, A, R> { /** * The serial version UID. @@ -111,8 +110,7 @@ private final MapGrid mapGrid; /** - * The {@link Icon} drawn into squares without {@link GameObject - * GameObjects}. + * The {@link Icon} drawn into squares without game objects. */ @NotNull private final Icon unknownSquareIcon; @@ -466,16 +464,16 @@ } /** - * Checks whether a {@link GameObject} is visible according to current - * editor settings. + * Checks whether a game object is visible according to current editor + * settings. * @param gameObject the game object * @return whether the game object is visible */ protected abstract boolean isGameObjectVisible(@NotNull final G gameObject); /** - * Paints a single {@link GameObject} if it is visible according to current - * editor settings. + * Paints a single game object if it is visible according to current editor + * settings. * @param g the graphics to paint to * @param xStart the x offset for painting * @param yStart the y offset for painting @@ -489,7 +487,7 @@ } /** - * Paints a single {@link GameObject}. + * Paints a single game object. * @param g the graphics to paint to * @param xStart the x offset for painting * @param yStart the y offset for painting Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -30,7 +30,6 @@ import net.sf.gridarta.model.filter.FilterConfigChangeType; import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.gameobject.DefaultIsoGameObject; -import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; @@ -46,7 +45,7 @@ * A {@link AbstractIsoMapRenderer} to render map files. * @author Andreas Kirschbaum */ -public class IsoMapRenderer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractIsoMapRenderer<G, A, R> { +public class IsoMapRenderer<G extends DefaultIsoGameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractIsoMapRenderer<G, A, R> { /** * Serial Version UID. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -24,7 +24,6 @@ import javax.swing.Icon; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.DefaultIsoGameObject; -import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; @@ -40,7 +39,7 @@ * A {@link AbstractIsoMapRenderer} to render map files. * @author Andreas Kirschbaum */ -public class IsoPickmapRenderer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractIsoMapRenderer<G, A, R> { +public class IsoPickmapRenderer<G extends DefaultIsoGameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractIsoMapRenderer<G, A, R> { /** * Serial Version UID. Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -25,6 +25,7 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -194,10 +195,40 @@ } /** + * Returns whether to draw this game object with double height. + * @param drawDoubleFaces whether the "draw double faces" map view setting + * is enabled + * @return whether to draw this game object with double height + */ + public abstract boolean isDrawDouble(final boolean drawDoubleFaces); + + /** * {@inheritDoc} */ @NotNull @Override + public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { + final boolean drawDouble = isDrawDouble(mapViewSettings.isDoubleFaces()); + if (mapViewSettings.isAlphaType(getEditType())) { + if (drawDouble) { + return getTransparentDoubleImage(); + } else { + return getTransparentImage(); + } + } else { + if (drawDouble) { + return getDoubleImage(); + } else { + return getNormalImage(); + } + } + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override @SuppressWarnings("unchecked") public G clone() { //noinspection OverriddenMethodCallDuringObjectConstruction Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java 2013-10-15 16:08:08 UTC (rev 9433) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java 2013-10-15 18:12:21 UTC (rev 9434) @@ -32,7 +32,7 @@ * A {@link GameObject} implementation for testing purposes. * @author Andreas Kirschbaum */ -public class TestGameObject extends AbstractGameObject<TestGameObject, TestMapArchObject, TestArchetype> { +public class TestGameObject extends DefaultIsoGameObject<TestGameObject, TestMapArchObject, TestArchetype> { /** * The serial version UID. @@ -61,6 +61,14 @@ /** * {@inheritDoc} */ + @Override + public boolean isDrawDouble(final boolean drawDoubleFaces) { + return drawDoubleFaces; + } + + /** + * {@inheritDoc} + */ @NotNull @Override public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |