You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2013-10-15 18:31:24
|
Revision: 9435 http://sourceforge.net/p/gridarta/code/9435 Author: akirschbaum Date: 2013-10-15 18:31:19 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Move code from GameObject to MapRenderer implementations. Removes dependency GameObject -> MapViewSettings. Modified Paths: -------------- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.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/map/renderer/AbstractIsoMapRenderer.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/GameObject.java trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-15 18:12:21 UTC (rev 9434) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -343,7 +343,7 @@ * @param node the game object to paint */ private void paintGameObject(@NotNull final Graphics g, final int x, final int y, @NotNull final net.sf.gridarta.model.gameobject.GameObject<GameObject, MapArchObject, Archetype> node) { - final ImageIcon img = node.getImage(mapViewSettings); + final ImageIcon img = node.getNormalImage(); if (!node.isMulti() || (img.getIconWidth() == IGUIConstants.SQUARE_WIDTH && img.getIconHeight() == IGUIConstants.SQUARE_HEIGHT)) { offset.x = 0; offset.y = 0; 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-15 18:12:21 UTC (rev 9434) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -19,12 +19,10 @@ package net.sf.gridarta.var.crossfire.model.gameobject; -import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.AbstractGameObject; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -155,16 +153,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { - return getNormalImage(); - } - - /** - * {@inheritDoc} - */ - @Override public int getLightRadius() { return getAttributeInt(GLOW_RADIUS); } 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 18:12:21 UTC (rev 9434) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -497,7 +497,25 @@ */ private void paintGameObject(@NotNull final Graphics2D g, final int xStart, final int yStart, @NotNull final G gameObject, final boolean inSpawnPoint) { final G head = gameObject.getHead(); - final Icon icon = "trans.101".equals(head.getFaceObjName()) ? unknownSquareIcon : head.getImage(mapViewSettings); + final Icon icon; + if ("trans.101".equals(head.getFaceObjName())) { + icon = unknownSquareIcon; + } else { + final boolean drawDouble = head.isDrawDouble(mapViewSettings.isDoubleFaces()); + if (mapViewSettings.isAlphaType(head.getEditType())) { + if (drawDouble) { + icon = head.getTransparentDoubleImage(); + } else { + icon = head.getTransparentImage(); + } + } else { + if (drawDouble) { + icon = head.getDoubleImage(); + } else { + icon = head.getNormalImage(); + } + } + } final int xOffset = head.getAttributeInt(DefaultIsoGameObject.ALIGN); final int zoom = head.getAttributeInt(DefaultIsoGameObject.ZOOM); final double rotate = getRotate(head); 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 18:12:21 UTC (rev 9434) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -25,7 +25,6 @@ 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; @@ -163,7 +162,7 @@ * @return the transparent face for this game object */ @NotNull - protected ImageIcon getTransparentImage() { + public ImageIcon getTransparentImage() { if (transFace == null) { transFace = faceObjectProviders.getTrans(this); } @@ -175,7 +174,7 @@ * @return the double face for this game object */ @NotNull - protected ImageIcon getDoubleImage() { + public ImageIcon getDoubleImage() { if (doubleFace == null) { doubleFace = faceObjectProviders.getDouble(this); } @@ -187,7 +186,7 @@ * @return the transparent face for this game object */ @NotNull - protected ImageIcon getTransparentDoubleImage() { + public ImageIcon getTransparentDoubleImage() { if (transDoubleFace == null) { transDoubleFace = faceObjectProviders.getTransDouble(this); } @@ -207,28 +206,6 @@ */ @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/main/java/net/sf/gridarta/model/gameobject/GameObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/GameObject.java 2013-10-15 18:12:21 UTC (rev 9434) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/GameObject.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -20,13 +20,11 @@ package net.sf.gridarta.model.gameobject; import java.util.Iterator; -import javax.swing.ImageIcon; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.baseobject.GameObjectContainer; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapSquare; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -130,15 +128,6 @@ boolean isEmpty(); /** - * Returns the face for this game object according to the settings of a - * {@link MapViewSettings} instance. - * @param mapViewSettings the map view settings instance - * @return the face - */ - @NotNull - ImageIcon getImage(@NotNull MapViewSettings mapViewSettings); - - /** * Remove this GameObject from its container. Does nothing if the object has * no container. This method also takes perfectly well care of multi-part * GameObjects. 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 18:12:21 UTC (rev 9434) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/gameobject/TestGameObject.java 2013-10-15 18:31:19 UTC (rev 9435) @@ -19,13 +19,11 @@ package net.sf.gridarta.model.gameobject; -import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import org.jetbrains.annotations.NotNull; /** @@ -69,16 +67,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public ImageIcon getImage(@NotNull final MapViewSettings mapViewSettings) { - return getNormalImage(); - } - - /** - * {@inheritDoc} - */ - @Override public int getLightRadius() { return 0; } 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. |
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-14 21:09:03
|
Revision: 9432 http://sourceforge.net/p/gridarta/code/9432 Author: akirschbaum Date: 2013-10-14 21:08:54 +0000 (Mon, 14 Oct 2013) Log Message: ----------- Extract ProjectModel from GridartaEditor. Modified Paths: -------------- trunk/build.xml trunk/gridarta.ipr trunk/settings.gradle trunk/src/atrinik/atrinik.iml trunk/src/atrinik/build.gradle trunk/src/crossfire/build.gradle trunk/src/crossfire/crossfire.iml trunk/src/daimonin/build.gradle trunk/src/daimonin/daimonin.iml trunk/src/gridarta/build.gradle trunk/src/gridarta/gridarta.iml 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/GUIMainControl.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 Added Paths: ----------- trunk/src/project/ trunk/src/project/build.gradle trunk/src/project/project.iml trunk/src/project/src/ trunk/src/project/src/main/ trunk/src/project/src/main/java/ trunk/src/project/src/main/java/net/ trunk/src/project/src/main/java/net/sf/ trunk/src/project/src/main/java/net/sf/gridarta/ trunk/src/project/src/main/java/net/sf/gridarta/project/ trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectFactory.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java trunk/src/project/src/main/resources/ trunk/src/project/src/test/ trunk/src/project/src/test/java/ trunk/src/project/src/test/resources/ trunk/src/project/src/test/resources/log4j.properties Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/build.xml 2013-10-14 21:08:54 UTC (rev 9432) @@ -114,6 +114,14 @@ <pathelement location="${build.dir}/plugin/test"/> </path> + <path id="path.class.project.app"> + <pathelement location="${build.dir}/project/app"/> + </path> + <path id="path.class.project.test"> + <path refid="path.class.project.app"/> + <pathelement location="${build.dir}/project/test"/> + </path> + <path id="path.class.textedit.app"> <pathelement location="${build.dir}/textedit/app"/> </path> @@ -193,6 +201,7 @@ <fileset dir="${build.dir}/model/app"/> <fileset dir="${build.dir}/preferences/app"/> <fileset dir="${build.dir}/plugin/app"/> + <fileset dir="${build.dir}/project/app"/> <fileset dir="${build.dir}/textedit/app"/> <fileset dir="${build.dir}/utils/app"/> <fileset dir="${build.dir}" includes="build.properties"/> @@ -231,6 +240,7 @@ <fileset dir="${build.dir}/model/app"/> <fileset dir="${build.dir}/preferences/app"/> <fileset dir="${build.dir}/plugin/app"/> + <fileset dir="${build.dir}/project/app"/> <fileset dir="${build.dir}/textedit/app"/> <fileset dir="${build.dir}/utils/app"/> <fileset dir="${build.dir}" includes="build.properties"/> @@ -269,6 +279,7 @@ <fileset dir="${build.dir}/model/app"/> <fileset dir="${build.dir}/preferences/app"/> <fileset dir="${build.dir}/plugin/app"/> + <fileset dir="${build.dir}/project/app"/> <fileset dir="${build.dir}/textedit/app"/> <fileset dir="${build.dir}/utils/app"/> <fileset dir="${build.dir}" includes="build.properties"/> @@ -315,13 +326,14 @@ </echoproperties> </target> - <target name="compile-atrinik" description="Compiles the atrinik module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-utils"> + <target name="compile-atrinik" description="Compiles the atrinik module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-project,compile-utils"> <mkdir dir="${build.dir}/atrinik/app"/> <javac srcdir="src/atrinik/src/main/java" destdir="${build.dir}/atrinik/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <path refid="path.class.gridarta.app"/> <path refid="path.class.model.app"/> <path refid="path.class.plugin.app"/> + <path refid="path.class.project.app"/> <path refid="path.class.utils.app"/> <path refid="path.lib.annotations"/> <path refid="path.lib.japi-swing-action"/> @@ -352,13 +364,14 @@ </copy> </target> - <target name="compile-crossfire" description="Compiles the crossfire module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-utils"> + <target name="compile-crossfire" description="Compiles the crossfire module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-project,compile-utils"> <mkdir dir="${build.dir}/crossfire/app"/> <javac srcdir="src/crossfire/src/main/java" destdir="${build.dir}/crossfire/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <path refid="path.class.gridarta.app"/> <path refid="path.class.model.app"/> <path refid="path.class.plugin.app"/> + <path refid="path.class.project.app"/> <path refid="path.class.utils.app"/> <path refid="path.lib.annotations"/> <path refid="path.lib.japi-swing-action"/> @@ -389,13 +402,14 @@ </copy> </target> - <target name="compile-daimonin" description="Compiles the daimonin module." depends="compile-gridarta,compile-model,compile-plugin,compile-utils"> + <target name="compile-daimonin" description="Compiles the daimonin module." depends="compile-gridarta,compile-model,compile-plugin,compile-project,compile-utils"> <mkdir dir="${build.dir}/daimonin/app"/> <javac srcdir="src/daimonin/src/main/java" destdir="${build.dir}/daimonin/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <path refid="path.class.gridarta.app"/> <path refid="path.class.model.app"/> <path refid="path.class.plugin.app"/> + <path refid="path.class.project.app"/> <path refid="path.class.utils.app"/> <path refid="path.lib.annotations"/> <path refid="path.lib.japi-swing-action"/> @@ -424,13 +438,14 @@ </copy> </target> - <target name="compile-gridarta" description="Compiles the gridarta module." depends="compile-model,compile-preferences,compile-plugin,compile-textedit,compile-utils"> + <target name="compile-gridarta" description="Compiles the gridarta module." depends="compile-model,compile-preferences,compile-plugin,compile-project,compile-textedit,compile-utils"> <mkdir dir="${build.dir}/gridarta/app"/> <javac srcdir="src/gridarta/src/main/java" destdir="${build.dir}/gridarta/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <path refid="path.class.model.app"/> <path refid="path.class.preferences.app"/> <path refid="path.class.plugin.app"/> + <path refid="path.class.project.app"/> <path refid="path.class.textedit.app"/> <path refid="path.class.utils.app"/> <path refid="path.lib.annotations"/> @@ -562,6 +577,33 @@ </copy> </target> + <target name="compile-project" description="Compiles the project module." depends="compile-model,compile-utils"> + <mkdir dir="${build.dir}/project/app"/> + <javac srcdir="src/project/src/main/java" destdir="${build.dir}/project/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> + <classpath> + <path refid="path.class.model.app"/> + <path refid="path.class.utils.app"/> + <path refid="path.lib.annotations"/> + <path refid="path.lib.japi-swing-action"/> + <path refid="path.lib.log4j"/> + </classpath> + <compilerarg line="${javac.args}"/> + </javac> + <copy todir="${build.dir}/project/app"> + <fileset dir="src/project/src/main/resources"/> + </copy> + <mkdir dir="${build.dir}/project/test"/> + <javac srcdir="src/project/src/test/java" destdir="${build.dir}/project/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> + <classpath> + <path refid="path.class.project.app"/> + </classpath> + <compilerarg line="${javac.args}"/> + </javac> + <copy todir="${build.dir}/project/test"> + <fileset dir="src/project/src/test/resources"/> + </copy> + </target> + <target name="compile-textedit" description="Compiles the textedit module." depends="compile-utils"> <mkdir dir="${build.dir}/textedit/app"/> <javac srcdir="src/textedit/src/main/java" destdir="${build.dir}/textedit/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> @@ -680,6 +722,7 @@ <path refid="path.class.model.test"/> <path refid="path.class.preferences.test"/> <path refid="path.class.plugin.test"/> + <path refid="path.class.project.test"/> <path refid="path.class.textedit.test"/> <path refid="path.class.utils.test"/> </sourcepath> @@ -697,6 +740,8 @@ <packageset dir="src/preferences/src/test/java" defaultexcludes="yes"/> <packageset dir="src/plugin/src/main/java" defaultexcludes="yes"/> <packageset dir="src/plugin/src/test/java" defaultexcludes="yes"/> + <packageset dir="src/project/src/main/java" defaultexcludes="yes"/> + <packageset dir="src/project/src/test/java" defaultexcludes="yes"/> <packageset dir="src/textedit/src/main/java" defaultexcludes="yes"/> <packageset dir="src/textedit/src/test/java" defaultexcludes="yes"/> <packageset dir="src/utils/src/main/java" defaultexcludes="yes"/> @@ -884,6 +929,8 @@ <fileset dir="src/preferences/src/test/java" includes="**/*.java"/> <fileset dir="src/plugin/src/main/java" includes="**/*.java"/> <fileset dir="src/plugin/src/test/java" includes="**/*.java"/> + <fileset dir="src/project/src/main/java" includes="**/*.java"/> + <fileset dir="src/project/src/test/java" includes="**/*.java"/> <fileset dir="src/textedit/src/main/java" includes="**/*.java"/> <fileset dir="src/textedit/src/test/java" includes="**/*.java"/> <fileset dir="src/utils/src/main/java" includes="**/*.java"/> @@ -923,6 +970,7 @@ <path refid="path.class.model.test"/> <path refid="path.class.preferences.test"/> <path refid="path.class.plugin.test"/> + <path refid="path.class.project.test"/> <path refid="path.class.textedit.test"/> <path refid="path.class.utils.test"/> </sourcepath> @@ -940,6 +988,8 @@ <packageset dir="src/preferences/src/test/java" defaultexcludes="yes"/> <packageset dir="src/plugin/src/main/java" defaultexcludes="yes"/> <packageset dir="src/plugin/src/test/java" defaultexcludes="yes"/> + <packageset dir="src/project/src/main/java" defaultexcludes="yes"/> + <packageset dir="src/project/src/test/java" defaultexcludes="yes"/> <packageset dir="src/textedit/src/main/java" defaultexcludes="yes"/> <packageset dir="src/textedit/src/test/java" defaultexcludes="yes"/> <packageset dir="src/utils/src/main/java" defaultexcludes="yes"/> @@ -974,7 +1024,7 @@ <target name="test" description="Executes all tests." depends="test-junit,test-mapvalidator-atrinik,test-mapvalidator-crossfire,test-mapvalidator-daimonin"/> - <target name="test-junit" description="Executes the junit tests." depends="test-atrinik,test-crossfire,test-daimonin,test-gridarta,test-model,test-preferences,test-plugin,test-textedit,test-utils"> + <target name="test-junit" description="Executes the junit tests." depends="test-atrinik,test-crossfire,test-daimonin,test-gridarta,test-model,test-preferences,test-plugin,test-project,test-textedit,test-utils"> <junitreport todir="${docs.dir}/test"> <fileset dir="${docs.dir}/test"> <include name="TEST-*.xml"/> @@ -1133,6 +1183,23 @@ </junit> </target> + <target name="test-project" depends="compile-project"> + <mkdir dir="${docs.dir}/test"/> + <junit printsummary="no" haltonfailure="yes"> + <classpath> + <path refid="path.class.project.test"/> + </classpath> + <formatter type="plain"/> + <formatter type="xml"/> + <batchtest todir="${docs.dir}/test"> + <fileset dir="${build.dir}/project/test"> + <include name="**/*Test.class"/> + <exclude name="**/*$*"/> + </fileset> + </batchtest> + </junit> + </target> + <target name="test-textedit" depends="compile-textedit"> <mkdir dir="${docs.dir}/test"/> <junit printsummary="no" haltonfailure="yes"> Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/gridarta.ipr 2013-10-14 21:08:54 UTC (rev 9432) @@ -2175,6 +2175,7 @@ <module fileurl="file://$PROJECT_DIR$/src/model/model.iml" filepath="$PROJECT_DIR$/src/model/model.iml" /> <module fileurl="file://$PROJECT_DIR$/src/plugin/plugin.iml" filepath="$PROJECT_DIR$/src/plugin/plugin.iml" /> <module fileurl="file://$PROJECT_DIR$/src/preferences/preferences.iml" filepath="$PROJECT_DIR$/src/preferences/preferences.iml" /> + <module fileurl="file://$PROJECT_DIR$/src/project/project.iml" filepath="$PROJECT_DIR$/src/project/project.iml" /> <module fileurl="file://$PROJECT_DIR$/src/resources/resources.iml" filepath="$PROJECT_DIR$/src/resources/resources.iml" /> <module fileurl="file://$PROJECT_DIR$/src/textedit/textedit.iml" filepath="$PROJECT_DIR$/src/textedit/textedit.iml" /> <module fileurl="file://$PROJECT_DIR$/src/utils/utils.iml" filepath="$PROJECT_DIR$/src/utils/utils.iml" /> Modified: trunk/settings.gradle =================================================================== --- trunk/settings.gradle 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/settings.gradle 2013-10-14 21:08:54 UTC (rev 9432) @@ -7,6 +7,7 @@ include 'src:model' include 'src:plugin' include 'src:preferences' +include 'src:project' include 'src:resources' include 'src:textedit' include 'src:utils' Modified: trunk/src/atrinik/atrinik.iml =================================================================== --- trunk/src/atrinik/atrinik.iml 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/atrinik/atrinik.iml 2013-10-14 21:08:54 UTC (rev 9432) @@ -14,6 +14,7 @@ <orderEntry type="module" module-name="gridarta" /> <orderEntry type="module" module-name="model" /> <orderEntry type="module" module-name="plugin" /> + <orderEntry type="module" module-name="project" /> <orderEntry type="module" module-name="resources" /> <orderEntry type="module" module-name="utils" /> <orderEntry type="library" name="annotations" level="project" /> Modified: trunk/src/atrinik/build.gradle =================================================================== --- trunk/src/atrinik/build.gradle 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/atrinik/build.gradle 2013-10-14 21:08:54 UTC (rev 9432) @@ -10,6 +10,7 @@ compile name: 'log4j', version: '1.2.13' compile project(':src:gridarta') compile project(':src:model') + compile project(':src:project') compile project(':src:resources') runtime name: 'bsh-classgen', version: '2.0b4' runtime name: 'bsh-commands', version: '2.0b4' Modified: trunk/src/crossfire/build.gradle =================================================================== --- trunk/src/crossfire/build.gradle 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/crossfire/build.gradle 2013-10-14 21:08:54 UTC (rev 9432) @@ -10,6 +10,7 @@ compile name: 'log4j', version: '1.2.13' compile project(':src:gridarta') compile project(':src:model') + compile project(':src:project') compile project(':src:resources') runtime name: 'bsh-classgen', version: '2.0b4' runtime name: 'bsh-commands', version: '2.0b4' Modified: trunk/src/crossfire/crossfire.iml =================================================================== --- trunk/src/crossfire/crossfire.iml 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/crossfire/crossfire.iml 2013-10-14 21:08:54 UTC (rev 9432) @@ -14,6 +14,7 @@ <orderEntry type="module" module-name="gridarta" /> <orderEntry type="module" module-name="model" /> <orderEntry type="module" module-name="plugin" /> + <orderEntry type="module" module-name="project" /> <orderEntry type="module" module-name="resources" /> <orderEntry type="module" module-name="utils" /> <orderEntry type="library" name="annotations" level="project" /> Modified: trunk/src/daimonin/build.gradle =================================================================== --- trunk/src/daimonin/build.gradle 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/daimonin/build.gradle 2013-10-14 21:08:54 UTC (rev 9432) @@ -10,6 +10,7 @@ compile name: 'log4j', version: '1.2.13' compile project(':src:gridarta') compile project(':src:model') + compile project(':src:project') compile project(':src:resources') runtime name: 'bsh-classgen', version: '2.0b4' runtime name: 'bsh-commands', version: '2.0b4' Modified: trunk/src/daimonin/daimonin.iml =================================================================== --- trunk/src/daimonin/daimonin.iml 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/daimonin/daimonin.iml 2013-10-14 21:08:54 UTC (rev 9432) @@ -14,6 +14,7 @@ <orderEntry type="module" module-name="gridarta" /> <orderEntry type="module" module-name="model" /> <orderEntry type="module" module-name="plugin" /> + <orderEntry type="module" module-name="project" /> <orderEntry type="module" module-name="resources" /> <orderEntry type="module" module-name="utils" /> <orderEntry type="library" name="annotations" level="project" /> Modified: trunk/src/gridarta/build.gradle =================================================================== --- trunk/src/gridarta/build.gradle 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/gridarta/build.gradle 2013-10-14 21:08:54 UTC (rev 9432) @@ -16,6 +16,7 @@ compile project(':src:model') compile project(':src:plugin') compile project(':src:preferences') + compile project(':src:project') compile project(':src:textedit') compile project(':src:utils') testCompile name: 'junit', version: '4.2' Modified: trunk/src/gridarta/gridarta.iml =================================================================== --- trunk/src/gridarta/gridarta.iml 2013-10-14 18:54:27 UTC (rev 9431) +++ trunk/src/gridarta/gridarta.iml 2013-10-14 21:08:54 UTC (rev 9432) @@ -14,6 +14,7 @@ <orderEntry type="module" module-name="model" /> <orderEntry type="module" module-name="preferences" /> <orderEntry type="module" module-name="plugin" /> + <orderEntry type="module" module-name="project" /> <orderEntry type="module" module-name="textedit" /> <orderEntry type="module" module-name="utils" /> <orderEntry type="library" name="annotations" level="project" /> 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-14 18:54:27 UTC (rev 9431) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-14 21:08:54 UTC (rev 9432) @@ -19,68 +19,15 @@ package net.sf.gridarta.maincontrol; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Collections; -import java.util.Map; -import javax.xml.parsers.DocumentBuilder; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.archetypeset.ArchetypeSet; -import net.sf.gridarta.model.archetypetype.ArchetypeAttributeFactory; -import net.sf.gridarta.model.archetypetype.ArchetypeAttributeParser; import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; -import net.sf.gridarta.model.archetypetype.ArchetypeTypeParser; 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.configsource.ConfigSource; 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.gameobject.GameObject; -import net.sf.gridarta.model.gameobject.GameObjectFactory; -import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.maparchobject.MapArchObject; -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.ProjectSettings; -import net.sf.gridarta.model.spells.ArchetypeSetSpellLoader; -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.spells.XMLSpellLoader; -import net.sf.gridarta.model.treasurelist.TreasureListsParser; -import net.sf.gridarta.model.treasurelist.TreasureTreeNode; -import net.sf.gridarta.model.validation.DelegatingMapValidator; -import net.sf.gridarta.model.validation.NoSuchValidatorException; -import net.sf.gridarta.model.validation.ValidatorPreferences; -import net.sf.gridarta.model.validation.checks.ArchetypeTypeChecks; -import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.model.validation.checks.EnvironmentChecker; -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.utils.CommonConstants; -import net.sf.gridarta.utils.IOUtils; -import net.sf.gridarta.utils.StringUtils; -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; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; /** * MainControl is a central class that's used for access on global data @@ -89,96 +36,7 @@ */ public class DefaultMainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - /** - * The Logger for printing log messages. - */ @NotNull - private static final Category log = Logger.getLogger(DefaultMainControl.class); - - /** - * 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 validatorPreferences the validator preferences to use - * @param mapWriter the map writer for writing temporary map files - * @return the map validators - */ - @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); - final AttributeRangeChecker<G, A, R> attributeRangeChecker = editorFactory.loadAttributeRangeChecker(validators, new ErrorViewCollector(errorView, new File("GameObjectMatchers.xml")), projectSettings, gameObjectMatchers, validatorPreferences); - 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"); - if (noSpellsMatcher != null) { - final GameObjectMatcher blockedMatcher = gameObjectMatchers.getMatcher("system_blocked", "blocked"); - validators.addValidator(new ShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, noSpellsMatcher, blockedMatcher)); - } - - final GameObjectMatcher paidItemMatcher = gameObjectMatchers.getMatcher("system_paid_item"); - if (paidItemMatcher != null) { - validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, paidItemMatcher)); - } - } - return validators; - } - - @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)); - try { - final GameObjectMatchersParser gameObjectMatchersParser = new GameObjectMatchersParser(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); - gameObjectMatchersParser.readGameObjectMatchers(url, gameObjectMatchers, gameObjectMatchersErrorViewCollector); - } finally { - xmlHelper.getDocumentBuilder().setErrorHandler(null); - } - } catch (final IOException ex) { - gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); - } - return gameObjectMatchers; - } - - @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); - try { - final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); - 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(), 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 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 ArchetypeTypeSet archetypeTypeSet) { final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); final ArchetypeTypeList eventTypeSet; @@ -191,124 +49,4 @@ return editorFactory.newScriptArchUtils(eventTypeSet); } - 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..."); - } - configSource.read(projectSettings, resources, errorView); - addArchetypes(archetypeChooserModel, archetypeSet); - if (log.isInfoEnabled()) { - log.info("Archetype loading took " + (double) (System.currentTimeMillis() - timeStart) / 1000.0 + " seconds."); - } - } - - @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 - 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 numberSpells; - } - - try { - final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), spellFile); - final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); - final DocumentBuilder documentBuilder = xmlHelper.getDocumentBuilder(); - documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(errorViewCollector, ErrorViewCategory.SPELLS_FILE_INVALID)); - try { - XMLSpellLoader.load(errorViewCollector, url, documentBuilder, numberSpells); - } finally { - documentBuilder.setErrorHandler(null); - } - } catch (final FileNotFoundException ex) { - 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) { - for (final R archetype : archetypeSet.getArchetypes()) { - final CharSequence editorFolder = archetype.getEditorFolder(); - if (editorFolder != null && !editorFolder.equals(GameObject.EDITOR_FOLDER_INTERN)) { - final String[] tmp = StringUtils.PATTERN_SLASH.split(editorFolder, 2); - if (tmp.length == 2) { - final String panelName = tmp[0]; - final String folderName = tmp[1]; - archetypeChooserModel.addArchetype(panelName, folderName, archetype); - } - } - } - } - - @NotNull - 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"); - final ErrorViewCollector treasureListsErrorViewCollector = new ErrorViewCollector(errorView, url); - try { - final InputStream inputStream = url.openStream(); - try { - documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(treasureListsErrorViewCollector, ErrorViewCategory.TREASURES_FILE_INVALID)); - try { - final Document specialTreasureListsDocument = documentBuilder.parse(new InputSource(inputStream)); - specialTreasureLists = TreasureListsParser.parseTreasureLists(specialTreasureListsDocument); - } finally { - documentBuilder.setErrorHandler(null); - } - } finally { - inputStream.close(); - } - } catch (final IOException ex) { - treasureListsErrorViewCollector.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, ex.getMessage()); - specialTreasureLists = Collections.emptyMap(); - } catch (final SAXException ex) { - treasureListsErrorViewCollector.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, ex.getMessage()); - specialTreasureLists = Collections.emptyMap(); - } - } catch (final FileNotFoundException ex) { - errorView.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, "TreasureLists.xml: " + ex.getMessage()); - specialTreasureLists = Collections.emptyMap(); - } - return specialTreasureLists; - } - - /** - * Creates map validators from preferences. - * @param validators the validators to add the newly created validators to - * @param validatorFactory the validator factory for creating new - * validators - * @param errorView the error view to add error messages to - */ - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadValidators(@NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ValidatorFactory<G, A, R> validatorFactory, @NotNull final ErrorView errorView) { - final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - int id = 0; - while (true) { - final String spec = actionBuilder.getString("validator." + id); - if (spec == null) { - break; - } - try { - validators.addValidator(validatorFactory.newValidator(spec)); - } catch (final NoSuchValidatorException ex) { - errorView.addWarning(ErrorViewCategory.MAP_VALIDATOR_ENTRY_INVALID, id, ex.getMessage()); - } - id++; - } - if (log.isInfoEnabled()) { - log.info("Loaded " + id + " map validators."); - } - } - } 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 18:54:27 UTC (rev 9431) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-10-14 21:08:54 UTC (rev 9432) @@ -32,39 +32,24 @@ 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.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetype.ArchetypeFactory; 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.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; -import net.sf.gridarta.model.face.ArchFaceProvider; 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.AbstractArchetypeParser; import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.io.GameObjectParserFactory; -import net.sf.gridarta.model.io.MapArchObjectParserFactory; -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.mapcontrol.MapControlFactory; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; -import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; -import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; @@ -72,8 +57,7 @@ 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; +import net.sf.gridarta.project.ProjectFactory; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; @@ -85,52 +69,9 @@ * A factory to create editor-dependent objects. * @author Andreas Kirschbaum */ -public interface EditorFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public interface EditorFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ProjectFactory<G, A, R> { /** - * Returns the offset for drawing double faces. - * @return the offset - */ - int getDoubleFaceOffset(); - - /** - * Creates a new {@link MapArchObjectFactory} instance. - * @param projectSettings the project settings to use - * @return the new instance - */ - @NotNull - MapArchObjectFactory<A> newMapArchObjectFactory(@NotNull ProjectSettings projectSettings); - - /** - * Creates a new {@link MapArchObjectParserFactory} instance. - * @return the new instance - */ - @NotNull - MapArchObjectParserFactory<A> newMapArchObjectParserFactory(); - - /** - * Creates a new {@link GameObjectFactory} instance. - * @param faceObjectProviders the face object providers to use - * @param animationObjects the animation objects for looking up animations - * @param archetypeTypeSet the archetype type set for looking up archetype - * types - * @return the new instance - */ - @NotNull - GameObjectFactory<G, A, R> newGameObjectFactory(@NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeTypeSet archetypeTypeSet); - - /** - * Creates a new {@link GameObjectParserFactory} instance. - * @param gameObjectFactory the game object parser factory to use - * @param archetypeSet the archetype set for looking up archetypes - * @param archetypeTypeSet the archetype type set for sorting attributes on - * save - * @return the new instance - */ - @NotNull - GameObjectParserFactory<G, A, R> newGameObjectParserFactory(@NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet); - - /** * Creates a new {@link ProjectSettings} instance. * @param editorSettings the editor settings instance for default values * @return the new instance @@ -139,66 +80,6 @@ ProjectSettings newProjectSettings(@NotNull EditorSettings editorSettings); /** - * Creates a new {@link ArchetypeFactory} instance. - * @param faceObjectProviders the face object providers for looking up - * faces - * @param animationObjects the animation objects for looking up animations - * @return the new instance - */ - @NotNull - ArchetypeFactory<G, A, R> newArchetypeFactory(@NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects); - - /** - * Creates a new {@link ArchetypeSet} instance. - * @param projectSettings the project settings to use - * @param archetypeFactory the archetype factory to use - * @return the new instance - */ - @NotNull - ArchetypeSet<G, A, R> newArchetypeSet(@NotNull ProjectSettings projectSettings, @NotNull ArchetypeFactory<G, A, R> archetypeFactory); - - /** - * Creates a new {@link MapControlFactory} instance. - * @param mapWriter the map writer to use - * @param projectSettings the project settings to use - * @param mapModelFactory the map model factory to use - * @return the new instance - */ - @NotNull - MapControlFactory<G, A, R> newMapControlFactory(@NotNull MapWriter<G, A, R> mapWriter, @NotNull ProjectSettings projectSettings, @NotNull MapModelFactory<G, A, R> mapModelFactory); - - /** - * Returns whether the face file contains face numbers. - * @return whether the face file contains face numbers - */ - boolean getIncludeFaceNumbers(); - - /** - * 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 validatorPreferences the validator preferences to use - * @return the loaded attribute range checker - */ - @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. - * @param errorView the error view for reporting errors - * @param gameObjectParser the game object parser to use - * @param animationObjects the animation objects to use - * @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, @NotNull SmoothFaces smoothFaces); - - /** * Creates a new {@link ScriptArchUtils} instance. * @param eventTypes the event types to use * @return the new instance @@ -301,23 +182,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 AbstractResources} instance. - * @param gameObjectParser the game object parser to use - * @param archetypeSet the archetype set to use - * @param archetypeParser the archetype parser to use - * @param mapViewSettings the map view settings to use - * @param faceObjects the face objects to use - * @param animationObjects the animation objects to use - * @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, @NotNull SmoothFaces smoothFaces); - - /** * Creates the "open in client" action. Does nothing if this editor does not * support this action. * @param mapViewManager the map view manager for tracking the current map @@ -330,25 +194,6 @@ 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(); - - /** - * Returns the spell file name to load. - * @return the spell file name or {@code null} to not load numbered spells - */ - @Nullable - String getSpellFile(); - - /** - * Returns the archetype type for game object spells. - * @return the archetype type or {@code 0} to not load game object spells - */ - int getSpellType(); - - /** * Returns the {@link FileFilter} for script files. * @return the file filter */ 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 18:54:27 UTC (rev 9431) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-10-14 21:08:54 UTC (rev 9432) @@ -169,52 +169,32 @@ import net.sf.gridarta.gui.utils.tabbedpanel.Tab; import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.mainactions.MainActions; -import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.AnimationValidator; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypechooser.DisplayMode; -import net.sf.gridarta.model.archetypeset.ArchetypeSet; 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.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.DefaultExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitMatcher; -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.MapReaderFactory; 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.InsertionModeSet; -import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; -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.TypeNrsGameObjectMatcher; import net.sf.gridarta.model.pickmapsettings.DefaultPickmapSettings; import net.sf.gridarta.model.pickmapsettings.PickmapSettings; -import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.settings.DefaultVolatileSettings; import net.sf.gridarta.model.settings.EditorSettings; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.settings.VolatileSettings; -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.plugin.PluginModel; +import net.sf.gridarta.project.ProjectModel; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; import net.sf.gridarta.updater.UpdaterManager; @@ -258,6 +238,12 @@ private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** + * The {@link ProjectModel} to edit. + */ + @NotNull + private final ProjectModel<G, A, R> projectModel; + + /** * The main window's {@link JFrame}. */ @NotNull @@ -301,12 +287,6 @@ private final DefaultFileControl<G, A, R> fileControl; /** - * The {@link ArchetypeSet} instance. - */ - @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; - - /** * The {@link UpdaterManager} instance. */ @NotNull @@ -314,84 +294,64 @@ /** * Creates a new instance. - * @param mapManager the map manager instance - * @param pickmapManager the pickmap manager instance - * @param archetypeSet the archetype set instance - * @param faceObjects the face objects instance + * @param projectModel the project model to edit * @param projectSettings the project settings instance * @param editorSettings the editor settings instance - * @param mapViewSettings the map view settings instance - * @param mapModelFactory the map model factory instance - * @param mapReaderFactory the map reader factory instance - * @param mapArchObjectFactory the map arch object factory instance - * @param treasureTree the treasure tree instance - * @param archetypeTypeSet the archetype type set instance - * @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 guiUtils the gui utils for creating icons * @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 * @param scriptedEventEditor the scripted event editor instance * @param scriptArchDataUtils the script arch data utils instance * @param scriptArchUtils the script arch utils instance * @param editorFactory the editor factory instance - * @param faceObjectProviders the face object providers for looking up - * faces - * @param gameObjectFactory the game object factory instance * @param pathManager the path manager for converting path names - * @param gameObjectSpells the game object spells instance - * @param numberSpells the numbered spells instance * @param systemIcons the system icons for creating icons * @param configSourceFactory the config source factory instance - * @param topmostInsertionMode the "topmost" insertion mode instance * @param rendererFactory the renderer factory instance * @param filterControl the filter control 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, 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; + 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); - mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, mapManager, pickmapManager); + 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>(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); + final DisplayMode<G, A, R> displayModeGameObjectNames = new DisplayNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); + final DisplayMode<G, A, R> displayModeArchetypeNames = new ArchetypeNameCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); + final DisplayMode<G, A, R> displayModeIconsOnly = new ArchetypeIconCellRenderer<G, A, R>(projectModel.getFaceObjectProviders()); final ExitConnectorModel exitConnectorModel = new De... [truncated message content] |
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-13 19:59:16
|
Revision: 9430 http://sourceforge.net/p/gridarta/code/9430 Author: akirschbaum Date: 2013-10-13 19:59:09 +0000 (Sun, 13 Oct 2013) Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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-13 19:55:38 UTC (rev 9429) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-13 19:59:09 UTC (rev 9430) @@ -533,7 +533,7 @@ System.out.println(" --config=config-file use given config file; uses " + (defaultConfig == null ? "Java preferences" : "~/.gridarta/" + defaultConfig) + " is not given"); System.out.println(" --noexit do not call System.exit()"); System.out.println(" --plugin=name [arg=value...]"); - System.out.println(" run a plugin with the given arguments"); + System.out.println(" run a plugin with the given arguments"); } } 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-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-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-09 21:30:42
|
Revision: 9426 http://sourceforge.net/p/gridarta/code/9426 Author: akirschbaum Date: 2013-10-09 21:30:39 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Properly initialize map validators. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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:29:05 UTC (rev 9425) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 21:30:39 UTC (rev 9426) @@ -303,10 +303,10 @@ 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); - DefaultMainControl.loadArchetypeTypeSet(errorView, projectSettings, archetypeTypeSet, xmlHelper); final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, archetypeTypeSet); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); final AutojoinLists<G, A, R> autojoinLists = AutojoinListsParser.loadList(errorView, archetypeSet, mapViewSettings, projectSettings.getConfigurationDirectory()); 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:29:07
|
Revision: 9425 http://sourceforge.net/p/gridarta/code/9425 Author: akirschbaum Date: 2013-10-09 21:29:05 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Remove unused type parameters. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.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:26:40 UTC (rev 9424) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 21:29:05 UTC (rev 9425) @@ -157,7 +157,7 @@ return gameObjectMatchers; } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadArchetypeTypeSet(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final XmlHelper xmlHelper) { + public static void loadArchetypeTypeSet(@NotNull final ErrorView errorView, @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); 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:26:49
|
Revision: 9424 http://sourceforge.net/p/gridarta/code/9424 Author: akirschbaum Date: 2013-10-09 21:26:40 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Extract code into function. 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 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:23:22 UTC (rev 9423) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 21:26:40 UTC (rev 9424) @@ -157,8 +157,7 @@ return gameObjectMatchers; } - @NotNull - 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) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void loadArchetypeTypeSet(@NotNull final ErrorView errorView, @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); @@ -175,6 +174,10 @@ } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } + } + + @NotNull + 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 ArchetypeTypeSet archetypeTypeSet) { final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); final ArchetypeTypeList eventTypeSet; if (eventTypeSetTmp == null) { 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:23:22 UTC (rev 9423) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-09 21:26:40 UTC (rev 9424) @@ -306,7 +306,8 @@ 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); + DefaultMainControl.loadArchetypeTypeSet(errorView, projectSettings, archetypeTypeSet, xmlHelper); + final ScriptArchUtils scriptArchUtils = DefaultMainControl.loadScriptArchUtils(errorView, editorFactory, archetypeTypeSet); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); 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); 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:23:28
|
Revision: 9423 http://sourceforge.net/p/gridarta/code/9423 Author: akirschbaum Date: 2013-10-09 21:23:22 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.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 20:35:11 UTC (rev 9422) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-10-09 21:23:22 UTC (rev 9423) @@ -162,7 +162,6 @@ final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); - ArchetypeTypeList eventTypeSet = null; try { final URL url = IOUtils.getResource(projectSettings.getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); final ErrorViewCollector typesErrorViewCollector = new ErrorViewCollector(errorView, url); @@ -173,17 +172,16 @@ } finally { xmlHelper.getDocumentBuilder().setErrorHandler(null); } - final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); - if (eventTypeSetTmp == null) { - typesErrorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "list 'list_event' does not exist"); - } else { - eventTypeSet = eventTypeSetTmp; - } } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - if (eventTypeSet == null) { + final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); + final ArchetypeTypeList eventTypeSet; + if (eventTypeSetTmp == null) { + errorView.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "list 'list_event' does not exist"); eventTypeSet = new ArchetypeTypeList(); + } else { + eventTypeSet = eventTypeSetTmp; } return editorFactory.newScriptArchUtils(eventTypeSet); } 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 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:04:19
|
Revision: 9420 http://sourceforge.net/p/gridarta/code/9420 Author: akirschbaum Date: 2013-10-09 20:04:13 +0000 (Wed, 09 Oct 2013) Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 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:02:44 UTC (rev 9419) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-10-09 20:04:13 UTC (rev 9420) @@ -408,7 +408,8 @@ * {@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 } 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 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-08 22:18:22
|
Revision: 9417 http://sourceforge.net/p/gridarta/code/9417 Author: akirschbaum Date: 2013-10-08 22:18:18 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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 22:12:11 UTC (rev 9416) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 22:18:18 UTC (rev 9417) @@ -255,8 +255,6 @@ final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final EditorSettings editorSettings = new DefaultEditorSettings(); - final ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); - final PathManager pathManager = new PathManager(projectSettings); final FaceObjects faceObjects = new DefaultFaceObjects(editorFactory.getIncludeFaceNumbers()); editorFactory.initSmoothFaces(faceObjects); final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); @@ -267,6 +265,22 @@ 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>(); + 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 { + 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 ProjectSettings projectSettings = editorFactory.newProjectSettings(editorSettings); + final PathManager pathManager = new PathManager(projectSettings); final ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(projectSettings, archetypeFactory); @@ -285,23 +299,10 @@ }); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(projectSettings); - final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); 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 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); - final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); - 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 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); 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-08 22:05:09
|
Revision: 9415 http://sourceforge.net/p/gridarta/code/9415 Author: akirschbaum Date: 2013-10-08 22:05:05 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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 22:01:05 UTC (rev 9414) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 22:05:05 UTC (rev 9415) @@ -265,15 +265,17 @@ 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>(); + final ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); + 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 ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); 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 ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); DefaultMainControl.loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); + faceObjectProviders.addFaceObjectProvidersListener(new FaceObjectProvidersListener() { @Override 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:01:08
|
Revision: 9414 http://sourceforge.net/p/gridarta/code/9414 Author: akirschbaum Date: 2013-10-08 22:01:05 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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:55:59 UTC (rev 9413) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 22:01:05 UTC (rev 9414) @@ -266,6 +266,14 @@ final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); 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 ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); + 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 ConfigSource configSource = mode == GridartaRunMode.COLLECT_ARCHES ? configSourceFactory.getFilesConfigSource() : configSourceFactory.getConfigSource(projectSettings.getConfigSourceName()); + DefaultMainControl.loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); faceObjectProviders.addFaceObjectProvidersListener(new FaceObjectProvidersListener() { @Override @@ -274,12 +282,9 @@ } }); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet, archetypeTypeSet); - final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(projectSettings); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); 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 MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); final PluginModel<G, A, R> pluginModel = new PluginModel<G, A, R>(); @@ -287,9 +292,6 @@ final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(validatorPreferences); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectSettings); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); - 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 XmlHelper xmlHelper; try { @@ -299,13 +301,11 @@ //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException 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 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); - DefaultMainControl.loadArchetypes(errorView, projectSettings, archetypeSet, archetypeChooserModel, resources, configSource); final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); 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); 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 21:47:09
|
Revision: 9412 http://sourceforge.net/p/gridarta/code/9412 Author: akirschbaum Date: 2013-10-08 21:47:05 +0000 (Tue, 08 Oct 2013) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.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:45:01 UTC (rev 9411) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-10-08 21:47:05 UTC (rev 9412) @@ -308,6 +308,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 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); @@ -321,9 +322,6 @@ 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()); 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); 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. |