From: <aki...@us...> - 2011-10-15 19:58:59
|
Revision: 9023 http://gridarta.svn.sourceforge.net/gridarta/?rev=9023&view=rev Author: akirschbaum Date: 2011-10-15 19:58:52 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Move MapGrid creation out of AbstractMapViewBasic. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -50,8 +50,8 @@ * Creates a new instance. * @param mapModel the map model to use */ - protected AbstractMapViewBasic(@NotNull final MapModel<G, A, R> mapModel) { - mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); + protected AbstractMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid) { + this.mapGrid = mapGrid; mapCursor = new MapCursor(mapGrid); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -159,8 +159,8 @@ * @param yScrollDistance the y distance when scrolling * @param rendererFactory the renderer factory to use */ - public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory) { - super(mapModel); + public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid) { + super(mapModel, mapGrid); this.mapModel = mapModel; scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (isPickmap) { Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -26,6 +26,8 @@ import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -84,7 +86,8 @@ @NotNull @Override public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapControl.getMapModel(), mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory), pathManager); + final MapModel<G,A,R> mapModel = mapControl.getMapModel(); + final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, new MapGrid(mapModel.getMapArchObject().getMapSize())), pathManager); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -24,6 +24,7 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; @@ -37,8 +38,8 @@ * Creates a new instance. * @param mapModel the map model to use */ - public TestMapViewBasic(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel) { - super(mapModel); + public TestMapViewBasic(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final MapGrid mapGrid) { + super(mapModel, mapGrid); } /** Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -24,6 +24,8 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,7 +41,8 @@ @NotNull @Override public MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapControl.getMapModel()); + final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapModel, new MapGrid(mapModel.getMapArchObject().getMapSize())); return new TestMapView(mapControl, mapViewBasic); } Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 19:50:20 UTC (rev 9022) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 19:58:52 UTC (rev 9023) @@ -39,6 +39,8 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import org.jetbrains.annotations.NotNull; @@ -61,7 +63,8 @@ */ @NotNull public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapControl.getMapModel()); + final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapModel, new MapGrid(mapModel.getMapArchObject().getMapSize())); return new TestMapView(mapControl, mapViewBasic); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 20:02:30
|
Revision: 9024 http://gridarta.svn.sourceforge.net/gridarta/?rev=9024&view=rev Author: akirschbaum Date: 2011-10-15 20:02:23 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) @@ -24,7 +24,6 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; -import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; /** @@ -48,9 +47,8 @@ /** * Creates a new instance. - * @param mapModel the map model to use */ - protected AbstractMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid) { + protected AbstractMapViewBasic(@NotNull final MapGrid mapGrid) { this.mapGrid = mapGrid; mapCursor = new MapCursor(mapGrid); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) @@ -160,7 +160,7 @@ * @param rendererFactory the renderer factory to use */ public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid) { - super(mapModel, mapGrid); + super(mapGrid); this.mapModel = mapModel; scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (isPickmap) { Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 19:58:52 UTC (rev 9023) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) @@ -25,7 +25,6 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapgrid.MapGrid; -import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; /** @@ -36,10 +35,9 @@ /** * Creates a new instance. - * @param mapModel the map model to use */ - public TestMapViewBasic(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final MapGrid mapGrid) { - super(mapModel, mapGrid); + public TestMapViewBasic(@NotNull final MapGrid mapGrid) { + super(mapGrid); } /** Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 19:58:52 UTC (rev 9023) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 20:02:23 UTC (rev 9024) @@ -42,7 +42,7 @@ @Override 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 MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapModel, new MapGrid(mapModel.getMapArchObject().getMapSize())); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(new MapGrid(mapModel.getMapArchObject().getMapSize())); return new TestMapView(mapControl, mapViewBasic); } Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 19:58:52 UTC (rev 9023) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 20:02:23 UTC (rev 9024) @@ -64,7 +64,7 @@ @NotNull public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapModel, new MapGrid(mapModel.getMapArchObject().getMapSize())); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(new MapGrid(mapModel.getMapArchObject().getMapSize())); return new TestMapView(mapControl, mapViewBasic); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 20:05:27
|
Revision: 9025 http://gridarta.svn.sourceforge.net/gridarta/?rev=9025&view=rev Author: akirschbaum Date: 2011-10-15 20:05:20 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Move MapCursor creation out of AbstractMapViewBasic. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -48,9 +48,9 @@ /** * Creates a new instance. */ - protected AbstractMapViewBasic(@NotNull final MapGrid mapGrid) { + protected AbstractMapViewBasic(@NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { this.mapGrid = mapGrid; - mapCursor = new MapCursor(mapGrid); + this.mapCursor = mapCursor; } /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -159,8 +159,8 @@ * @param yScrollDistance the y distance when scrolling * @param rendererFactory the renderer factory to use */ - public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid) { - super(mapGrid); + public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + super(mapGrid, mapCursor); this.mapModel = mapModel; scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (isPickmap) { Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.japi.swing.action.ActionBuilder; @@ -87,7 +88,8 @@ @Override public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, final int viewCounter) { final MapModel<G,A,R> mapModel = mapControl.getMapModel(); - final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, new MapGrid(mapModel.getMapArchObject().getMapSize())), pathManager); + final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); + final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, mapGrid, new MapCursor(mapGrid)), pathManager); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -24,6 +24,7 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; import org.jetbrains.annotations.NotNull; @@ -36,8 +37,8 @@ /** * Creates a new instance. */ - public TestMapViewBasic(@NotNull final MapGrid mapGrid) { - super(mapGrid); + public TestMapViewBasic(@NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + super(mapGrid, mapCursor); } /** Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -24,6 +24,7 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; @@ -42,7 +43,8 @@ @Override 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 MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(new MapGrid(mapModel.getMapArchObject().getMapSize())); + final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapGrid, new MapCursor(mapGrid)); return new TestMapView(mapControl, mapViewBasic); } Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 20:02:23 UTC (rev 9024) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 20:05:20 UTC (rev 9025) @@ -39,6 +39,7 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; +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.mapmodel.TestMapModelCreator; @@ -64,7 +65,8 @@ @NotNull public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(new MapGrid(mapModel.getMapArchObject().getMapSize())); + final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapGrid, new MapCursor(mapGrid)); return new TestMapView(mapControl, mapViewBasic); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 20:09:14
|
Revision: 9026 http://gridarta.svn.sourceforge.net/gridarta/?rev=9026&view=rev Author: akirschbaum Date: 2011-10-15 20:09:08 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove AbstractMapViewBasic. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) @@ -1,74 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapview; - -import net.sf.gridarta.model.archetype.Archetype; -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.mapgrid.MapGrid; -import org.jetbrains.annotations.NotNull; - -/** - * Abstract base class for {@link MapViewBasic} implementations. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public abstract class AbstractMapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapViewBasic<G, A, R> { - - /** - * The {@link MapGrid} of this view. - */ - @NotNull - private final MapGrid mapGrid; - - /** - * The {@link MapCursor} of this view. - */ - @NotNull - private final MapCursor mapCursor; - - /** - * Creates a new instance. - */ - protected AbstractMapViewBasic(@NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { - this.mapGrid = mapGrid; - this.mapCursor = mapCursor; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapGrid getMapGrid() { - return mapGrid; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapCursor getMapCursor() { - return mapCursor; - } - -} // class AbstractMapViewBasic Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) @@ -54,9 +54,21 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public class DefaultMapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapViewBasic<G, A, R> { +public class DefaultMapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapViewBasic<G,A,R> { /** + * The {@link MapGrid} of this view. + */ + @NotNull + private final MapGrid mapGrid; + + /** + * The {@link MapCursor} of this view. + */ + @NotNull + private final MapCursor mapCursor; + + /** * The {@link MapModel} to display. */ @NotNull @@ -158,9 +170,12 @@ * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param rendererFactory the renderer factory to use + * @param mapGrid the map grid for this instance + * @param mapCursor the map cursor for this instance */ public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { - super(mapGrid, mapCursor); + this.mapGrid = mapGrid; + this.mapCursor = mapCursor; this.mapModel = mapModel; scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (isPickmap) { @@ -172,9 +187,9 @@ scrollPane.getHorizontalScrollBar().setUnitIncrement(xScrollDistance); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - getMapCursor().addMapCursorListener(mapCursorListener); + mapCursor.addMapCursorListener(mapCursorListener); - renderer = isPickmap ? rendererFactory.newPickmapRenderer(mapModel, getMapGrid()) : rendererFactory.newMapRenderer(mapModel, getMapGrid()); + renderer = isPickmap ? rendererFactory.newPickmapRenderer(mapModel, mapGrid) : rendererFactory.newMapRenderer(mapModel, mapGrid); scrollPane.setViewportView(renderer); if (initial != null) { scrollPane.getViewport().setViewPosition(initial); @@ -193,7 +208,7 @@ @Override public void closeNotify() { renderer.closeNotify(); - getMapCursor().removeMapCursorListener(mapCursorListener); + mapCursor.removeMapCursorListener(mapCursorListener); scrollPane.setViewportView(null); mapModel.removeMapModelListener(mapModelListener); } @@ -222,7 +237,6 @@ */ private void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { erroneousMapSquares.clear(); - final MapGrid mapGrid = getMapGrid(); mapGrid.beginTransaction(); try { mapGrid.clearErrors(); @@ -241,4 +255,22 @@ } } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapGrid getMapGrid() { + return mapGrid; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapCursor getMapCursor() { + return mapCursor; + } + } // class DefaultMapViewBasic Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:05:20 UTC (rev 9025) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) @@ -32,13 +32,28 @@ * A {@link MapViewBasic} implementation for regression tests. * @author Andreas Kirschbaum */ -public class TestMapViewBasic extends AbstractMapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> { +public class TestMapViewBasic implements MapViewBasic<TestGameObject,TestMapArchObject,TestArchetype> { /** + * The {@link MapGrid} of this view. + */ + @NotNull + private final MapGrid mapGrid; + + /** + * The {@link MapCursor} of this view. + */ + @NotNull + private final MapCursor mapCursor; + + /** * Creates a new instance. + * @param mapGrid the map grid for this instance + * @param mapCursor the map cursor for this instance */ public TestMapViewBasic(@NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { - super(mapGrid, mapCursor); + this.mapGrid = mapGrid; + this.mapCursor = mapCursor; } /** @@ -66,4 +81,22 @@ throw new AssertionError(); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapGrid getMapGrid() { + return mapGrid; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapCursor getMapCursor() { + return mapCursor; + } + } // class TestMapViewBasic This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 20:24:28
|
Revision: 9027 http://gridarta.svn.sourceforge.net/gridarta/?rev=9027&view=rev Author: akirschbaum Date: 2011-10-15 20:24:20 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Move MapViewBasic.getMapGrid() and getMapCursor() to MapView. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/panel/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -163,7 +163,7 @@ gbcField.gridwidth = GridBagConstraints.REMAINDER; coordinatesPanel.setBorder(new CompoundBorder(new TitledBorder(new EtchedBorder()), GUIConstants.DIALOG_BORDER)); - final Point point = mapView.getMapViewBasic().getMapCursor().getLocation(); + final Point point = mapView.getMapCursor().getLocation(); coordinatesPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "goLocationX"), gbcLabel); xCoordinateField.setText(point == null ? "0" : Integer.toString(point.x)); @@ -222,7 +222,7 @@ return false; } - mapView.getMapViewBasic().getMapCursor().setLocation(point); + mapView.getMapCursor().setLocation(point); return true; } Modified: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -615,7 +615,7 @@ final boolean deleteOnly = replaceWithBox.getSelectedIndex() == REPLACE_WITH_NOTHING; final boolean entireMap = replaceEntireBox.getSelectedIndex() == REPLACE_ON_MAP; - if (!entireMap && mapView.getMapViewBasic().getMapGrid().getSelectedRec() == null) { + if (!entireMap && mapView.getMapGrid().getSelectedRec() == null) { // user selected "replace highlighted" but nothing is highlighted ACTION_BUILDER.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapModel().getMapArchObject().getMapName()); return false; Modified: trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -23,7 +23,6 @@ import javax.swing.Action; import net.sf.gridarta.actions.ExitConnectorActions; import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.model.archetype.Archetype; @@ -207,11 +206,11 @@ */ private void setCurrentMapView(@Nullable final MapView<G, A, R> currentMapView) { if (this.currentMapView != null) { - this.currentMapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + this.currentMapView.getMapCursor().removeMapCursorListener(mapCursorListener); } this.currentMapView = currentMapView; if (this.currentMapView != null) { - this.currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + this.currentMapView.getMapCursor().addMapCursorListener(mapCursorListener); } refreshActions(); } @@ -237,8 +236,7 @@ return false; } - final MapViewBasic<G, A, R> mapViewBasic = mapView.getMapViewBasic(); - final MapCursor mapCursor = mapViewBasic.getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); if (!mapCursor.isActive()) { // no active cursor ==> no location to remember return false; @@ -260,7 +258,7 @@ return false; } - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); if (!mapCursor.isActive()) { return false; } @@ -280,7 +278,7 @@ return false; } - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); if (!mapCursor.isActive()) { return false; } Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -93,7 +93,7 @@ public MouseOpEvent(@NotNull final MapView<G, A, R> mapView) { super(""); this.mapView = mapView; - mapCursor = mapView.getMapViewBasic().getMapCursor(); + mapCursor = mapView.getMapCursor(); mapControl = mapView.getMapControl(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -179,7 +179,7 @@ return; } - mapView.getMapViewBasic().getMapCursor().setLocation(point2); + mapView.getMapCursor().setLocation(point2); } /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -312,13 +312,13 @@ @Override public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + currentMapView.getMapCursor().removeMapCursorListener(mapCursorListener); assert currentMapView != null; currentMapView.getMapControl().getMapModel().getMapArchObject().removeMapArchObjectListener(mapArchObjectListener); } currentMapView = mapView; if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + currentMapView.getMapCursor().addMapCursorListener(mapCursorListener); assert currentMapView != null; currentMapView.getMapControl().getMapModel().getMapArchObject().addMapArchObjectListener(mapArchObjectListener); } @@ -410,7 +410,7 @@ mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + currentMapView.getMapCursor().addMapCursorListener(mapCursorListener); assert currentMapView != null; currentMapView.getMapControl().getMapModel().getMapArchObject().addMapArchObjectListener(mapArchObjectListener); } @@ -576,7 +576,7 @@ * @param direction the direction to search */ private void selectExit(@NotNull final MapView<G, A, R> mapView, final int xStart, final int yStart, final int direction) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); final int width = mapSize.getWidth(); @@ -848,7 +848,7 @@ final GameObject<G, A, R> exit; final GameObject<G, A, R> selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); if (selectedExit == null) { - final GameObject<G, A, R> cursorExit = exitMatcher.getValidExit(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getMapCursor().getLocation()); + final GameObject<G, A, R> cursorExit = exitMatcher.getValidExit(mapView.getMapControl().getMapModel(), mapView.getMapCursor().getLocation()); if (cursorExit == null) { return false; } @@ -879,7 +879,7 @@ } if (performAction) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); final Point cursorLocation = mapCursor.getLocation(); if (cursorLocation == null) { selectExit(mapView, -1, 0, 1); @@ -903,7 +903,7 @@ } if (performAction) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); final Point cursorLocation = mapCursor.getLocation(); if (cursorLocation == null) { final Size2D mapSize = mapView.getMapControl().getMapModel().getMapArchObject().getMapSize(); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.archetype.Archetype; 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.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -52,13 +53,21 @@ private final MapGrid mapGrid; /** + * The {@link MapCursor} of this map view. + */ + @NotNull + private final MapCursor mapCursor; + + /** * Creates a new instance. * @param mapModel the map model of this map view * @param mapGrid the map grid of this map view + * @param mapCursor the map cursor of this map view */ - protected AbstractMapView(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid) { + protected AbstractMapView(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { this.mapModel = mapModel; this.mapGrid = mapGrid; + this.mapCursor = mapCursor; } /** @@ -112,4 +121,22 @@ return objects.get(RandomUtils.rnd.nextInt(objects.size())); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapGrid getMapGrid() { + return mapGrid; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapCursor getMapCursor() { + return mapCursor; + } + } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -35,6 +35,8 @@ import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlListener; +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.mapmodel.MapModelListener; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -171,9 +173,11 @@ * @param number each view of a map will get a number * @param mapViewBasic the underlying map view object * @param pathManager the path manager for converting path names + * @param mapGrid the map grid for this map view + * @param mapCursor the map cursor for this map view */ - public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final MapViewBasic<G, A, R> mapViewBasic, @NotNull final PathManager pathManager) { - super(mapControl.getMapModel(), mapViewBasic.getMapGrid()); + public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final MapViewBasic<G, A, R> mapViewBasic, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + super(mapControl.getMapModel(), mapGrid, mapCursor); internalFrame = new JInternalFrame(getWindowTitle(mapControl, number, pathManager), true, true, true, true); this.mapControl = mapControl; this.number = number; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -126,7 +126,7 @@ /** {@inheritDoc} */ @Override public void mapSizeChanged(@NotNull final Size2D newSize) { - getMapGrid().resize(newSize); + mapGrid.resize(newSize); } /** {@inheritDoc} */ @@ -255,22 +255,4 @@ } } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapGrid getMapGrid() { - return mapGrid; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapCursor getMapCursor() { - return mapCursor; - } - } // class DefaultMapViewBasic Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -89,7 +89,7 @@ public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, final int viewCounter) { final MapModel<G,A,R> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, mapGrid, new MapCursor(mapGrid)), pathManager); + final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, mapGrid, new MapCursor(mapGrid)), pathManager, mapGrid, new MapCursor(mapGrid)); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -26,6 +26,8 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcursor.MapCursor; +import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapmodel.MapSquare; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -108,4 +110,18 @@ @NotNull List<MapSquare<G, A, R>> getSelectedSquares(); + /** + * Returns the {@link MapGrid} of this view. + * @return the map grid of this view + */ + @NotNull + MapGrid getMapGrid(); + + /** + * Returns the {@link MapCursor} of this view. + * @return the map cursor of this view + */ + @NotNull + MapCursor getMapCursor(); + } // interface MapView Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -24,8 +24,6 @@ import net.sf.gridarta.model.archetype.Archetype; 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.mapgrid.MapGrid; import org.jetbrains.annotations.NotNull; /** @@ -36,20 +34,6 @@ public interface MapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * Returns the {@link MapGrid} of this view. - * @return the map grid of this view - */ - @NotNull - MapGrid getMapGrid(); - - /** - * Returns the {@link MapCursor} of this view. - * @return the map cursor of this view - */ - @NotNull - MapCursor getMapCursor(); - - /** * Must be called when this renderer is not used anymore. It un-registers * all listeners. */ Modified: trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -171,13 +171,13 @@ /** {@inheritDoc} */ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + mapView.getMapCursor().addMapCursorListener(mapCursorListener); } /** {@inheritDoc} */ @Override public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + mapView.getMapCursor().removeMapCursorListener(mapCursorListener); } }; @@ -409,7 +409,7 @@ */ @Nullable private MapCursor getActiveMapCursor(@NotNull final MapView<G, A, R> mapView) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); return mapCursor.isActive() ? mapCursor : null; } Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -160,13 +160,26 @@ * file has not been loaded */ @Nullable - public MapViewBasic<G, A, R> getView() { + public MapViewBasic<G, A, R> getMapViewBasic() { synchronized (sync) { return pickmapView == null ? null : pickmapView.getMapViewBasic(); } } /** + * Returns the {@link MapView} instance for this pickmap. Returns + * <code>null</code> unless {@link #loadPickmap()} was successfully called. + * @return the <code>MapView</code> instance, or <code>null if the map file + * has not been loaded + */ + @Nullable + public MapView<G, A, R> getMapView() { + synchronized (sync) { + return pickmapView; + } + } + + /** * Loads the pickmap from the underlying map file. * @throws IOException if the map file cannot be loaded */ Modified: trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -111,7 +111,7 @@ * @return whether shifting is possible */ public boolean canShift(@NotNull final Direction dir) { - mapGrid = mapView.getMapViewBasic().getMapGrid(); + mapGrid = mapView.getMapGrid(); selRec = mapGrid.getSelectedRec(); if (selRec == null) { return false; Modified: trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -395,18 +395,18 @@ private void setCurrentMapView(@Nullable final MapView<G, A, R> mapView) { if (this.mapView != null) { - this.mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + this.mapView.getMapCursor().removeMapCursorListener(mapCursorListener); this.mapView.getMapViewBasic().getRenderer().removeMouseMotionListener(mouseMotionListener); } this.mapView = mapView; if (this.mapView != null) { - this.mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + this.mapView.getMapCursor().addMapCursorListener(mapCursorListener); this.mapView.getMapViewBasic().getRenderer().addMouseMotionListener(mouseMotionListener); } - mapCursorChanged(mapView == null ? null : mapView.getMapViewBasic().getMapCursor()); + mapCursorChanged(mapView == null ? null : mapView.getMapCursor()); mouse.setText(""); } Modified: trunk/src/app/net/sf/gridarta/gui/panel/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/connectionview/Control.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/connectionview/Control.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -105,7 +105,7 @@ return; } - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final MapGrid mapGrid = mapView.getMapGrid(); mapGrid.unSelect(); final Point point = new Point(); Modified: trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -381,7 +381,7 @@ final MapView<G, A, R> mapView = mapViewsManager.getMapViewFrame(mapControl); if (mapView != null) { final ErrorCollector<G, A, R> errorCollector = mapControl.getMapModel().getErrors(); - setErrors(mapView.getMapViewBasic().getMapCursor(), errorCollector); + setErrors(mapView.getMapCursor(), errorCollector); return; } } Modified: trunk/src/app/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -30,7 +30,7 @@ import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; +import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.mapfiles.MapFile; import net.sf.gridarta.gui.panel.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserModel; @@ -109,10 +109,10 @@ private MapFile<G, A, R> activeMapFile = null; /** - * The map view of {@link #activeMapFile}. + * The {@link MapView} of {@link #activeMapFile}. */ @Nullable - private MapViewBasic<G, A, R> activePickmapView = null; + private MapView<G, A, R> activePickmapView = null; /** * The last reported selection. @@ -389,7 +389,7 @@ * Updates the display state after {@link #activeMapFile} has changed. */ private void updateActivePickmap() { - activePickmapView = activeMapFile != null ? activeMapFile.getView() : null; + activePickmapView = activeMapFile != null ? activeMapFile.getMapView() : null; updatePickmapInfo(activePickmapView == null ? null : activePickmapView.getMapCursor()); } Modified: trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -294,7 +294,7 @@ final MapFile<G, A, R> mapFile = getSelectedPickmap(); final MapControl<G, A, R> mapControl = mapFile == null ? null : mapFile.getPickmap(); if (mapControl != null) { - mapViewsManager.getMapViewFrame(mapControl).getMapViewBasic().getMapCursor().deactivate(); + mapViewsManager.getMapViewFrame(mapControl).getMapCursor().deactivate(); } pickmapChooserModel.fireActivePickmapChanged(mapFile); } Modified: trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -211,7 +211,7 @@ } final int index = pickmapChooserModel.addMapFile(mapFile); - final MapViewBasic<G, A, R> mapViewBasic = mapFile.getView(); + final MapViewBasic<G, A, R> mapViewBasic = mapFile.getMapViewBasic(); pickmapPanel.insertTab(getTitle(mapFile), null, mapViewBasic == null ? null : mapViewBasic.getScrollPane(), null, index); } @@ -237,7 +237,7 @@ return; } pickmapPanel.setTitleAt(index, getTitle(mapFile)); - final MapViewBasic<G, A, R> mapViewBasic = mapFile.getView(); + final MapViewBasic<G, A, R> mapViewBasic = mapFile.getMapViewBasic(); pickmapPanel.setComponentAt(index, mapViewBasic == null ? null : mapViewBasic.getScrollPane()); } Modified: trunk/src/app/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -274,13 +274,13 @@ /** {@inheritDoc} */ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + mapView.getMapCursor().addMapCursorListener(mapCursorListener); } /** {@inheritDoc} */ @Override public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + mapView.getMapCursor().removeMapCursorListener(mapCursorListener); final MapSquareSelection<G, A, R> closedMapSquare = mapSquareSelectionCache.find(mapView); if (selectedSquareModel.getSelectedMapSquare() == closedMapSquare) { Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -33,7 +33,6 @@ import net.sf.gridarta.gui.copybuffer.CopyBuffer; import net.sf.gridarta.gui.dialog.replace.ReplaceDialogManager; import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.misc.ShiftProcessor; @@ -534,15 +533,15 @@ /** {@inheritDoc} */ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapGrid().addMapGridListener(mapGridListener); - mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + mapView.getMapGrid().addMapGridListener(mapGridListener); + mapView.getMapCursor().addMapCursorListener(mapCursorListener); } /** {@inheritDoc} */ @Override public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); - mapView.getMapViewBasic().getMapGrid().removeMapGridListener(mapGridListener); + mapView.getMapCursor().removeMapCursorListener(mapCursorListener); + mapView.getMapGrid().removeMapGridListener(mapGridListener); } }; @@ -937,7 +936,7 @@ */ @Nullable private MapView<G, A, R> getSelection() { - return currentMapView != null && currentMapView.getMapViewBasic().getMapGrid().getSelectedRec() != null ? currentMapView : null; + return currentMapView != null && currentMapView.getMapGrid().getSelectedRec() != null ? currentMapView : null; } /** @@ -969,7 +968,7 @@ return false; } - final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + final Rectangle selectedRec = mapView.getMapGrid().getSelectedRec(); if (selectedRec == null) { return false; } @@ -992,7 +991,7 @@ return false; } - final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + final Rectangle selectedRec = mapView.getMapGrid().getSelectedRec(); if (selectedRec == null) { return false; } @@ -1015,7 +1014,7 @@ return false; } - final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + final Rectangle selectedRec = mapView.getMapGrid().getSelectedRec(); if (selectedRec == null) { return false; } @@ -1038,7 +1037,7 @@ return false; } - final Point startLocation = mapView.getMapViewBasic().getMapCursor().getLocation(); + final Point startLocation = mapView.getMapCursor().getLocation(); if (startLocation == null) { return false; } @@ -1065,7 +1064,7 @@ return false; } - final Point startLocation = mapView.getMapViewBasic().getMapCursor().getLocation(); + final Point startLocation = mapView.getMapCursor().getLocation(); if (startLocation == null) { return false; } @@ -1079,14 +1078,14 @@ return false; } - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final MapGrid mapGrid = mapView.getMapGrid(); final Rectangle selectedRec = mapGrid.getSelectedRec(); if (selectedRec == null) { return false; } if (performAction) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); final Point cursorLocation = mapCursor.getLocation(); final Point origin = cursorLocation == null ? selectedRec.getLocation() : cursorLocation; copyBuffer.pasteTiled(mapView, selectedSquares, origin); @@ -1243,8 +1242,7 @@ return false; } - final MapViewBasic<G, A, R> mapViewBasic = mapView.getMapViewBasic(); - final MapCursor mapCursor = mapViewBasic.getMapCursor(); + final MapCursor mapCursor = mapView.getMapCursor(); final Point mapCursorLocation = mapCursor.getLocation(); if (mapCursorLocation == null) { return false; @@ -1268,7 +1266,7 @@ } if (performAction) { - currentMapView.getMapViewBasic().getMapGrid().selectAll(); + currentMapView.getMapGrid().selectAll(); } return true; @@ -1285,7 +1283,7 @@ } if (performAction) { - currentMapView.getMapViewBasic().getMapGrid().invertSelection(); + currentMapView.getMapGrid().invertSelection(); } return true; @@ -1315,7 +1313,7 @@ } if (performAction) { - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final MapGrid mapGrid = mapView.getMapGrid(); final Map<MapSquare<G, A, R>, Void> newSelection = new IdentityHashMap<MapSquare<G, A, R>, Void>(); Map<MapSquare<G, A, R>, Void> todo = new IdentityHashMap<MapSquare<G, A, R>, Void>(); for (final MapSquare<G, A, R> mapSquare : selectedSquares) { @@ -1379,7 +1377,7 @@ } if (performAction) { - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final MapGrid mapGrid = mapView.getMapGrid(); final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); final MapArchObject<A> mapArchObject = mapModel.getMapArchObject(); final Point point = new Point(); @@ -1421,7 +1419,7 @@ } if (performAction) { - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final MapGrid mapGrid = mapView.getMapGrid(); final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); final MapArchObject<A> mapArchObject = mapModel.getMapArchObject(); final Point point = new Point(); Modified: trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -77,7 +77,7 @@ // select + cut final CopyBuffer<TestGameObject, TestMapArchObject, TestArchetype> copyBuffer = TestMapControlCreatorUtils.newCopyBuffer(testMapControlCreator); final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = TestMapControlCreatorUtils.newMapView(mapControl); - mapView.getMapViewBasic().getMapGrid().select(new Point(1, 1), new Point(1, 1), SelectionMode.ADD); + mapView.getMapGrid().select(new Point(1, 1), new Point(1, 1), SelectionMode.ADD); copyBuffer.cut(mapView, new Rectangle(1, 1, 1, 1)); TestMapModelHelper.checkMapContents(mapModel, "||", "||", "||"); Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -27,6 +27,8 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcursor.MapCursor; +import net.sf.gridarta.model.mapgrid.MapGrid; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,9 +54,11 @@ * Creates a new instance. * @param mapControl the controller of this view * @param mapViewBasic the underlying map view object + * @param mapGrid the map grid for this map view + * @param mapCursor the map cursor for this map view */ - public TestMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic) { - super(mapControl.getMapModel(), mapViewBasic.getMapGrid()); + public TestMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + super(mapControl.getMapModel(), mapGrid, mapCursor); this.mapControl = mapControl; this.mapViewBasic = mapViewBasic; } Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -24,8 +24,6 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.mapcursor.MapCursor; -import net.sf.gridarta.model.mapgrid.MapGrid; import org.jetbrains.annotations.NotNull; /** @@ -35,28 +33,6 @@ public class TestMapViewBasic implements MapViewBasic<TestGameObject,TestMapArchObject,TestArchetype> { /** - * The {@link MapGrid} of this view. - */ - @NotNull - private final MapGrid mapGrid; - - /** - * The {@link MapCursor} of this view. - */ - @NotNull - private final MapCursor mapCursor; - - /** - * Creates a new instance. - * @param mapGrid the map grid for this instance - * @param mapCursor the map cursor for this instance - */ - public TestMapViewBasic(@NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { - this.mapGrid = mapGrid; - this.mapCursor = mapCursor; - } - - /** * {@inheritDoc} */ @Override @@ -81,22 +57,4 @@ throw new AssertionError(); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapGrid getMapGrid() { - return mapGrid; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapCursor getMapCursor() { - return mapCursor; - } - } // class TestMapViewBasic Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -44,8 +44,8 @@ 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()); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapGrid, new MapCursor(mapGrid)); - return new TestMapView(mapControl, mapViewBasic); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(); + return new TestMapView(mapControl, mapViewBasic, mapGrid, new MapCursor(mapGrid)); } } // class TestMapViewFactory Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 20:09:08 UTC (rev 9026) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 20:24:20 UTC (rev 9027) @@ -66,8 +66,8 @@ public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(mapGrid, new MapCursor(mapGrid)); - return new TestMapView(mapControl, mapViewBasic); + final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(); + return new TestMapView(mapControl, mapViewBasic, mapGrid, new MapCursor(mapGrid)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 21:34:39
|
Revision: 9033 http://gridarta.svn.sourceforge.net/gridarta/?rev=9033&view=rev Author: akirschbaum Date: 2011-10-15 21:34:32 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Move MapViewBasic.getRenderer() to MapView. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -26,6 +26,8 @@ import java.util.Set; import javax.swing.JInternalFrame; import javax.swing.WindowConstants; +import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; +import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -88,6 +90,12 @@ private final PathManager pathManager; /** + * The {@link AbstractMapRenderer} for rendering the map model. + */ + @NotNull + private final AbstractMapRenderer<G, A, R> renderer; + + /** * The {@link MapModelListener} used to detect changes in the map model that * should be reflected in the window title. */ @@ -175,14 +183,16 @@ * @param pathManager the path manager for converting path names * @param mapGrid the map grid for this map view * @param mapCursor the map cursor for this map view + * @param renderer the map renderer for rendering the map model */ - public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final MapViewBasic<G, A, R> mapViewBasic, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final MapViewBasic<G, A, R> mapViewBasic, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor, final AbstractMapRenderer<G, A, R> renderer) { super(mapControl.getMapModel(), mapGrid, mapCursor); internalFrame = new JInternalFrame(getWindowTitle(mapControl, number, pathManager), true, true, true, true); this.mapControl = mapControl; this.number = number; this.mapViewBasic = mapViewBasic; this.pathManager = pathManager; + this.renderer = renderer; final MapModel<G, A, R> mapModel = mapControl.getMapModel(); mapModel.addMapModelListener(mapModelListener); mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); @@ -200,6 +210,7 @@ public void closeNotify() { internalFrame.getContentPane().remove(mapViewBasic.getScrollPane()); mapViewBasic.closeNotify(); + renderer.closeNotify(); mapControl.removeMapControlListener(mapControlListener); final MapModel<G, A, R> mapModel = mapControl.getMapModel(); mapModel.getMapArchObject().removeMapArchObjectListener(mapArchObjectListener); @@ -288,4 +299,13 @@ return internalFrame; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapRenderer getRenderer() { + return renderer; + } + } // class MapView Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -24,8 +24,6 @@ import javax.swing.JViewport; import javax.swing.ScrollPaneConstants; import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; -import net.sf.gridarta.gui.map.renderer.MapRenderer; -import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -57,12 +55,6 @@ private final MapCursorTracker<G, A, R> mapCursorTracker; /** - * The {@link AbstractMapRenderer} for rendering the map model. - */ - @NotNull - private final AbstractMapRenderer<G, A, R> renderer; - - /** * The {@link JScrollPane} for this instance. */ @NotNull @@ -76,14 +68,11 @@ * corner * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling - * @param rendererFactory the renderer factory to use * @param mapGrid the map grid for this instance * @param mapCursor the map cursor for this instance + * @param renderer the map renderer for rendering the map model */ - public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { - renderer = isPickmap ? rendererFactory.newPickmapRenderer(mapModel, mapGrid) : rendererFactory.newMapRenderer(mapModel, mapGrid); - renderer.setFocusable(true); - + public DefaultMapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor, @NotNull final AbstractMapRenderer<G, A, R> renderer) { erroneousMapSquares = new ErroneousMapSquares<G, A, R>(mapModel, mapGrid, renderer); mapCursorTracker = new MapCursorTracker<G, A, R>(mapCursor, renderer); @@ -111,7 +100,6 @@ scrollPane.setViewportView(null); mapCursorTracker.closeNotify(); erroneousMapSquares.closeNotify(); - renderer.closeNotify(); } /** @@ -119,15 +107,6 @@ */ @NotNull @Override - public MapRenderer getRenderer() { - return renderer; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public JScrollPane getScrollPane() { return scrollPane; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map.mapview; import java.awt.Point; +import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -89,7 +90,9 @@ public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, final int viewCounter) { final MapModel<G,A,R> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, rendererFactory, mapGrid, new MapCursor(mapGrid)), pathManager, mapGrid, new MapCursor(mapGrid)); + 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, new DefaultMapViewBasic<G, A, R>(mapModel, mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, mapGrid, new MapCursor(mapGrid), renderer), pathManager, mapGrid, new MapCursor(mapGrid), renderer); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -22,6 +22,7 @@ import java.awt.Component; import java.util.List; import javax.swing.JInternalFrame; +import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -124,4 +125,11 @@ @NotNull MapCursor getMapCursor(); + /** + * Returns the {@link MapRenderer} for this view. + * @return the map renderer + */ + @NotNull + MapRenderer getRenderer(); + } // interface MapView Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.mapview; import javax.swing.JScrollPane; -import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -40,13 +39,6 @@ void closeNotify(); /** - * Returns the {@link MapRenderer} for this view. - * @return the map renderer - */ - @NotNull - MapRenderer getRenderer(); - - /** * Returns the {@link JScrollPane} of this map view basic. * @return the scroll pane */ Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -115,7 +115,7 @@ listener.mapViewCreated(mapView); } if (viewPosition == null && centerSquare != null) { - final Rectangle squareBounds = mapView.getMapViewBasic().getRenderer().getSquareBounds(centerSquare); + final Rectangle squareBounds = mapView.getRenderer().getSquareBounds(centerSquare); final JScrollPane scrollPane = mapView.getMapViewBasic().getScrollPane(); final Dimension extentSize = scrollPane.getViewport().getExtentSize(); final Point centerPoint = new Point(Math.max(0, squareBounds.x + squareBounds.width / 2 - extentSize.width / 2), Math.max(0, squareBounds.y + squareBounds.height / 2 - extentSize.height / 2)); @@ -187,7 +187,7 @@ */ public void repaintAllViews() { for (final MapView<G, A, R> mapView : mapViews) { - mapView.getMapViewBasic().getRenderer().forceRepaint(); + mapView.getRenderer().forceRepaint(); } } Modified: trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -99,7 +99,7 @@ /** {@inheritDoc} */ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - final MapUserListener<G, A, R> mapUserListener = new MapUserListener<G, A, R>(mapView.getMapViewBasic().getRenderer(), toolPalette, mapView); + final MapUserListener<G, A, R> mapUserListener = new MapUserListener<G, A, R>(mapView.getRenderer(), toolPalette, mapView); mapUserListeners.put(mapView, mapUserListener); } Modified: trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -396,14 +396,14 @@ private void setCurrentMapView(@Nullable final MapView<G, A, R> mapView) { if (this.mapView != null) { this.mapView.getMapCursor().removeMapCursorListener(mapCursorListener); - this.mapView.getMapViewBasic().getRenderer().removeMouseMotionListener(mouseMotionListener); + this.mapView.getRenderer().removeMouseMotionListener(mouseMotionListener); } this.mapView = mapView; if (this.mapView != null) { this.mapView.getMapCursor().addMapCursorListener(mapCursorListener); - this.mapView.getMapViewBasic().getRenderer().addMouseMotionListener(mouseMotionListener); + this.mapView.getRenderer().addMouseMotionListener(mouseMotionListener); } mapCursorChanged(mapView == null ? null : mapView.getMapCursor()); Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.List; import javax.swing.JInternalFrame; +import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -140,4 +141,13 @@ throw new AssertionError(); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public MapRenderer getRenderer() { + throw new AssertionError(); + } + } // class TestMapView Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 21:22:37 UTC (rev 9032) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 21:34:32 UTC (rev 9033) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.mapview; import javax.swing.JScrollPane; -import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -44,15 +43,6 @@ */ @NotNull @Override - public MapRenderer getRenderer() { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public JScrollPane getScrollPane() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 21:55:07
|
Revision: 9036 http://gridarta.svn.sourceforge.net/gridarta/?rev=9036&view=rev Author: akirschbaum Date: 2011-10-15 21:54:59 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove MapViewBasic. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -156,7 +156,7 @@ if (destinationPoint != null) { showLocation(newMapView, destinationPoint); } else if (mapView != null) { - newMapView.getMapViewBasic().getScrollPane().getViewport().setViewPosition(calculateNewViewPosition(mapView.getMapViewBasic().getScrollPane(), newMapView.getMapViewBasic().getScrollPane(), direction)); + newMapView.getScrollPane().getViewport().setViewPosition(calculateNewViewPosition(mapView.getScrollPane(), newMapView.getScrollPane(), direction)); } if (mapView != null && ACTION_BUILDER.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -794,7 +794,7 @@ } if (performAction) { - mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getScrollPane().getViewport().getViewPosition(), null); + mapViewsManager.newMapView(mapView.getMapControl(), mapView.getScrollPane().getViewport().getViewPosition(), null); } return true; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -21,10 +21,12 @@ import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Point; import java.beans.PropertyVetoException; import java.io.File; import java.util.Set; import javax.swing.JInternalFrame; +import javax.swing.JScrollPane; import javax.swing.WindowConstants; import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.gui.map.renderer.MapRenderer; @@ -78,12 +80,6 @@ private final int number; /** - * The underlying map view object. - */ - @NotNull - private final MapViewBasic<G, A, R> mapViewBasic; - - /** * The {@link PathManager} for converting path names. */ @NotNull @@ -191,28 +187,30 @@ * Create a new instance. * @param mapControl the controller of this view * @param number each view of a map will get a number - * @param mapViewBasic the underlying map view object * @param pathManager the path manager for converting path names * @param mapGrid the map grid for this map view * @param mapCursor the map cursor for this map view * @param renderer the map renderer for rendering the map model + * @param viewPosition the initial view position to show; null=show top left + * corner + * @param xScrollDistance the x distance when scrolling + * @param yScrollDistance the y distance when scrolling */ - public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final MapViewBasic<G, A, R> mapViewBasic, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor, final AbstractMapRenderer<G, A, R> renderer) { + public DefaultMapView(@NotNull final MapControl<G, A, R> mapControl, final int number, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor, final AbstractMapRenderer<G, A, R> renderer, @Nullable final Point viewPosition, final int xScrollDistance, final int yScrollDistance) { super(mapControl.getMapModel(), mapGrid, mapCursor); internalFrame = new JInternalFrame(getWindowTitle(mapControl, number, pathManager), true, true, true, true); this.mapControl = mapControl; this.number = number; - this.mapViewBasic = mapViewBasic; this.pathManager = pathManager; this.renderer = renderer; final MapModel<G, A, R> mapModel = mapControl.getMapModel(); erroneousMapSquares = new ErroneousMapSquares<G, A, R>(mapModel, mapGrid, renderer); - mapCursorTracker = new MapCursorTracker<G, A, R>(mapCursor, renderer); + mapCursorTracker = new MapCursorTracker<G, A, R>(mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, mapCursor, renderer); mapModel.addMapModelListener(mapModelListener); mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); mapControl.addMapControlListener(mapControlListener); internalFrame.getContentPane().setLayout(new BorderLayout()); - internalFrame.getContentPane().add(mapViewBasic.getScrollPane(), BorderLayout.CENTER); + internalFrame.getContentPane().add(mapCursorTracker.getScrollPane(), BorderLayout.CENTER); internalFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); internalFrame.setAutoscrolls(true); } @@ -222,8 +220,7 @@ */ @Override public void closeNotify() { - internalFrame.getContentPane().remove(mapViewBasic.getScrollPane()); - mapViewBasic.closeNotify(); + internalFrame.getContentPane().remove(mapCursorTracker.getScrollPane()); mapCursorTracker.closeNotify(); erroneousMapSquares.closeNotify(); renderer.closeNotify(); @@ -285,16 +282,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public MapViewBasic<G, A, R> getMapViewBasic() { - return mapViewBasic; - } - - /** - * {@inheritDoc} - */ - @Override public void activate() { try { internalFrame.setSelected(true); @@ -324,4 +312,13 @@ return renderer; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public JScrollPane getScrollPane() { + return mapCursorTracker.getScrollPane(); + } + } // class MapView Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -1,90 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapview; - -import java.awt.Component; -import java.awt.Point; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import javax.swing.ScrollPaneConstants; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.utils.CommonConstants; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Default {@link MapViewBasic} implementation. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public class DefaultMapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapViewBasic<G, A, R> { - - /** - * The {@link JScrollPane} for this instance. - */ - @NotNull - private final JScrollPane scrollPane; - - /** - * Creates a new instance. - * @param isPickmap whether the map model belongs to a pickmap - * @param initial the initial view position to show; null=show top left - * corner - * @param xScrollDistance the x distance when scrolling - * @param yScrollDistance the y distance when scrolling - * @param renderer the map renderer for rendering the map model - */ - public DefaultMapViewBasic(final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final Component renderer) { - scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - if (isPickmap) { - scrollPane.setBackground(CommonConstants.BG_COLOR); - } - - // set the pixel increment scrolling for clicking once on a scroll bar arrow - scrollPane.getVerticalScrollBar().setUnitIncrement(yScrollDistance); - scrollPane.getHorizontalScrollBar().setUnitIncrement(xScrollDistance); - scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setViewportView(renderer); - if (initial != null) { - scrollPane.getViewport().setViewPosition(initial); - } - scrollPane.setFocusable(true); - } - - /** - * {@inheritDoc} - */ - @Override - public void closeNotify() { - scrollPane.setViewportView(null); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public JScrollPane getScrollPane() { - return scrollPane; - } - -} // class DefaultMapViewBasic Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -92,7 +92,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, new DefaultMapViewBasic<G, A, R>(mapControl.isPickmap(), viewPosition, xScrollDistance, yScrollDistance, renderer), pathManager, mapGrid, new MapCursor(mapGrid), renderer); + final MapView<G, A, R> mapView = new DefaultMapView<G, A, R>(mapControl, viewCounter, pathManager, mapGrid, new MapCursor(mapGrid), renderer, viewPosition, xScrollDistance, yScrollDistance); mapView.getInternalFrame().setJMenuBar(ACTION_BUILDER.createMenuBar(false, "mapwindow")); return mapView; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -20,6 +20,9 @@ package net.sf.gridarta.gui.map.mapview; import java.awt.Point; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.ScrollPaneConstants; import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -27,7 +30,9 @@ import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorEvent; import net.sf.gridarta.model.mapcursor.MapCursorListener; +import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Tracks the {@link MapCursor} of map and scrolls the {@link @@ -50,6 +55,12 @@ private final AbstractMapRenderer<G, A, R> renderer; /** + * The {@link JScrollPane} for this instance. + */ + @NotNull + private final JScrollPane scrollPane; + + /** * The {@link MapCursorListener} attached to {@link #mapCursor}. */ @NotNull @@ -71,13 +82,32 @@ /** * Creates a new instance. + * @param isPickmap whether the map model belongs to a pickmap + * @param viewPosition the initial view position to show; null=show top left + * corner + * @param xScrollDistance the x distance when scrolling + * @param yScrollDistance the y distance when scrolling * @param mapCursor the map cursor to track * @param renderer the map renderer to update */ - public MapCursorTracker(@NotNull final MapCursor mapCursor, @NotNull final AbstractMapRenderer<G, A, R> renderer) { + public MapCursorTracker(final boolean isPickmap, @Nullable final Point viewPosition, final int xScrollDistance, final int yScrollDistance, @NotNull final MapCursor mapCursor, @NotNull final AbstractMapRenderer<G, A, R> renderer) { this.mapCursor = mapCursor; this.renderer = renderer; this.mapCursor.addMapCursorListener(mapCursorListener); + scrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + if (isPickmap) { + scrollPane.setBackground(CommonConstants.BG_COLOR); + } + + // set the pixel increment scrolling for clicking once on a scroll bar arrow + scrollPane.getVerticalScrollBar().setUnitIncrement(yScrollDistance); + scrollPane.getHorizontalScrollBar().setUnitIncrement(xScrollDistance); + scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); + scrollPane.setViewportView(renderer); + if (viewPosition != null) { + scrollPane.getViewport().setViewPosition(viewPosition); + } + scrollPane.setFocusable(true); ensureVisibleMapCursor(); } @@ -86,6 +116,7 @@ * all listeners. */ public void closeNotify() { + scrollPane.setViewportView(null); mapCursor.removeMapCursorListener(mapCursorListener); } @@ -99,4 +130,13 @@ } } + /** + * Returns the {@link JScrollPane} of the renderer. + * @return the scroll pane + */ + @NotNull + public JScrollPane getScrollPane() { + return scrollPane; + } + } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -22,6 +22,7 @@ import java.awt.Component; import java.util.List; import javax.swing.JInternalFrame; +import javax.swing.JScrollPane; import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -86,13 +87,6 @@ MapControl<G, A, R> getMapControl(); /** - * Return the associated {@link MapViewBasic}. - * @return the associated <code>MapViewBasic</code> - */ - @NotNull - MapViewBasic<G, A, R> getMapViewBasic(); - - /** * Activate this map view. */ void activate(); @@ -132,4 +126,11 @@ @NotNull MapRenderer getRenderer(); + /** + * Returns the {@link JScrollPane} of this map view. + * @return the scroll pane + */ + @NotNull + JScrollPane getScrollPane(); + } // interface MapView Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -1,48 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapview; - -import javax.swing.JScrollPane; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * MapViewBasic is a view for maps. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public interface MapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * Must be called when this renderer is not used anymore. It un-registers - * all listeners. - */ - void closeNotify(); - - /** - * Returns the {@link JScrollPane} of this map view basic. - * @return the scroll pane - */ - @NotNull - JScrollPane getScrollPane(); - -} // interface MapViewBasic Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -116,7 +116,7 @@ } if (viewPosition == null && centerSquare != null) { final Rectangle squareBounds = mapView.getRenderer().getSquareBounds(centerSquare); - final JScrollPane scrollPane = mapView.getMapViewBasic().getScrollPane(); + final JScrollPane scrollPane = mapView.getScrollPane(); final Dimension extentSize = scrollPane.getViewport().getExtentSize(); final Point centerPoint = new Point(Math.max(0, squareBounds.x + squareBounds.width / 2 - extentSize.width / 2), Math.max(0, squareBounds.y + squareBounds.height / 2 - extentSize.height / 2)); scrollPane.getViewport().setViewPosition(centerPoint); @@ -135,7 +135,7 @@ public Point[] getViewPositions() { final Point[] result = new Point[mapViews.size()]; for (int i = 0; i < result.length; i++) { - result[i] = mapViews.get(i).getMapViewBasic().getScrollPane().getViewport().getViewPosition(); + result[i] = mapViews.get(i).getScrollPane().getViewport().getViewPosition(); } return result; } Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -24,7 +24,6 @@ import java.util.Collection; import java.util.regex.Pattern; import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -154,19 +153,6 @@ } /** - * Returns the {@link MapViewBasic} instance for this pickmap. Returns - * <code>null</code> unless {@link #loadPickmap()} was successfully called. - * @return the <code>MapViewBasic</code> instance, or <code>null if the map - * file has not been loaded - */ - @Nullable - public MapViewBasic<G, A, R> getMapViewBasic() { - synchronized (sync) { - return pickmapView == null ? null : pickmapView.getMapViewBasic(); - } - } - - /** * Returns the {@link MapView} instance for this pickmap. Returns * <code>null</code> unless {@link #loadPickmap()} was successfully called. * @return the <code>MapView</code> instance, or <code>null if the map file Modified: trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/app/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -26,7 +26,7 @@ import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import javax.swing.event.ChangeListener; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; +import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.mapfiles.MapFile; import net.sf.gridarta.gui.mapfiles.MapFolder; import net.sf.gridarta.gui.mapfiles.MapFolderListener; @@ -211,8 +211,8 @@ } final int index = pickmapChooserModel.addMapFile(mapFile); - final MapViewBasic<G, A, R> mapViewBasic = mapFile.getMapViewBasic(); - pickmapPanel.insertTab(getTitle(mapFile), null, mapViewBasic == null ? null : mapViewBasic.getScrollPane(), null, index); + final MapView<G, A, R> mapView = mapFile.getMapView(); + pickmapPanel.insertTab(getTitle(mapFile), null, mapView == null ? null : mapView.getScrollPane(), null, index); } /** @@ -237,8 +237,8 @@ return; } pickmapPanel.setTitleAt(index, getTitle(mapFile)); - final MapViewBasic<G, A, R> mapViewBasic = mapFile.getMapViewBasic(); - pickmapPanel.setComponentAt(index, mapViewBasic == null ? null : mapViewBasic.getScrollPane()); + final MapView<G, A, R> mapView = mapFile.getMapView(); + pickmapPanel.setComponentAt(index, mapView == null ? null : mapView.getScrollPane()); } /** Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.List; import javax.swing.JInternalFrame; +import javax.swing.JScrollPane; import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; @@ -46,22 +47,14 @@ private final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl; /** - * The underlying map view object. - */ - @NotNull - private final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic; - - /** * Creates a new instance. * @param mapControl the controller of this view - * @param mapViewBasic the underlying map view object * @param mapGrid the map grid for this map view * @param mapCursor the map cursor for this map view */ - public TestMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { + public TestMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final MapGrid mapGrid, @NotNull final MapCursor mapCursor) { super(mapControl.getMapModel(), mapGrid, mapCursor); this.mapControl = mapControl; - this.mapViewBasic = mapViewBasic; } /** @@ -119,17 +112,17 @@ /** * {@inheritDoc} */ - @NotNull @Override - public MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> getMapViewBasic() { - return mapViewBasic; + public void activate() { } /** * {@inheritDoc} */ + @NotNull @Override - public void activate() { + public JInternalFrame getInternalFrame() { + throw new AssertionError(); } /** @@ -137,7 +130,7 @@ */ @NotNull @Override - public JInternalFrame getInternalFrame() { + public MapRenderer getRenderer() { throw new AssertionError(); } @@ -146,7 +139,7 @@ */ @NotNull @Override - public MapRenderer getRenderer() { + public JScrollPane getScrollPane() { throw new AssertionError(); } Deleted: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -1,50 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapview; - -import javax.swing.JScrollPane; -import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * A {@link MapViewBasic} implementation for regression tests. - * @author Andreas Kirschbaum - */ -public class TestMapViewBasic implements MapViewBasic<TestGameObject,TestMapArchObject,TestArchetype> { - - /** - * {@inheritDoc} - */ - @Override - public void closeNotify() { - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public JScrollPane getScrollPane() { - throw new AssertionError(); - } - -} // class TestMapViewBasic Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -44,8 +44,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()); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(); - return new TestMapView(mapControl, mapViewBasic, mapGrid, new MapCursor(mapGrid)); + return new TestMapView(mapControl, mapGrid, new MapCursor(mapGrid)); } } // class TestMapViewFactory Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 21:41:26 UTC (rev 9035) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-10-15 21:54:59 UTC (rev 9036) @@ -23,11 +23,9 @@ import java.awt.image.BufferedImage; import net.sf.gridarta.gui.copybuffer.CopyBuffer; import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewFactory; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.mapview.TestMapView; -import net.sf.gridarta.gui.map.mapview.TestMapViewBasic; import net.sf.gridarta.gui.map.mapview.TestMapViewFactory; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.map.renderer.TestRendererFactory; @@ -66,8 +64,7 @@ public static MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { final MapModel<TestGameObject,TestMapArchObject,TestArchetype> mapModel = mapControl.getMapModel(); final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); - final MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype> mapViewBasic = new TestMapViewBasic(); - return new TestMapView(mapControl, mapViewBasic, mapGrid, new MapCursor(mapGrid)); + return new TestMapView(mapControl, mapGrid, new MapCursor(mapGrid)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-05-30 22:17:45
|
Revision: 9245 http://sourceforge.net/p/gridarta/code/9245 Author: akirschbaum Date: 2013-05-30 22:17:39 +0000 (Thu, 30 May 2013) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/errors/ValidationError.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2013-05-30 18:28:46 UTC (rev 9244) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2013-05-30 22:17:39 UTC (rev 9245) @@ -93,7 +93,7 @@ private final JTextField textField; /** - * The {@link RASwitch}. + * The {@link TilePanel.RASwitch}. */ @NotNull private final RASwitch raSwitch; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2013-05-30 18:28:46 UTC (rev 9244) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2013-05-30 22:17:39 UTC (rev 9245) @@ -119,8 +119,8 @@ private final Map<MapView<G, A, R>, WindowAction<G, A, R>> windowActions = new IdentityHashMap<MapView<G, A, R>, WindowAction<G, A, R>>(); /** - * The {@link MapViewFrameListener MapViewFrameListeners} associated with - * {@link MapView MapViews}. Maps map view to listener. + * The {@link MapDesktop.MapViewFrameListener MapViewFrameListeners} + * associated with {@link MapView MapViews}. Maps map view to listener. */ @NotNull private final Map<MapView<G, A, R>, MapViewFrameListener> mapViewFrameListeners = new IdentityHashMap<MapView<G, A, R>, MapViewFrameListener>(); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/validation/errors/ValidationError.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/errors/ValidationError.java 2013-05-30 18:28:46 UTC (rev 9244) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/errors/ValidationError.java 2013-05-30 22:17:39 UTC (rev 9245) @@ -94,14 +94,16 @@ private final List<G> gameObjects = new ArrayList<G>(0); /** - * The {@link Formatter} for formatting {@link MapSquare} instances. + * The {@link ValidationError.MapSquareFormatter} for formatting {@link + * MapSquare} instances. * @serial */ @NotNull private final MapSquareFormatter mapSquareFormatter = new MapSquareFormatter(); /** - * The {@link Formatter} for formatting {@link GameObject} instances. + * The {@link ValidationError.MapSquareFormatter} for formatting {@link + * GameObject} instances. * @serial */ @NotNull This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-05-31 18:12:47
|
Revision: 9255 http://sourceforge.net/p/gridarta/code/9255 Author: akirschbaum Date: 2013-05-31 18:12:42 +0000 (Fri, 31 May 2013) Log Message: ----------- Properly initialize log4j in regression tests. Added Paths: ----------- trunk/src/atrinik/src/test/resources/log4j.properties trunk/src/crossfire/src/test/resources/log4j.properties trunk/src/daimonin/src/test/resources/log4j.properties trunk/src/gridarta/src/test/resources/log4j.properties trunk/src/model/src/test/resources/log4j.properties trunk/src/plugin/src/test/resources/log4j.properties trunk/src/preferences/src/test/resources/log4j.properties trunk/src/textedit/src/test/resources/log4j.properties trunk/src/utils/src/test/resources/log4j.properties Added: trunk/src/atrinik/src/test/resources/log4j.properties =================================================================== --- trunk/src/atrinik/src/test/resources/log4j.properties (rev 0) +++ trunk/src/atrinik/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/atrinik/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/crossfire/src/test/resources/log4j.properties =================================================================== --- trunk/src/crossfire/src/test/resources/log4j.properties (rev 0) +++ trunk/src/crossfire/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/crossfire/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/daimonin/src/test/resources/log4j.properties =================================================================== --- trunk/src/daimonin/src/test/resources/log4j.properties (rev 0) +++ trunk/src/daimonin/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/daimonin/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/test/resources/log4j.properties =================================================================== --- trunk/src/gridarta/src/test/resources/log4j.properties (rev 0) +++ trunk/src/gridarta/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/gridarta/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/model/src/test/resources/log4j.properties =================================================================== --- trunk/src/model/src/test/resources/log4j.properties (rev 0) +++ trunk/src/model/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/model/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/plugin/src/test/resources/log4j.properties =================================================================== --- trunk/src/plugin/src/test/resources/log4j.properties (rev 0) +++ trunk/src/plugin/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/plugin/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/preferences/src/test/resources/log4j.properties =================================================================== --- trunk/src/preferences/src/test/resources/log4j.properties (rev 0) +++ trunk/src/preferences/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/preferences/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/textedit/src/test/resources/log4j.properties =================================================================== --- trunk/src/textedit/src/test/resources/log4j.properties (rev 0) +++ trunk/src/textedit/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/textedit/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/utils/src/test/resources/log4j.properties =================================================================== --- trunk/src/utils/src/test/resources/log4j.properties (rev 0) +++ trunk/src/utils/src/test/resources/log4j.properties 2013-05-31 18:12:42 UTC (rev 9255) @@ -0,0 +1,30 @@ +# +# Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. +# Copyright (C) 2000-2011 The Gridarta Developers. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# Set root logger level to INFO and its only appender to A1. +log4j.rootLogger=INFO, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-5p(%t) %-30c %x - %m%n + +log4j.logger.net.sf.gridarta.model.index.MapsIndexer=WARN Property changes on: trunk/src/utils/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-06-01 10:51:50
|
Revision: 9257 http://sourceforge.net/p/gridarta/code/9257 Author: akirschbaum Date: 2013-06-01 10:51:43 +0000 (Sat, 01 Jun 2013) Log Message: ----------- Replace ArchetypeAttribute.sectionId with ArchetypeAttributeSection class. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimationName.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSection.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-ignoreDefinedAttribute1-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-ignoreImportAttribute1-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-import1-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-import2-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-msgDefault1-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-msgDefault2-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-msgDefault3-result.txt trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-test1-result.txt Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSections.java Removed Paths: ------------- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/SectionNames.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -88,6 +88,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeAttributeLong; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeMapPath; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeScriptFile; +import net.sf.gridarta.model.archetypetype.ArchetypeAttributeSection; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeSpell; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeString; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeText; @@ -960,43 +961,49 @@ public final void buildAttribute() { tabbedPane.removeAll(); final ArchetypeType archetypeType = typesBoxItemListener.getArchetypeType(); - for (int sectionId = 0; sectionId < archetypeType.getSectionNum(); sectionId++) { - final Component panel = makeAttributePanel(sectionId); + int sectionId = 0; + for (final ArchetypeAttributeSection archetypeAttributeSection : archetypeType) { + final Component panel = makeAttributePanel(archetypeAttributeSection); if (panel != null) { - final String sectionName = archetypeType.getSectionName(sectionId); - tabbedPane.addTab(sectionName, null, panel); + final String sectionName = archetypeAttributeSection.getSectionName(); + final String title; + if (sectionName.length() <= 1) { + title = sectionName; + } else { + title = sectionName.substring(0, 1).toUpperCase() + sectionName.substring(1); + } + tabbedPane.addTab(title, null, panel); + sectionId++; } } // set selected tab - tabbedPane.setSelectedIndex(0); + tabbedPane.setSelectedIndex(sectionId > 0 ? 0 : -1); tabbedPane.validate(); } /** * This method creates an attribute panel for one section of attributes. If * the section is empty, null is returned. - * @param sectionId the identifier of the section + * @param archetypeAttributeSection the section * @return a <code>Component</code> containing the attribute panel * (currently always a JScrollPane) */ @Nullable - private Component makeAttributePanel(final int sectionId) { + private Component makeAttributePanel(@NotNull final Iterable<ArchetypeAttribute> archetypeAttributeSection) { int matchingAttributes = 0; // number of attributes in this section boolean hasBitmask = false; // true if this section contains a bitmask attribute // first we check how many attributes this section has - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { - if (archetypeAttribute.getSectionId() == sectionId) { - // count number of attributes - if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) { - matchingAttributes++; - } - // check for bitmask attributes - if (!hasBitmask && archetypeAttribute instanceof ArchetypeAttributeBitmask) { - hasBitmask = true; - } + for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) { + // count number of attributes + if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) { + matchingAttributes++; } + // check for bitmask attributes + if (!hasBitmask && archetypeAttribute instanceof ArchetypeAttributeBitmask) { + hasBitmask = true; + } } if (matchingAttributes == 0) { return null; @@ -1022,8 +1029,8 @@ boolean isText = false; // now add the entries, line by line - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { - if (archetypeAttribute.getSectionId() == sectionId && !(archetypeAttribute instanceof ArchetypeAttributeFixed)) { + for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) { + if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) { final AbstractButton helpButton = new JButton("?"); helpButton.setMargin(new Insets(0, 5, 0, 5)); panel.add(helpButton, helpGbc); @@ -1190,17 +1197,19 @@ } // Also write all the 'fixed' attributes into the archetype text - for (final ArchetypeAttribute archetypeAttribute : typesBoxItemListener.getArchetypeType()) { - // ### TODO: for changed types, copy fixed attributes over default arches ### - if (archetypeAttribute instanceof ArchetypeAttributeFixed) { - final String defaultValue = archetype.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); - if (defaultValue.length() == 0 || (gameObject.getTypeNo() != archetype.getTypeNo() && !defaultValue.equalsIgnoreCase(archetypeAttribute.getAttributeName()))) { - // usually, fixed attributes are only applied when *not* defined in the archetype. - // the reason behind this is: if the default gameObject violates our fixed attribute, - // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. - // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. - // So, in this special case, the fixed attribute applies always. - newArchText.append(archetypeAttribute.getArchetypeAttributeName()).append(" ").append(archetypeAttribute.getAttributeName()).append("\n"); + for (final ArchetypeAttributeSection archetypeAttributeSection : typesBoxItemListener.getArchetypeType()) { + for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) { + // ### TODO: for changed types, copy fixed attributes over default arches ### + if (archetypeAttribute instanceof ArchetypeAttributeFixed) { + final String defaultValue = archetype.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); + if (defaultValue.length() == 0 || (gameObject.getTypeNo() != archetype.getTypeNo() && !defaultValue.equalsIgnoreCase(archetypeAttribute.getAttributeName()))) { + // usually, fixed attributes are only applied when *not* defined in the archetype. + // the reason behind this is: if the default gameObject violates our fixed attribute, + // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. + // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. + // So, in this special case, the fixed attribute applies always. + newArchText.append(archetypeAttribute.getArchetypeAttributeName()).append(" ").append(archetypeAttribute.getAttributeName()).append("\n"); + } } } } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - protected AbstractArchetypeAttributeInvSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + protected AbstractArchetypeAttributeInvSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - protected AbstractArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + protected AbstractArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -36,10 +36,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - protected AbstractArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + protected AbstractArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -56,30 +56,17 @@ private final int inputLength; /** - * Identifier of the section this attribute is in. - */ - private int sectionId = -1; - - /** - * Name of the section this attribute is in. - */ - @NotNull - private final String sectionName; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name */ - protected ArchetypeAttribute(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + protected ArchetypeAttribute(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { this.archetypeAttributeName = archetypeAttributeName; this.attributeName = attributeName; this.description = description; this.inputLength = inputLength; - this.sectionName = sectionName; } /** @@ -96,31 +83,6 @@ } /** - * Returns the section ID. - * @return the section ID - */ - public int getSectionId() { - return sectionId; - } - - /** - * Sets the section ID. - * @param sectionId the section ID - */ - public void setSectionId(final int sectionId) { - this.sectionId = sectionId; - } - - /** - * Returns the section name. - * @return the section name - */ - @NotNull - public String getSectionName() { - return sectionName; - } - - /** * Returns the archetype attribute name. * @return the archetype attribute name */ @@ -161,7 +123,7 @@ @NotNull @Override public String toString() { - return "editor=" + archetypeAttributeName + ",arch=" + attributeName + ",section=" + sectionId + "/" + sectionName; + return "editor=" + archetypeAttributeName + ",arch=" + attributeName; } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimationName.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimationName.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimationName.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute faces */ - public ArchetypeAttributeAnimationName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeAnimationName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -40,11 +40,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param bitmaskName the bitmask name */ - public ArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String bitmaskName) { + super(archetypeAttributeName, attributeName, description, inputLength); this.bitmaskName = bitmaskName; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeBool(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeBool(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -47,12 +47,11 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param trueValue the true value * @param falseValue the false value */ - public ArchetypeAttributeBoolSpec(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String trueValue, @NotNull final String falseValue) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeBoolSpec(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String trueValue, @NotNull final String falseValue) { + super(archetypeAttributeName, attributeName, description, inputLength); this.trueValue = trueValue; this.falseValue = falseValue; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeFaceName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeFaceName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,11 +34,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the archetype attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeAnimname(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeAnimname(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "bitmask" archetype attribute. @@ -46,12 +45,11 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param bitmaskName the bitmask name * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeBitmask(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName, @NotNull String bitmaskName); + ArchetypeAttribute newArchetypeAttributeBitmask(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String bitmaskName); /** * Creates a new "bool" archetype attribute. @@ -59,11 +57,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeBool(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeBool(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "bool spec" archetype attribute. @@ -71,13 +68,12 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param trueValue the true value * @param falseValue the false value * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeBoolSpec(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName, @NotNull String trueValue, @NotNull String falseValue); + ArchetypeAttribute newArchetypeAttributeBoolSpec(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String trueValue, @NotNull String falseValue); /** * Creates a new "face name" archetype attribute. @@ -85,11 +81,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeFacename(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeFacename(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "fixed" archetype attribute. @@ -97,11 +92,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeFixed(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeFixed(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "float" archetype attribute. @@ -109,11 +103,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeFloat(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeFloat(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "int" archetype attribute. @@ -121,7 +114,6 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param minValue the absolute minimum allowed value * @param maxValue the absolute maximum allowed value * @param minCheckValue the logical minimum allowed value @@ -129,7 +121,7 @@ * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeInt(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName, int minValue, int maxValue, int minCheckValue, int maxCheckValue); + ArchetypeAttribute newArchetypeAttributeInt(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, int minValue, int maxValue, int minCheckValue, int maxCheckValue); /** * Creates a new "inv spell" archetype attribute. @@ -137,11 +129,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeInvSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeInvSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "inv spell optional" archetype attribute. @@ -149,11 +140,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeInvSpellOptional(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeInvSpellOptional(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "list" archetype attribute. @@ -161,12 +151,11 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param listName the list name * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeList(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName, @NotNull String listName); + ArchetypeAttribute newArchetypeAttributeList(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String listName); /** * Creates a new "long" archetype attribute. @@ -174,11 +163,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeLong(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeLong(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "map path" archetype attribute. @@ -186,11 +174,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeMapPath(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeMapPath(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "script file" archetype attribute. @@ -198,11 +185,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeScriptFile(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeScriptFile(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "spell" archetype attribute. @@ -210,11 +196,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "string" archetype attribute. @@ -222,11 +207,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeString(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeString(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "text" archetype attribute. @@ -247,11 +231,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeTreasure(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeTreasure(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); /** * Creates a new "z-spell" archetype attribute. @@ -259,10 +242,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @return the bitmask attribute */ @NotNull - ArchetypeAttribute newArchetypeAttributeZSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); + ArchetypeAttribute newArchetypeAttributeZSpell(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeFixed(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeFixed(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeFloat(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeFloat(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -54,14 +54,13 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param minValue the absolute minimum allowed value * @param maxValue the absolute maximum allowed value * @param minCheckValue the logical minimum allowed value * @param maxCheckValue the logical maximum allowed value */ - public ArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, final int minValue, final int maxValue, final int minCheckValue, final int maxCheckValue) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, final int minValue, final int maxValue, final int minCheckValue, final int maxCheckValue) { + super(archetypeAttributeName, attributeName, description, inputLength); this.minValue = minValue; this.maxValue = maxValue; this.minCheckValue = minCheckValue; Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -41,10 +41,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeInvSpell(final boolean isOptionalSpell, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeInvSpell(final boolean isOptionalSpell, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); this.isOptionalSpell = isOptionalSpell; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -40,11 +40,10 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute * @param listName the list name */ - public ArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String listName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String listName) { + super(archetypeAttributeName, attributeName, description, inputLength); this.listName = listName; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -34,10 +34,9 @@ * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields - * @param sectionName the section name for the new attribute */ - public ArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + public ArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + super(archetypeAttributeName, attributeName, description, inputLength); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2013-05-31 18:18:34 UTC (rev 9256) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2013-06-01 10:51:43 UTC (rev 9257) @@ -62,20 +62,19 @@ * @param archetypeTypeSet the archetype type list * @param typeName (descriptive) name of the type this attribute belongs to * (e.g. "Weapon") - * @param sectionName the section name for the new attribute * @return the archetype attribute or <code>null</code> if an error occurs * @throws MissingAttributeException if the element cannot be parsed */ @Nullable @SuppressWarnings("FeatureEnvy") - public ArchetypeAttribute load(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final String typeName, @NotNull final String sectionName) throws MissingAttributeException { + public ArchetypeAttribute load(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final String typeName) throws MissingAttributeException { final String description = parseText(attributeElement); final int inputLength = getAttributeIntValue(attributeElement, Constants.XML_ATTRIBUTE_LENGTH, 0, typeName, errorViewCollector); final String attributeType = getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_TYPE); if (attributeType.equals("bool")) { - return archetypeAttributeFactory.newArchetypeAttributeBool(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeBool(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("bool_special")) { - return archetypeAttributeFactory.newArchetypeAttributeBoolSpec(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_TRUE), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_FALSE)); + return archetypeAttributeFactory.newArchetypeAttributeBoolSpec(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_TRUE), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_FALSE)); } else if (attributeType.equals("int")) { final int minValue = getAttributeIntValue(attributeElement, Constants.XML_ATTRIBUTE_MIN, Integer.MIN_VALUE, typeName, errorViewCollector); final int maxValue = getAttributeIntValue(attributeElement, Constants.XML_ATTRIBUTE_MAX, Integer.MAX_VALUE, typeName, errorViewCollector); @@ -102,33 +101,33 @@ return null; } - return archetypeAttributeFactory.newArchetypeAttributeInt(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, minValue, maxValue, minCheckValue, maxCheckValue); + return archetypeAttributeFactory.newArchetypeAttributeInt(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, minValue, maxValue, minCheckValue, maxCheckValue); } else if (attributeType.equals("long")) { - return archetypeAttributeFactory.newArchetypeAttributeLong(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeLong(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("float")) { - return archetypeAttributeFactory.newArchetypeAttributeFloat(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeFloat(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("string")) { - return archetypeAttributeFactory.newArchetypeAttributeString(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeString(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("map_path")) { - return archetypeAttributeFactory.newArchetypeAttributeMapPath(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeMapPath(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("script_file")) { - return archetypeAttributeFactory.newArchetypeAttributeScriptFile(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeScriptFile(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("facename")) { - return archetypeAttributeFactory.newArchetypeAttributeFacename(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeFacename(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("animname")) { - return archetypeAttributeFactory.newArchetypeAttributeAnimname(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeAnimname(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else if (attributeType.equals("text")) { return archetypeAttributeFactory.newArchetypeAttributeText(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH_BEGIN), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH_END), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, getAttributeValueOptional(attributeElement, Constants.XML_ATTRIBUTE_MARKER)); } else if (attributeType.equals("fixed")) { - return archetypeAttributeFactory.newArchetypeAttributeFixed(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_VALUE), description, inputLength, sectionName); + return archetypeAttributeFactory.newAr... [truncated message content] |
From: <aki...@us...> - 2013-06-02 21:38:52
|
Revision: 9263 http://sourceforge.net/p/gridarta/code/9263 Author: akirschbaum Date: 2013-06-02 21:38:45 +0000 (Sun, 02 Jun 2013) Log Message: ----------- Replace MapArchObject.clone() with copy constructor. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -126,23 +126,56 @@ * @serial */ @NotNull - private String backgroundMusic = ""; + private String backgroundMusic; /** * The region the map is in. * @serial */ @NotNull - private String region = ""; + private String region; /** * The weather effect active on this map. * @serial */ @NotNull - private String weather = ""; + private String weather; /** + * Creates a new instance. + */ + public MapArchObject() { + backgroundMusic = ""; + region = ""; + weather = ""; + } + + /** + * Creates a new instance as a copy of another map arch object. + * @param mapArchObject the other map arch object + */ + public MapArchObject(@NotNull final MapArchObject mapArchObject) { + super(mapArchObject); + noSave = mapArchObject.noSave; + noMagic = mapArchObject.noMagic; + noPriest = mapArchObject.noPriest; + noHarm = mapArchObject.noHarm; + noSummon = mapArchObject.noSummon; + fixedLogin = mapArchObject.fixedLogin; + unique = mapArchObject.unique; + fixedResetTime = mapArchObject.fixedResetTime; + playerNoSave = mapArchObject.playerNoSave; + pvp = mapArchObject.pvp; + tilesetId = mapArchObject.tilesetId; + tilesetX = mapArchObject.tilesetX; + tilesetY = mapArchObject.tilesetY; + backgroundMusic = mapArchObject.backgroundMusic; + region = mapArchObject.region; + weather = mapArchObject.weather; + } + + /** * {@inheritDoc} */ @Override @@ -543,8 +576,8 @@ */ @NotNull @Override - public MapArchObject clone() { - return super.clone(); + public MapArchObject createClone() { + return new MapArchObject(this); } /** Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -47,7 +47,7 @@ * The map lore attribute. * @serial */ - private StringBuilder loreText = new StringBuilder(); + private final StringBuilder loreText = new StringBuilder(); /** * If set, this entire map is unique. @@ -108,14 +108,14 @@ * @serial */ @NotNull - private String shopItems = ""; + private String shopItems; /** * The preferred race of the shop. * @serial */ @NotNull - private String shopRace = ""; + private String shopRace; /** * The greed of the shop. @@ -140,16 +140,51 @@ * @serial */ @NotNull - private String region = ""; + private String region; /** * The background music to play. * @serial */ @NotNull - private String backgroundMusic = ""; + private String backgroundMusic; /** + * Creates a new instance. + */ + public MapArchObject() { + region = ""; + backgroundMusic = ""; + shopRace = ""; + shopItems = ""; + } + + /** + * Creates a new instance as a copy of another map arch object. + * @param mapArchObject the other map arch object + */ + public MapArchObject(@NotNull final MapArchObject mapArchObject) { + super(mapArchObject); + loreText.append(mapArchObject.loreText); + unique = mapArchObject.unique; + template = mapArchObject.template; + noSmooth = mapArchObject.noSmooth; + temperature = mapArchObject.temperature; + pressure = mapArchObject.pressure; + humidity = mapArchObject.humidity; + windSpeed = mapArchObject.windSpeed; + windDirection = mapArchObject.windDirection; + sky = mapArchObject.sky; + shopItems = mapArchObject.shopItems; + shopRace = mapArchObject.shopRace; + shopGreed = mapArchObject.shopGreed; + shopMin = mapArchObject.shopMin; + shopMax = mapArchObject.shopMax; + region = mapArchObject.region; + backgroundMusic = mapArchObject.backgroundMusic; + } + + /** * {@inheritDoc} */ @Override @@ -593,10 +628,8 @@ */ @NotNull @Override - public MapArchObject clone() { - final MapArchObject clone = super.clone(); - clone.loreText = new StringBuilder(loreText.toString()); - return clone; + public MapArchObject createClone() { + return new MapArchObject(this); } /** Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -126,9 +126,38 @@ * @serial */ @NotNull - private String backgroundMusic = ""; + private String backgroundMusic; /** + * Creates a new instance. + */ + public MapArchObject() { + backgroundMusic = ""; + } + + /** + * Creates a new instance as a copy of another map arch object. + * @param mapArchObject the other map arch object + */ + public MapArchObject(@NotNull final MapArchObject mapArchObject) { + super(mapArchObject); + noSave = mapArchObject.noSave; + noMagic = mapArchObject.noMagic; + noPriest = mapArchObject.noPriest; + noHarm = mapArchObject.noHarm; + noSummon = mapArchObject.noSummon; + fixedLogin = mapArchObject.fixedLogin; + permDeath = mapArchObject.permDeath; + ultraDeath = mapArchObject.ultraDeath; + ultimateDeath = mapArchObject.ultimateDeath; + pvp = mapArchObject.pvp; + tilesetId = mapArchObject.tilesetId; + tilesetX = mapArchObject.tilesetX; + tilesetY = mapArchObject.tilesetY; + backgroundMusic = mapArchObject.backgroundMusic; + } + + /** * {@inheritDoc} */ @Override @@ -481,8 +510,8 @@ */ @NotNull @Override - public MapArchObject clone() { - return super.clone(); + public MapArchObject createClone() { + return new MapArchObject(this); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -107,7 +107,7 @@ @Override public void beginTransaction(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String name) { undoModel = undoModels.get(mapModel); - undoState = new UndoState<G, A, R>(name, mapModel.getMapArchObject().clone()); + undoState = new UndoState<G, A, R>(name, mapModel.getMapArchObject().createClone()); } @Override Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -68,19 +68,19 @@ * The map text. */ @NotNull - private StringBuilder msgText = new StringBuilder(); + private final StringBuilder msgText = new StringBuilder(); /** * The size of the map reflected by this map arch object. */ @NotNull - private Size2D mapSize = Size2D.ONE; + private Size2D mapSize; /** * The name of this map. */ @NotNull - private String mapName = MAP_NAME_UNNAMED; + private String mapName; /** * The x coordinate for entering the map. @@ -129,7 +129,7 @@ * = west. 4 = northeast, 5 = southeast, 6 = southwest, 7 = northwest */ @NotNull - private String[] tilePaths = new String[Direction.values().length]; + private final String[] tilePaths; /** * The registered event listeners. @@ -161,10 +161,32 @@ * Creates a new instance. */ protected AbstractMapArchObject() { + tilePaths = new String[Direction.values().length]; Arrays.fill(tilePaths, ""); + mapSize = Size2D.ONE; + mapName = MAP_NAME_UNNAMED; } /** + * Creates a new instance as a copy of another map arch object. + * @param mapArchObject the other map arch object + */ + protected AbstractMapArchObject(@NotNull final AbstractMapArchObject<A> mapArchObject) { + msgText.append(mapArchObject.msgText); + mapSize = mapArchObject.mapSize; + mapName = mapArchObject.mapName; + enterX = mapArchObject.enterX; + enterY = mapArchObject.enterY; + outdoor = mapArchObject.outdoor; + resetTimeout = mapArchObject.resetTimeout; + swapTime = mapArchObject.swapTime; + difficulty = mapArchObject.difficulty; + fixedReset = mapArchObject.fixedReset; + darkness = mapArchObject.darkness; + tilePaths = mapArchObject.tilePaths.clone(); + } + + /** * {@inheritDoc} */ @NotNull @@ -620,25 +642,6 @@ } /** - * {@inheritDoc} - */ - @NotNull - @Override - @SuppressWarnings("unchecked") - public A clone() { - final AbstractMapArchObject<A> clone; - try { - //noinspection OverriddenMethodCallDuringObjectConstruction - clone = (AbstractMapArchObject<A>) super.clone(); - } catch (final CloneNotSupportedException ex) { - throw new AssertionError(ex); - } - clone.msgText = new StringBuilder(msgText.toString()); - clone.tilePaths = tilePaths.clone(); - return clone.getThis(); - } - - /** * Returns this map arch object cast to its real type. * @return this map arch object */ Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/MapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/MapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -34,7 +34,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public interface MapArchObject<A extends MapArchObject<A>> extends Cloneable, Serializable { +public interface MapArchObject<A extends MapArchObject<A>> extends Serializable { /** * Resets the state of this object to the state of the given map arch @@ -200,7 +200,7 @@ * @return the newly created clone of this object */ @NotNull - A clone(); + A createClone(); /** * Registers an event listener. Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2013-06-02 19:39:24 UTC (rev 9262) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2013-06-02 21:38:45 UTC (rev 9263) @@ -33,12 +33,27 @@ private static final long serialVersionUID = 1L; /** + * Creates a new instance. + */ + public TestMapArchObject() { + } + + /** + * Creates a new instance as a copy of another map arch object. + * @param mapArchObject the other map arch object + * @noinspection TypeMayBeWeakened + */ + public TestMapArchObject(@NotNull final TestMapArchObject mapArchObject) { + super(mapArchObject); + } + + /** * {@inheritDoc} */ @NotNull @Override - public TestMapArchObject clone() { - return super.clone(); + public TestMapArchObject createClone() { + return new TestMapArchObject(this); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-06 13:19:40
|
Revision: 9265 http://sourceforge.net/p/gridarta/code/9265 Author: akirschbaum Date: 2013-07-06 13:19:37 +0000 (Sat, 06 Jul 2013) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/mapproperties/MapPropertiesDialogFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.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/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.atrinik.gui.mappropertiesdialog; import java.awt.Component; -import javax.swing.JFrame; +import java.awt.Frame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; @@ -75,7 +75,7 @@ * {@inheritDoc} */ @Override - public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { + public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -23,6 +23,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; @@ -35,7 +36,6 @@ import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -92,7 +92,7 @@ * @serial */ @NotNull - private final JFrame helpParent; + private final Frame helpParent; /** * The {@link MapModel} this dialog shows. @@ -320,7 +320,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.crossfire.gui.mappropertiesdialog; import java.awt.Component; -import javax.swing.JFrame; +import java.awt.Frame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; @@ -75,7 +75,7 @@ * {@inheritDoc} */ @Override - public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { + public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -30,7 +31,6 @@ import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; @@ -84,7 +84,7 @@ * @serial */ @NotNull - private final JFrame helpParent; + private final Frame helpParent; /** * The {@link MapModel} this dialog shows. @@ -363,7 +363,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.daimonin.gui.mappropertiesdialog; import java.awt.Component; -import javax.swing.JFrame; +import java.awt.Frame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; @@ -75,7 +75,7 @@ * {@inheritDoc} */ @Override - public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { + public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -23,6 +23,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; @@ -36,7 +37,6 @@ import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFileChooser; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -94,7 +94,7 @@ * @serial */ @NotNull - private final JFrame helpParent; + private final Frame helpParent; /** * The global settings instance. @@ -314,7 +314,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -24,6 +24,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -47,7 +48,6 @@ import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFormattedTextField; -import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -186,7 +186,7 @@ * @serial */ @NotNull - private final JFrame parent; + private final Frame parent; /** * The {@link CFTreasureListTree} to use. @@ -757,7 +757,7 @@ * @param textAreaDefaults the text area defaults for text fields * @param mapManager the map manager instance */ - public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final ArchetypeTypeSet archetypeTypeSet, @NotNull final G gameObject, @NotNull final JFrame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults, @NotNull final MapManager<G, A, R> mapManager) { + public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final ArchetypeTypeSet archetypeTypeSet, @NotNull final G gameObject, @NotNull final Frame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults, @NotNull final MapManager<G, A, R> mapManager) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archetypeTypeSet = archetypeTypeSet; this.gameObject = gameObject; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialogFactory.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -19,12 +19,12 @@ package net.sf.gridarta.gui.dialog.gameobjectattributes; +import java.awt.Frame; import java.awt.Window; import java.util.HashMap; import java.util.Map; import javax.swing.ImageIcon; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.treasurelist.CFTreasureListTree; import net.sf.gridarta.model.anim.AnimationObjects; @@ -68,7 +68,7 @@ * The parent frame for showing dialog boxes. */ @NotNull - private final JFrame parent; + private final Frame parent; /** * The {@link CFTreasureListTree} to display. @@ -180,7 +180,7 @@ * @param unknownSquareIcon the image icon for undefined animations * @param mapManager the map manager instance */ - public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final JFrame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final MapManager<G, A, R> mapManager) { + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Frame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final MapManager<G, A, R> mapManager) { this.archetypeTypeSet = archetypeTypeSet; this.parent = parent; this.treasureListTree = treasureListTree; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/mapproperties/MapPropertiesDialogFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/mapproperties/MapPropertiesDialogFactory.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/mapproperties/MapPropertiesDialogFactory.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -20,7 +20,7 @@ package net.sf.gridarta.gui.dialog.mapproperties; import java.awt.Component; -import javax.swing.JFrame; +import java.awt.Frame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -41,6 +41,6 @@ * @param mapModel the map to show dialog about * @param mapFileFilter the Swing file filter to use */ - void showDialog(@NotNull Component parent, @NotNull JFrame helpParent, @NotNull MapModel<G, A, R> mapModel, @NotNull FileFilter mapFileFilter); + void showDialog(@NotNull Component parent, @NotNull Frame helpParent, @NotNull MapModel<G, A, R> mapModel, @NotNull FileFilter mapFileFilter); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -19,13 +19,13 @@ package net.sf.gridarta.gui.map.mapactions; +import java.awt.Frame; import java.awt.Point; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import javax.swing.Action; -import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.shrinkmapsize.ShrinkMapSizeDialogManager; @@ -171,7 +171,7 @@ * The parent frame for help windows. */ @NotNull - private final JFrame helpParent; + private final Frame helpParent; /** * The {@link ExitMatcher} for selecting exit game objects. @@ -396,7 +396,7 @@ * @param mapViewsManager the map views * @param enterMap the enter map instance to use */ - public MapActions(@NotNull final JFrame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final EnterMap<G, A, R> enterMap) { + public MapActions(@NotNull final Frame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final EnterMap<G, A, R> enterMap) { this.helpParent = helpParent; this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java 2013-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -22,13 +22,13 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; +import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; @@ -90,7 +90,7 @@ * @serial */ @NotNull - private final JFrame parent; + private final Frame parent; /** * JDialog containing the tree. @@ -129,7 +129,7 @@ * faces * @param systemIcons the system icons for creating icons */ - public CFTreasureListTree(@NotNull final TreasureTree treasureTree, @NotNull final JFrame parent, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { + public CFTreasureListTree(@NotNull final TreasureTree treasureTree, @NotNull final Frame parent, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final SystemIcons systemIcons) { super(treasureTree.getRoot()); this.treasureTree = treasureTree; this.parent = parent; 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-07-01 14:50:35 UTC (rev 9264) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-06 13:19:37 UTC (rev 9265) @@ -21,6 +21,7 @@ import java.awt.BorderLayout; import java.awt.Container; +import java.awt.Frame; import java.io.File; import java.io.IOException; import java.util.MissingResourceException; @@ -457,15 +458,16 @@ final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(globalSettings.getPickmapDir()); final ImageIcon icon = systemIcons.getAppIcon(); mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); - newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, mapArchObjectFactory, mainViewFrame); + final Frame parent = mainViewFrame; + newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, mapArchObjectFactory, parent); final PickmapChooserModel<G, A, R> pickmapChooserModel = new PickmapChooserModel<G, A, R>(); final PickmapSettings pickmapSettings = new DefaultPickmapSettings(); - pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapArchObjectFactory, mapReaderFactory, mapFolderTree, mapManager, mainViewFrame, pickmapManager, mapViewsManager); + pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapArchObjectFactory, mapReaderFactory, mapFolderTree, mapManager, parent, pickmapManager, mapViewsManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - final CFTreasureListTree treasureListTree = new CFTreasureListTree(treasureTree, mainViewFrame, archetypeSet, faceObjectProviders, systemIcons); + 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, mainViewFrame, treasureListTree, faceObjectProviders, animationObjects, globalSettings, 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, globalSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, noFaceSquareIcon, unknownSquareIcon, mapManager); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, archetypeChooserModel, pickmapChooserModel, archetypeTypeSet); newMapDialogFactory.setObjectChooser(objectChooser); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); @@ -478,16 +480,16 @@ final GameObjectMatcher systemObjectMatcher = gameObjectMatchers.getMatcher("system_system_object"); final InsertionModeSet<G, A, R> insertionModeSet = new InsertionModeSet<G, A, R>(topmostInsertionMode, floorMatcher, wallMatcher, belowFloorMatcher, systemObjectMatcher); 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>(mainViewFrame, mapViewManager); - final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBuffer, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); - exiter = new DefaultExiter(mainViewFrame); - scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainViewFrame, globalSettings.getMapsDirectory(), preferences, exiter); + final FindDialogManager<G, A, R> findDialogManager = new FindDialogManager<G, A, R>(parent, mapViewManager); + final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(parent, copyBuffer, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); + exiter = new DefaultExiter(parent); + scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, parent, globalSettings.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>(globalSettings, mapImageCache, mapManager, mapViewsManager, mainViewFrame, GuiFileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); + fileControl = new DefaultFileControl<G, A, R>(globalSettings, mapImageCache, mapManager, mapViewsManager, parent, GuiFileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); pickmapChooserControl.setFileControl(fileControl); mapViewsManager.setFileControl(fileControl); final GameObjectMatcher monsterMatcherTmp = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_monster", "monster"); @@ -499,37 +501,37 @@ final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(globalSettings, 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>(mainViewFrame, directionMap, mapPathNormalizer, fileControl, mapViewsManager); - new MapActions<G, A, R>(mainViewFrame, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); + final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, directionMap, mapPathNormalizer, fileControl, mapViewsManager); + new MapActions<G, A, R>(parent, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, selectedSquareView, gameObjectFactory); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager, faceObjectProviders); final File scriptsFile = new File(globalSettings.getMapsDirectory(), scriptsDir); - pluginControl = new PluginController<G, A, R>(filterControl, pluginParameters, mainViewFrame, pluginParameterViewFactory, scriptsFile, pluginModel, pluginParameterFactory, pluginExecutor, systemIcons); + pluginControl = new PluginController<G, A, R>(filterControl, pluginParameters, parent, pluginParameterViewFactory, scriptsFile, pluginModel, pluginParameterFactory, pluginExecutor, systemIcons); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapSettings, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); - updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); + updaterManager = new UpdaterManager(exiter, mapManager, parent, gridartaJarFilename); final TextEditorTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, archetypeTypeSet); final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, false, 0, true); //noinspection ResultOfObjectAllocationIgnored - new About(mainViewFrame); + new About(parent); //noinspection ResultOfObjectAllocationIgnored - new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); + new FindArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet); //noinspection ResultOfObjectAllocationIgnored new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final Action exitAction = ActionUtils.newAction(ACTION_BUILDER, "Other", this, "exit"); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, pickmapSettings, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); final ViewActions<G, A, R> viewActions = new ViewActions<G, A, R>(mapViewSettings, mapManager); //noinspection ResultOfObjectAllocationIgnored - new MapFileActions<G, A, R>(imageCreator2, mapManager, mapViewsManager, mapViewManager, fileControl, mainViewFrame); + new MapFileActions<G, A, R>(imageCreator2, mapManager, mapViewsManager, mapViewManager, fileControl, parent); //noinspection ResultOfObjectAllocationIgnored new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, insertionModeSet, exiter); - final HelpActions helpActions = new HelpActions(mainViewFrame); + final HelpActions helpActions = new HelpActions(parent); ActionUtils.newActions(ACTION_BUILDER, "Map", newMapDialogFactory, "newMap"); - final GoMapDialogManager<G, A, R> goMapDialogManager = new GoMapDialogManager<G, A, R>(mainViewFrame, mapManager, mapViewsManager, globalSettings, exiter); + final GoMapDialogManager<G, A, R> goMapDialogManager = new GoMapDialogManager<G, A, R>(parent, mapManager, mapViewsManager, globalSettings, exiter); ActionUtils.newActions(ACTION_BUILDER, "Map", goMapDialogManager, "goMap"); - final GoExitDialogManager<G, A, R> goExitDialogManager = new GoExitDialogManager<G, A, R>(mainViewFrame, mapManager, mapViewManager, exitGameObjectMatcher, pathManager, enterMap, faceObjectProviders); + final GoExitDialogManager<G, A, R> goExitDialogManager = new GoExitDialogManager<G, A, R>(parent, mapManager, mapViewManager, exitGameObjectMatcher, pathManager, enterMap, faceObjectProviders); ActionUtils.newActions(ACTION_BUILDER, "Map Navigation", goExitDialogManager, "goExit"); ActionUtils.newActions(ACTION_BUILDER, "Tool", this, "cleanCompletelyBlockedSquares", "collectSpells", "controlClient", "controlServer", "gc", "options", "shortcuts", "zoom"); //noinspection ResultOfObjectAllocationIgnored @@ -544,7 +546,7 @@ final MapMenu mapMenu = bookmarksMapMenuPreferences.getMapMenu(); @Nullable final MapMenuManager<G, A, R> bookmarksMapMenuManager = new MapMenuManager<G, A, R>(mapMenu, mapViewsManager, fileControl, mapImageCache); //noinspection ResultOfObjectAllocationIgnored - new BookmarkActions<G, A, R>(bookmarksMapMenuPreferences, mapMenu, mapViewManager, mainViewFrame, mapImageCache); + new BookmarkActions<G, A, R>(bookmarksMapMenuPreferences, mapMenu, mapViewManager, parent, mapImageCache); editorFactory.newServerActions(mapViewManager, fileControl, pathManager); pickmapChooserControl.setPopupMenu(ACTION_BUILDER.createPopupMenu(true, "pickmaps")); @@ -590,7 +592,7 @@ final ErrorListView<G, A, R> errorListView = new ErrorListView<G, A, R>(mapViewManager); gameObjectAttributesControl.addTab(new ArchTab<G, A, R>(archetypeTypeSet, gameObjectAttributesModel)); gameObjectAttributesControl.addTab(new MsgTextTab<G, A, R>(gameObjectAttributesModel)); - gameObjectAttributesControl.addTab(new EventsTab<G, A, R>(mainViewFrame, mapManager, gameObjectAttributesModel, scriptArchEditor, scriptArchData, scriptArchDataUtils, scriptArchUtils)); + gameObjectAttributesControl.addTab(new EventsTab<G, A, R>(parent, mapManager, gameObjectAttributesModel, scriptArchEditor, scriptArchData, scriptArchDataUtils, scriptArchUtils)); gameObjectAttributesControl.addTab(new FaceTab<G, A, R>(gameObjectAttributesModel, faceObjects, faceObjectProviders, animationObjects, noFaceSquareIcon, unknownSquareIcon)); gameObjectAttributesControl.addTab(textEditorTab); mainView.addTab(new Tab("monsters", new MonsterControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, monsterMatcher).getView(), Location.BOTTOM, false, 4, false)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-06 21:50:41
|
Revision: 9266 http://sourceforge.net/p/gridarta/code/9266 Author: akirschbaum Date: 2013-07-06 21:50:34 +0000 (Sat, 06 Jul 2013) Log Message: ----------- Move displayMode field from ArchetypeChooserView to ArchetypeChooserModel. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeIconCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeNameCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DirectionPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayNameCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/DisplayMode.java Removed Paths: ------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserViewListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayMode.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -20,8 +20,6 @@ package net.sf.gridarta.gui.panel.archetypechooser; import java.awt.BorderLayout; -import java.util.ArrayList; -import java.util.Collection; import java.util.prefs.Preferences; import javax.swing.AbstractButton; import javax.swing.BorderFactory; @@ -34,8 +32,11 @@ import javax.swing.event.ChangeListener; import net.sf.gridarta.MainControl; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolder; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModelListener; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjectProvidersListener; import net.sf.gridarta.model.gameobject.GameObject; @@ -78,12 +79,6 @@ private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** - * The registered listeners. - */ - @NotNull - private final Collection<ArchetypeChooserViewListener<G, A, R>> listeners = new ArrayList<ArchetypeChooserViewListener<G, A, R>>(); - - /** * The button for "display game object names". * @serial */ @@ -119,13 +114,6 @@ private final JTabbedPane tabDesktop = new JTabbedPane(SwingConstants.TOP); /** - * Indicates whether object names are shown. - * @serial - */ - @NotNull - private DisplayMode<G, A, R> displayMode; - - /** * The list cell renderer displaying object names. * @serial */ @@ -176,6 +164,37 @@ displayModeArchetypeNames = new ArchetypeNameCellRenderer<G, A, R>(faceObjectProviders); displayModeIconsOnly = new ArchetypeIconCellRenderer<G, A, R>(faceObjectProviders); + archetypeChooserModel.addArchetypeChooserModelListener(new ArchetypeChooserModelListener<G, A, R>() { + + @Override + public void selectedPanelChanged(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { + } + + @Override + public void selectedFolderChanged(@NotNull final ArchetypeChooserFolder<G, A, R> selectedFolder) { + } + + @Override + public void selectedArchetypeChanged(@Nullable final R selectedArchetype) { + } + + @Override + public void directionChanged(@Nullable final Integer direction) { + } + + @Override + public void displayModeChanged(@NotNull final DisplayMode<G, A, R> displayMode) { + if (displayMode == displayModeGameObjectNames) { + preferences.putInt(DISPLAY_MODE_KEY, 0); + } else if (displayMode == displayModeArchetypeNames) { + preferences.putInt(DISPLAY_MODE_KEY, 1); + } else if (displayMode == displayModeIconsOnly) { + preferences.putInt(DISPLAY_MODE_KEY, 2); + } + updateActions(); + } + + }); final FaceObjectProvidersListener faceObjectProvidersListener = new FaceObjectProvidersListener() { @Override @@ -200,18 +219,17 @@ switch (preferencesDisplayMode) { case 0: default: - displayMode = displayModeGameObjectNames; + archetypeChooserModel.setDisplayMode(displayModeGameObjectNames); break; case 1: - displayMode = displayModeArchetypeNames; + archetypeChooserModel.setDisplayMode(displayModeArchetypeNames); break; case 2: - displayMode = displayModeIconsOnly; + archetypeChooserModel.setDisplayMode(displayModeIconsOnly); break; } - fireDisplayObjectNamesChangedEvent(); tabDesktop.setBorder(BorderFactory.createEmptyBorder(CommonConstants.SPACE_PICKMAP_ARCHETYPE_TOP, 0, 0, 0)); add(tabDesktop); if (createDirectionPane) { @@ -241,7 +259,7 @@ } final ArchetypeChooserPanel<G, A, R> archetypeChooserPanel = archetypeChooserModel.getPanel(panelName); - final ArchetypePanel<G, A, R> newPanel = new ArchetypePanel<G, A, R>(this, archetypeChooserPanel); + final ArchetypePanel<G, A, R> newPanel = new ArchetypePanel<G, A, R>(archetypeChooserModel, archetypeChooserPanel); // insert new panel in alphabetical order int i; @@ -297,50 +315,11 @@ } /** - * Notifies all listeners that the display mode has changed. - */ - private void fireDisplayObjectNamesChangedEvent() { - if (displayMode == displayModeGameObjectNames) { - preferences.putInt(DISPLAY_MODE_KEY, 0); - } else if (displayMode == displayModeArchetypeNames) { - preferences.putInt(DISPLAY_MODE_KEY, 1); - } else if (displayMode == displayModeIconsOnly) { - preferences.putInt(DISPLAY_MODE_KEY, 2); - } - updateActions(); - for (final ArchetypeChooserViewListener<G, A, R> listener : listeners) { - listener.displayModeChanged(displayMode); - } - } - - /** - * Returns the current display mode. - * @return the current display mode - */ - @NotNull - public DisplayMode<G, A, R> getDisplayMode() { - return displayMode; - } - - /** - * Updates the display mode. - * @param displayMode the new display mode - */ - private void setDisplayMode(@NotNull final DisplayMode<G, A, R> displayMode) { - if (this.displayMode == displayMode) { - return; - } - - this.displayMode = displayMode; - fireDisplayObjectNamesChangedEvent(); - } - - /** * Sets whether game object names are shown. */ @ActionMethod public void displayGameObjectNames() { - setDisplayMode(displayModeGameObjectNames); + archetypeChooserModel.setDisplayMode(displayModeGameObjectNames); } /** @@ -348,7 +327,7 @@ */ @ActionMethod public void displayArchetypeNames() { - setDisplayMode(displayModeArchetypeNames); + archetypeChooserModel.setDisplayMode(displayModeArchetypeNames); } /** @@ -356,29 +335,14 @@ */ @ActionMethod public void displayIconsOnly() { - setDisplayMode(displayModeIconsOnly); + archetypeChooserModel.setDisplayMode(displayModeIconsOnly); } /** - * Adds a listener to be notified of events. - * @param listener the listener to add - */ - public void addArchetypeChooserViewListener(@NotNull final ArchetypeChooserViewListener<G, A, R> listener) { - listeners.add(listener); - } - - /** - * Removes a listener to be notified of events. - * @param listener the listener to remove - */ - public void removeArchetypeChooserViewListener(@NotNull final ArchetypeChooserViewListener<G, A, R> listener) { - listeners.remove(listener); - } - - /** * Update the actions' state. */ private void updateActions() { + final DisplayMode<G, A, R> displayMode = archetypeChooserModel.getDisplayMode(); if (displayMode == displayModeGameObjectNames) { buttonDisplayGameObjectNames.setSelected(true); } else if (displayMode == displayModeArchetypeNames) { Deleted: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserViewListener.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserViewListener.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserViewListener.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -1,41 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.panel.archetypechooser; - -import java.util.EventListener; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * Interface for listeners listening to Archetype Chooser events. - * @author Andreas Kirschbaum - */ -public interface ArchetypeChooserViewListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { - - /** - * This event handler is called when an attribute "display object names" has - * changed. - * @param displayMode the new display mode - */ - void displayModeChanged(@NotNull DisplayMode<G, A, R> displayMode); - -} Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeIconCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeIconCellRenderer.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeIconCellRenderer.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -22,6 +22,7 @@ import java.awt.Component; import javax.swing.JList; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeNameCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeNameCellRenderer.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeNameCellRenderer.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -22,6 +22,7 @@ import java.awt.Component; import javax.swing.JList; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypePanel.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypePanel.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -39,8 +39,11 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolder; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolderListener; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModelListener; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanelListener; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.CommonConstants; @@ -142,10 +145,10 @@ /** * Creates a new instance. - * @param archetypeChooserView the associated archetype chooser view + * @param archetypeChooserModel the associated archetype chooser model * @param archetypeChooserPanel the associated archetype chooser panel */ - public ArchetypePanel(@NotNull final ArchetypeChooserView<G, A, R> archetypeChooserView, @NotNull final ArchetypeChooserPanel<G, A, R> archetypeChooserPanel) { + public ArchetypePanel(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ArchetypeChooserPanel<G, A, R> archetypeChooserPanel) { super(new BorderLayout()); this.archetypeChooserPanel = archetypeChooserPanel; archetypeList.setFocusable(false); @@ -158,16 +161,32 @@ scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); folders.setAutoscrolls(true); - final ArchetypeChooserViewListener<G, A, R> archetypeChooserViewListener = new ArchetypeChooserViewListener<G, A, R>() { + final ArchetypeChooserModelListener<G, A, R> archetypeChooserModelListener = new ArchetypeChooserModelListener<G, A, R>() { @Override + public void selectedPanelChanged(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { + } + + @Override + public void selectedFolderChanged(@NotNull final ArchetypeChooserFolder<G, A, R> selectedFolder) { + } + + @Override + public void selectedArchetypeChanged(@Nullable final R selectedArchetype) { + } + + @Override + public void directionChanged(@Nullable final Integer direction) { + } + + @Override public void displayModeChanged(@NotNull final DisplayMode<G, A, R> displayMode) { updateCellRenderer(displayMode); } }; - archetypeChooserView.addArchetypeChooserViewListener(archetypeChooserViewListener); - updateCellRenderer(archetypeChooserView.getDisplayMode()); + archetypeChooserModel.addArchetypeChooserModelListener(archetypeChooserModelListener); + updateCellRenderer(archetypeChooserModel.getDisplayMode()); final ArchetypeChooserPanelListener<G, A, R> archetypeChooserPanelListener = new ArchetypeChooserPanelListener<G, A, R>() { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DirectionPane.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DirectionPane.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DirectionPane.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -25,6 +25,7 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModelListener; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -79,6 +80,11 @@ updateDirection(direction); } + @Override + public void displayModeChanged(@NotNull final DisplayMode<G, A, R> displayMode) { + // ignore + } + }; /** Deleted: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayMode.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayMode.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayMode.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -1,54 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.panel.archetypechooser; - -import java.util.Comparator; -import javax.swing.DefaultListCellRenderer; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; - -/** - * Abstract base class for classes implementing display modes of the archetype - * chooser. It defines both a {@link DefaultListCellRenderer} and a {@link - * Comparator} for sorting the list entries. - * @author Andreas Kirschbaum - * @noinspection AbstractClassExtendsConcreteClass - */ -public abstract class DisplayMode<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DefaultListCellRenderer implements Comparator<Archetype<G, A, R>> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Creates a new instance. - */ - protected DisplayMode() { - } - - /** - * Returns the layout orientation. See {@link javax.swing.JList#getLayoutOrientation}. - * @return the layout orientation - */ - public abstract int getLayoutOrientation(); - -} Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayNameCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayNameCellRenderer.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayNameCellRenderer.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -22,6 +22,7 @@ import java.awt.Component; import javax.swing.JList; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModelListener; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; +import net.sf.gridarta.model.archetypechooser.DisplayMode; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; @@ -205,6 +206,11 @@ // ignore } + @Override + public void displayModeChanged(@NotNull final DisplayMode<G, A, R> displayMode) { + // ignore + } + }; archetypeChooserModel.addArchetypeChooserModelListener(archetypeChooserModelListener); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -63,6 +63,13 @@ private Integer direction; /** + * Indicates whether object names are shown. + * @serial + */ + @NotNull + private DisplayMode<G, A, R> displayMode; + + /** * The registered listeners. */ @NotNull @@ -214,6 +221,28 @@ } /** + * Returns the current display mode. + * @return the current display mode + */ + @NotNull + public DisplayMode<G, A, R> getDisplayMode() { + return displayMode; + } + + /** + * Updates the display mode. + * @param displayMode the new display mode + */ + public void setDisplayMode(@NotNull final DisplayMode<G, A, R> displayMode) { + if (this.displayMode == displayMode) { + return; + } + + this.displayMode = displayMode; + fireDisplayObjectNamesChangedEvent(); + } + + /** * Notifies all registered {@link ArchetypeChooserModelListener * ArchetypeChooserModelListeners} that the selected folder has changed. * @param selectedFolder the new selected folder @@ -236,4 +265,13 @@ } } + /** + * Notifies all listeners that the display mode has changed. + */ + private void fireDisplayObjectNamesChangedEvent() { + for (final ArchetypeChooserModelListener<G, A, R> listener : listeners.getListeners()) { + listener.displayModeChanged(displayMode); + } + } + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java 2013-07-06 13:19:37 UTC (rev 9265) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -58,4 +58,11 @@ */ void directionChanged(@Nullable Integer direction); + /** + * This event handler is called when an attribute "display object names" has + * changed. + * @param displayMode the new display mode + */ + void displayModeChanged(@NotNull DisplayMode<G, A, R> displayMode); + } Copied: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/DisplayMode.java (from rev 9265, trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/DisplayMode.java) =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/DisplayMode.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/DisplayMode.java 2013-07-06 21:50:34 UTC (rev 9266) @@ -0,0 +1,54 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.archetypechooser; + +import java.util.Comparator; +import javax.swing.DefaultListCellRenderer; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; + +/** + * Abstract base class for classes implementing display modes of the archetype + * chooser. It defines both a {@link DefaultListCellRenderer} and a {@link + * Comparator} for sorting the list entries. + * @author Andreas Kirschbaum + * @noinspection AbstractClassExtendsConcreteClass + */ +public abstract class DisplayMode<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DefaultListCellRenderer implements Comparator<Archetype<G, A, R>> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + */ + protected DisplayMode() { + } + + /** + * Returns the layout orientation. See {@link javax.swing.JList#getLayoutOrientation}. + * @return the layout orientation + */ + public abstract int getLayoutOrientation(); + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/DisplayMode.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:mergeinfo ## -0,0 +1 ## +/streams/cher-japi-update/src/app/net/sf/gridarta/gui/archetypechooser/DisplayMode.java:5966-5991 \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-07 07:31:18
|
Revision: 9267 http://sourceforge.net/p/gridarta/code/9267 Author: akirschbaum Date: 2013-07-07 07:31:05 +0000 (Sun, 07 Jul 2013) Log Message: ----------- Create actions in GUIMainControl. 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/actions/AbstractServerActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/ManageBookmarksDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/GoMapDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java 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/PluginManagerFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/shortcuts/ShortcutsManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/viewaction/ViewActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/About.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/HelpActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MainViewActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.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/treasurelist/CFTreasureListTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.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/updater/UpdaterManager.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ActionUtils.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CleanCompletelyBlockedSquaresAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectSpellsAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayArchetypeNamesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayGameObjectNamesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayIconsOnlyAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ExitAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GcAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShortcutsAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ZoomAction.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/EditorAction.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-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -100,6 +100,7 @@ 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; import net.sf.gridarta.utils.IOUtils; @@ -486,9 +487,10 @@ /** * {@inheritDoc} */ + @NotNull @Override - public void newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { - new AtrinikServerActions(mapViewManager, fileControl, pathManager); + public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { + return new AtrinikServerActions(mapViewManager, fileControl, pathManager); } } 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-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -97,6 +97,7 @@ 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; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.SystemIcons; @@ -398,9 +399,10 @@ /** * {@inheritDoc} */ + @Nullable @Override - public void newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { - // do nothing: action not supported + public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { + return null; // action not supported } } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -100,6 +100,7 @@ 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; import net.sf.gridarta.utils.IOUtils; @@ -125,6 +126,7 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * An {@link EditorFactory} that creates Crossfire objects. @@ -485,9 +487,10 @@ /** * {@inheritDoc} */ + @Nullable @Override - public void newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { - // do nothing: action not supported + 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 } } Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CleanCompletelyBlockedSquaresAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CleanCompletelyBlockedSquaresAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CleanCompletelyBlockedSquaresAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,80 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.baseobject.GameObjectContainer; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.validation.checks.BlockedSquareChecker; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class CleanCompletelyBlockedSquaresAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final MapManager<G, A, R> mapManager; + + /** + * Creates a new instance. + */ + public CleanCompletelyBlockedSquaresAction(@NotNull final MapManager<G, A, R> mapManager) { + this.mapManager = mapManager; + } + + /** + * The action method for "cleanCompletelyBlockedSquares". Cleans all + * completely blocked squares of a map. + * @fixme this implementation does not take care of multi square objects. + */ + @ActionMethod + public void cleanCompletelyBlockedSquares() { + final MapControl<G, A, R> mapControl = mapManager.getCurrentMap(); + if (mapControl == null) { + return; + } + + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + mapModel.beginTransaction("cleanCompletelyBlockedSquares"); // TODO: I18N/L10N + try { + for (final GameObjectContainer<G, A, R> completelyBlockedSquare : BlockedSquareChecker.findCompletelyBlockedSquares(mapModel)) { + completelyBlockedSquare.removeAll(); + } + } finally { + mapModel.endTransaction(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CleanCompletelyBlockedSquaresAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectSpellsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectSpellsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectSpellsAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,72 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import net.sf.gridarta.gui.spells.SpellsUtils; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Andreas Kirschbaum + */ +public class CollectSpellsAction implements EditorAction { + + @Nullable + private final SpellsUtils spellsUtils; + + @NotNull + private final GlobalSettings globalSettings; + + @NotNull + private final Component parent; + + /** + * Creates a new instance. + */ + public CollectSpellsAction(@Nullable final SpellsUtils spellsUtils, @NotNull final GlobalSettings globalSettings, @NotNull final Component parent) { + this.spellsUtils = spellsUtils; + this.globalSettings = globalSettings; + this.parent = parent; + } + + /** + * The action method for "collectSpells". Opens the dialog to import spell + * definitions. + */ + @ActionMethod + public void collectSpells() { + if (spellsUtils != null) { + spellsUtils.importSpells(globalSettings.getConfigurationDirectory(), parent); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectSpellsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,78 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import javax.swing.JFrame; +import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; +import net.sf.gridarta.utils.EditorAction; +import net.sf.gridarta.utils.ProcessRunner; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Andreas Kirschbaum + */ +public class ControlClientAction implements EditorAction { + + @NotNull + private final AppPreferencesModel appPreferencesModel; + + @NotNull + private final JFrame parent; + + /** + * The {@link ProcessRunner} instance that controls the client. Set to + * <code>null</code> if not yet created. + */ + @Nullable + private ProcessRunner controlClient; + + /** + * {@inheritDoc} + */ + public ControlClientAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final JFrame parent) { + this.appPreferencesModel = appPreferencesModel; + this.parent = parent; + } + + /** + * The action method for "controlClient". Opens the dialog to control the + * client. + */ + @ActionMethod + public void controlClient() { + if (controlClient == null) { + controlClient = new ProcessRunner("controlClient", new String[] { appPreferencesModel.getClient(), }); + } else { + controlClient.setCommand(new String[] { appPreferencesModel.getClient(), }); + } + controlClient.showDialog(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,87 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; +import net.sf.gridarta.utils.EditorAction; +import net.sf.gridarta.utils.ProcessRunner; +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; + +/** + * @author Andreas Kirschbaum + */ +public class ControlServerAction implements EditorAction { + + /** + * The {@link ActionBuilder}. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + @NotNull + private final AppPreferencesModel appPreferencesModel; + + @NotNull + private final JFrame parent; + + /** + * The {@link ProcessRunner} instance that controls the server. Set to + * <code>null</code> if not yet created. + */ + @Nullable + private ProcessRunner controlServer; + + /** + * Creates a new instance. + */ + public ControlServerAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final JFrame parent) { + this.appPreferencesModel = appPreferencesModel; + this.parent = parent; + } + + /** + * The action method for "controlServer". Opens the dialog to control the + * server. + */ + @ActionMethod + public void controlServer() { + if (controlServer == null) { + controlServer = new ProcessRunner("controlServer", new String[] { appPreferencesModel.getServer(), }); + ACTION_BUILDER.showOnetimeMessageDialog(parent, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); + } else { + controlServer.setCommand(new String[] { appPreferencesModel.getServer(), }); + } + controlServer.showDialog(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayArchetypeNamesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayArchetypeNamesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayArchetypeNamesAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +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.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class DisplayArchetypeNamesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + @NotNull + private final DisplayMode<G, A, R> displayMode; + + /** + * Creates a new instance. + */ + public DisplayArchetypeNamesAction(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final DisplayMode<G, A, R> displayMode) { + this.archetypeChooserModel = archetypeChooserModel; + this.displayMode = displayMode; + } + + /** + * Sets whether game object names are shown. + */ + @ActionMethod + public void displayArchetypeNames() { + archetypeChooserModel.setDisplayMode(displayMode); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayArchetypeNamesAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayGameObjectNamesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayGameObjectNamesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayGameObjectNamesAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +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.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class DisplayGameObjectNamesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + @NotNull + private final DisplayMode<G, A, R> displayMode; + + /** + * Creates a new instance. + */ + public DisplayGameObjectNamesAction(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final DisplayMode<G, A, R> displayMode) { + this.archetypeChooserModel = archetypeChooserModel; + this.displayMode = displayMode; + } + + /** + * Sets whether game object names are shown. + */ + @ActionMethod + public void displayGameObjectNames() { + archetypeChooserModel.setDisplayMode(displayMode); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayGameObjectNamesAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayIconsOnlyAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayIconsOnlyAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayIconsOnlyAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +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.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class DisplayIconsOnlyAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + @NotNull + private final DisplayMode<G, A, R> displayMode; + + /** + * Creates a new instance. + */ + public DisplayIconsOnlyAction(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final DisplayMode<G, A, R> displayMode) { + this.archetypeChooserModel = archetypeChooserModel; + this.displayMode = displayMode; + } + + /** + * Sets whether game object names are shown. + */ + @ActionMethod + public void displayIconsOnly() { + archetypeChooserModel.setDisplayMode(displayMode); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/DisplayIconsOnlyAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ExitAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ExitAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ExitAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,90 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.plugin.PluginController; +import net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserControl; +import net.sf.gridarta.model.mapmanager.FileControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.utils.EditorAction; +import net.sf.gridarta.utils.Exiter; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class ExitAction implements EditorAction { + + @NotNull + private final Exiter exiter; + + @NotNull + private final ScriptEditControl scriptEditControl; + + @NotNull + private final FileControl<?, ?, ?> fileControl; + + @NotNull + private final PickmapChooserControl<?, ?, ?> pickmapChooserControl; + + @NotNull + private final PluginController<?, ?, ?> pluginControl; + + /** + * Creates a new instance. + */ + public ExitAction(@NotNull final Exiter exiter, @NotNull final ScriptEditControl scriptEditControl, @NotNull final FileControl<?, ?, ?> fileControl, @NotNull final PickmapChooserControl<?, ?, ?> pickmapChooserControl, @NotNull final PluginController<?, ?, ?> pluginControl) { + this.exiter = exiter; + this.scriptEditControl = scriptEditControl; + this.fileControl = fileControl; + this.pickmapChooserControl = pickmapChooserControl; + this.pluginControl = pluginControl; + } + + /** + * The action method for "exit". Invoked when user wants to exit from the + * program. + */ + @ActionMethod + public void exit() { + if (canExit()) { + exiter.doExit(0); + } + } + + /** + * Prepares existing the application: save modified data (possibly ask the + * user if applicable). + * @return whether all modified data has been saved + */ + private boolean canExit() { + return scriptEditControl.closeAllTabs() && fileControl.closeAllMaps() && pickmapChooserControl.canExit() && pluginControl.canExit(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ExitAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GcAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GcAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GcAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,61 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.misc.StatusBar; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class GcAction implements EditorAction { + + @NotNull + private final StatusBar<?, ?, ?> statusBar; + + /** + * Creates a new instance. + */ + public GcAction(@NotNull final StatusBar<?, ?, ?> statusBar) { + this.statusBar = statusBar; + } + + /** + * The action method for "gc". Runs the garbage collection. + */ + @ActionMethod + public void gc() { + //noinspection CallToSystemGC + System.gc(); + System.runFinalization(); + statusBar.setStatusText("Garbage collection - done."); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GcAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,104 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; +import net.sf.gridarta.maincontrol.EditorFactory; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; +import net.sf.gridarta.model.exitconnector.ExitConnectorModel; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.model.validation.DelegatingMapValidator; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import net.sf.japi.swing.prefs.PreferencesGroup; +import net.sf.japi.swing.prefs.PreferencesPane; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Andreas Kirschbaum + */ +public class OptionsAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final EditorFactory<G, A, R> editorFactory; + + @NotNull + private final GlobalSettings globalSettings; + + @NotNull + private final DelegatingMapValidator<G, A, R> validators; + + @NotNull + private final AppPreferencesModel appPreferencesModel; + + @NotNull + private final ExitConnectorModel exitConnectorModel; + + @NotNull + private final ConfigSourceFactory configSourceFactory; + + @NotNull + private final Component parent; + + /** + * The {@link PreferencesGroup} instance. Set to <code>null</code> if not + * yet created. + */ + @Nullable + private PreferencesGroup preferencesGroup; + + /** + * Creates a new instance. + */ + public OptionsAction(@NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AppPreferencesModel appPreferencesModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final Component parent) { + this.editorFactory = editorFactory; + this.globalSettings = globalSettings; + this.validators = validators; + this.appPreferencesModel = appPreferencesModel; + this.exitConnectorModel = exitConnectorModel; + this.configSourceFactory = configSourceFactory; + this.parent = parent; + } + + /** + * The action method for "options". Opens the options dialog. + */ + @ActionMethod + public void options() { + if (preferencesGroup == null) { + preferencesGroup = editorFactory.createPreferencesGroup(globalSettings, validators, appPreferencesModel, exitConnectorModel, configSourceFactory); + } + PreferencesPane.showPreferencesDialog(parent, preferencesGroup, false); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShortcutsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShortcutsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShortcutsAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,64 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class ShortcutsAction implements EditorAction { + + @NotNull + private final ShortcutsManager shortcutsManager; + + @NotNull + private final Component parent; + + /** + * Creates a new instance. + */ + public ShortcutsAction(@NotNull final ShortcutsManager shortcutsManager, @NotNull final Component parent) { + this.shortcutsManager = shortcutsManager; + this.parent = parent; + } + + /** + * The action method for "shortcuts". Opens the dialog to configure keyboard + * shortcuts. + */ + @ActionMethod + public void shortcuts() { + shortcutsManager.showShortcutsDialog(parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShortcutsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ZoomAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ZoomAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ZoomAction.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -0,0 +1,80 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import javax.swing.JOptionPane; +import net.sf.gridarta.gui.map.renderer.RendererFactory; +import net.sf.gridarta.gui.misc.MapPreview; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class ZoomAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + @NotNull + private final MapManager<G, A, R> mapManager; + + @NotNull + private final RendererFactory<G, A, R> rendererFactory; + + @NotNull + private final Component parent; + + /** + * Creates a new instance. + */ + public ZoomAction(@NotNull final MapManager<G, A, R> mapManager, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final Component parent) { + this.mapManager = mapManager; + this.rendererFactory = rendererFactory; + this.parent = parent; + } + + /** + * The action method for "zoom". Opens the dialog to create zoomed images of + * the current map. + */ + @ActionMethod + public void zoom() { + final MapControl<G, A, R> mapControl = mapManager.getCurrentMap(); + if (mapControl == null) { + JOptionPane.showMessageDialog(parent, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + new MapPreview(rendererFactory.newSimpleMapRenderer(mapControl.getMapModel()).getFullImage()); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ZoomAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -33,7 +33,7 @@ import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.utils.ActionUtils; +import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -45,7 +45,7 @@ * @author Andreas Kirschbaum * @noinspection AbstractClassWithOnlyOneDirectInheritor */ -public abstract class AbstractServerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public abstract class AbstractServerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** * Action Builder to create Actions. @@ -75,8 +75,8 @@ * The action for "open in client". * @noinspection ThisEscapedInObjectConstruction */ - @NotNull - private final Action aOpenInClient = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "openInClient"); + @Nullable + private Action aOpenInClient; /** * The map manager listener which is attached to the current map if the @@ -116,7 +116,6 @@ this.pathManager = pathManager; mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); - updateActions(); } /** @@ -131,7 +130,10 @@ * Update the enabled/disabled state of all actions. */ private void updateActions() { - aOpenInClient.setEnabled(doOpenInClient(false)); + if (aOpenInClient != null) { + //noinspection ConstantConditions + aOpenInClient.setEnabled(doOpenInClient(false)); + } } /** @@ -192,4 +194,13 @@ */ protected abstract void teleportCharacterToMap(@NotNull final String mapPath, final int mapX, final int mapY) throws IOException; + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + aOpenInClient = action; + updateActions(); + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -34,9 +34,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.utils.ActionUtils; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,15 +43,9 @@ * Implements actions for managing bookmarks. * @author Andreas Kirschbaum */ -public class BookmarkActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class BookmarkActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * The {@link ActionBuilder} instance. - */ - @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link AbstractMapMenuPreferences} for adding new bookmarks. */ @NotNull @@ -86,8 +78,8 @@ /** * The {@link Action} for "add bookmark". */ - @NotNull - private final Action aAddBookmark = ActionUtils.newAction(ACTION_BUILDER, "Bookmarks", this, "addBookmark"); + @Nullable + private Action aAddBookmark; /** * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if @@ -111,8 +103,6 @@ this.mapViewManager = mapViewManager; this.parentComponent = parentComponent; this.mapImageCache = mapImageCache; - ActionUtils.newAction(ACTION_BUILDER, "Bookmarks", this, "manageBookmarks"); - final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { @Override @@ -132,8 +122,6 @@ }; mapViewManager.addMapViewManagerListener(mapViewManagerListener); - - updateActions(); } /** @@ -161,7 +149,10 @@ * Updates the enabled state of all actions. */ private void updateActions() { - aAddBookmark.setEnabled(doAddBookmark(false)); + if (aAddBookmark != null) { + //noinspection ConstantConditions + aAddBookmark.setEnabled(doAddBookmark(false)); + } } /** @@ -194,4 +185,15 @@ return true; } + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + if (name.equals("addBookmark")) { + aAddBookmark = action; + updateActions(); + } + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/ManageBookmarksDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/ManageBookmarksDialog.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/ManageBookmarksDialog.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -188,8 +188,6 @@ dialog.setModal(false); dialog.setResizable(true); dialog.pack(); - - updateActions(); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.dialog.goexit; import java.awt.Window; +import javax.swing.Action; import net.sf.gridarta.gui.map.mapactions.EnterMap; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; @@ -31,6 +32,7 @@ import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; @@ -38,7 +40,7 @@ * Manager for {@link GoExitDialog} instances. * @author Andreas Kirschbaum */ -public class GoExitDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class GoExitDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** * The parent {@link Window} for go map dialogs. @@ -120,4 +122,11 @@ new GoExitDialog<G, A, R>(parent, mapView, exitGameObjectMatcher, pathManager, enterMap, faceObjectProviders).showDialog(); } + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/GoMapDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/GoMapDialogManager.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/GoMapDialogManager.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.dialog.gomap; import java.awt.Window; +import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -28,6 +29,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.ExiterListener; import net.sf.japi.swing.action.ActionMethod; @@ -39,7 +41,7 @@ * Manager for {@link GoMapDialog} instances. * @author Andreas Kirschbaum */ -public class GoMapDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class GoMapDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** * The Logger for printing log messages. @@ -117,4 +119,11 @@ new GoMapDialog<G, A, R>(parent, mapsIndex, mapViewsManager).showDialog(); } + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java 2013-07-06 21:50:34 UTC (rev 9266) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java 2013-07-07 07:31:05 UTC (rev 9267) @@ -20,6 +20,7 @@ p... [truncated message content] |
From: <aki...@us...> - 2013-07-08 20:29:33
|
Revision: 9276 http://sourceforge.net/p/gridarta/code/9276 Author: akirschbaum Date: 2013-07-08 20:29:23 +0000 (Mon, 08 Jul 2013) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java 2013-07-08 20:26:31 UTC (rev 9275) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java 2013-07-08 20:29:23 UTC (rev 9276) @@ -19,8 +19,8 @@ package net.sf.gridarta.action; +import java.awt.Frame; import javax.swing.Action; -import javax.swing.JFrame; import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.ProcessRunner; @@ -37,7 +37,7 @@ private final AppPreferencesModel appPreferencesModel; @NotNull - private final JFrame parent; + private final Frame parent; /** * The {@link ProcessRunner} instance that controls the client. Set to @@ -49,7 +49,7 @@ /** * Creates a new instance. */ - public ControlClientAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final JFrame parent) { + public ControlClientAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final Frame parent) { this.appPreferencesModel = appPreferencesModel; this.parent = parent; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java 2013-07-08 20:26:31 UTC (rev 9275) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java 2013-07-08 20:29:23 UTC (rev 9276) @@ -19,8 +19,8 @@ package net.sf.gridarta.action; +import java.awt.Frame; import javax.swing.Action; -import javax.swing.JFrame; import javax.swing.JOptionPane; import net.sf.gridarta.gui.dialog.prefs.AppPreferencesModel; import net.sf.gridarta.utils.EditorAction; @@ -45,7 +45,7 @@ private final AppPreferencesModel appPreferencesModel; @NotNull - private final JFrame parent; + private final Frame parent; /** * The {@link ProcessRunner} instance that controls the server. Set to @@ -57,7 +57,7 @@ /** * Creates a new instance. */ - public ControlServerAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final JFrame parent) { + public ControlServerAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final Frame parent) { this.appPreferencesModel = appPreferencesModel; this.parent = parent; } Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java 2013-07-08 20:26:31 UTC (rev 9275) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/ProcessRunner.java 2013-07-08 20:29:23 UTC (rev 9276) @@ -23,6 +23,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.Font; +import java.awt.Frame; import java.awt.Window; import java.io.File; import java.io.IOException; @@ -31,7 +32,6 @@ import java.util.concurrent.ConcurrentLinkedQueue; import javax.swing.Action; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -186,7 +186,7 @@ * Show a dialog if not already visible. * @param parent owner frame to display on */ - public void showDialog(@NotNull final JFrame parent) { + public void showDialog(@NotNull final Frame parent) { if (dialog == null || dialog.getOwner() != parent) { createDialog(parent); } @@ -200,7 +200,7 @@ * Create the dialog. * @param parent owner frame to display on */ - private void createDialog(@NotNull final JFrame parent) { + private void createDialog(@NotNull final Frame parent) { dialog = new JDialog(parent, ActionBuilderUtils.getString(ACTION_BUILDER, key + ".title")); dialog.add(this); assert dialog != null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:33:47
|
Revision: 9303 http://sourceforge.net/p/gridarta/code/9303 Author: akirschbaum Date: 2013-07-10 20:33:42 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Merge FileControl.editScript() and editFile() into openFile(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -171,36 +171,26 @@ return tmpFileChooser; } - /** - * {@inheritDoc} - */ @ActionMethod - @Override public void editScript() { openFile(false); } - /** - * {@inheritDoc} - */ @ActionMethod - @Override public void openFile() { openFile(true); } /** - * The user wants to open a file. The file filters and preselected file - * filter are set accordingly to <code>mapFilter</code>. - * @param mapFilter set to <code>true</code> if the user probably wants to - * open a map, <code>false</code> otherwise + * {@inheritDoc} */ - private void openFile(final boolean mapFilter) { + @Override + public void openFile(final boolean mapFile) { if (fileChooser == null) { fileChooser = createFileChooser(); } final JFileChooser tmpFileChooser = fileChooser; - if (mapFilter) { + if (mapFile) { tmpFileChooser.setFileFilter(mapFileFilter); } else { tmpFileChooser.setFileFilter(scriptFileFilter); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -30,16 +30,13 @@ public interface FileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * The user wants to edit a script file. + * The user wants to edit a file. + * @param mapFile {@code true} for map files, {@code false} for script + * files */ - void editScript(); + void openFile(boolean mapFile); /** - * The user wants to open a map file. - */ - void openFile(); - - /** * Save one map. * @param mapControl the map * @return <code>false</code> if saving failed, <code>true</code> otherwise Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -43,7 +43,7 @@ * {@inheritDoc} */ @Override - public void editScript() { + public void openFile(final boolean mapFile) { throw new AssertionError(); } @@ -51,14 +51,6 @@ * {@inheritDoc} */ @Override - public void openFile() { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @Override public boolean save(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-12 04:30:16
|
Revision: 9317 http://sourceforge.net/p/gridarta/code/9317 Author: akirschbaum Date: 2013-07-12 04:30:13 +0000 (Fri, 12 Jul 2013) Log Message: ----------- Release 0.10. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-07-12 04:22:41 UTC (rev 9316) +++ trunk/src/atrinik/ChangeLog 2013-07-12 04:30:13 UTC (rev 9317) @@ -1,3 +1,7 @@ +2013-07-12 Andreas Kirschbaum + + * Release 0.10. + 2013-01-03 Andreas Kirschbaum * Do not disable map cursor in "enter xyz map". Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-07-12 04:22:41 UTC (rev 9316) +++ trunk/src/crossfire/ChangeLog 2013-07-12 04:30:13 UTC (rev 9317) @@ -1,5 +1,7 @@ 2013-07-12 Andreas Kirschbaum + * Release 0.10. + * Collect resources. 2013-02-03 Andreas Kirschbaum Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-07-12 04:22:41 UTC (rev 9316) +++ trunk/src/daimonin/ChangeLog 2013-07-12 04:30:13 UTC (rev 9317) @@ -1,3 +1,7 @@ +2013-07-12 Andreas Kirschbaum + + * Release 0.10. + 2013-07-01 Smacky * TYPE_SHOP_FLOOR is now a sys object, not a floor so do not check for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-13 13:30:52
|
Revision: 9327 http://sourceforge.net/p/gridarta/code/9327 Author: akirschbaum Date: 2013-07-13 13:30:45 +0000 (Sat, 13 Jul 2013) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html 2013-07-13 10:42:56 UTC (rev 9326) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html 2013-07-13 13:30:45 UTC (rev 9327) @@ -22,7 +22,7 @@ <body> <p>Renders maps.</p> -<p>Note: management of maps is in a different package: {@link +<p>Note: management of maps is in a different package: {@code net.sf.gridarta.model.mapcontrol}.</p> </body> </html> Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html 2013-07-13 10:42:56 UTC (rev 9326) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html 2013-07-13 13:30:45 UTC (rev 9327) @@ -22,7 +22,7 @@ <body> <p>Renders maps.</p> -<p>Note: management of maps is in a different package: {@link +<p>Note: management of maps is in a different package: {@code net.sf.gridarta.model.mapcontrol}.</p> </body> </html> Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html 2013-07-13 10:42:56 UTC (rev 9326) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html 2013-07-13 13:30:45 UTC (rev 9327) @@ -22,7 +22,7 @@ <body> <p>Renders maps.</p> -<p>Note: management of maps is in a different package: {@link +<p>Note: management of maps is in a different package: {@code net.sf.gridarta.model.mapcontrol}.</p> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-15 08:29:40
|
Revision: 9345 http://sourceforge.net/p/gridarta/code/9345 Author: akirschbaum Date: 2013-07-15 08:29:34 +0000 (Mon, 15 Jul 2013) Log Message: ----------- Extract Attributes from BaseObject. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/BaseObject.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-14 21:34:00 UTC (rev 9344) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-15 08:29:34 UTC (rev 9345) @@ -82,6 +82,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.archetypetype.AttributeBitmask; +import net.sf.gridarta.model.baseobject.Attributes; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -125,7 +126,7 @@ * @serial */ @NotNull - private G gameObject; + private Attributes attributes; /** * The parent component for dialogs. @@ -260,7 +261,7 @@ @Override public void visit(@NotNull final ArchetypeAttributeAnimationName archetypeAttribute) { final String attributeName = archetypeAttribute.getArchetypeAttributeName(); - final String defaultText = gameObject.getAttributeString(attributeName); + final String defaultText = attributes.getAttributeString(attributeName); final AnimationComponent input = new AnimationComponent(defaultText, animationObjects, faceObjectProviders, noFaceSquareIcon, unknownSquareIcon); final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": "); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeAnimationName>(new DialogAttributeAnimationName<G, A, R>(archetypeAttribute, input), cLabel, input, null, null, false); @@ -282,7 +283,7 @@ input.setBorder(BorderFactory.createLineBorder(Color.gray)); input.setText(bitmask.getText(tmpAttribute.getValue())); component = input; - tmpAttribute.setEncodedValue(gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); + tmpAttribute.setEncodedValue(attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); row = null; } else { label = null; @@ -294,13 +295,13 @@ @Override public void visit(@NotNull final ArchetypeAttributeBool archetypeAttribute) { - final JCheckBox input = new JCheckBox(archetypeAttribute.getAttributeName(), gameObject.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()) == 1); + final JCheckBox input = new JCheckBox(archetypeAttribute.getAttributeName(), attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()) == 1); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeBool>(new DialogAttributeBool<G, A, R>(archetypeAttribute, input), null, null, input, null, false); } @Override public void visit(@NotNull final ArchetypeAttributeBoolSpec archetypeAttribute) { - final CharSequence attributeString = gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); + final CharSequence attributeString = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); final boolean defaultValue; if (archetypeAttribute.getTrueValue().equals("0")) { defaultValue = attributeString.length() == 0 || attributeString.equals("0"); @@ -314,7 +315,7 @@ @Override public void visit(@NotNull final ArchetypeAttributeFaceName archetypeAttribute) { final String attributeName = archetypeAttribute.getArchetypeAttributeName(); - final String defaultText = gameObject.getAttributeString(attributeName); + final String defaultText = attributes.getAttributeString(attributeName); final FaceComponent input = new FaceComponent(defaultText, faceObjects, faceObjectProviders, noFaceSquareIcon, unknownSquareIcon); final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ":"); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeFaceName>(new DialogAttributeFaceName<G, A, R>(archetypeAttribute, input), label, input, null, null, false); @@ -336,8 +337,8 @@ final NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Double.class); final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeDouble(archetypeAttribute.getArchetypeAttributeName()); + // parse value from attributes + final Number value = attributes.getAttributeDouble(archetypeAttribute.getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeFloat>(new DialogAttributeFloat<G, A, R>(archetypeAttribute, input), label, input, null, null, false); @@ -352,8 +353,8 @@ format.setGroupingUsed(false); final NumberFormatter formatter = new NumberFormatter(format); final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()); + // parse value from attributes + final Number value = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeInt>(new DialogAttributeInt<G, A, R>(archetypeAttribute, input), label, input, null, null, false); @@ -364,7 +365,7 @@ final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); label.setForeground(INT_COLOR); // create ComboBox with parsed selection - @Nullable final JComboBox input = buildInvSpellBox(gameObjectSpells, gameObject, archetypeAttribute.isOptionalSpell(), archetypeAttribute.getAttributeName()); + @Nullable final JComboBox input = buildInvSpellBox(gameObjectSpells, attributes, archetypeAttribute.isOptionalSpell(), archetypeAttribute.getAttributeName()); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeInvSpell>(new DialogAttributeInvSpell<G, A, R>(archetypeAttribute.isOptionalSpell(), archetypeAttribute, input, gameObjectSpells), label, input, null, null, false); } @@ -378,7 +379,7 @@ final ArchetypeTypeList list = archetypeTypeSet.getList(archetypeAttribute.getListName()); if (list != null) { // build the list from vector data - input = buildArrayBox(list, gameObject, archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName()); + input = buildArrayBox(list, attributes, archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName()); component = input; } else { // error: list data is missing or corrupt @@ -397,8 +398,8 @@ format.setGroupingUsed(false); final NumberFormatter formatter = new NumberFormatter(format); final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeLong(archetypeAttribute.getArchetypeAttributeName()); + // parse value from attributes + final Number value = attributes.getAttributeLong(archetypeAttribute.getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeLong>(new DialogAttributeLong<G, A, R>(archetypeAttribute, input), label, input, null, null, false); @@ -406,13 +407,13 @@ @Override public void visit(@NotNull final ArchetypeAttributeMapPath archetypeAttribute) { - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); + final MapSquare<?, ?, ?> mapSquare = attributes instanceof GameObject ? ((GameObject<?, ?, ?>) attributes).getMapSquare() : null; File relativeReference = mapSquare == null ? null : mapSquare.getMapModel().getMapFile(); if (relativeReference == null) { relativeReference = new File(globalSettings.getMapsDirectory(), "dummy"); } final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(mapFileFilter, gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), relativeReference, globalSettings.getMapsDirectory()); + final TilePanel tilePanel = new TilePanel(mapFileFilter, attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), relativeReference, globalSettings.getMapsDirectory()); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeMapPath>(new DialogAttributeMapPath<G, A, R>(archetypeAttribute, tilePanel), label, tilePanel, null, null, false); } @@ -420,7 +421,7 @@ public void visit(@NotNull final ArchetypeAttributeScriptFile archetypeAttribute) { final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); final File mapsDirectory = globalSettings.getMapsDirectory(); - final TilePanel tilePanel = new TilePanel(scriptFileFilter, gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), new File(mapsDirectory, "dummy"), mapsDirectory); + final TilePanel tilePanel = new TilePanel(scriptFileFilter, attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), new File(mapsDirectory, "dummy"), mapsDirectory); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeScriptFile>(new DialogAttributeScriptFile<G, A, R>(archetypeAttribute, tilePanel), label, tilePanel, null, null, false); } @@ -429,13 +430,13 @@ final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); label.setForeground(INT_COLOR); // create ComboBox with parsed selection - @Nullable final JComboBox input = buildSpellBox(gameObject, numberSpells, undefinedSpellIndex, false, archetypeAttribute); + @Nullable final JComboBox input = buildSpellBox(attributes, numberSpells, undefinedSpellIndex, false, archetypeAttribute); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeSpell>(new DialogAttributeSpell<G, A, R>(archetypeAttribute, input, numberSpells), label, input, null, null, false); } @Override public void visit(@NotNull final ArchetypeAttributeString archetypeAttribute) { - final String defaultText = gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); + final String defaultText = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); final JTextField input = new JTextField(defaultText, ArchetypeAttribute.TEXTFIELD_COLUMNS); final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeString>(new DialogAttributeString<G, A, R>(archetypeAttribute, input), label, input, null, null, false); @@ -443,15 +444,18 @@ @Override public void visit(@NotNull final ArchetypeAttributeText archetypeAttribute) { - String text = ""; - if (archetypeAttribute.getArchetypeAttributeName().equals("msg")) { - final String archetypeMsgText = gameObject.getArchetype().getMsgText(); - final String gameObjectMsgText = gameObject.getMsgText(); + final String text; + if (archetypeAttribute.getArchetypeAttributeName().equals("msg") && attributes instanceof GameObject) { + final GameObject<?, ?, ?> tmp = (GameObject<?, ?, ?>) attributes; + final String archetypeMsgText = tmp.getArchetype().getMsgText(); + final String gameObjectMsgText = tmp.getMsgText(); if (archetypeMsgText != null && archetypeMsgText.length() > 0 && (gameObjectMsgText == null || gameObjectMsgText.length() == 0)) { text = archetypeMsgText; } else { text = gameObjectMsgText; } + } else { + text = ""; } final JEditTextArea input = new JEditTextArea(textAreaDefaults); input.setDocument(new SyntaxDocument()); @@ -466,7 +470,7 @@ @Override public void visit(@NotNull final ArchetypeAttributeTreasure archetypeAttribute) { // textfield (no direct input, text is set by the treasurelist dialog) - String treasureName = gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); + String treasureName = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } @@ -482,7 +486,7 @@ final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); label.setForeground(INT_COLOR); // create ComboBox with parsed selection - @Nullable final JComboBox input = buildSpellBox(gameObject, numberSpells, undefinedSpellIndex, true, archetypeAttribute); + @Nullable final JComboBox input = buildSpellBox(attributes, numberSpells, undefinedSpellIndex, true, archetypeAttribute); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeZSpell>(new DialogAttributeZSpell<G, A, R>(archetypeAttribute, input, numberSpells, undefinedSpellIndex), label, input, null, null, false); } @@ -490,7 +494,7 @@ /** * Creates a new instance. - * @param gameObject the game object for which the attributes are built + * @param attributes the game object for which the attributes are built * @param parent the parent component for dialogs * @param archetypeTypeSet the reference to the list of archetype types * @param treasureListTree the treasure list tree to display @@ -510,8 +514,8 @@ * @param unknownSquareIcon the image icon for undefined animations * @param textAreaDefaults the text area defaults for text fields */ - public AttributesPaneBuilder(@NotNull final G gameObject, @NotNull final Component parent, final ArchetypeTypeSet archetypeTypeSet, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults) { - this.gameObject = gameObject; + public AttributesPaneBuilder(@NotNull final Attributes attributes, @NotNull final Component parent, final ArchetypeTypeSet archetypeTypeSet, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults) { + this.attributes = attributes; this.parent = parent; this.archetypeTypeSet = archetypeTypeSet; this.treasureListTree = treasureListTree; @@ -550,12 +554,12 @@ /** * Constructs the central part of the attribute dialog, containing the - * object's gameObject attributes. - * @param gameObject the game object for which the attributes are built + * object's attributes. + * @param attributes the attributes for which the attributes panel is built * @param archetypeType the archetype type of {@code gamObject} */ - public void buildAttribute(@NotNull final G gameObject, @NotNull final Iterable<ArchetypeAttributeSection> archetypeType) { - this.gameObject = gameObject; + public void buildAttribute(@NotNull final Attributes attributes, @NotNull final Iterable<ArchetypeAttributeSection> archetypeType) { + this.attributes = attributes; tabbedPane.removeAll(); int sectionId = 0; for (final ArchetypeAttributeSection archetypeAttributeSection : archetypeType) { @@ -674,14 +678,18 @@ * @param gameObjectSpells the game object spells to use * @param isOptionalSpell whether the entry <none> should be shown * @param attributeName the archetype attribute's name - * @param gameObject the associated game object + * @param attributes the associated game object * @return the completed <code>JComboBox</code> */ @NotNull - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> JComboBox buildInvSpellBox(@NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean isOptionalSpell, @NotNull final String attributeName) { + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> JComboBox buildInvSpellBox(@NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Attributes attributes, final boolean isOptionalSpell, @NotNull final String attributeName) { + if (!(attributes instanceof BaseObject)) { + throw new IllegalArgumentException(); + } + final BaseObject<?, ?, ?, ?> baseObject = (BaseObject<?, ?, ?, ?>) attributes; final int selectedIndex; @Nullable final String title; - switch (gameObject.countInvObjects()) { + switch (baseObject.countInvObjects()) { case 0: selectedIndex = gameObjectSpells.size(); title = isOptionalSpell ? null : "<none>"; @@ -693,7 +701,7 @@ break; case 1: - final GameObject<?, ?, ?> invObject = gameObject.iterator().next(); + final GameObject<?, ?, ?> invObject = baseObject.iterator().next(); final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); int index = 0; @Nullable String tmpTitle = "<customized spell>"; @@ -730,17 +738,17 @@ /** * Constructs the combo box for arrays of "list data". * @param listData list with list items and corresponding values - * @param gameObject the associated game object + * @param attributes the associated game object * @param archetypeAttributeName the name of the shown attribute * @param attributeName the label to show on the combo box * @return the completed <code>JComboBox</code> */ @NotNull - private static JComboBox buildArrayBox(@NotNull final ArchetypeTypeList listData, @NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String archetypeAttributeName, @NotNull final String attributeName) { + private static JComboBox buildArrayBox(@NotNull final ArchetypeTypeList listData, @NotNull final Attributes attributes, @NotNull final String archetypeAttributeName, @NotNull final String attributeName) { // build the array of list-items final String[] array = new String[listData.size()]; boolean hasSelection = false; - int active = gameObject.getAttributeInt(archetypeAttributeName); + int active = attributes.getAttributeInt(archetypeAttributeName); for (int i = 0; i < array.length; i++) { array[i] = listData.get(i).getSecond(); if (!hasSelection && listData.get(i).getFirst() == active) { @@ -762,7 +770,7 @@ /** * Constructs the combo box of the available spells. - * @param gameObject the associated game object + * @param attributes the associated game object * @param numberSpells the number spells to use * @param undefinedSpellIndex the index to use for the undefined spell * @param isZSpell whether a z-spell or a spell combo box is built @@ -770,8 +778,8 @@ * @return the completed <code>JComboBox</code> */ @NotNull - private static JComboBox buildSpellBox(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, final boolean isZSpell, @NotNull final ArchetypeAttribute archetypeAttribute) { - int spellNumber = gameObject.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()); + private static JComboBox buildSpellBox(@NotNull final Attributes attributes, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, final boolean isZSpell, @NotNull final ArchetypeAttribute archetypeAttribute) { + int spellNumber = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()); if (spellNumber < 0 || spellNumber >= numberSpells.size()) { spellNumber = undefinedSpellIndex; Added: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java 2013-07-15 08:29:34 UTC (rev 9345) @@ -0,0 +1,86 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.baseobject; + +import org.jetbrains.annotations.NotNull; + +/** + * A set of key/value pairs. + * @author Andreas Kirschbaum + */ +public interface Attributes { + + /** + * Returns whether an attribute name exists. + * @param attributeName the attribute name + * @return whether the attribute name exists + */ + boolean hasAttribute(@NotNull String attributeName); + + /** + * Returns the requested attribute value of this GameObject as {@link + * String}. The attribute value is first searched in this GameObject. If the + * attribute value is not found and this GameObject is not an Archetype + * itself, the attribute value is searched in this GameObject's Archetype as + * well. + * @param attributeName the name of the attribute to search + * @return the attribute value or an empty String ("") if no such attribute + */ + @NotNull + String getAttributeString(@NotNull String attributeName); + + /** + * Returns an attribute value of this Archetype as int. + * @param attributeName the name of the attribute value to return + * @return the attribute value or <code>0</code> (zero) if not found + * @see #getAttributeString(String) + */ + int getAttributeInt(@NotNull String attributeName); + + /** + * Returns an attribute value of this Archetype as long. + * @param attributeName the name of the attribute value to return + * @return the attribute value or <code>0</code> (zero) if not found + * @see #getAttributeString(String) + */ + long getAttributeLong(@NotNull String attributeName); + + /** + * Returns an attribute value of this Archetype as double. + * @param attributeName the name of the attribute value to return + * @return the attribute value or <code>0.0</code> (zero) if not found + * @see #getAttributeString(String) + */ + double getAttributeDouble(@NotNull String attributeName); + + /** + * Sets an int value attribute. + * @param attributeName the name of the attribute to update + * @param value the new value + */ + void setAttributeInt(@NotNull String attributeName, int value); + + /** + * Removes the String of an archetype attribute from the objectText. + * @param attributeName search for "attributeName <string>" + */ + void removeAttribute(@NotNull String attributeName); + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/BaseObject.java 2013-07-14 21:34:00 UTC (rev 9344) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/BaseObject.java 2013-07-15 08:29:34 UTC (rev 9345) @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public interface BaseObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, T extends BaseObject<G, A, R, T>> extends Cloneable, Iterable<G>, Serializable { +public interface BaseObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, T extends BaseObject<G, A, R, T>> extends Attributes, Cloneable, Iterable<G>, Serializable { int EDIT_TYPE_NONE = 0x10000; // special case @@ -168,13 +168,6 @@ boolean hasAttribute(@NotNull String attributeName, boolean queryArchetype); /** - * Returns whether an attribute name exists. - * @param attributeName the attribute name - * @return whether the attribute name exists - */ - boolean hasAttribute(@NotNull String attributeName); - - /** * Returns the requested attribute value of this GameObject as {@link * String}. The attribute value is first searched in this GameObject. If * <code>queryArchetype == true</code>, additional search is done: if the @@ -194,20 +187,6 @@ String getAttributeString(@NotNull String attributeName, boolean queryArchetype); /** - * Returns the requested attribute value of this GameObject as {@link - * String}. The attribute value is first searched in this GameObject. If the - * attribute value is not found and this GameObject is not an Archetype - * itself, the attribute value is searched in this GameObject's Archetype as - * well. <p/> This methods corresponds to {@link #getAttributeString(String, - * boolean)} with <code>useArchetype == true</code>. - * @param attributeName the name of the attribute to search - * @return the attribute value or an empty String ("") if no such attribute - * @see #getAttributeString(String, boolean) - */ - @NotNull - String getAttributeString(@NotNull String attributeName); - - /** * Returns the requested attribute value of this GameObject as * <code>int</code>. * @param attributeName the name of the attribute to search @@ -219,14 +198,6 @@ int getAttributeInt(@NotNull String attributeName, boolean queryArchetype); /** - * Returns an attribute value of this Archetype as int. - * @param attributeName the name of the attribute value to return - * @return the attribute value or <code>0</code> (zero) if not found - * @see #getAttributeString(String) - */ - int getAttributeInt(@NotNull String attributeName); - - /** * Returns the requested attribute value of this GameObject as * <code>long</code>. * @param attributeName the name of the attribute to search @@ -238,14 +209,6 @@ long getAttributeLong(@NotNull String attributeName, boolean queryArchetype); /** - * Returns an attribute value of this Archetype as long. - * @param attributeName the name of the attribute value to return - * @return the attribute value or <code>0</code> (zero) if not found - * @see #getAttributeString(String) - */ - long getAttributeLong(@NotNull String attributeName); - - /** * Returns the requested attribute value of this GameObject as * <code>double</code>. * @param attributeName the name of the attribute to search @@ -257,14 +220,6 @@ double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype); /** - * Returns an attribute value of this Archetype as double. - * @param attributeName the name of the attribute value to return - * @return the attribute value or <code>0.0</code> (zero) if not found - * @see #getAttributeString(String) - */ - double getAttributeDouble(@NotNull String attributeName); - - /** * Sets the String of an archetype attribute in the objectText. * @param attributeName search for "attributeName <string>" * @param value the value to set @@ -272,19 +227,6 @@ void setAttributeString(@NotNull String attributeName, @NotNull String value); /** - * Sets an int value attribute. - * @param attributeName the name of the attribute to update - * @param value the new value - */ - void setAttributeInt(@NotNull String attributeName, int value); - - /** - * Removes the String of an archetype attribute from the objectText. - * @param attributeName search for "attributeName <string>" - */ - void removeAttribute(@NotNull String attributeName); - - /** * Notifies the map model that this container is about to change. */ void notifyBeginChange(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-15 19:49:03
|
Revision: 9349 http://sourceforge.net/p/gridarta/code/9349 Author: akirschbaum Date: 2013-07-15 19:48:50 +0000 (Mon, 15 Jul 2013) Log Message: ----------- Replace length() == 0 with isEmpty(). Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/MapArchObjectParser.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeAnimationName.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFaceName.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFloat.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInt.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInvSpell.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeLong.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeMapPath.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeScriptFile.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeSpell.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeString.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeText.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeTreasure.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeZSpell.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/LockedItemsView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/MsgTextTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/UpdaterManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AttributeListUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AttributeBitmask.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinListsParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/GameObjectUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractArchetypeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/GameObjectMatcherParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/smoothface/SmoothFacesLoader.java trunk/src/model/src/main/java/net/sf/gridarta/model/spells/GameObjectSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ConnectedInsideContainerChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/TestMapArchObjectParser.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Find.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/Paste.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -658,7 +658,7 @@ mainControl.showMessage("Illegal Value", "Darkness level must be in range 0-1000." ); return false; }*/ - if (mapName.getText().length() == 0) { + if (mapName.getText().isEmpty()) { ACTION_BUILDER.showMessageDialog(this, "mapErrorMissingMapName"); return false; } @@ -721,7 +721,7 @@ * @throws IllegalArgumentException when parsing fails */ private static int parseProperty(@NotNull final String s, @NotNull final String label) { - if (s.length() == 0) { + if (s.isEmpty()) { return 0; // empty string is interpreted as zero } final int r = Integer.parseInt(s); // trying to parse Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -42,7 +42,7 @@ public void save(@NotNull final Appendable appendable, @NotNull final MapArchObject mapArchObject) throws IOException { final Formatter format = new Formatter(appendable); appendable.append("arch map\n"); - if (mapArchObject.getMapName().length() > 0) { + if (!mapArchObject.getMapName().isEmpty()) { format.format("name %s\n", mapArchObject.getMapName()); } format.format("msg\n%s%sendmsg\n", mapArchObject.getText().trim(), "\n"); @@ -103,7 +103,7 @@ appendable.append("pvp 1\n"); } for (final Direction direction : Direction.values()) { - if (mapArchObject.getTilePath(direction).length() > 0) { + if (!mapArchObject.getTilePath(direction).isEmpty()) { format.format("tile_path_%d %s\n", direction.ordinal() + 1, mapArchObject.getTilePath(direction)); } } @@ -113,15 +113,15 @@ format.format("tileset_y %d\n", mapArchObject.getTilesetY()); } final String backgroundMusic = mapArchObject.getBackgroundMusic(); - if (backgroundMusic.length() > 0) { + if (!backgroundMusic.isEmpty()) { format.format("bg_music %s\n", backgroundMusic); } final String region = mapArchObject.getRegion(); - if (region.length() > 0) { + if (!region.isEmpty()) { format.format("region %s\n", region); } final String weather = mapArchObject.getWeather(); - if (weather.length() > 0) { + if (!weather.isEmpty()) { format.format("weather %s\n", weather); } appendable.append("end\n"); Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -116,13 +116,13 @@ final String newPluginName = scriptedEventEditor.getInputPluginName(); final String newOptions = scriptedEventEditor.getInputOptions(); - if (newPath.length() > 0) { + if (!newPath.isEmpty()) { setScriptPath(newPath); } - if (newPluginName.length() > 0) { + if (!newPluginName.isEmpty()) { setPluginName(newPluginName); } - if (newOptions.length() > 0) { + if (!newOptions.isEmpty()) { setOptions(newOptions); } } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -709,7 +709,7 @@ ACTION_BUILDER.showMessageDialog(this, "mapErrorInvalidDarkness"); return false; } - if (mapName.getText().length() == 0) { + if (mapName.getText().isEmpty()) { ACTION_BUILDER.showMessageDialog(this, "mapErrorMissingMapName"); return false; } @@ -777,7 +777,7 @@ * @throws IllegalArgumentException when parsing fails */ private static int parseProperty(@NotNull final String s, @NotNull final String label) { - if (s.length() == 0) { + if (s.isEmpty()) { return 0; // empty string is interpreted as zero } @@ -807,7 +807,7 @@ * @throws IllegalArgumentException when parsing fails */ private static double parsePropertyToDouble(@NotNull final String s, @NotNull final String label) { - if (s.length() == 0) { + if (s.isEmpty()) { return 0.0; // empty string is interpreted as zero } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -50,7 +50,7 @@ public void save(@NotNull final Appendable appendable, @NotNull final MapArchObject mapArchObject) throws IOException { final Formatter format = new Formatter(appendable); appendable.append("arch map\n"); - if (mapArchObject.getMapName().length() > 0) { + if (!mapArchObject.getMapName().isEmpty()) { format.format("name %s\n", mapArchObject.getMapName()); } if (mapArchObject.getSwapTime() != 0) { @@ -65,10 +65,10 @@ if (mapArchObject.getDifficulty() != 0) { format.format("difficulty %d\n", mapArchObject.getDifficulty()); } - if (mapArchObject.getRegion().length() > 0) { + if (!mapArchObject.getRegion().isEmpty()) { format.format("region %s\n", mapArchObject.getRegion()); } - if (mapArchObject.getShopItems().length() > 0) { + if (!mapArchObject.getShopItems().isEmpty()) { format.format("shopitems %s\n", mapArchObject.getShopItems()); } // The following floating point equality comparison is assumed to be okay @@ -81,7 +81,7 @@ if (mapArchObject.getShopMax() != 0) { format.format("shopmax %d\n", mapArchObject.getShopMax()); } - if (mapArchObject.getShopRace().length() > 0) { + if (!mapArchObject.getShopRace().isEmpty()) { format.format("shoprace %s\n", mapArchObject.getShopRace()); } if (mapArchObject.getDarkness() != 0) { @@ -95,10 +95,10 @@ if (mapArchObject.getEnterY() != 0) { format.format("enter_y %d\n", mapArchObject.getEnterY()); } - if (mapArchObject.getText().trim().length() > 0) { + if (!mapArchObject.getText().trim().isEmpty()) { format.format("msg\n" + "%s\n" + "endmsg\n", mapArchObject.getText().trim()); } - if (mapArchObject.getLore().trim().length() > 0) { + if (!mapArchObject.getLore().trim().isEmpty()) { format.format("maplore\n" + "%s\n" + "endmaplore\n", mapArchObject.getLore().trim()); } if (mapArchObject.isUnique()) { @@ -129,14 +129,14 @@ format.format("sky %d\n", mapArchObject.getSky()); } for (final Direction direction : Direction.values()) { - if (mapArchObject.getTilePath(direction).length() > 0) { + if (!mapArchObject.getTilePath(direction).isEmpty()) { format.format("tile_path_%d %s\n", direction.ordinal() + 1, mapArchObject.getTilePath(direction)); } } if (mapArchObject.isNoSmooth()) { appendable.append("nosmooth 1\n"); } - if (mapArchObject.getBackgroundMusic().length() > 0) { + if (!mapArchObject.getBackgroundMusic().isEmpty()) { format.format("background_music %s\n", mapArchObject.getBackgroundMusic()); } appendable.append("end\n"); @@ -233,7 +233,7 @@ break; } - if (mapArchObject.getLore().length() > 0) { + if (!mapArchObject.getLore().isEmpty()) { mapArchObject.addLore("\n"); } mapArchObject.addLore(loreLine); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -560,7 +560,7 @@ * @param text the text to append */ public void addLore(@NotNull final String text) { - if (text.length() == 0) { + if (text.isEmpty()) { return; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -116,10 +116,10 @@ final String newPluginName = scriptedEventEditor.getInputPluginName(); final String newOptions = scriptedEventEditor.getInputOptions(); - if (newPath.length() > 0) { + if (!newPath.isEmpty()) { setScriptPath(newPath); } - if (newPluginName.length() > 0) { + if (!newPluginName.isEmpty()) { setPluginName(newPluginName); } setOptions(newOptions); // unlike the above two, event options can be empty Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -643,7 +643,7 @@ mainControl.showMessage("Illegal Value", "Darkness level must be in range 0-1000." ); return false; }*/ - if (mapName.getText().length() == 0) { + if (mapName.getText().isEmpty()) { ACTION_BUILDER.showMessageDialog(this, "mapErrorMissingMapName"); return false; } @@ -704,7 +704,7 @@ * @throws IllegalArgumentException if parsing fails */ private static int parseProperty(@NotNull final String s, @NotNull final String label) { - if (s.length() == 0) { + if (s.isEmpty()) { return 0; // empty string is interpreted as zero } final int r = Integer.parseInt(s); // trying to parse Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/MapArchObjectParser.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/MapArchObjectParser.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/MapArchObjectParser.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -42,7 +42,7 @@ public void save(@NotNull final Appendable appendable, @NotNull final MapArchObject mapArchObject) throws IOException { final Formatter format = new Formatter(appendable); appendable.append("arch map\n"); - if (mapArchObject.getMapName().length() > 0) { + if (!mapArchObject.getMapName().isEmpty()) { format.format("name %s\n", mapArchObject.getMapName()); } format.format("msg\n%s%sendmsg\n", mapArchObject.getText().trim(), "\n"); @@ -103,7 +103,7 @@ appendable.append("pvp 1\n"); } for (final Direction direction : Direction.values()) { - if (mapArchObject.getTilePath(direction).length() > 0) { + if (!mapArchObject.getTilePath(direction).isEmpty()) { format.format("tile_path_%d %s\n", direction.ordinal() + 1, mapArchObject.getTilePath(direction)); } } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -116,13 +116,13 @@ final String newPluginName = scriptedEventEditor.getInputPluginName(); final String newOptions = scriptedEventEditor.getInputOptions(); - if (newPath.length() > 0) { + if (!newPath.isEmpty()) { setScriptPath(newPath); } - if (newPluginName.length() > 0) { + if (!newPluginName.isEmpty()) { setPluginName(newPluginName); } - if (newOptions.length() > 0) { + if (!newOptions.isEmpty()) { setOptions(newOptions); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -193,7 +193,7 @@ final Direction direction = mapLink.getMapDirection(); if (mapControls.get(direction.ordinal()) == null) { final String tilePath = mapControl.getMapModel().getMapArchObject().getTilePath(mapLink.getLinkDirection()); - if (tilePath.length() > 0) { + if (!tilePath.isEmpty()) { try { mapControls.set(direction.ordinal(), loadMapControl(mapControl.getMapModel(), tilePath)); repeatFlag = true; @@ -331,7 +331,7 @@ final String sep = Matcher.quoteReplacement(File.separator); /* our map is in root - second is higher or same map */ - if (first.length() == 0) { + if (first.isEmpty()) { return link.substring(mapDirectory.length()).trim().replaceAll(sep, "/"); } // same folder... we return the name without '/' Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -301,10 +301,10 @@ @Override public void visit(@NotNull final ArchetypeAttributeBoolSpec archetypeAttribute) { - final CharSequence attributeString = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); + final String attributeString = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); final boolean defaultValue; if (archetypeAttribute.getTrueValue().equals("0")) { - defaultValue = attributeString.length() == 0 || attributeString.equals("0"); + defaultValue = attributeString.isEmpty() || attributeString.equals("0"); } else { defaultValue = attributeString.equals(archetypeAttribute.getTrueValue()); } @@ -449,7 +449,7 @@ final GameObject<?, ?, ?> tmp = (GameObject<?, ?, ?>) attributes; final String archetypeMsgText = tmp.getArchetype().getMsgText(); final String gameObjectMsgText = tmp.getMsgText(); - if (archetypeMsgText != null && archetypeMsgText.length() > 0 && (gameObjectMsgText == null || gameObjectMsgText.length() == 0)) { + if (archetypeMsgText != null && !archetypeMsgText.isEmpty() && (gameObjectMsgText == null || gameObjectMsgText.isEmpty())) { text = archetypeMsgText; } else { text = gameObjectMsgText; @@ -471,7 +471,7 @@ public void visit(@NotNull final ArchetypeAttributeTreasure archetypeAttribute) { // textfield (no direct input, text is set by the treasurelist dialog) String treasureName = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); - if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { + if (treasureName.trim().isEmpty() || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } final JTextField input = new JTextField(" " + treasureName, ArchetypeAttribute.TEXTFIELD_COLUMNS); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeAnimationName.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeAnimationName.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeAnimationName.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -70,7 +70,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getAnimName(); - if (value.length() > 0) { + if (!value.isEmpty()) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -79,8 +79,8 @@ public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { final String encodedValue = getEncodedValue(); // get bitmask value final String archetypeAttributeName = getRef().getArchetypeAttributeName(); - CharSequence oldValue = archetype.getAttributeString(archetypeAttributeName); - if (oldValue.length() == 0) { + String oldValue = archetype.getAttributeString(archetypeAttributeName); + if (oldValue.isEmpty()) { oldValue = "0"; } @@ -97,7 +97,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String tmp = input.getText().trim(); - if (tmp.length() > 0 && !tmp.startsWith("<")) { + if (!tmp.isEmpty() && !tmp.startsWith("<")) { addLine(doc, style, getRef().getAttributeName() + " = " + tmp); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFaceName.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFaceName.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFaceName.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -70,7 +70,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getFaceName(); - if (value.length() > 0) { + if (!value.isEmpty()) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFloat.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFloat.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeFloat.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -57,7 +57,7 @@ @Override public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { final String archetypeAttributeName = getRef().getArchetypeAttributeName(); - if (input.getText().trim().length() == 0) { + if (input.getText().trim().isEmpty()) { if (archetype.hasAttribute(archetypeAttributeName)) { return archetypeAttributeName + " 0.0"; } @@ -85,7 +85,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0 && !value.equals("0")) { + if (value != null && !value.isEmpty() && !value.equals("0")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInt.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInt.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInt.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -65,7 +65,7 @@ public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { final String archetypeAttributeName = ref.getArchetypeAttributeName(); final int value; - if (input.getText().trim().length() == 0) { + if (input.getText().trim().isEmpty()) { value = 0; } else { try { @@ -94,7 +94,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0 && !value.equals("0")) { + if (value != null && !value.isEmpty() && !value.equals("0")) { addLine(doc, style, ref.getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInvSpell.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInvSpell.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeInvSpell.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -131,7 +131,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getSelectedItem().toString().trim(); - if (value.length() > 0 && !value.startsWith("<")) { + if (!value.isEmpty() && !value.startsWith("<")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -81,7 +81,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getSelectedItem().toString().trim(); - if (value.length() > 0 && !value.startsWith("<")) { + if (!value.isEmpty() && !value.startsWith("<")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeLong.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeLong.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeLong.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -57,7 +57,7 @@ @Override public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { final String archetypeAttributeName = getRef().getArchetypeAttributeName(); - if (input.getText().trim().length() == 0) { + if (input.getText().trim().isEmpty()) { if (archetype.getAttributeLong(archetypeAttributeName) != 0L) { return archetypeAttributeName + " 0"; } @@ -82,7 +82,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0 && !value.equals("0")) { + if (value != null && !value.isEmpty() && !value.equals("0")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeMapPath.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeMapPath.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeMapPath.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -70,7 +70,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0) { + if (value != null && !value.isEmpty()) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeScriptFile.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeScriptFile.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeScriptFile.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -70,7 +70,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0) { + if (value != null && !value.isEmpty()) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeSpell.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeSpell.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeSpell.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -81,7 +81,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getSelectedItem().toString().trim(); - if (value.length() > 0 && !value.startsWith("<")) { + if (!value.isEmpty() && !value.startsWith("<")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeString.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeString.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeString.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -72,7 +72,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText(); - if (value != null && value.length() > 0) { + if (value != null && !value.isEmpty()) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeText.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeText.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeText.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -58,7 +58,7 @@ public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { if (getRef().getArchetypeAttributeName().equalsIgnoreCase("msg")) { final String msgText = StringUtils.removeTrailingWhitespaceFromLines(input.getText()); - if (msgText.length() > 0) { + if (!msgText.isEmpty()) { newMsg[0] = msgText; } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeTreasure.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeTreasure.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeTreasure.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -69,7 +69,7 @@ @Override public String getText2(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newMsg, final ArchetypeType archetypeType, final Component parent) { final String inline = input.getText().trim(); // input string - final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; + final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.isEmpty(); final String archetypeAttributeName = getRef().getArchetypeAttributeName(); if (!isNone && treasureTree.get(inline) == null && !inline.equalsIgnoreCase(archetype.getAttributeString(archetypeAttributeName))) { // The user has specified a WRONG treasurelist name, and it does not come @@ -95,7 +95,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getText().trim(); - if (value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { + if (!value.isEmpty() && !value.equals(CFTreasureListTree.NONE_SYM)) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeZSpell.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeZSpell.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeZSpell.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -87,7 +87,7 @@ @Override public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { final String value = input.getSelectedItem().toString().trim(); - if (value.length() > 0 && !value.startsWith("<")) { + if (!value.isEmpty() && !value.startsWith("<")) { addLine(doc, style, getRef().getAttributeName() + " = " + value); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -583,12 +583,12 @@ gbc.weightx = 1.0; final JTextComponent nameTextField; final String objName = gameObject.getObjName(); - if (objName.length() > 0) { - nameTextField = new JTextField(objName, 16); - } else { + if (objName.isEmpty()) { final String archObjName = archetype.getObjName(); - final String nameText = archObjName.length() > 0 ? archObjName : archetype.getArchetypeName(); + final String nameText = !archObjName.isEmpty() ? archObjName : archetype.getArchetypeName(); nameTextField = new JTextField(nameText, 16); + } else { + nameTextField = new JTextField(objName, 16); } nameTextField.setEditable(false); header.add(nameTextField, gbc); @@ -719,7 +719,7 @@ if (text == null) { return false; } - if (text.length() > 0) { + if (!text.isEmpty()) { newArchText.append(text).append("\n"); } } @@ -730,7 +730,7 @@ // ### TODO: for changed types, copy fixed attributes over default arches ### if (archetypeAttribute instanceof ArchetypeAttributeFixed) { final String defaultValue = archetype.getAttributeString(archetypeAttribute.getArchetypeAttributeName()); - if (defaultValue.length() == 0 || (gameObject.getTypeNo() != archetype.getTypeNo() && !defaultValue.equalsIgnoreCase(archetypeAttribute.getAttributeName()))) { + if (defaultValue.isEmpty() || (gameObject.getTypeNo() != archetype.getTypeNo() && !defaultValue.equalsIgnoreCase(archetypeAttribute.getAttributeName()))) { // usually, fixed attributes are only applied when *not* defined in the archetype. // the reason behind this is: if the default gameObject violates our fixed attribute, // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. @@ -757,8 +757,8 @@ final String archetypeMsgText = archetype.getMsgText(); gameObject.setMsgText(msgText.equals(archetypeMsgText == null ? "" : archetypeMsgText) ? null : msgText); } else { - final CharSequence archetypeMsgText = archetype.getMsgText(); - gameObject.setMsgText(archetypeMsgText != null && archetypeMsgText.length() > 0 ? "" : null); + final String archetypeMsgText = archetype.getMsgText(); + gameObject.setMsgText(archetypeMsgText != null && !archetypeMsgText.isEmpty() ? "" : null); } // now lets assign the visible face - perhaps we have still an animation Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialog.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialog.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -253,7 +253,7 @@ @Nullable private String getMapName() { final String mapName = mapNameField.getText(); - return mapName.length() > 0 ? mapName : null; + return !mapName.isEmpty() ? mapName : null; } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -948,7 +948,7 @@ } final String path = mapView.getMapControl().getMapModel().getMapArchObject().getTilePath(direction); - if (path.length() == 0) { + if (path.isEmpty()) { return false; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -184,7 +184,7 @@ final File tmpRelativeReference = relativeReference; final JFileChooser chooser = tmpRelativeReference == null ? new JFileChooser() : new JFileChooser(tmpRelativeReference.getParentFile()); final String oldFilename = getText(); - if (oldFilename.length() > 0) { + if (!oldFilename.isEmpty()) { // Point the chooser on the current path tile file final File oldFile; if (tmpRelativeReference == null || oldFilename.startsWith("/")) { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -61,7 +61,7 @@ final String objectText = gameObject.getObjectText(); final String msgText = gameObject.getMsgText(); final String text = objectText + (msgText == null ? "" : msgText + "\n" + "msg\n" + msgText + "\n" + "endmsg"); - if (alwaysInclude || text.length() > 0 || !gameObject.isEmpty()) { + if (alwaysInclude || !text.isEmpty() || !gameObject.isEmpty()) { if (empty) { empty = false; } else { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolder.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolder.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -103,7 +103,7 @@ public MapFolder(@Nullable final MapFolder<G, A, R> parent, @NotNull final String name, @NotNull final File baseDir, @NotNull final MapViewsManager<G, A, R> mapViewsManager) throws InvalidNameException { this.baseDir = baseDir; this.mapViewsManager = mapViewsManager; - if (parent == null ? name.length() > 0 : !PATTERN_VALID_MAP_FOLDER_NAME.matcher(name).matches()) { + if (parent == null ? !name.isEmpty() : !PATTERN_VALID_MAP_FOLDER_NAME.matcher(name).matches()) { throw new InvalidNameException(name); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/LockedItemsView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/LockedItemsView.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/LockedItemsView.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -79,7 +79,7 @@ private void scanGameObject(@NotNull final GameObject<G, A, R> gameObject) { if (typeNumbers.contains(gameObject.getTypeNo())) { final String slayingSpec = gameObject.getAttributeString(BaseObject.SLAYING); - if (slayingSpec.length() > 0) { + if (!slayingSpec.isEmpty()) { addConnection(slayingSpec, gameObject); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -277,11 +277,11 @@ setArchNameField("", Color.black); } else { final String objName = gameObject.getAttributeString(BaseObject.NAME, false); - if (objName.length() > 0) { + if (objName.isEmpty()) { + final String archObjName = gameObject.getArchetype().getObjName(); + setArchNameField(archObjName.isEmpty() ? gameObject.getArchetype().getArchetypeName() : archObjName, Color.black); + } else { setArchNameField(objName, Color.blue); - } else { - final String archObjName = gameObject.getArchetype().getObjName(); - setArchNameField(archObjName.length() > 0 ? archObjName : gameObject.getArchetype().getArchetypeName(), Color.black); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -352,7 +352,7 @@ final String animSpeed = animSpeedTextField.getText().trim(); final String animSpeedAttribute = gameObject.getArchetype().getAttributeString(BaseObject.ANIM_SPEED); - if (animSpeed.length() == 0 || (animSpeed.equals("0") ? "" : animSpeed).equals(animSpeedAttribute)) { + if (animSpeed.isEmpty() || (animSpeed.equals("0") ? "" : animSpeed).equals(animSpeedAttribute)) { gameObject.removeAttribute(BaseObject.ANIM_SPEED); } else { gameObject.setAttributeString(BaseObject.ANIM_SPEED, animSpeed); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/MsgTextTab.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/MsgTextTab.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/MsgTextTab.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -162,7 +162,13 @@ // if there is an entry in the archTextArea (msg window), this // overrules the default text (if any) final String msgText = StringUtils.removeTrailingWhitespaceFromLines(archTextArea.getText()); - if (msgText.length() > 0) { // there is something in the msg win + if (msgText.isEmpty()) { // there is nothing in the msg win + if (archetype.getMsgText() == null) { + return null; // always delete this... + } else { + return ""; // but here we must overrule default with msg/endmsg (empty msg) + } + } else { // there is something in the msg win final String archetypeMsgText = archetype.getMsgText(); if (archetypeMsgText != null) { if (msgText.equals(archetypeMsgText)) { @@ -173,12 +179,6 @@ } else { return msgText; } - } else { // there is nothing in the msg win - if (archetype.getMsgText() != null) { - return ""; // but here we must overrule default with msg/endmsg (empty msg) - } else { - return null; // always delete this... - } } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/UpdaterManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/UpdaterManager.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/UpdaterManager.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -115,8 +115,8 @@ this.parentComponent = parentComponent; this.updateFileName = updateFileName; - final CharSequence propUrl = ACTION_BUILDER.getString("update.url"); - hasUpdateURL = propUrl != null && propUrl.length() > 0; + final String propUrl = ACTION_BUILDER.getString("update.url"); + hasUpdateURL = propUrl != null && !propUrl.isEmpty(); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetype.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetype.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -137,10 +137,10 @@ @Nullable @Override protected String getEffectiveFaceName(@NotNull final String faceName) { - final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + final String normalizedFaceName = faceName.isEmpty() ? null : faceName.intern(); //Strings are interned //noinspection StringEquality - return normalizedFaceName != null && normalizedFaceName.length() > 0 ? normalizedFaceName : null; + return normalizedFaceName != null && !normalizedFaceName.isEmpty() ? normalizedFaceName : null; } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AttributeListUtils.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AttributeListUtils.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AttributeListUtils.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -52,7 +52,7 @@ final StringBuilder sb = new StringBuilder(); for (final String line : lines) { - if (line.length() > 0 && !line.startsWith(prefix)) { + if (!line.isEmpty() && !line.startsWith(prefix)) { sb.append(line); sb.append('\n'); } @@ -74,7 +74,7 @@ final StringBuilder result = new StringBuilder(); for (final String line : StringUtils.PATTERN_END_OF_LINE.split(archetype.getObjectText(), 0)) { final int spaceIndex = line.indexOf(' '); - if (line.length() > 0 && spaceIndex > 0 && StringUtils.diffTextString(oldObjectText, line.substring(0, spaceIndex + 1), true) == null) { + if (!line.isEmpty() && spaceIndex > 0 && StringUtils.diffTextString(oldObjectText, line.substring(0, spaceIndex + 1), true) == null) { result.append(line).append('\n'); } } @@ -100,7 +100,7 @@ if (test != null) { c = test.charAt(0); } - if (line.length() > 0 && (test == null || c == '\n')) { + if (!line.isEmpty() && (test == null || c == '\n')) { result.append(line).append('\n'); } } catch (final StringIndexOutOfBoundsException ignored) { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -65,8 +65,8 @@ * @param attributeValue the attribute value * @return whether the attribute value matches */ - private boolean matches(@NotNull final CharSequence attributeValue) { - return attributeValue.equals(value) || (value.equals("0") && attributeValue.length() == 0); + private boolean matches(@NotNull final String attributeValue) { + return attributeValue.equals(value) || (value.equals("0") && attributeValue.isEmpty()); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2013-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2013-07-15 19:48:50 UTC (rev 9349) @@ -292,7 +292,7 @@ sb.append(typeNo); sb.append(')'); - if (display.length() > 0) { + if (!display.isEmpty()) { sb.append(" ["); int start = 0; while (start < display.length()) { 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-07-15 19:29:09 UTC (rev 9348) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetPars... [truncated message content] |
From: <aki...@us...> - 2013-07-18 19:35:25
|
Revision: 9354 http://sourceforge.net/p/gridarta/code/9354 Author: akirschbaum Date: 2013-07-18 19:35:20 +0000 (Thu, 18 Jul 2013) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2013-07-15 20:35:51 UTC (rev 9353) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2013-07-18 19:35:20 UTC (rev 9354) @@ -293,7 +293,7 @@ * @param key the key to add */ private static void addKey(final String key) { - keys.put(key.equals("msg") || key.equals("lore") ? key + "\n" : key + " ", idKey++); + keys.put(key, idKey++); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2013-07-15 20:35:51 UTC (rev 9353) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2013-07-18 19:35:20 UTC (rev 9354) @@ -75,8 +75,8 @@ } } else { final Map<String, String> fields = gameObjectParser != null ? gameObjectParser.getModifiedFields(gameObject) : Collections.<String, String>emptyMap(); - fields.remove("x "); - fields.remove("y "); + fields.remove("x"); + fields.remove("y"); if (alwaysInclude || !fields.isEmpty() || !gameObject.isEmpty()) { if (empty) { empty = false; @@ -88,7 +88,7 @@ for (final Map.Entry<String, String> field : fields.entrySet()) { sb.append("<br>"); sb.append(prefix); - sb.append((encode(field.getKey()) + encode(field.getValue())).trim().replaceAll("\n", "<br>" + prefix)); + sb.append((encode(field.getKey()) + " " + encode(field.getValue())).trim().replaceAll("\n", "<br>" + prefix)); } for (final G invGameObject : gameObject.reverse()) { appendGameObject(invGameObject, true, prefix + " "); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2013-07-15 20:35:51 UTC (rev 9353) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2013-07-18 19:35:20 UTC (rev 9354) @@ -212,9 +212,17 @@ appendable.append(gameObject.getArchetype().getArchetypeName()); appendable.append("\n"); for (final Entry<String, String> entry : fields.entrySet()) { - appendable.append(entry.getKey()); - appendable.append(entry.getValue()); - appendable.append("\n"); + final String key = entry.getKey(); + appendable.append(key); + if (key.equals("msg")) { + appendable.append("\n"); + appendable.append(entry.getValue()); + appendable.append("endmsg\n"); + } else { + appendable.append(" "); + appendable.append(entry.getValue()); + appendable.append("\n"); + } } for (final G inventoryItem : gameObject) { @@ -234,7 +242,7 @@ final String msgText = gameObject.getMsgText(); final String archMsgText = archetype.getMsgText(); if (msgText != null && !msgText.equals(archMsgText == null ? "" : archMsgText)) { - fields.put("msg\n", msgText + "endmsg"); + fields.put("msg", msgText); } final CharSequence objText = gameObject.getObjectText(); @@ -242,7 +250,7 @@ for (final String aTmp : StringUtils.PATTERN_END_OF_LINE.split(objText, 0)) { final String[] line = StringUtils.PATTERN_SPACES.split(aTmp, 2); if (line.length == 2) { - fields.put(line[0] + " ", line[1]); + fields.put(line[0], line[1]); } else { log.warn("writeMapArch: ignoring invalid arch line: " + aTmp); } @@ -251,10 +259,10 @@ // map coordinates only belong into map arches (not inventory arches) if (gameObject.getMapX() != 0) { - fields.put("x ", Integer.toString(gameObject.getMapX())); + fields.put("x", Integer.toString(gameObject.getMapX())); } if (gameObject.getMapY() != 0) { - fields.put("y ", Integer.toString(gameObject.getMapY())); + fields.put("y", Integer.toString(gameObject.getMapY())); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-19 07:12:17
|
Revision: 9363 http://sourceforge.net/p/gridarta/code/9363 Author: akirschbaum Date: 2013-07-19 07:12:07 +0000 (Fri, 19 Jul 2013) Log Message: ----------- Add nullable annotations. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttribute.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/HtmlPane.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/gui/map/mapview/DefaultMapView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCacheEntry.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/anim/DefaultAnimationObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/artifact/ArtifactParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/AbstractFaceProvider.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/src/model/src/test/java/net/sf/gridarta/model/errorview/TestErrorView.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/CollectArchesCommand.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -38,6 +38,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(CollectArchesCommand.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -54,6 +54,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DelayedMapModelListenerManager.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttribute.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttribute.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttribute.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -44,6 +44,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DialogAttribute.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeBitmask.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -43,6 +43,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DialogAttributeBitmask.class); /** @@ -59,6 +60,7 @@ /** * Reference to the bitmask data. */ + @Nullable private AttributeBitmask bitmask; /** @@ -121,6 +123,7 @@ * Get the active bitmask value in external file representation. * @return active bitmask value in external file representation */ + @NotNull private String getEncodedValue() { return bitmask.encodeValue(value); } @@ -143,16 +146,17 @@ * @param encodedValue new active bitmask value in external file * representation */ - public void setEncodedValue(final String encodedValue) { + public void setEncodedValue(@NotNull final String encodedValue) { assert bitmask != null; setValue(bitmask.decodeValue(encodedValue)); } + @Nullable public AttributeBitmask getBitmask() { return bitmask; } - public void setBitmask(final AttributeBitmask bitmask) { + public void setBitmask(@Nullable final AttributeBitmask bitmask) { this.bitmask = bitmask; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/HtmlPane.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/HtmlPane.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/HtmlPane.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -35,6 +35,7 @@ import javax.swing.event.HyperlinkListener; import javax.swing.text.Document; import net.sf.gridarta.utils.CommonConstants; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -46,6 +47,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Logger log = Logger.getLogger("HtmlPane.class"); /** @@ -56,6 +58,7 @@ /** * The JEditorPane that displays the html page. */ + @NotNull private final JEditorPane html; /** @@ -63,7 +66,7 @@ * contents in this HtmlPane. * @param fileName the name of the HTML-file */ - HtmlPane(final String fileName) { + HtmlPane(@NotNull final String fileName) { try { // first looking for the html file in extracted form final File file = new File(CommonConstants.HELP_DIR, fileName); @@ -124,7 +127,7 @@ * @param type mime-type of the given text (e.g. "text/html") * @param text text to display (can be html-text for example) */ - HtmlPane(final String type, final String text) { + HtmlPane(@NotNull final String type, @NotNull final String text) { // open new JEditorPane html = new JEditorPane(type, text); html.setEditable(false); @@ -151,7 +154,7 @@ * @param e occurred <code>HyperlinkEvent</code> */ @Override - public void hyperlinkUpdate(final HyperlinkEvent e) { + public void hyperlinkUpdate(@NotNull final HyperlinkEvent e) { if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { linkActivated(e.getURL()); } @@ -166,7 +169,7 @@ * argument. * @param u the URL to follow */ - private void linkActivated(final URL u) { + private void linkActivated(@NotNull final URL u) { final Cursor cursor = html.getCursor(); final Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); html.setCursor(waitCursor); @@ -187,6 +190,7 @@ /** * Original cursor that should be restored once the document is loaded. */ + @NotNull private final Cursor cursor; /** @@ -194,7 +198,7 @@ * @param url the URL to load * @param cursor the cursor to restore once the document is loaded */ - private PageLoader(final URL url, final Cursor cursor) { + private PageLoader(@NotNull final URL url, @NotNull final Cursor cursor) { this.url = url; this.cursor = cursor; } 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-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ParameterTypeEditor.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -40,16 +40,20 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(ParameterTypeEditor.class); + @NotNull private final PluginParameter<G, A, R> parameter; + @NotNull private final Plugin<G, A, R> plugin; + @NotNull private final ItemListener itemListener = new ItemListener() { @Override - public void itemStateChanged(final ItemEvent e) { + public void itemStateChanged(@NotNull final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (!parameter.getParameterType().equals(e.getItem())) { try { @@ -63,7 +67,7 @@ }; - public ParameterTypeEditor(@NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final Plugin<G, A, R> plugin, final PluginParameter<G, A, R> parameter) { + 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()); this.parameter = parameter; this.plugin = plugin; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapView.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -67,6 +67,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DefaultMapView.class); /** @@ -120,6 +121,7 @@ * The {@link MapModelListener} used to detect changes in the map model that * should be reflected in the window title. */ + @NotNull private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { @Override @@ -158,6 +160,7 @@ * The {@link MapArchObjectListener} used to detect changes in the map model * that should be reflected in the window title. */ + @NotNull private final MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { @Override @@ -176,6 +179,7 @@ * The {@link MapControlListener} used to detect changes in the map control * that should be reflected in the window title. */ + @NotNull private final MapControlListener<G, A, R> mapControlListener = new MapControlListener<G, A, R>() { @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -48,6 +48,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(ImageCreator.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCacheEntry.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCacheEntry.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCacheEntry.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -44,6 +44,7 @@ /** * The logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(MapImageCache.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -45,6 +45,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(MapMenu.class); /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -81,11 +81,13 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(PickmapChooserControl.class); /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** @@ -204,6 +206,7 @@ /** * The map control listener which is registered to the selected pickmap. */ + @NotNull private final MapControlListener<G, A, R> mapControlListener = new MapControlListener<G, A, R>() { @Override @@ -221,6 +224,7 @@ * The {@link MapModelListener} which is registered to the selected * pickmap. */ + @NotNull private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { @Override @@ -258,6 +262,7 @@ /** * The pickmap chooser listener used to track the currently active pickmap. */ + @NotNull private final PickmapChooserModelListener<G, A, R> pickmapChooserModelListener = new PickmapChooserModelListener<G, A, R>() { @Override @@ -298,6 +303,7 @@ /** * The {@link MapManagerListener} to track existing pickmaps. */ + @NotNull private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -51,11 +51,13 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(PickmapChooserView.class); /** * The attached {@link PickmapChooserModel}. */ + @NotNull private final PickmapChooserModel<G, A, R> pickmapChooserModel; /** @@ -67,16 +69,19 @@ /** * Panel with pickmaps. */ + @NotNull private final JTabbedPane pickmapPanel = new JTabbedPane(SwingConstants.TOP); /** * The last known active folder. */ + @Nullable private MapFolder<G, A, R> activeMapFolder; /** * The listener attached to {@link #mapFolderTree}. */ + @NotNull private final MapFolderTreeListener<G, A, R> mapFolderTreeListener = new MapFolderTreeListener<G, A, R>() { @Override @@ -115,6 +120,7 @@ /** * The listener attached to {@link #activeMapFolder}. */ + @NotNull private final MapFolderListener<G, A, R> mapFolderListener = new MapFolderListener<G, A, R>() { @Override @@ -138,6 +144,7 @@ * The {@link PickmapChooserModelListener} attached to {@link * #pickmapChooserModel} to detect modified pickmaps. */ + @NotNull private final PickmapChooserModelListener<G, A, R> pickmapChooserModelListener = new PickmapChooserModelListener<G, A, R>() { @Override @@ -258,6 +265,7 @@ * @param mapFile the pickmap * @return the title */ + @NotNull public String getTitle(@NotNull final MapFile<G, A, R> mapFile) { final String name = mapFile.getFile().getName(); final MapControl<G, A, R> mapControl = mapFile.getPickmap(); @@ -269,6 +277,7 @@ * Returns the {@link JTabbedPane} with all pickmaps. * @return the <code>JTabbedPane</code> with all pickmaps */ + @NotNull public Component getPickmapPanel() { return pickmapPanel; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/spells/SpellsUtils.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/spells/SpellsUtils.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/spells/SpellsUtils.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -57,16 +57,19 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(SpellsUtils.class); /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * File filter for filtering spellist.h files. */ + @NotNull private static final FileFilter SPELL_LIST_H_FILE_FILTER = new FilenameFileFilter(true, "spellist.h", "spellist.h"); /** 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-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -130,6 +130,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DefaultMainControl.class); @NotNull 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-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -251,11 +251,13 @@ /** * The logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(GUIMainControl.class); /** * The {@link Preferences}. */ + @NotNull private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/anim/DefaultAnimationObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -41,6 +41,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DefaultAnimationObject.class); /** @@ -81,6 +82,7 @@ /** * A {@link Pattern} that matches the end of lines. */ + @NotNull private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("\n"); /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/artifact/ArtifactParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/artifact/ArtifactParser.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/artifact/ArtifactParser.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -50,6 +50,7 @@ /** * The logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(ArtifactParser.class); /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/face/AbstractFaceProvider.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/face/AbstractFaceProvider.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/face/AbstractFaceProvider.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -38,12 +38,14 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(AbstractFaceProvider.class); /** * The HashMap to provide the icons from. Note: Weak hashing does not differ * because the keys are definitely referenced elsewhere. */ + @NotNull private final Map<String, SoftReference<ImageIcon>> cache = new HashMap<String, SoftReference<ImageIcon>>(); /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObjects.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObjects.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObjects.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -62,11 +62,13 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(DefaultFaceObjects.class); /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/errorview/TestErrorView.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/errorview/TestErrorView.java 2013-07-19 06:58:07 UTC (rev 9362) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/errorview/TestErrorView.java 2013-07-19 07:12:07 UTC (rev 9363) @@ -32,6 +32,7 @@ /** * The {@link Logger} for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(TestErrorView.class); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-19 08:59:02
|
Revision: 9369 http://sourceforge.net/p/gridarta/code/9369 Author: akirschbaum Date: 2013-07-19 08:58:58 +0000 (Fri, 19 Jul 2013) Log Message: ----------- Properly support attack_movement attribute in game object attributes dialog. [Crossfire] Modified Paths: -------------- trunk/src/crossfire/ChangeLog trunk/src/crossfire/src/main/resources/resource/conf/types.xml trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList2.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList2.java Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/crossfire/ChangeLog 2013-07-19 08:58:58 UTC (rev 9369) @@ -1,3 +1,8 @@ +2013-07-19 Andreas Kirschbaum + + * Properly support attack_movement attribute in game object + attributes dialog. + 2013-07-12 Andreas Kirschbaum * Release 0.10. Modified: trunk/src/crossfire/src/main/resources/resource/conf/types.xml =================================================================== --- trunk/src/crossfire/src/main/resources/resource/conf/types.xml 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/crossfire/src/main/resources/resource/conf/types.xml 2013-07-19 08:58:58 UTC (rev 9369) @@ -103,6 +103,10 @@ # bool_special - Like bool, but with customized true/false values # # treasurelist - CF treasure list (see "treasures" file) # # list_LISTNAME - list, must be defined as a <list> element; # +# list2_LISTNAME1_LISTNAME2 # +# - double list, must be defined as a <list> elements; # +# LISTNAME1 selects bits 0-3, LISTNAME2 selects bits # +# 4+ # # bitmask_BITMASKNAME - bitmask, must be defined as a <bitmask> # # element # # # @@ -376,6 +380,31 @@ <listentry value="3" name="general"/> <listentry value="4" name="window"/> </list> + + <list name="attackmovementlow"> + <listentry value="0" name="default"/> + <listentry value="1" name="DISTATT"/> + <listentry value="2" name="RUNATT"/> + <listentry value="3" name="HITRUN"/> + <listentry value="4" name="WAITATT"/> + <listentry value="5" name="RUSH"/> + <listentry value="6" name="ALLRUN"/> + <listentry value="7" name="DISTHIT"/> + <listentry value="8" name="WAIT2"/> + </list> + + <list name="attackmovementhigh"> + <listentry value="0" name="default"/> + <listentry value="1" name="PETMOVE"/> + <listentry value="2" name="CIRCLE1"/> + <listentry value="3" name="CIRCLE2"/> + <listentry value="4" name="PACEH"/> + <listentry value="5" name="PACEH2"/> + <listentry value="6" name="RANDO"/> + <listentry value="7" name="RANDO2"/> + <listentry value="8" name="PACEV"/> + <listentry value="9" name="PACEV2"/> + </list> </lists> <ignorelists> @@ -3563,7 +3592,42 @@ wake the monster up. If the player has stealth, the size of this square is reduced in half plus 1. </attribute> - <attribute arch="attack_movement" editor="attack movement" type="int"/> + <attribute arch="attack_movement" editor="attack movement" type="list2_attackmovementlow_attackmovementhigh"><![CDATA[ + Specifies how the NPC or Monster moves: + default - Move toward a player. + DISTATT - Move toward a player if far, but maintain some space, + attack from a distance - good for missile users only. + RUNATT - Run but attack if player catches up to object. + HITRUN - Run to then hit player then run away cyclicly. + WAITATT - Wait for player to approach then hit, move if hit. + RUSH - Rush toward player blindly, similiar to dumb monster. + ALLRUN - Always run, never attack good for sim. of weak player. + DISTHIT - Attack from a distance if hit as recommended by Frank. + WAIT2 - Monster does not try to move towards player if far. + Maintains comfortable distance. + + The second setting specifies the behavior when there is no enemy: + default - Stand still. + PETMOVE - The monster follows the player until it is called off + and will try to attack whatever the player is attacking. + CIRCLE1 - The monster will move in a circle until it is attacked, + or until it finds an enemy. This is good for + non-aggressive monsters and NPC. + CIRCLE2 - Same as CIRCLE1 but a larger circle is used. + PACEH - The monster will pace back and forth until attacked. + This is HORIZONTAL movement. + PACEH2 - The monster will pace as above but the length of the + pace area is longer and the monster stops before + changing directions. This is HORIZONTAL movement. + RANDO - The monster will go in a random direction until it is + stopped by an obstacle, then it chooses another direction. + RANDO2 - Constantly move in a different random direction. + PACEV - The monster will pace back and forth until attacked. + This is VERTICAL movement. + PACEV2 - The monster will pace as above but the length of the + pace area is longer and the monster stops before + changing directions. This is VERTICAL movement.]]> + </attribute> <attribute arch="run_away" editor="run at % health" type="int"> This is a percentage value in the range 0-100. When the monster's health points drop below this percentage (relative to Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -69,6 +69,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeAttributeInt; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeInvSpell; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeList; +import net.sf.gridarta.model.archetypetype.ArchetypeAttributeList2; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeLong; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeMapPath; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeScriptFile; @@ -379,6 +380,45 @@ } @Override + public void visit(@NotNull final ArchetypeAttributeList2 archetypeAttribute) { + final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); + label.setForeground(INT_COLOR); + final int value = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()); + + final JComponent component1; + @Nullable final JComboBox input1; + final ArchetypeTypeList list1 = archetypeTypeSet.getList(archetypeAttribute.getListName1()); + if (list1 != null) { + input1 = buildArrayBox(list1, value & 0x0F, archetypeAttribute.getAttributeName()); + component1 = input1; + } else { + // error: list data is missing or corrupt + input1 = new JComboBox(); + component1 = new JLabel("Error: Undefined List"); + } + + final JComponent component2; + @Nullable final JComboBox input2; + final ArchetypeTypeList list2 = archetypeTypeSet.getList(archetypeAttribute.getListName2()); + if (list2 != null) { + input2 = buildArrayBox(list2, value >> 4, archetypeAttribute.getAttributeName()); + component2 = input2; + } else { + // error: list data is missing or corrupt + input2 = new JComboBox(); + component2 = new JLabel("Error: Undefined List"); + } + + final JComponent component = new JPanel(new GridBagLayout()); + final GridBagConstraints gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.fill = GridBagConstraints.HORIZONTAL; + component.add(component1, gbc); + component.add(component2, gbc); + guiInfo = new GuiInfoTwoColumn<G, A, R, ArchetypeAttributeList2>(new DialogAttributeList2<G, A, R>(archetypeAttribute, input1, input2, archetypeTypeSet), label, component); + } + + @Override public void visit(@NotNull final ArchetypeAttributeLong archetypeAttribute) { final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": "); label.setForeground(INT_COLOR); Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList2.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList2.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList2.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -0,0 +1,120 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.gameobjectattributes; + +import javax.swing.JComboBox; +import javax.swing.text.Document; +import javax.swing.text.Style; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypetype.ArchetypeAttributeList2; +import net.sf.gridarta.model.archetypetype.ArchetypeType; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link DialogAttribute} for {@link ArchetypeAttributeList2}. + * @author Andreas Kirschbaum + */ +public class DialogAttributeList2<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttribute<G, A, R, ArchetypeAttributeList2> { + + /** + * The input ui component for editing bits 0-3 of the value. + */ + @NotNull + private final JComboBox input1; + + /** + * The input ui component for editing bits 4+ of the value. + */ + @NotNull + private final JComboBox input2; + + /** + * The archetype type set. + */ + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; + + /** + * Creates a new instance. + * @param ref reference to the attribute data + * @param input1 the input ui component for editing bits 0-3 of the value + * @param input2 the input ui component for editing bits 4+ of the value + * @param archetypeTypeSet the archetype type set + */ + public DialogAttributeList2(@NotNull final ArchetypeAttributeList2 ref, @NotNull final JComboBox input1, @NotNull final JComboBox input2, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + super(ref); + this.input1 = input1; + this.input2 = input2; + this.archetypeTypeSet = archetypeTypeSet; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getObjectText(@NotNull final G gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final String[] newMsg, @NotNull final ArchetypeType archetypeType) { + final int attributeValueTmp1 = input1.getSelectedIndex(); + final int attributeValue1 = archetypeTypeSet.getList(getRef().getListName1()).get(attributeValueTmp1).getFirst(); + + final int attributeValueTmp2 = input2.getSelectedIndex(); + final int attributeValue2 = archetypeTypeSet.getList(getRef().getListName2()).get(attributeValueTmp2).getFirst(); + + final int attributeValue = (attributeValue1 & 0x0F) | (attributeValue2 << 4); + final String archetypeAttributeName = getRef().getArchetypeAttributeName(); + if (archetype.getAttributeInt(archetypeAttributeName) != attributeValue) { + return archetypeAttributeName + " " + attributeValue; + } + + return ""; + } + + /** + * {@inheritDoc} + */ + @Override + public void appendSummary(@NotNull final Document doc, @NotNull final Style style) { + final Object selectedItem1 = input1.getSelectedItem(); + if (selectedItem1 == null) { + return; + } + + final Object selectedItem2 = input2.getSelectedItem(); + if (selectedItem2 == null) { + return; + } + + final String value1 = selectedItem1.toString().trim(); + if (value1.isEmpty() || value1.startsWith("<")) { + return; + } + + final String value2 = selectedItem2.toString().trim(); + if (value2.isEmpty() || value2.startsWith("<")) { + return; + } + + addLine(doc, style, "", " = " + value1 + " / " + value2); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/DialogAttributeList2.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -158,6 +158,19 @@ ArchetypeAttribute newArchetypeAttributeList(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String listName); /** + * Creates a new "list2" archetype attribute. + * @param archetypeAttributeName the archetype attribute name + * @param attributeName the user interface attribute name + * @param description the attribute's description + * @param inputLength the input length in characters for text input fields + * @param listName1 the list name for bits 0-3 + * @param listName2 the list name for bits 4+ + * @return the bitmask attribute + */ + @NotNull + ArchetypeAttribute newArchetypeAttributeList2(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String listName1, @NotNull String listName2); + + /** * Creates a new "long" archetype attribute. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name Added: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList2.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList2.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList2.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -0,0 +1,83 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.archetypetype; + +import org.jetbrains.annotations.NotNull; + +/** + * An {@link ArchetypeAttribute} for selecting a value from two lists. + * @author Andreas Kirschbaum + */ +public class ArchetypeAttributeList2 extends AbstractArchetypeAttributeList { + + /** + * The list name for bits 0-3. + */ + @NotNull + private final String listName1; + + /** + * The list name for bits 4+. + */ + @NotNull + private final String listName2; + + /** + * Creates a new instance. + * @param archetypeAttributeName the archetype attribute name + * @param attributeName the user interface attribute name + * @param description the attribute's description + * @param inputLength the input length in characters for text input fields + * @param listName1 the list name for bits 0-3 + * @param listName2 the list name for bits 4+ + */ + public ArchetypeAttributeList2(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String listName1, @NotNull final String listName2) { + super(archetypeAttributeName, attributeName, description, inputLength); + this.listName1 = listName1; + this.listName2 = listName2; + } + + /** + * Returns the list name for bits 0-3. + * @return the list name + */ + @NotNull + public String getListName1() { + return listName1; + } + + /** + * Returns the list name for bits 4+. + * @return the list name + */ + @NotNull + public String getListName2() { + return listName2; + } + + /** + * {@inheritDoc} + */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor visitor) { + visitor.visit(this); + } + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList2.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -41,6 +41,12 @@ private static final Pattern LINE_BREAK = Pattern.compile("\\s*\n\\s*"); /** + * Pattern to match the list name separator in "list2_xxx_yyy" types. + */ + @NotNull + private static final Pattern UNDERSCORE = Pattern.compile("_"); + + /** * The {@link ArchetypeAttributeFactory} for creating {@link * ArchetypeAttribute ArchetypeAttributes}. */ @@ -144,6 +150,25 @@ return null; } return archetypeAttributeFactory.newArchetypeAttributeList(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, listName); + } else if (attributeType.startsWith("list2_")) { + // got a bitmask attribute + final String listNames = attributeType.substring(6).trim(); + final String[] tmp = UNDERSCORE.split(listNames, 2); + if (tmp.length != 2) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": Lists \"" + listNames + "\" are undefined."); + return null; + } + final String listName1 = tmp[0]; + final String listName2 = tmp[1]; + if (archetypeTypeSet.getList(listName1) == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": List \"" + listName1 + "\" is undefined."); + return null; + } + if (archetypeTypeSet.getList(listName2) == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": List \"" + listName2 + "\" is undefined."); + return null; + } + return archetypeAttributeFactory.newArchetypeAttributeList2(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength, listName1, listName2); } else if (attributeType.equals("treasurelist")) { return archetypeAttributeFactory.newArchetypeAttributeTreasure(getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, Constants.XML_ATTRIBUTE_EDITOR), description, inputLength); } else { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -91,6 +91,12 @@ * Visitor callback function. * @param archetypeAttribute the visited node */ + void visit(@NotNull ArchetypeAttributeList2 archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ void visit(@NotNull ArchetypeAttributeLong archetypeAttribute); /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -133,6 +133,15 @@ */ @NotNull @Override + public ArchetypeAttribute newArchetypeAttributeList2(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String listName1, @NotNull final String listName2) { + return new ArchetypeAttributeList2(archetypeAttributeName, attributeName, description, inputLength, listName1, listName2); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override public ArchetypeAttribute newArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { return new ArchetypeAttributeLong(archetypeAttributeName, attributeName, description, inputLength); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ArchetypeTypeChecks.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -34,6 +34,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeAttributeInt; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeInvSpell; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeList; +import net.sf.gridarta.model.archetypetype.ArchetypeAttributeList2; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeLong; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeMapPath; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeScriptFile; @@ -185,6 +186,11 @@ } @Override + public void visit(@NotNull final ArchetypeAttributeList2 archetypeAttribute) { + // XXX: missing + } + + @Override public void visit(@NotNull final ArchetypeAttributeLong archetypeAttribute) { // XXX: missing } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java 2013-07-19 08:24:28 UTC (rev 9368) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java 2013-07-19 08:58:58 UTC (rev 9369) @@ -132,6 +132,15 @@ */ @NotNull @Override + public ArchetypeAttribute newArchetypeAttributeList2(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String listName1, @NotNull final String listName2) { + return new TestArchetypeAttribute("list2", archetypeAttributeName, attributeName, description, inputLength); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override public ArchetypeAttribute newArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { return new TestArchetypeAttribute("long", archetypeAttributeName, attributeName, description, inputLength); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-19 13:27:29
|
Revision: 9370 http://sourceforge.net/p/gridarta/code/9370 Author: akirschbaum Date: 2013-07-19 13:27:24 +0000 (Fri, 19 Jul 2013) Log Message: ----------- Add attribute_ordering section to types.xml. It specifies the ordering of attributes when writing map files. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/ChangeLog 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/model/io/DefaultGameObjectParser.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java trunk/src/crossfire/src/main/resources/resource/conf/types.xml trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java trunk/src/daimonin/ChangeLog 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 trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/Constants.java trunk/src/model/src/main/resources/system/dtd/types.dtd trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/StringUtils.java Added Paths: ----------- trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder1-types.xml trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder2-types.xml trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder3-types.xml trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder4-types.xml Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/atrinik/ChangeLog 2013-07-19 13:27:24 UTC (rev 9370) @@ -1,3 +1,8 @@ +2013-07-19 Andreas Kirschbaum + + * Add attribute_ordering section to types.xml. It specifies the + ordering of attributes when writing map files. + 2013-07-12 Andreas Kirschbaum * Release 0.10. 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -225,7 +225,7 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/ChangeLog 2013-07-19 13:27:24 UTC (rev 9370) @@ -1,5 +1,8 @@ 2013-07-19 Andreas Kirschbaum + * Add attribute_ordering section to types.xml. It specifies the + ordering of attributes when writing map files. + * Properly support attack_movement attribute in game object attributes dialog. 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -195,8 +195,8 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet, archetypeTypeSet); } /** Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -19,11 +19,10 @@ package net.sf.gridarta.var.crossfire.model.io; -import java.util.Comparator; -import java.util.HashMap; import java.util.Map; import java.util.TreeMap; import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractGameObjectParser; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; @@ -39,298 +38,22 @@ public class DefaultGameObjectParser extends AbstractGameObjectParser<GameObject, MapArchObject, Archetype> { /** - * Determines the field order when writing objects to a file. The key is the - * field name, the value is an Integer that describes the order. Lower - * values are written first. + * The {@link ArchetypeTypeSet} for sorting attributes on save. */ - private static final Map<String, Integer> keys = new HashMap<String, Integer>(); + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; - /* - * Initialize {@link keys} array. - * @todo this information should be read from a file. - */ - - static { - addKey("name"); - addKey("name_pl"); - addKey("custom_name"); - addKey("title"); - addKey("race"); - addKey("slaying"); - addKey("skill"); - addKey("msg"); - addKey("lore"); - addKey("other_arch"); - addKey("face"); - addKey("animation"); - addKey("is_animated"); - addKey("Str"); - addKey("Dex"); - addKey("Con"); - addKey("Wis"); - addKey("Pow"); - addKey("Cha"); - addKey("Int"); - addKey("hp"); - addKey("maxhp"); - addKey("sp"); - addKey("maxsp"); - addKey("grace"); - addKey("maxgrace"); - addKey("exp"); - addKey("perm_exp"); - addKey("expmul"); - addKey("food"); - addKey("dam"); - addKey("luck"); - addKey("wc"); - addKey("ac"); - addKey("x"); - addKey("y"); - addKey("speed"); - addKey("speed_left"); - addKey("move_state"); - addKey("attack_movement"); - addKey("nrof"); - addKey("level"); - addKey("direction"); - addKey("type"); - addKey("subtype"); - addKey("attacktype"); - addKey("resist_physical"); - addKey("resist_magic"); - addKey("resist_fire"); - addKey("resist_electricity"); - addKey("resist_cold"); - addKey("resist_confusion"); - addKey("resist_acid"); - addKey("resist_drain"); - addKey("resist_weaponmagic"); - addKey("resist_ghosthit"); - addKey("resist_poison"); - addKey("resist_slow"); - addKey("resist_paralyze"); - addKey("resist_turn_undead"); - addKey("resist_fear"); - addKey("resist_cancellation"); - addKey("resist_deplete"); - addKey("resist_death"); - addKey("resist_chaos"); - addKey("resist_counterspell"); - addKey("resist_godpower"); - addKey("resist_holyword"); - addKey("resist_blind"); - addKey("resist_internal"); - addKey("resist_life_stealing"); - addKey("resist_disease"); - addKey("path_attuned"); - addKey("path_repelled"); - addKey("path_denied"); - addKey("material"); - addKey("materialname"); - addKey("value"); - addKey("carrying"); - addKey("weight"); - addKey("invisible"); - addKey("state"); - addKey("magic"); - addKey("last_heal"); - addKey("last_sp"); - addKey("last_grace"); - addKey("last_eat"); - addKey("connected"); - addKey("glow_radius"); - addKey("randomitems"); - addKey("npc_status"); - addKey("npc_program"); - addKey("run_away"); - addKey("pick_up"); - addKey("container"); - addKey("will_apply"); - addKey("smoothlevel"); - addKey("map_layer"); - addKey("current_weapon_script"); - addKey("weapontype"); - addKey("tooltype"); - addKey("elevation"); - addKey("client_type"); - addKey("item_power"); - addKey("duration"); - addKey("range"); - addKey("range_modifier"); - addKey("duration_modifier"); - addKey("dam_modifier"); - addKey("gen_sp_armour"); - addKey("move_type"); - addKey("move_block"); - addKey("move_allow"); - addKey("move_on"); - addKey("move_off"); - addKey("move_slow"); - addKey("move_slow_penalty"); - addKey("alive"); - addKey("wiz"); - addKey("was_wiz"); - addKey("applied"); - addKey("unpaid"); - addKey("can_use_shield"); - addKey("no_pick"); - addKey("walk_on"); - addKey("no_pass"); - addKey("is_animated"); - addKey("slow_move"); - addKey("flying"); - addKey("monster"); - addKey("friendly"); - addKey("generator"); - addKey("is_thrown"); - addKey("auto_apply"); - addKey("treasure"); - addKey("player sold"); - addKey("see_invisible"); - addKey("can_roll"); - addKey("overlay_floor"); - addKey("is_turnable"); - addKey("walk_off"); - addKey("fly_on"); - addKey("fly_off"); - addKey("is_used_up"); - addKey("identified"); - addKey("reflecting"); - addKey("changing"); - addKey("splitting"); - addKey("hitback"); - addKey("startequip"); - addKey("blocksview"); - addKey("undead"); - addKey("scared"); - addKey("unaggressive"); - addKey("reflect_missile"); - addKey("reflect_spell"); - addKey("no_magic"); - addKey("no_fix_player"); - addKey("is_lightable"); - addKey("tear_down"); - addKey("run_away"); - addKey("pass_thru"); - addKey("can_pass_thru"); - addKey("unique"); - addKey("no_drop"); - addKey("wizcast"); - addKey("can_cast_spell"); - addKey("can_use_scroll"); - addKey("can_use_range"); - addKey("can_use_bow"); - addKey("can_use_armour"); - addKey("can_use_weapon"); - addKey("can_use_ring"); - addKey("has_ready_range"); - addKey("has_ready_bow"); - addKey("xrays"); - addKey("is_floor"); - addKey("lifesave"); - addKey("no_strength"); - addKey("sleep"); - addKey("stand_still"); - addKey("random_move"); - addKey("only_attack"); - addKey("confused"); - addKey("stealth"); - addKey("cursed"); - addKey("damned"); - addKey("see_anywhere"); - addKey("known_magical"); - addKey("known_cursed"); - addKey("can_use_skill"); - addKey("been_applied"); - addKey("has_ready_scroll"); - addKey("can_use_rod"); - addKey("can_use_horn"); - addKey("make_invisible"); - addKey("inv_locked"); - addKey("is_wooded"); - addKey("is_hilly"); - addKey("has_ready_skill"); - addKey("has_ready_weapon"); - addKey("no_skill_ident"); - addKey("is_blind"); - addKey("can_see_in_dark"); - addKey("is_cauldron"); - addKey("is_dust"); - addKey("no_steal"); - addKey("one_hit"); - addKey("berserk"); - addKey("neutral"); - addKey("no_attack"); - addKey("no_damage"); - addKey("activate_on_push"); - addKey("activate_on_release"); - addKey("is_water"); - addKey("use_content_on_gen"); - addKey("is_buildable"); - addKey("body_range"); - addKey("body_arm"); - addKey("body_torso"); - addKey("body_head"); - addKey("body_neck"); - addKey("body_skill"); - addKey("body_finger"); - addKey("body_shoulder"); - addKey("body_foot"); - addKey("body_hand"); - addKey("body_wrist"); - addKey("body_waist"); - } - /** - * The next key added via {@link #addKey(String)} is assigned this id. - */ - private static int idKey = 1; - - /** - * Adds a new key to {@link #keys}. The order in which the keys are added is - * the order in which the objects fields are written out. - * @param key the key to add - */ - private static void addKey(final String key) { - keys.put(key, idKey++); - } - - /** - * Comparator to compare two object fields. The comparator sorts the fields - * in the order in which they should be written to disk. - */ - private static final Comparator<String> keyOrderComparator = new Comparator<String>() { - - @Override - public int compare(final String o1, final String o2) { - final Integer i1 = keys.get(o1); - final Integer i2 = keys.get(o2); - final int v1 = i1 == null ? Integer.MAX_VALUE : i1; - final int v2 = i2 == null ? Integer.MAX_VALUE : i2; - if (v1 < v2) { - return -1; - } - if (v1 > v2) { - return +1; - } - assert v1 == v2; - if (v1 == Integer.MAX_VALUE) { - return o1.compareTo(o2); - } - return 0; - } - - }; - - /** * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances * @param archetypeSet the archetype set for looking up archetypes + * @param archetypeTypeSet the archetype type set for sorting attributes on + * save */ - public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(gameObjectFactory, archetypeSet); + this.archetypeTypeSet = archetypeTypeSet; } /** @@ -339,7 +62,7 @@ @NotNull @Override public Map<String, String> getModifiedFields(@NotNull final GameObject gameObject) { - final Map<String, String> fields = new TreeMap<String, String>(keyOrderComparator); + final Map<String, String> fields = new TreeMap<String, String>(archetypeTypeSet.getAttributeOrderComparator()); addModifiedFields(gameObject, fields); return fields; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.crossfire.model.io; import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; @@ -47,13 +48,22 @@ private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; /** + * The {@link ArchetypeTypeSet} for sorting attributes on save. + */ + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; + + /** * Creates a new instance. * @param gameObjectFactory the game object factory to use * @param archetypeSet the archetype set for looking up archetypes + * @param archetypeTypeSet the archetype type set for sorting attributes on + * save */ - public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet) { this.gameObjectFactory = gameObjectFactory; this.archetypeSet = archetypeSet; + this.archetypeTypeSet = archetypeTypeSet; } /** @@ -61,7 +71,7 @@ */ @Override public GameObjectParser<GameObject, MapArchObject, Archetype> newGameObjectParser() { - return new DefaultGameObjectParser(gameObjectFactory, archetypeSet); + return new DefaultGameObjectParser(gameObjectFactory, archetypeSet, archetypeTypeSet); } } Modified: trunk/src/crossfire/src/main/resources/resource/conf/types.xml =================================================================== --- trunk/src/crossfire/src/main/resources/resource/conf/types.xml 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/src/main/resources/resource/conf/types.xml 2013-07-19 13:27:24 UTC (rev 9370) @@ -448,6 +448,239 @@ </ignorelists> + <!-- This is the order in which attributes are written to map files. + Attributes not included here are placed at the end and sorted + alphabetically. --> + <attribute_order> + name + name_pl + custom_name + title + race + slaying + skill + msg + lore + other_arch + face + animation + Str + Dex + Con + Wis + Pow + Cha + Int + hp + maxhp + sp + maxsp + grace + maxgrace + exp + perm_exp + expmul + food + dam + luck + wc + ac + x + y + speed + speed_left + move_state + attack_movement + nrof + level + direction + type + subtype + attacktype + resist_physical + resist_magic + resist_fire + resist_electricity + resist_cold + resist_confusion + resist_acid + resist_drain + resist_weaponmagic + resist_ghosthit + resist_poison + resist_slow + resist_paralyze + resist_turn_undead + resist_fear + resist_cancellation + resist_deplete + resist_death + resist_chaos + resist_counterspell + resist_godpower + resist_holyword + resist_blind + resist_internal + resist_life_stealing + resist_disease + path_attuned + path_repelled + path_denied + material + materialname + value + carrying + weight + invisible + state + magic + last_heal + last_sp + last_grace + last_eat + connected + glow_radius + randomitems + npc_status + npc_program + pick_up + container + will_apply + smoothlevel + map_layer + current_weapon_script + weapontype + tooltype + elevation + client_type + item_power + duration + range + range_modifier + duration_modifier + dam_modifier + gen_sp_armour + move_type + move_block + move_allow + move_on + move_off + move_slow + move_slow_penalty + alive + wiz + was_wiz + applied + unpaid + can_use_shield + no_pick + walk_on + no_pass + is_animated + slow_move + flying + monster + friendly + generator + is_thrown + auto_apply + treasure + player sold + see_invisible + can_roll + overlay_floor + is_turnable + walk_off + fly_on + fly_off + is_used_up + identified + reflecting + changing + splitting + hitback + startequip + blocksview + undead + scared + unaggressive + reflect_missile + reflect_spell + no_magic + no_fix_player + is_lightable + tear_down + run_away + pass_thru + can_pass_thru + unique + no_drop + wizcast + can_cast_spell + can_use_scroll + can_use_range + can_use_bow + can_use_armour + can_use_weapon + can_use_ring + has_ready_range + has_ready_bow + xrays + is_floor + lifesave + no_strength + sleep + stand_still + random_move + only_attack + confused + stealth + cursed + damned + see_anywhere + known_magical + known_cursed + can_use_skill + been_applied + has_ready_scroll + can_use_rod + can_use_horn + make_invisible + inv_locked + is_wooded + is_hilly + has_ready_skill + has_ready_weapon + no_skill_ident + is_blind + can_see_in_dark + is_cauldron + is_dust + no_steal + one_hit + berserk + neutral + no_attack + no_damage + activate_on_push + activate_on_release + is_water + use_content_on_gen + is_buildable + body_range + body_arm + body_torso + body_head + body_neck + body_skill + body_finger + body_shoulder + body_foot + body_hand + body_wrist + body_waist + </attribute_order> + <!--###################### default attributes ######################--> <!-- Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParserTest.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -23,15 +23,16 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeBuilder; -import net.sf.gridarta.model.io.AbstractArchetypeParserTest; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.archetypeset.DefaultArchetypeSet; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.BaseObject; 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.io.AbstractArchetypeParser; +import net.sf.gridarta.model.io.AbstractArchetypeParserTest; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.smoothface.SmoothFaces; import net.sf.gridarta.utils.GUIUtils; @@ -108,8 +109,9 @@ final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); archetypeSet = new DefaultArchetypeSet<GameObject, MapArchObject, Archetype>(archetypeFactory, "images"); archetypeSet.setLoadedFromArchive(true); + final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); assert archetypeSet != null; - final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); + final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet, archetypeTypeSet); assert archetypeSet != null; final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); assert archetypeSet != null; Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/daimonin/ChangeLog 2013-07-19 13:27:24 UTC (rev 9370) @@ -1,3 +1,8 @@ +2013-07-19 Andreas Kirschbaum + + * Add attribute_ordering section to types.xml. It specifies the + ordering of attributes when writing map files. + 2013-07-12 Andreas Kirschbaum * Release 0.10. 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -225,7 +225,7 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -158,10 +158,12 @@ * 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); + 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 GlobalSettings} instance. 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -258,7 +258,7 @@ } }); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet); + 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(globalSettings); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -94,7 +94,7 @@ final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet); + final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet, archetypeTypeSet); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, mapViewSettings); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -21,8 +21,10 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -73,6 +75,42 @@ private final Map<String, AttributeBitmask> bitmaskTable = new HashMap<String, AttributeBitmask>(); /** + * Attribute names in save order. + */ + @NotNull + private final Map<String, Integer> attributeOrder = new LinkedHashMap<String, Integer>(); + + /** + * A {@link Comparator} that compares strings by {@link #attributeOrder}. + */ + @NotNull + private final Comparator<String> attributeOrderComparator = new Comparator<String>() { + + @Override + public int compare(@NotNull final String o1, @NotNull final String o2) { + final Integer index1 = attributeOrder.get(o1); + final Integer index2 = attributeOrder.get(o2); + if (index1 == null) { + if (index2 == null) { + return o1.compareTo(o2); + } + return +1; + } + if (index2 == null) { + return -1; + } + if (index1 < index2) { + return -1; + } + if (index1 > index2) { + return +1; + } + return 0; + } + + }; + + /** * Adds an {@link ArchetypeType} instance. * @param archetypeType the archetype type instance */ @@ -209,6 +247,33 @@ } /** + * Adds an attribute name for attribute ordering when saving. The new + * attribute name is placed after all previously added attribute names and + * before all other attribute names. + * @param attributeName the attribute name + * @return whether insertion failed because the attribute name was already + * known + */ + public boolean addAttributeOrder(@NotNull final String attributeName) { + if (attributeOrder.containsKey(attributeName)) { + return true; + } + + attributeOrder.put(attributeName, attributeOrder.size()); + return false; + } + + /** + * Returns a {@link Comparator} that sorts attributes keys by the order + * defined by {@link #addAttributeOrder(String)}. + * @return the comparator + */ + @NotNull + public Comparator<String> getAttributeOrderComparator() { + return attributeOrderComparator; + } + + /** * Returns a description of this type. * @param baseObject the base object to describe * @return the description 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -24,6 +24,7 @@ import javax.xml.parsers.DocumentBuilder; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.gridarta.utils.XmlUtils; import net.sf.japi.xml.NodeListIterator; @@ -34,6 +35,7 @@ import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -112,6 +114,7 @@ parseBitmasks(XmlUtils.getChild(rootElement, Constants.XML_ELEMENT_BITMASKS), errorViewCollector); parseLists(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); final Iterator<Element> typeElements = new NodeListIterator<Element>(rootElement, Constants.XML_ELEMENT_TYPE); @@ -319,6 +322,24 @@ } /** + * Parses the {@link Constants#XML_ELEMENT_ATTRIBUTE_ORDER} section of a + * types.xml file. + * @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) { + if (attributeOrderElement != null) { + for (final String value : StringUtils.PATTERN_WHITESPACE_NEWLINE.split(attributeOrderElement.getTextContent())) { + if (!value.isEmpty()) { + if (archetypeTypeSet.addAttributeOrder(value)) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, value + ": duplicate attribute name"); + } + } + } + } + } + + /** * Parses the {@link Constants#XML_ELEMENT_IGNORE_LIST} section of a * types.xml file. * @param ignoreListElement the element to parse Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/Constants.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/Constants.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/Constants.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -194,6 +194,12 @@ public static final String XML_ELEMENT_IGNORELISTS = "ignorelists"; /** + * The name of the "attribute_order" element. + */ + @NotNull + public static final String XML_ELEMENT_ATTRIBUTE_ORDER = "attribute_order"; + + /** * The name of the "ignore_list" element. */ @NotNull Modified: trunk/src/model/src/main/resources/system/dtd/types.dtd =================================================================== --- trunk/src/model/src/main/resources/system/dtd/types.dtd 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/model/src/main/resources/system/dtd/types.dtd 2013-07-19 13:27:24 UTC (rev 9370) @@ -19,7 +19,7 @@ --> <!-- The types document root element. --> -<!ELEMENT types ((bitmasks|xi:include), (lists|xi:include), (ignorelists|xi:include), (default_type|xi:include), (type|xi:include)+)> +<!ELEMENT types ((bitmasks|xi:include), (lists|xi:include), (ignorelists|xi:include), attribute_order?, (default_type|xi:include), (type|xi:include)+)> <!ATTLIST types> <!ELEMENT bitmasks (bitmask*)> @@ -37,6 +37,11 @@ xml:base CDATA #IMPLIED > +<!-- When writing a game object, the attributes are sorted in this order. + Attributes not specified here are placed at the end and ordered + alphabetically. Attributes are delimited with whitespace. --> +<!ELEMENT attribute_order (#PCDATA)> + <!-- name: the name of the bitmask; must be unique --> <!-- is_named: whether values are to be encoded as strings in external representation --> 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-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -23,6 +23,10 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -142,22 +146,68 @@ } /** + * Checks that a "archetype_order" is parsed correctly: missing + * attribute_order element. + * @throws ParserConfigurationException if the test fails + */ + @Test + public void testArchetypeOrder1() throws ParserConfigurationException { + final ArchetypeTypeSet typeSet = loadArchetypeTypeSet("attributeOrder1"); + Assert.assertFalse(errorView.hasErrors()); + final List<String> keys = new ArrayList<String>(Arrays.asList("a", "b", "c", "d")); + Collections.sort(keys, typeSet.getAttributeOrderComparator()); + Assert.assertEquals("[a, b, c, d]", keys.toString()); + } + + /** + * Checks that a "archetype_order" is parsed correctly: empty element. + * @throws ParserConfigurationException if the test fails + */ + @Test + public void testArchetypeOrder2() throws ParserConfigurationException { + final ArchetypeTypeSet typeSet = loadArchetypeTypeSet("attributeOrder2"); + Assert.assertFalse(errorView.hasErrors()); + final List<String> keys = new ArrayList<String>(Arrays.asList("a", "b", "c", "d")); + Collections.sort(keys, typeSet.getAttributeOrderComparator()); + Assert.assertEquals("[a, b, c, d]", keys.toString()); + } + + /** + * Checks that a "archetype_order" is parsed correctly: all attributes + * specified. + * @throws ParserConfigurationException if the test fails + */ + @Test + public void testArchetypeOrder3() throws ParserConfigurationException { + final ArchetypeTypeSet typeSet = loadArchetypeTypeSet("attributeOrder3"); + Assert.assertFalse(errorView.hasErrors()); + final List<String> keys = new ArrayList<String>(Arrays.asList("a", "b", "c", "d")); + Collections.sort(keys, typeSet.getAttributeOrderComparator()); + Assert.assertEquals("[c, d, a, b]", keys.toString()); + } + + /** + * Checks that a "archetype_order" is parsed correctly: some attributes + * missing. + * @throws ParserConfigurationException if the test fails + */ + @Test + public void testArchetypeOrder4() throws ParserConfigurationException { + final ArchetypeTypeSet typeSet = loadArchetypeTypeSet("attributeOrder4"); + Assert.assertFalse(errorView.hasErrors()); + final List<String> keys = new ArrayList<String>(Arrays.asList("a", "b", "c", "d")); + Collections.sort(keys, typeSet.getAttributeOrderComparator()); + Assert.assertEquals("[c, a, b, d]", keys.toString()); + } + + /** * Checks that a types.xml file can be read. * @param name the base name of the resources to load * @throws ParserConfigurationException if the test fails * @throws IOException if the test fails */ private void check(@NotNull final String name) throws ParserConfigurationException, IOException { - final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); - final ArchetypeTypeSetParser parser = createArchetypeTypeSetParser(archetypeTypeSet); - - final InputStream typesXml = getClass().getResourceAsStream("ArchetypeTypeSetParserTest-" + name + "-types.xml"); - Assert.assertNotNull(typesXml); - final InputSource inputSource = new InputSource(typesXml); - inputSource.setSystemId("types.dtd"); - - parser.loadTypesFromXML(errorViewCollector, inputSource); - + final ArchetypeTypeSet archetypeTypeSet = loadArchetypeTypeSet(name); final InputStream is = getClass().getResourceAsStream("ArchetypeTypeSetParserTest-" + name + "-result.txt"); Assert.assertNotNull(is); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -174,6 +224,27 @@ } /** + * Loads a types.xml file from resources. + * @param name the base name of the resources to load + * @return the archetype type set + * @throws ParserConfigurationException if the file cannot be read + */ + @NotNull + private ArchetypeTypeSet loadArchetypeTypeSet(@NotNull final String name) throws ParserConfigurationException { + final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); + final ArchetypeTypeSetParser parser = createArchetypeTypeSetParser(archetypeTypeSet); + + final InputStream typesXml = getClass().getResourceAsStream("ArchetypeTypeSetParserTest-" + name + "-types.xml"); + System.out.println("ArchetypeTypeSetParserTest-" + name + "-types.xml"); + Assert.assertNotNull(typesXml); + final InputSource inputSource = new InputSource(typesXml); + inputSource.setSystemId("types.dtd"); + + parser.loadTypesFromXML(errorViewCollector, inputSource); + return archetypeTypeSet; + } + + /** * Creates a new {@link ArchetypeTypeSetParser} instance. * @param archetypeTypeSet the archetype type set to modify * @return the archetype type set parser instance Added: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder1-types.xml =================================================================== --- trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder1-types.xml (rev 0) +++ trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder1-types.xml 2013-07-19 13:27:24 UTC (rev 9370) @@ -0,0 +1,10 @@ +<?xml version="1.0" standalone="no" ?> + +<!DOCTYPE types SYSTEM "types.dtd"> +<types> + <bitmasks/> + <lists/> + <ignorelists/> + <default_type/> + <type number="1" name="name1"/> +</types> Property changes on: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder1-types.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/xml \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder2-types.xml =================================================================== --- trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder2-types.xml (rev 0) +++ trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder2-types.xml 2013-07-19 13:27:24 UTC (rev 9370) @@ -0,0 +1,11 @@ +<?xml version="1.0" standalone="no" ?> + +<!DOCTYPE types SYSTEM "types.dtd"> +<types> + <bitmasks/> + <lists/> + <ignorelists/> + <attribute_order/> + <default_type/> + <type number="1" name="name1"/> +</types> Property changes on: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder2-types.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/xml \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder3-types.xml =================================================================== --- trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder3-types.xml (rev 0) +++ trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder3-types.xml 2013-07-19 13:27:24 UTC (rev 9370) @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no" ?> + +<!DOCTYPE types SYSTEM "types.dtd"> +<types> + <bitmasks/> + <lists/> + <ignorelists/> + <attribute_order> + c d + a b + </attribute_order> + <default_type/> + <type number="1" name="name1"/> +</types> Property changes on: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder3-types.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/xml \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder4-types.xml =================================================================== --- trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder4-types.xml (rev 0) +++ trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder4-types.xml 2013-07-19 13:27:24 UTC (rev 9370) @@ -0,0 +1,11 @@ +<?xml version="1.0" standalone="no" ?> + +<!DOCTYPE types SYSTEM "types.dtd"> +<types> + <bitmasks/> + <lists/> + <ignorelists/> + <attribute_order>c a</attribute_order> + <default_type/> + <type number="1" name="name1"/> +</types> Property changes on: trunk/src/model/src/test/resources/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest-attributeOrder4-types.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/xml \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/StringUtils.java 2013-07-19 08:58:58 UTC (rev 9369) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/StringUtils.java 2013-07-19 13:27:24 UTC (rev 9370) @@ -31,12 +31,18 @@ public class StringUtils { /** - * Pattern to match whitespace. + * Pattern to match whitespace excluding NL and CR. */ @NotNull public static final Pattern PATTERN_WHITESPACE = Pattern.compile("[\\x00-\\x09\\x0b\\x20]+"); /** + * Pattern to match whitespace including NL and CR. + */ + @NotNull + public static final Pattern PATTERN_WHITESPACE_NEWLINE = Pattern.compile("[\\x00-\\x0b\\x0d\\x20]+"); + + /** * Pattern to match trailing whitespace. */ @NotNull This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-10-05 06:30:15
|
Revision: 9371 http://sourceforge.net/p/gridarta/code/9371 Author: akirschbaum Date: 2013-10-05 06:30:08 +0000 (Sat, 05 Oct 2013) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.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/archetypetype/ArchetypeAttributeDefinition.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-07-19 13:27:24 UTC (rev 9370) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java 2013-10-05 06:30:08 UTC (rev 9371) @@ -564,7 +564,7 @@ * @return the pane */ @NotNull - public JTabbedPane getTabbedPane() { + public Component getTabbedPane() { return tabbedPane; } @@ -573,7 +573,7 @@ * @return the dialog attributes */ @NotNull - public Collection<DialogAttribute<G, A, R, ?>> getDialogAttributes() { + public Iterable<DialogAttribute<G, A, R, ?>> getDialogAttributes() { return Collections.unmodifiableCollection(dialogAttributes); } 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-07-19 13:27:24 UTC (rev 9370) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2013-10-05 06:30:08 UTC (rev 9371) @@ -33,6 +33,7 @@ import java.util.Set; import javax.swing.Icon; import net.sf.gridarta.model.archetype.Archetype; +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; @@ -556,7 +557,7 @@ * @param head the head of the game object * @return the rotation angle in radians */ - private static double getRotate(@NotNull final BaseObject<?, ?, ?, ?> head) { + private static double getRotate(@NotNull final Attributes head) { final int rotate = -head.getAttributeInt(DefaultIsoGameObject.ROTATE) % 360; return (rotate < 0 ? rotate + 360 : rotate) * 2 * Math.PI / 360; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java 2013-07-19 13:27:24 UTC (rev 9370) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeDefinition.java 2013-10-05 06:30:08 UTC (rev 9371) @@ -19,7 +19,7 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.baseobject.Attributes; import org.jetbrains.annotations.NotNull; /** @@ -56,7 +56,7 @@ * @param baseObject the base object * @return whether the base object matches */ - public boolean matches(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { + public boolean matches(@NotNull final Attributes baseObject) { return matches(baseObject.getAttributeString(key)); } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2013-07-19 13:27:24 UTC (rev 9370) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2013-10-05 06:30:08 UTC (rev 9371) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.archetypetype; import java.util.Iterator; +import net.sf.gridarta.model.baseobject.Attributes; import net.sf.gridarta.model.baseobject.BaseObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -285,7 +286,7 @@ * @return the description */ @NotNull - public String getDisplayName(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { + public String getDisplayName(@NotNull final Attributes baseObject) { final StringBuilder sb = new StringBuilder(); sb.append(typeName); sb.append(" ("); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2013-07-19 13:27:24 UTC (rev 9370) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2013-10-05 06:30:08 UTC (rev 9371) @@ -22,6 +22,7 @@ import java.awt.Point; import java.io.File; import java.util.regex.Pattern; +import net.sf.gridarta.model.baseobject.Attributes; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; @@ -159,7 +160,7 @@ * @param gameObject the game object * @return the exit x coordinate */ - private static int getMapY(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + private static int getMapY(@NotNull final Attributes gameObject) { return gameObject.getAttributeInt(BaseObject.SP); } @@ -168,7 +169,7 @@ * @param gameObject the game object * @return the exit y coordinate */ - private static int getMapX(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + private static int getMapX(@NotNull final Attributes gameObject) { return gameObject.getAttributeInt(BaseObject.HP); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |