From: <aki...@us...> - 2011-03-08 19:41:44
|
Revision: 8860 http://gridarta.svn.sourceforge.net/gridarta/?rev=8860&view=rev Author: akirschbaum Date: 2011-03-08 19:41:37 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Remove temporary variables. Modified Paths: -------------- trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java Modified: trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -492,8 +492,7 @@ private FaceObjectProviders newFaceObjectProviders() { final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); assert systemIcons != null; - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - return faceObjectProviders; + return new FaceObjectProviders(0, faceObjects, systemIcons); } /** Modified: trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -176,8 +176,7 @@ final TestMapArchObject mapArchObject = mapArchObjectFactory.newMapArchObject(false); mapArchObject.setMapSize(mapSize); mapArchObject.setMapName(mapName); - final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = mapManager.newMap(null, mapArchObject, mapFile, true); - return mapControl; + return mapManager.newMap(null, mapArchObject, mapFile, true); } /** Modified: trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -165,8 +165,7 @@ private FaceObjectProviders newFaceObjectProviders() { final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); assert systemIcons != null; - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - return faceObjectProviders; + return new FaceObjectProviders(0, faceObjects, systemIcons); } /** Modified: trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -63,8 +63,7 @@ final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new DefaultMapWriter<TestGameObject, TestMapArchObject, TestArchetype>(mapArchObjectParserFactory, gameObjectParser); final GlobalSettings globalSettings = new TestGlobalSettings(); - final ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype> validatorFactory = new ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype>(validatorPreferences, gameObjectMatchers, globalSettings, mapWriter); - return validatorFactory; + return new ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype>(validatorPreferences, gameObjectMatchers, globalSettings, mapWriter); } } // class ValidationUtils Modified: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -140,12 +140,11 @@ private void loadAdjacentMaps(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Collection<MapControl<G, A, R>> mapControls, @NotNull final String[] tilePaths) throws CannotLoadMapFileException { for (@Nullable final String tilePath : tilePaths) { @Nullable final MapControl<G, A, R> mapControl; - final String path = tilePath; - if (path != null && path.length() != 0) { + if (tilePath != null && tilePath.length() != 0) { try { - mapControl = loadMapControl(mapModel, path); + mapControl = loadMapControl(mapModel, tilePath); } catch (final IOException ex) { - throw new CannotLoadMapFileException(path, ex); + throw new CannotLoadMapFileException(tilePath, ex); } } else { mapControl = null; Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -186,8 +186,8 @@ * @return the <code>JComboBox</code> for selecting the proxy type */ private static JComboBox createProxyType() { - final JComboBox proxyType = new JComboBox(EnumSet.allOf(Proxy.Type.class).toArray()); - return proxyType; + + return new JComboBox(EnumSet.allOf(Proxy.Type.class).toArray()); } /** Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-03-08 19:35:50 UTC (rev 8859) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java 2011-03-08 19:41:37 UTC (rev 8860) @@ -62,8 +62,7 @@ @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 MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = new TestMapView(mapControl, mapViewBasic); - return mapView; + 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-03-09 08:20:33
|
Revision: 8863 http://gridarta.svn.sourceforge.net/gridarta/?rev=8863&view=rev Author: akirschbaum Date: 2011-03-09 08:20:24 +0000 (Wed, 09 Mar 2011) Log Message: ----------- Fix or suppress false posirive nullable warnings. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/face/FilterFaceProvider.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObject.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -547,6 +547,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected MapArchObject getThis() { return this; Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -164,6 +164,7 @@ */ @NotNull @Override + @SuppressWarnings({"NullableProblems"}) protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -602,6 +602,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected MapArchObject getThis() { return this; Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -120,6 +120,7 @@ */ @NotNull @Override + @SuppressWarnings({"NullableProblems"}) protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -488,6 +488,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected MapArchObject getThis() { return this; Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -165,11 +165,15 @@ } /** - * @noinspection TypeMayBeWeakened + * @noinspection NullableProblems, TypeMayBeWeakened */ @NotNull protected R getArchetype() { - return archetype; + final R result = archetype; + if (result == null) { + throw new IllegalStateException(); + } + return result; } } // class AbstractArchetypeBuilder Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -208,6 +208,7 @@ /** * {@inheritDoc} */ + @NotNull @Override public Collection<R> getArchetypes() { return Collections.unmodifiableCollection(archetypes); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -93,6 +93,7 @@ * Returns a read-only collection of all {@link Archetype Archetypes}. * @return a read-only collection of all archetypes */ + @NotNull Collection<R> getArchetypes(); void connectFaces(); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -165,6 +165,7 @@ * Sets the selected {@link ArchetypeChooserPanel}. * @param selectedPanel the selected panel */ + @SuppressWarnings({"NullableProblems"}) public void setSelectedPanel(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { if (!panels.contains(selectedPanel)) { throw new IllegalArgumentException("selected panel " + selectedPanel.getName() + " is not part of the model"); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -154,8 +154,10 @@ * @return the description */ @NotNull + @SuppressWarnings({"NullableProblems"}) public String getDescription() { - return description == null ? "" : description.trim(); + final String result = description; + return result == null ? "" : result.trim(); } /** @@ -163,8 +165,10 @@ * @return the usage notes */ @NotNull + @SuppressWarnings({"NullableProblems"}) public String getUse() { - return use == null ? "" : use.trim(); + final String result = use; + return result == null ? "" : result.trim(); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -172,7 +172,7 @@ * Sets the default archetype type. * @param defaultArchetypeType the default archetype type */ - public void setDefaultArchetypeType(@NotNull final ArchetypeType defaultArchetypeType) { + public void setDefaultArchetypeType(@Nullable final ArchetypeType defaultArchetypeType) { this.defaultArchetypeType = defaultArchetypeType; } Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -214,6 +214,7 @@ * Sets the face name. * @param faceName the new face name */ + @SuppressWarnings({"NullableProblems"}) private void setFaceName(@NotNull final String faceName) { final String effectiveFaceName = getEffectiveFaceName(faceName); //Strings are interned @@ -922,6 +923,7 @@ * Sets object animation <code>animation <var>animName</var></code>. * @param animName object animation <code>animation <var>animName</var></code> */ + @SuppressWarnings({"NullableProblems"}) private void setAnimName(@NotNull final String animName) { final String newAnimName = animName.length() > 0 ? animName.intern() : null; // Using == on these Strings is okay, they are both interned. @@ -968,6 +970,7 @@ /** * {@inheritDoc} */ + @SuppressWarnings({"NullableProblems"}) @Override public void setMulti(@NotNull final MultiArchData<G, A, R, T> multi) { this.multi = multi; Modified: trunk/model/src/app/net/sf/gridarta/model/face/FilterFaceProvider.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/FilterFaceProvider.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/face/FilterFaceProvider.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -62,7 +62,7 @@ * @param parent parent provider to get unfiltered images from * @param filter ImageFilter to apply for creating the images */ - public FilterFaceProvider(@NotNull final FaceProvider parent, @NotNull final ImageFilter filter) { + public FilterFaceProvider(@Nullable final FaceProvider parent, @NotNull final ImageFilter filter) { this.parent = parent; this.filter = filter; } @@ -71,7 +71,7 @@ * Sets a new provider as parent. * @param parent parent provider to get unfiltered images from */ - public void setParent(@NotNull final FaceProvider parent) { + public void setParent(@Nullable final FaceProvider parent) { this.parent = parent; } Modified: trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -79,6 +79,7 @@ * @throws IllegalStateException if changed map squares have been recorded * before */ + @SuppressWarnings({"NullableProblems"}) public void setSavedSquares(@NotNull final SavedSquares<G, A, R> savedSquares) { if (this.savedSquares != null) { throw new IllegalStateException(); @@ -93,6 +94,7 @@ * @throws IllegalStateException if no saved squares have been recorded */ @NotNull + @SuppressWarnings({"NullableProblems"}) public SavedSquares<G, A, R> getSavedSquares() { if (savedSquares == null) { throw new IllegalStateException(); Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -205,11 +205,13 @@ */ @NotNull @Override + @SuppressWarnings({"NullableProblems"}) protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> getArchetypeSet() { - if (archetypeSet == null) { + final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> result = archetypeSet; + if (result == null) { throw new IllegalStateException(); } - return archetypeSet; + return result; } } // class ArchetypeParserTest Modified: trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObject.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObject.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -44,6 +44,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected TestMapArchObject getThis() { return this; Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -84,6 +84,7 @@ * @return the menu item */ @NotNull + @SuppressWarnings({"NullableProblems"}) public JMenuItem getMenuItem() { assert menuItem != null; return menuItem; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -174,8 +174,9 @@ * Updates the text and icon of {@link #preview}. * @param image the icon to set or <code>null</code> */ + @SuppressWarnings({"NullableProblems"}) private void setPreview(@Nullable final Image image) { - preview.setIcon(new ImageIcon(image)); + preview.setIcon(image == null ? null : new ImageIcon(image)); preview.setText(null); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -61,6 +61,7 @@ * Sets the active map view. The map view will be moved to the front. * @param mapView the map view to activate */ + @SuppressWarnings({"NullableProblems"}) public void setActiveMapView(@NotNull final MapView<G, A, R> mapView) { assert mapViewsList.contains(mapView); mapViewsList.remove(mapView); Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -159,6 +159,7 @@ * @param mapFolder the active map folder or <code>null</code> if no folder * should be active */ + @SuppressWarnings({"NullableProblems"}) public synchronized void setActiveMapFolder(@NotNull final MapFolder<G, A, R> mapFolder) { if (activeMapFolder == mapFolder) { return; Modified: trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -179,7 +179,7 @@ */ @Deprecated @Override - public void setScriptEditControl(@NotNull final ScriptEditControl scriptEditControl) { + public void setScriptEditControl(@Nullable final ScriptEditControl scriptEditControl) { this.scriptEditControl = scriptEditControl; } Modified: trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface ScriptArchEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { @@ -43,6 +44,6 @@ void addEventScript(G gameObject, ScriptArchData<G, A, R> scriptArchData, @NotNull Frame parent); @Deprecated - void setScriptEditControl(@NotNull ScriptEditControl scriptEditControl); + void setScriptEditControl(@Nullable ScriptEditControl scriptEditControl); } // interface ScriptArchEditor Modified: trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -107,7 +107,7 @@ } @Deprecated - public void setScriptEditControl(@NotNull final ScriptEditControl scriptEditControl) { + public void setScriptEditControl(@Nullable final ScriptEditControl scriptEditControl) { this.scriptEditControl = scriptEditControl; } Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -259,6 +259,7 @@ * @return the key stroke or <code>null</code> */ @Nullable + @SuppressWarnings({"NullableProblems"}) public KeyStroke getKeyStroke() { return keyStroke.getKeyStroke(); } Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -123,6 +123,7 @@ * Updates the current key stroke. * @param keyStroke the new key stroke */ + @SuppressWarnings({"NullableProblems"}) private void setKeyStroke(@NotNull final KeyStroke keyStroke) { if (this.keyStroke == keyStroke) { return; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -727,7 +727,11 @@ * Returns the document this text area is editing. */ @NotNull + @SuppressWarnings({"NullableProblems"}) public SyntaxDocument getDocument() { + if (document == null) { + throw new IllegalStateException(); + } return document; } Modified: trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -123,6 +123,7 @@ * recorded. * @param failure the failure reason */ + @SuppressWarnings({"NullableProblems"}) private void setFailure(@NotNull final String failure) { synchronized (sync) { stopped = true; Modified: trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-03-09 07:51:34 UTC (rev 8862) +++ trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-03-09 08:20:24 UTC (rev 8863) @@ -193,6 +193,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapCursorIcon() { if (mapCursorIcon == null) { mapCursorIcon = guiUtils.getResourceIcon(SQUARE_CURSOR); @@ -201,6 +202,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getEmptySquareIcon() { if (emptySquareIcon == null) { emptySquareIcon = guiUtils.getResourceIcon(SQUARE_EMPTY); @@ -209,6 +211,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getUnknownSquareIcon() { if (unknownSquareIcon == null) { unknownSquareIcon = guiUtils.getResourceIcon(SQUARE_UNKNOWN); @@ -217,6 +220,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; @@ -231,6 +235,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getNoFaceSquareIcon() { if (noFaceSquareIcon == null) { noFaceSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_FACE); @@ -239,6 +244,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getNoArchSquareIcon() { if (noArchSquareIcon == null) { noArchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); @@ -247,6 +253,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapSelectedIcon() { if (mapSelIcon == null) { mapSelIcon = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE); @@ -255,6 +262,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapSelectedIconNorth() { if (mapSelIconNorth == null) { mapSelIconNorth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); @@ -263,6 +271,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapSelectedIconEast() { if (mapSelIconEast == null) { mapSelIconEast = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); @@ -271,6 +280,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapSelectedIconSouth() { if (mapSelIconSouth == null) { mapSelIconSouth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); @@ -279,6 +289,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapSelectedIconWest() { if (mapSelIconWest == null) { mapSelIconWest = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); @@ -287,6 +298,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getMapPreSelectedIcon() { if (mapPreSelIcon == null) { mapPreSelIcon = guiUtils.getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); @@ -299,6 +311,7 @@ * @return the image */ @NotNull + @SuppressWarnings({"NullableProblems"}) public Image getDefaultIcon() { if (defaultIcon == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_ICON); @@ -313,6 +326,7 @@ * @return the image */ @NotNull + @SuppressWarnings({"NullableProblems"}) public Image getDefaultPreview() { if (defaultPreview == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_PREVIEW); @@ -323,6 +337,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getTreasureListIcon() { if (treasureListIcon == null) { treasureListIcon = guiUtils.getResourceIcon(TREASURE_LIST); @@ -331,6 +346,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getTreasureOneListIcon() { if (treasureOneListIcon == null) { treasureOneListIcon = guiUtils.getResourceIcon(TREASUREONE_LIST); @@ -339,6 +355,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getTreasureYesIcon() { if (treasureYesIcon == null) { treasureYesIcon = guiUtils.getResourceIcon(TREASURE_YES); @@ -347,6 +364,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getTreasureNoIcon() { if (treasureNoIcon == null) { treasureNoIcon = guiUtils.getResourceIcon(TREASURE_NO); @@ -355,6 +373,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public ImageIcon getCloseTabSmallIcon() { if (closeTabSmallIcon == null) { closeTabSmallIcon = guiUtils.getResourceIcon(CLOSE_TAB_SMALL_ICON); @@ -363,6 +382,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getAutoRunSmallIcon() { if (autoRunSmallIcon == null) { autoRunSmallIcon = guiUtils.getResourceIcon(AUTO_RUN_SMALL_ICON); @@ -371,6 +391,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getFilterSmallIcon() { if (filterSmallIcon == null) { filterSmallIcon = guiUtils.getResourceIcon(FILTER_SMALL_ICON); @@ -379,6 +400,7 @@ } @NotNull + @SuppressWarnings({"NullableProblems"}) public Icon getRunPluginSmallIcon() { if (runPluginSmallIcon == null) { runPluginSmallIcon = guiUtils.getResourceIcon(RUN_PLUGIN_SMALL_ICON); @@ -391,6 +413,7 @@ * @return the icon or <code>null</code> if none is available */ @Nullable + @SuppressWarnings({"NullableProblems"}) public ImageIcon getAppIcon() { if (appIcon == null) { appIcon = guiUtils.getResourceIcon(APP_ICON); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-09 09:04:35
|
Revision: 8864 http://gridarta.svn.sourceforge.net/gridarta/?rev=8864&view=rev Author: akirschbaum Date: 2011-03-09 09:04:28 +0000 (Wed, 09 Mar 2011) Log Message: ----------- Extract duplicated code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2011-03-09 09:04:28 UTC (rev 8864) @@ -53,64 +53,64 @@ */ @Override protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(archetype.getArchetypeName()).append('\n'); + writeArchetype(out, archetype, true, gameObjectParser); + // process the multi-part tails: + int result = 1; + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + result++; + + out.append("More\n"); + writeArchetype(out, tail, false, gameObjectParser); + } + + return result; + } + + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @param gameObjectParser the game object parser for writing the inventory + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); + if (archetype.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); + writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); } if (archetype.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); + writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); } if (archetype.getMsgText() != null) { - out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); } - // special: add a string-attribute with the display-category - out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - - out.append(archetype.getObjectText()); - - for (final GameObject inv : archetype) { - gameObjectParser.save(out, inv); + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); } - out.append("end\n"); + writer.append(archetype.getObjectText()); - // process the multi-part tails: - int result = 1; - for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - result++; - - out.append("More\n"); - - out.append("Object ").append(tail.getArchetypeName()).append('\n'); - - if (tail.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(tail.getMultiShapeID())).append('\n'); + if (isHeadPart) { + for (final GameObject inv : archetype) { + gameObjectParser.save(writer, inv); } - if (tail.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(tail.getMultiPartNr())).append('\n'); - } - - if (tail.getMsgText() != null) { - out.append("msg\n").append(tail.getMsgText()).append("endmsg\n"); - } - - out.append(tail.getObjectText()); - + } else { // position of multi relative to head - if (tail.getMultiX() != 0) { - out.append("x ").append(Integer.toString(tail.getMultiX())).append('\n'); + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); } - if (tail.getMultiY() != 0) { - out.append("y ").append(Integer.toString(tail.getMultiY())).append('\n'); + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); } - - out.append("end\n"); } - return result; + writer.append("end\n"); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2011-03-09 09:04:28 UTC (rev 8864) @@ -61,47 +61,57 @@ */ @Override protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(archetype.getArchetypeName()).append('\n'); + writeArchetype(out, archetype, true, gameObjectParser); - // special: add a string-attribute with the display-category - out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - - // add message text - if (archetype.getMsgText() != null) { - out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); - } - - out.append(archetype.getObjectText()); - - for (final GameObject inv : archetype) { - gameObjectParser.save(out, inv); - } - - out.append("end\n"); - // process the multi-part tails: int result = 1; for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { result++; out.append("More\n"); + writeArchetype(out, tail, false, gameObjectParser); + } - out.append("Object ").append(tail.getArchetypeName()).append('\n'); + return result; + } - out.append(tail.getObjectText()); + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @param gameObjectParser the game object parser for writing the inventory + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, ?, ?> archetype, final boolean isHeadPart, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); + + // add message text + if (archetype.getMsgText() != null) { + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + } + } + + writer.append(archetype.getObjectText()); + if (isHeadPart) { + for (final GameObject inv : archetype) { + gameObjectParser.save(writer, inv); + } + } else { // position of multi relative to head - if (tail.getMultiX() != 0) { - out.append("x ").append(Integer.toString(tail.getMultiX())).append('\n'); + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); } - if (tail.getMultiY() != 0) { - out.append("y ").append(Integer.toString(tail.getMultiY())).append('\n'); + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); } - - out.append("end\n"); } - return result; + writer.append("end\n"); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-03-09 08:20:24 UTC (rev 8863) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2011-03-09 09:04:28 UTC (rev 8864) @@ -53,60 +53,59 @@ */ @Override protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(archetype.getArchetypeName()).append('\n'); + writeArchetype(out, archetype, true); - if (archetype.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); - } - if (archetype.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); - } - - if (archetype.getMsgText() != null) { - out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); - } - - // special: add a string-attribute with the display-category - out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - - out.append(archetype.getObjectText()); - - out.append("end\n"); - // process the multi-part tails: int result = 1; for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { result++; out.append("More\n"); + writeArchetype(out, tail, false); + } - out.append("Object ").append(tail.getArchetypeName()).append('\n'); + return result; + } - if (tail.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(tail.getMultiShapeID())).append('\n'); - } - if (tail.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(tail.getMultiPartNr())).append('\n'); - } + /** + * Writes an {@link Archetype}. + * @param writer the writer to write to + * @param archetype the archetype to write + * @param isHeadPart whether this part is the head part + * @throws IOException if an I/O error occurs + */ + private static void writeArchetype(@NotNull final Writer writer, @NotNull final net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> archetype, final boolean isHeadPart) throws IOException { + writer.append("Object ").append(archetype.getArchetypeName()).append('\n'); - if (tail.getMsgText() != null) { - out.append("msg\n").append(tail.getMsgText()).append("endmsg\n"); - } + if (archetype.getMultiShapeID() > 0) { + writer.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); + } + if (archetype.getMultiPartNr() > 0) { + writer.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); + } - out.append(tail.getObjectText()); + if (archetype.getMsgText() != null) { + writer.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); + } + if (isHeadPart) { + // special: add a string-attribute with the display-category + writer.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); + } + + writer.append(archetype.getObjectText()); + + if (!isHeadPart) { // position of multi relative to head - if (tail.getMultiX() != 0) { - out.append("x ").append(Integer.toString(tail.getMultiX())).append('\n'); + if (archetype.getMultiX() != 0) { + writer.append("x ").append(Integer.toString(archetype.getMultiX())).append('\n'); } - if (tail.getMultiY() != 0) { - out.append("y ").append(Integer.toString(tail.getMultiY())).append('\n'); + if (archetype.getMultiY() != 0) { + writer.append("y ").append(Integer.toString(archetype.getMultiY())).append('\n'); } - - out.append("end\n"); } - return result; + writer.append("end\n"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-10 17:33:50
|
Revision: 8868 http://gridarta.svn.sourceforge.net/gridarta/?rev=8868&view=rev Author: akirschbaum Date: 2011-03-10 17:33:42 +0000 (Thu, 10 Mar 2011) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -164,7 +164,7 @@ */ @NotNull @Override - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -120,7 +120,7 @@ */ @NotNull @Override - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -165,7 +165,7 @@ * Sets the selected {@link ArchetypeChooserPanel}. * @param selectedPanel the selected panel */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public void setSelectedPanel(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { if (!panels.contains(selectedPanel)) { throw new IllegalArgumentException("selected panel " + selectedPanel.getName() + " is not part of the model"); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -154,7 +154,7 @@ * @return the description */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public String getDescription() { final String result = description; return result == null ? "" : result.trim(); @@ -165,7 +165,7 @@ * @return the usage notes */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public String getUse() { final String result = use; return result == null ? "" : result.trim(); Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -214,7 +214,7 @@ * Sets the face name. * @param faceName the new face name */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) private void setFaceName(@NotNull final String faceName) { final String effectiveFaceName = getEffectiveFaceName(faceName); //Strings are interned @@ -923,7 +923,7 @@ * Sets object animation <code>animation <var>animName</var></code>. * @param animName object animation <code>animation <var>animName</var></code> */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) private void setAnimName(@NotNull final String animName) { final String newAnimName = animName.length() > 0 ? animName.intern() : null; // Using == on these Strings is okay, they are both interned. @@ -970,7 +970,7 @@ /** * {@inheritDoc} */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) @Override public void setMulti(@NotNull final MultiArchData<G, A, R, T> multi) { this.multi = multi; Modified: trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -79,7 +79,7 @@ * @throws IllegalStateException if changed map squares have been recorded * before */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public void setSavedSquares(@NotNull final SavedSquares<G, A, R> savedSquares) { if (this.savedSquares != null) { throw new IllegalStateException(); @@ -94,7 +94,7 @@ * @throws IllegalStateException if no saved squares have been recorded */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public SavedSquares<G, A, R> getSavedSquares() { if (savedSquares == null) { throw new IllegalStateException(); Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -205,7 +205,7 @@ */ @NotNull @Override - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> getArchetypeSet() { final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> result = archetypeSet; if (result == null) { Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -84,7 +84,7 @@ * @return the menu item */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public JMenuItem getMenuItem() { assert menuItem != null; return menuItem; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -174,7 +174,7 @@ * Updates the text and icon of {@link #preview}. * @param image the icon to set or <code>null</code> */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) private void setPreview(@Nullable final Image image) { preview.setIcon(image == null ? null : new ImageIcon(image)); preview.setText(null); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -61,7 +61,7 @@ * Sets the active map view. The map view will be moved to the front. * @param mapView the map view to activate */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public void setActiveMapView(@NotNull final MapView<G, A, R> mapView) { assert mapViewsList.contains(mapView); mapViewsList.remove(mapView); Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -159,7 +159,7 @@ * @param mapFolder the active map folder or <code>null</code> if no folder * should be active */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public synchronized void setActiveMapFolder(@NotNull final MapFolder<G, A, R> mapFolder) { if (activeMapFolder == mapFolder) { return; Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -259,7 +259,7 @@ * @return the key stroke or <code>null</code> */ @Nullable - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public KeyStroke getKeyStroke() { return keyStroke.getKeyStroke(); } Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -123,7 +123,7 @@ * Updates the current key stroke. * @param keyStroke the new key stroke */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) private void setKeyStroke(@NotNull final KeyStroke keyStroke) { if (this.keyStroke == keyStroke) { return; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -727,7 +727,7 @@ * Returns the document this text area is editing. */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public SyntaxDocument getDocument() { if (document == null) { throw new IllegalStateException(); Modified: trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -123,7 +123,7 @@ * recorded. * @param failure the failure reason */ - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) private void setFailure(@NotNull final String failure) { synchronized (sync) { stopped = true; Modified: trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-03-09 09:18:28 UTC (rev 8867) +++ trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-03-10 17:33:42 UTC (rev 8868) @@ -193,7 +193,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapCursorIcon() { if (mapCursorIcon == null) { mapCursorIcon = guiUtils.getResourceIcon(SQUARE_CURSOR); @@ -202,7 +202,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getEmptySquareIcon() { if (emptySquareIcon == null) { emptySquareIcon = guiUtils.getResourceIcon(SQUARE_EMPTY); @@ -211,7 +211,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getUnknownSquareIcon() { if (unknownSquareIcon == null) { unknownSquareIcon = guiUtils.getResourceIcon(SQUARE_UNKNOWN); @@ -220,7 +220,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; @@ -235,7 +235,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getNoFaceSquareIcon() { if (noFaceSquareIcon == null) { noFaceSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_FACE); @@ -244,7 +244,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getNoArchSquareIcon() { if (noArchSquareIcon == null) { noArchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); @@ -253,7 +253,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapSelectedIcon() { if (mapSelIcon == null) { mapSelIcon = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE); @@ -262,7 +262,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapSelectedIconNorth() { if (mapSelIconNorth == null) { mapSelIconNorth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); @@ -271,7 +271,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapSelectedIconEast() { if (mapSelIconEast == null) { mapSelIconEast = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); @@ -280,7 +280,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapSelectedIconSouth() { if (mapSelIconSouth == null) { mapSelIconSouth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); @@ -289,7 +289,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapSelectedIconWest() { if (mapSelIconWest == null) { mapSelIconWest = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); @@ -298,7 +298,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getMapPreSelectedIcon() { if (mapPreSelIcon == null) { mapPreSelIcon = guiUtils.getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); @@ -311,7 +311,7 @@ * @return the image */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Image getDefaultIcon() { if (defaultIcon == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_ICON); @@ -326,7 +326,7 @@ * @return the image */ @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Image getDefaultPreview() { if (defaultPreview == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_PREVIEW); @@ -337,7 +337,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getTreasureListIcon() { if (treasureListIcon == null) { treasureListIcon = guiUtils.getResourceIcon(TREASURE_LIST); @@ -346,7 +346,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getTreasureOneListIcon() { if (treasureOneListIcon == null) { treasureOneListIcon = guiUtils.getResourceIcon(TREASUREONE_LIST); @@ -355,7 +355,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getTreasureYesIcon() { if (treasureYesIcon == null) { treasureYesIcon = guiUtils.getResourceIcon(TREASURE_YES); @@ -364,7 +364,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getTreasureNoIcon() { if (treasureNoIcon == null) { treasureNoIcon = guiUtils.getResourceIcon(TREASURE_NO); @@ -373,7 +373,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getCloseTabSmallIcon() { if (closeTabSmallIcon == null) { closeTabSmallIcon = guiUtils.getResourceIcon(CLOSE_TAB_SMALL_ICON); @@ -382,7 +382,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getAutoRunSmallIcon() { if (autoRunSmallIcon == null) { autoRunSmallIcon = guiUtils.getResourceIcon(AUTO_RUN_SMALL_ICON); @@ -391,7 +391,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getFilterSmallIcon() { if (filterSmallIcon == null) { filterSmallIcon = guiUtils.getResourceIcon(FILTER_SMALL_ICON); @@ -400,7 +400,7 @@ } @NotNull - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public Icon getRunPluginSmallIcon() { if (runPluginSmallIcon == null) { runPluginSmallIcon = guiUtils.getResourceIcon(RUN_PLUGIN_SMALL_ICON); @@ -413,7 +413,7 @@ * @return the icon or <code>null</code> if none is available */ @Nullable - @SuppressWarnings({"NullableProblems"}) + @SuppressWarnings({ "NullableProblems" }) public ImageIcon getAppIcon() { if (appIcon == null) { appIcon = guiUtils.getResourceIcon(APP_ICON); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-17 21:19:22
|
Revision: 8870 http://gridarta.svn.sourceforge.net/gridarta/?rev=8870&view=rev Author: akirschbaum Date: 2011-03-17 21:19:15 +0000 (Thu, 17 Mar 2011) Log Message: ----------- Implement Edit|Invert Selection which inverts the currently selected map squares. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/atrinik/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) @@ -1,3 +1,8 @@ +2011-03-17 Andreas Kirschbaum + + * Implement Edit|Invert Selection which inverts the currently + selected map squares. + 2011-03-17 Alex Tokar * Remove support for 'plugins' map attribute; add support for Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/crossfire/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) @@ -1,3 +1,8 @@ +2011-03-17 Andreas Kirschbaum + + * Implement Edit|Invert Selection which inverts the currently + selected map squares. + 2011-03-01 Andreas Kirschbaum * Manage bookmarks dialog: Add "undo remove" button for restoring Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible smoothing enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/daimonin/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) @@ -1,3 +1,8 @@ +2011-03-17 Andreas Kirschbaum + + * Implement Edit|Invert Selection which inverts the currently + selected map squares. + 2011-03-01 Andreas Kirschbaum * Manage bookmarks dialog: Add "undo remove" button for restoring Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java 2011-03-17 21:19:15 UTC (rev 8870) @@ -410,15 +410,7 @@ unsetFlags(cornerMin.x, cornerMin.y, cornerMax.x, cornerMax.y, GRID_FLAG_SELECTION); break; case FLIP: - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - updateSelectionFlag(x, y, (gridFlags[x][y] & GRID_FLAG_SELECTION) == 0); - gridFlags[x][y] ^= GRID_FLAG_SELECTION; - } - } - cachedSelectedRecValid = false; - updateRecChange(cornerMin.x, cornerMin.y); - updateRecChange(cornerMax.x, cornerMax.y); + toggleFlags(cornerMin.x, cornerMin.y, cornerMax.x, cornerMax.y, GRID_FLAG_SELECTION); break; } } finally { @@ -585,6 +577,18 @@ } /** + * Inverts all selected squares. + */ + public void invertSelection() { + beginTransaction(); + try { + toggleFlags(0, 0, gridSize.getWidth() - 1, gridSize.getHeight() - 1, GRID_FLAG_SELECTION); + } finally { + endTransaction(); + } + } + + /** * Sets the error flag at given coordinates. * @param x the x coordinate * @param y the y coordinate @@ -701,6 +705,26 @@ } /** + * Flips flags in a rectangle and generate a grid change event. + * @param minX the left x-coordinate + * @param minY the left y-coordinate + * @param maxX the right x-coordinate + * @param maxY the right y-coordinate + * @param flags the flags to reset + */ + private void toggleFlags(final int minX, final int minY, final int maxX, final int maxY, final int flags) { + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + updateSelectionFlag(x, y, (gridFlags[x][y] & flags) == 0); + gridFlags[x][y] ^= flags; + } + } + cachedSelectedRecValid = false; + updateRecChange(minX, minY); + updateRecChange(maxX, maxY); + } + + /** * Starts a new transaction. Transactions may be nested. Transactions serve * the purpose of firing events to the views when more changes are known to * come before the view is really required to update. Each invocation of Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/action.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -79,6 +79,8 @@ selectAll.icon=EmptySmallIcon +invertSelection=EmptySmallIcon + mapProperties.icon=general/Properties16 pickmaps.menu=lockAllPickmaps - addNewPickmap deletePickmap - openPickmapMap - savePickmap revertPickmap - createPickmapFolder deletePickmapFolder - pickmapFolders Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2011-03-17 21:19:15 UTC (rev 8870) @@ -299,6 +299,12 @@ private final Action aSelectAll; /** + * Action called for "invert selection". + */ + @NotNull + private final Action aInvertSelection; + + /** * Action called for "grow empty selection". */ @NotNull @@ -451,6 +457,7 @@ aRandFillBelow = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "randFillBelow"); aFloodFill = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "floodFill"); aSelectAll = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "selectAll"); + aInvertSelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "invertSelection"); aExpandEmptySelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "expandEmptySelection"); aGrowSelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "growSelection"); aShrinkSelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "shrinkSelection"); @@ -681,6 +688,7 @@ aRandFillBelow.setEnabled(doRandFillBelow(false)); aFloodFill.setEnabled(doFloodFill(false)); aSelectAll.setEnabled(doSelectAll(false)); + aInvertSelection.setEnabled(doInvertSelection(false)); aExpandEmptySelection.setEnabled(doExpandEmptySelection(false)); aGrowSelection.setEnabled(doGrowSelection(false)); aShrinkSelection.setEnabled(doShrinkSelection(false)); @@ -866,6 +874,14 @@ } /** + * Invoked when the user wants to invert all selected squares from a map. + */ + @ActionMethod + public void invertSelection() { + doInvertSelection(true); + } + + /** * Invoked when the user wants to expand the selection of empty map squares * to surrounding empty map squares. */ @@ -1260,6 +1276,23 @@ } /** + * Executes the "invert selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doInvertSelection(final boolean performAction) { + if (currentMapView == null) { + return false; + } + + if (performAction) { + currentMapView.getMapViewBasic().getMapGrid().invertSelection(); + } + + return true; + } + + /** * Executes the "expand empty selection" action. * @param performAction whether the action should be performed * @return whether the action was or can be performed Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -823,6 +823,11 @@ selectAll.shortdescription=Selects all map squares of the current map. selectAll.accel=ctrl pressed A +invertSelection.text=Invert Selection +invertSelection.mnemonic=I +invertSelection.shortdescription=Inverts the selection. +invertSelection.accel=ctrl pressed I + expandEmptySelection.text=Expand Empty Selection expandEmptySelection.shortdescription=Includes empty map squares surrounding selected empty squares to the selection. Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -767,6 +767,10 @@ selectAll.mnemonic=S selectAll.shortdescription=W\u00e4hlt alle Felder der aktiven Karte aus. +invertSelection.text=Auswahl invertieren +invertSelection.mnemonic=I +invertSelection.shortdescription=Vertauscht ausgew\u00e4lte und nicht ausgew\u00e4hlte Felder. + expandEmptySelection.text=Leere Auswahl erweitern expandEmptySelection.shortdescription=Erweitert die Auswahl um leere Felder, die an ausgew\u00e4hlte leere Felder angrenzen. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -763,6 +763,10 @@ selectAll.mnemonic=T #selectAll.shortdescription= +#invertSelection.text= +#invertSelection.mnemonic= +#invertSelection.shortdescription= + expandEmptySelection.text=\u00c9tendre la s\u00e9lection aux carr\u00e9s vides expandEmptySelection.shortdescription=\u00c9tend la s\u00e9lection aux carr\u00e9s vides adjacents \u00e0 un carr\u00e9 vide d\u00e9j\u00e0 s\u00e9lectionn\u00e9. Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-03-17 20:59:35 UTC (rev 8869) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-03-17 21:19:15 UTC (rev 8870) @@ -765,6 +765,10 @@ selectAll.mnemonic=M #selectAll.shortdescription= +#invertSelection.text= +#invertSelection.mnemonic= +#invertSelection.shortdescription= + #expandEmptySelection.text= #expandEmptySelection.shortdescription= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-17 22:36:20
|
Revision: 8871 http://gridarta.svn.sourceforge.net/gridarta/?rev=8871&view=rev Author: akirschbaum Date: 2011-03-17 22:36:13 +0000 (Thu, 17 Mar 2011) Log Message: ----------- Center map view around destination of "Enter Exit". Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/MapRenderer.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java trunk/src/app/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/atrinik/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) @@ -1,5 +1,7 @@ 2011-03-17 Andreas Kirschbaum + * Center map view around destination of "Enter Exit". + * Implement Edit|Invert Selection which inverts the currently selected map squares. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/crossfire/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) @@ -1,5 +1,7 @@ 2011-03-17 Andreas Kirschbaum + * Center map view around destination of "Enter Exit". + * Implement Edit|Invert Selection which inverts the currently selected map squares. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/daimonin/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) @@ -1,5 +1,7 @@ 2011-03-17 Andreas Kirschbaum + * Center map view around destination of "Enter Exit". + * Implement Edit|Invert Selection which inverts the currently selected map squares. Modified: trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -542,7 +542,7 @@ boolean result = false; for (final Object selectedValue : selectedValues) { try { - mapViewsManager.openMapFileWithView((File) selectedValue, null); + mapViewsManager.openMapFileWithView((File) selectedValue, null, null); result = true; } catch (final IOException ex) { ACTION_BUILDER.showMessageDialog(dialog, "goMapIOException", selectedValue, ex.getMessage()); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -755,7 +755,7 @@ final MapView<G, A, R> newMapView; try { - newMapView = mapViewsManager.openMapFileWithView(canonicalNewFile, null); + newMapView = mapViewsManager.openMapFileWithView(canonicalNewFile, null, destinationPoint); } catch (final IOException ex) { fileControl.reportLoadError(canonicalNewFile, ex.getMessage()); return false; @@ -953,7 +953,7 @@ } if (performAction) { - mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getScrollPane().getViewport().getViewPosition()); + mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getScrollPane().getViewport().getViewPosition(), null); } return true; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -19,11 +19,14 @@ package net.sf.gridarta.gui.map.mapview; +import java.awt.Dimension; import java.awt.Point; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; +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; @@ -96,11 +99,13 @@ * @param mapControl the map control new map view is part of * @param viewPosition the view position to show initially; may be * <code>null</code> to show the top left corner + * @param centerSquare the map square that should be in the center of the + * view; ignored if <code>viewPosition</code> is set * @param mapViewFactory the map view factory to use * @return the map view */ @NotNull - public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, @NotNull final MapViewFactory<G, A, R> mapViewFactory) { + public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, @Nullable final Point centerSquare, @NotNull final MapViewFactory<G, A, R> mapViewFactory) { mapControl.acquire(); try { final MapView<G, A, R> mapView = mapViewFactory.newMapView(mapControl, viewPosition, ++nextMapViewCounter); @@ -109,6 +114,13 @@ for (final MapViewsListener<G, A, R> listener : listeners.getListeners()) { listener.mapViewCreated(mapView); } + if (viewPosition == null && centerSquare != null) { + final Rectangle squareBounds = mapView.getMapViewBasic().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)); + scrollPane.getViewport().setViewPosition(centerPoint); + } return mapView; } finally { mapControl.release(); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -213,11 +213,13 @@ * @param mapControl the map control * @param viewPosition the view position to show initially; may be * <code>null</code> to show the top left corner + * @param centerSquare the map square that should be in the center of the + * view; ignored if <code>viewPosition</code> is set * @return the map view */ @NotNull - public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition) { - return getMapViewsInt(mapControl).newMapView(mapControl, viewPosition, mapViewFactory); + public MapView<G, A, R> newMapView(@NotNull final MapControl<G, A, R> mapControl, @Nullable final Point viewPosition, @Nullable final Point centerSquare) { + return getMapViewsInt(mapControl).newMapView(mapControl, viewPosition, centerSquare, mapViewFactory); } /** @@ -285,7 +287,7 @@ public MapView<G, A, R> newMapWithView(@Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final Point viewPosition, @Nullable final File file) { final MapControl<G, A, R> mapControl = mapManager.newMap(objects, mapArchObject, file, true); try { - return newMapView(mapControl, viewPosition); + return newMapView(mapControl, viewPosition, null); } finally { mapManager.release(mapControl); } @@ -316,14 +318,16 @@ * @param file the map file to load * @param viewPosition the view position to show initially; may be * <code>null</code> to show the top left corner + * @param centerSquare the map square that should be in the center of the + * view; ignored if <code>viewPosition</code> is set * @return the map view * @throws IOException if an I/O error occurs */ @NotNull - public MapView<G, A, R> openMapFileWithView(@NotNull final File file, @Nullable final Point viewPosition) throws IOException { + public MapView<G, A, R> openMapFileWithView(@NotNull final File file, @Nullable final Point viewPosition, @Nullable final Point centerSquare) throws IOException { final MapControl<G, A, R> mapControl = mapManager.openMapFile(file, true); try { - return newMapView(mapControl, viewPosition); + return newMapView(mapControl, viewPosition, centerSquare); } finally { mapManager.release(mapControl); } Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.renderer; import java.awt.Point; -import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; @@ -108,14 +107,6 @@ public abstract void closeNotify(); /** - * Returns coordinates, length and width of map square. - * @param p the map coordinates - * @return the boundary rectangle of square - */ - @NotNull - public abstract Rectangle getSquareBounds(@NotNull final Point p); - - /** * {@inheritDoc} * @noinspection RefusedBequest */ Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/MapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/MapRenderer.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/MapRenderer.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map.renderer; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.image.BufferedImage; @@ -80,4 +81,12 @@ void removeMouseListener(@NotNull MouseListener l); + /** + * Returns coordinates, length and width of map square. + * @param p the map coordinates + * @return the boundary rectangle of square + */ + @NotNull + Rectangle getSquareBounds(@NotNull Point p); + } // interface MapRenderer Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -172,7 +172,7 @@ final File file = getFile(); final MapReader<G, A> decoder = mapReaderFactory.newMapReader(file); pickmap = pickmapManager.newMap(decoder.getGameObjects(), decoder.getMapArchObject(), file, true); - pickmapView = mapViewsManager.newMapView(pickmap, null); + pickmapView = mapViewsManager.newMapView(pickmap, null, null); } } Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -86,7 +86,7 @@ public void actionPerformed(final ActionEvent e) { final File mapFile = mapMenuEntryMap.getMapFile(); try { - mapViewsManager.openMapFileWithView(mapFile, null); + mapViewsManager.openMapFileWithView(mapFile, null, null); } catch (final IOException ex) { fileControl.reportLoadError(mapFile, ex.getMessage()); } Modified: trunk/src/app/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/DefaultFileControl.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/misc/DefaultFileControl.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -220,7 +220,7 @@ } else { globalSettings.setCurrentDirectory(dir); try { - mapViewsManager.openMapFileWithView(file, null); + mapViewsManager.openMapFileWithView(file, null, null); } catch (final IOException ex) { reportLoadError(file, ex.getMessage()); } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -723,7 +723,7 @@ if (performAction) { final File file = mapFile.getFile(); try { - mapViewsManager.openMapFileWithView(file, null); + mapViewsManager.openMapFileWithView(file, null, null); } catch (final IOException ex) { fileControl.reportLoadError(file, ex.getMessage()); return false; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2011-03-17 21:19:15 UTC (rev 8870) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2011-03-17 22:36:13 UTC (rev 8871) @@ -737,7 +737,7 @@ if (isScriptFile) { scriptEditControl.openScriptFile(file.getAbsolutePath()); } else { - return mapViewsManager.openMapFileWithView(file, null); + return mapViewsManager.openMapFileWithView(file, null, null); } } else if (!file.exists()) { if (isScriptFile) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-18 19:46:45
|
Revision: 8872 http://gridarta.svn.sourceforge.net/gridarta/?rev=8872&view=rev Author: akirschbaum Date: 2011-03-18 19:46:39 +0000 (Fri, 18 Mar 2011) Log Message: ----------- Correctly display special characters (<, >, and &) in map tooltips. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java Added Paths: ----------- trunk/src/test/net/sf/gridarta/gui/map/renderer/ToolTipAppenderTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) +++ trunk/atrinik/ChangeLog 2011-03-18 19:46:39 UTC (rev 8872) @@ -1,3 +1,7 @@ +2011-03-18 Andreas Kirschbaum + + * Correctly display special characters (<, >, and &) in map tooltips. + 2011-03-17 Andreas Kirschbaum * Center map view around destination of "Enter Exit". Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) +++ trunk/crossfire/ChangeLog 2011-03-18 19:46:39 UTC (rev 8872) @@ -1,3 +1,7 @@ +2011-03-18 Andreas Kirschbaum + + * Correctly display special characters (<, >, and &) in map tooltips. + 2011-03-17 Andreas Kirschbaum * Center map view around destination of "Enter Exit". Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-03-17 22:36:13 UTC (rev 8871) +++ trunk/daimonin/ChangeLog 2011-03-18 19:46:39 UTC (rev 8872) @@ -1,3 +1,7 @@ +2011-03-18 Andreas Kirschbaum + + * Correctly display special characters (<, >, and &) in map tooltips. + 2011-03-17 Andreas Kirschbaum * Center map view around destination of "Enter Exit". Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2011-03-17 22:36:13 UTC (rev 8871) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2011-03-18 19:46:39 UTC (rev 8872) @@ -67,7 +67,7 @@ sb.append("<br><hr>"); } sb.append(prefix); - sb.append(("<b>" + gameObject.getBestName() + "</b>\n" + text).trim().replaceAll("\n", "<br>" + prefix)); + sb.append(("<b>" + encode(gameObject.getBestName()) + "</b>\n" + encode(text)).trim().replaceAll("\n", "<br>" + prefix)); for (final G invGameObject : gameObject.reverse()) { appendGameObject(invGameObject, true, prefix + " "); } @@ -83,11 +83,11 @@ sb.append("<br><hr>"); } sb.append(prefix); - sb.append("<b>").append(gameObject.getBestName()).append("</b>"); + sb.append("<b>").append(encode(gameObject.getBestName())).append("</b>"); for (final Map.Entry<String, String> field : fields.entrySet()) { sb.append("<br>"); sb.append(prefix); - sb.append((field.getKey() + 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 + " "); @@ -102,7 +102,7 @@ } else { sb.append("\n<hr>"); } - sb.append(error.getMessage().trim()); + sb.append(encode(error.getMessage().trim())); } @Nullable @@ -110,4 +110,34 @@ return empty ? null : sb.toString().replaceAll("\n", "<br>"); } + /** + * Encodes a string so that the result can be embedded into HTML. + * @param str the string to encode + * @return the encoded string + */ + @NotNull + private static String encode(@NotNull final String str) { + final StringBuilder sb = new StringBuilder(str.length()); + for (final char ch : str.toCharArray()) { + switch (ch) { + case '<': + sb.append("<"); + break; + + case '>': + sb.append(">"); + break; + + case '&': + sb.append("&"); + break; + + default: + sb.append(ch); + break; + } + } + return sb.toString(); + } + } Added: trunk/src/test/net/sf/gridarta/gui/map/renderer/ToolTipAppenderTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/renderer/ToolTipAppenderTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/gui/map/renderer/ToolTipAppenderTest.java 2011-03-18 19:46:39 UTC (rev 8872) @@ -0,0 +1,54 @@ +/* + * 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.gui.map.renderer; + +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.GameObjectFactory; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapmodel.TestMapModelCreator; +import org.junit.Assert; +import org.junit.Test; + +/** + * Regression tests for {@link ToolTipAppender}. + * @author Andreas Kirschbaum + */ +public class ToolTipAppenderTest { + + /** + * Checks that HTML tags are correctly encoded in tooltip. + */ + @Test + public void testEmbeddedHtml1() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser = mapModelCreator.newGameObjectParser(); + final ToolTipAppender<TestGameObject, TestMapArchObject, TestArchetype> toolTipAppender = new ToolTipAppender<TestGameObject, TestMapArchObject, TestArchetype>(gameObjectParser); + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = mapModelCreator.getGameObjectFactory(); + final TestArchetype archetype = gameObjectFactory.newArchetype("arch"); + final TestGameObject gameObject = gameObjectFactory.createGameObject(archetype); + gameObject.setAttributeString("<key>", "<value>&<value>"); + toolTipAppender.appendGameObject(gameObject, false, ""); + final String tooltip = toolTipAppender.finish(); + Assert.assertEquals("<html><b>arch</b><br><key> <value>&<value>", tooltip); + } + +} // class ToolTipAppenderTest Property changes on: trunk/src/test/net/sf/gridarta/gui/map/renderer/ToolTipAppenderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-19 13:13:32
|
Revision: 8873 http://gridarta.svn.sourceforge.net/gridarta/?rev=8873&view=rev Author: akirschbaum Date: 2011-03-19 13:13:25 +0000 (Sat, 19 Mar 2011) Log Message: ----------- Increase maximum execution time for map-checker.py map validator to 30 seconds. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-18 19:46:39 UTC (rev 8872) +++ trunk/atrinik/ChangeLog 2011-03-19 13:13:25 UTC (rev 8873) @@ -1,3 +1,8 @@ +2011-03-19 Andreas Kirschbaum + + * Increase maximum execution time for map-checker.py map validator + to 30 seconds. + 2011-03-18 Andreas Kirschbaum * Correctly display special characters (<, >, and &) in map tooltips. Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-18 19:46:39 UTC (rev 8872) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-19 13:13:25 UTC (rev 8873) @@ -58,7 +58,7 @@ * The maximum execution time of the checker script in milliseconds. If the * script runs longer, it will be terminated. */ - private static final int MAX_EXEC_TIME = 1000; + private static final int MAX_EXEC_TIME = 30000; /** * The placeholder in the command's arguments for the map to check. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-22 21:01:43
|
Revision: 8875 http://gridarta.svn.sourceforge.net/gridarta/?rev=8875&view=rev Author: akirschbaum Date: 2011-03-22 21:01:35 +0000 (Tue, 22 Mar 2011) Log Message: ----------- Allow map paths starting with /random/. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/build.xml trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/validation/checks/ExitChecker.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java Added Paths: ----------- trunk/test-mapvalidator/atrinik/ trunk/test-mapvalidator/atrinik/arch/ trunk/test-mapvalidator/atrinik/arch/artifacts trunk/test-mapvalidator/atrinik/arch/dev/ trunk/test-mapvalidator/atrinik/arch/dev/editor/ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/GameObjectMatchers.xml trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/TreasureLists.xml trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/archdef.dat trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/autojoin.txt trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/spells.xml trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/types.xml trunk/test-mapvalidator/atrinik/arch/dev/editor/pickmaps/ trunk/test-mapvalidator/atrinik/arch/floor_volcano_2.arc trunk/test-mapvalidator/atrinik/arch/stairs_stone_down.arc trunk/test-mapvalidator/atrinik/arch/treasures trunk/test-mapvalidator/atrinik/maps/ trunk/test-mapvalidator/atrinik/maps/dev/ trunk/test-mapvalidator/atrinik/maps/dev/editor/ trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/ trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/MapValidator trunk/test-mapvalidator/atrinik/maps/random_stairs_test trunk/test-mapvalidator/atrinik/maps/random_stairs_test.expected trunk/test-mapvalidator/atrinik/regtest.conf Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/atrinik/ChangeLog 2011-03-22 21:01:35 UTC (rev 8875) @@ -1,3 +1,7 @@ +2011-03-22 Andreas Kirschbaum + + * Allow map paths starting with /random/. + 2011-03-19 Andreas Kirschbaum * Increase maximum execution time for map-checker.py map validator Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/build.xml 2011-03-22 21:01:35 UTC (rev 8875) @@ -967,7 +967,7 @@ </javadoc> </target> - <target name="test" description="Executes all tests." depends="test-junit,test-mapvalidator-crossfire,test-mapvalidator-daimonin"/> + <target name="test" description="Executes all tests." depends="test-junit,test-mapvalidator-atrinik,test-mapvalidator-crossfire,test-mapvalidator-daimonin"/> <target name="test-junit" description="Executes the junit tests." depends="test-atrinik,test-crossfire,test-daimonin,test-gridarta,test-model,test-preferences,test-script,test-textedit,test-utils"> <junitreport todir="${docs.dir}/test"> @@ -1173,6 +1173,13 @@ </junit> </target> + <target name="test-mapvalidator-atrinik" description="Executes the map validator tests using AtrinikEditor.jar." depends="jar-atrinik"> + <java jar="AtrinikEditor.jar" failonerror="true" fork="true"> + <arg value="--config=test-mapvalidator/atrinik/regtest.conf"/> + <arg value="--script=MapValidator"/> + </java> + </target> + <target name="test-mapvalidator-crossfire" description="Executes the map validator tests using CrossfireEditor.jar." depends="jar-crossfire"> <java jar="CrossfireEditor.jar" failonerror="true" fork="true"> <arg value="--config=test-mapvalidator/crossfire/regtest.conf"/> Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/crossfire/ChangeLog 2011-03-22 21:01:35 UTC (rev 8875) @@ -1,3 +1,7 @@ +2011-03-22 Andreas Kirschbaum + + * Allow map paths starting with /random/. + 2011-03-18 Andreas Kirschbaum * Correctly display special characters (<, >, and &) in map tooltips. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/daimonin/ChangeLog 2011-03-22 21:01:35 UTC (rev 8875) @@ -1,3 +1,7 @@ +2011-03-22 Andreas Kirschbaum + + * Allow map paths starting with /random/. + 2011-03-18 Andreas Kirschbaum * Correctly display special characters (<, >, and &) in map tooltips. Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/ExitChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/ExitChecker.java 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/ExitChecker.java 2011-03-22 21:01:35 UTC (rev 8875) @@ -71,7 +71,7 @@ } final String path = gameObject.getAttributeString("slaying", false); - if (path.length() <= 0 || path.equals("/!")) { + if (path.length() <= 0 || path.equals("/!") || path.startsWith("/random/")) { return; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-03-19 16:22:21 UTC (rev 8874) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-03-22 21:01:35 UTC (rev 8875) @@ -115,7 +115,7 @@ */ public static String getMapPath(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { String path = gameObject.getAttributeString("slaying"); - if (allowRandomMapParameters && path.equals("/!")) { + if (allowRandomMapParameters && (path.equals("/!") || path.startsWith("/random/"))) { // destination is a random map; extract the final non-random map path = getRandomMapParameter(gameObject, "final_map"); if (path == null) { Property changes on: trunk/test-mapvalidator/atrinik/arch/artifacts ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/GameObjectMatchers.xml =================================================================== --- trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/GameObjectMatchers.xml (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/GameObjectMatchers.xml 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<!DOCTYPE GameObjectMatchers SYSTEM "GameObjectMatchers.dtd"> +<GameObjectMatchers> + <!-- Objects to be put below the floor in insertion tool --> + <GameObjectMatcher id="system_below_floor" system="true"> + <title xml:lang="en">Below Floor</title> + <TypeNrs numbers="-666" /> + </GameObjectMatcher> + + <!-- Objects to be put below the floor in insertion tool --> + <GameObjectMatcher id="system_wall" system="true"> + <title xml:lang="en">Wall</title> + <And> + <TypeNrs numbers="77 79" /> + <Attrib name="no_pass" type="int" op="ne" value="0" /> + </And> + </GameObjectMatcher> + + <!-- Objects to be treated as monsters in insertion tool --> + <GameObjectMatcher id="system_monster" system="true"> + <title xml:lang="en">Monster</title> + <TypeNrs numbers="80 81 83" /> + </GameObjectMatcher> + + <!-- Objects to be treated as exits by the GUI --> + <GameObjectMatcher id="system_exit" system="true"> + <title xml:lang="en">Exit</title> + <TypeNrs numbers="41 66 69 94 95" /> + </GameObjectMatcher> + + <!-- Objects to be checked by the "Critical slaying characters" map + validator. --> + <GameObjectMatcher id="system_environment_sensor" system="true"> + <title xml:lang="en">Environment Sensor</title> + <TypeNrs numbers="133" /> + </GameObjectMatcher> + + <GameObjectMatcher id="system_monster_only" system="true"> + <title xml:lang="en">Monster Only</title> + <TypeNrs numbers="80 83" /> + </GameObjectMatcher> + + <GameObjectMatcher id="system_combat_values_objects" system="true"> + <title xml:lang="en">Objects using "combat_values"</title> + <TypeNrs numbers="5 6 7 13 39 54 62 72 73 80 83 154 158" /> + </GameObjectMatcher> + + <!-- Objects checked by the "Suspicious connection" map validator: objects + matching this matcher are connection sources. --> + <GameObjectMatcher id="system_connection_source" system="true"> + <title xml:lang="en">Connected objects being a source</title> + <TypeNrs numbers="17 18 27 30 31 32 51 64 92 93 132 133 134" /> + </GameObjectMatcher> + + <!-- Objects checked by the "Suspicious connection" map validator: objects + matching this matcher are connection sinks. --> + <GameObjectMatcher id="system_connection_sink" system="true"> + <title xml:lang="en">Connected objects being a sink</title> + <Or> + <TypeNrs numbers="26 41 42 55 62 65 74 78 81 91 94 98 112 132" /> + </Or> + </GameObjectMatcher> + + <!-- Objects checked by the "Suspicious connection" map validator: objects + matching this matcher are connection sinks. This matcher exists in + order to match inventory objects since <Env> cannot be included + into <Or>. --> + <GameObjectMatcher id="system_connection_sink2" system="true"> + <title xml:lang="en">Connected objects being a sink</title> + <TypeNrs numbers="-666" /> + </GameObjectMatcher> + + <!-- Objects checked by the "Shop square contains paid item" map validator: + objects matching this matcher are paid items. --> + <GameObjectMatcher id="system_paid_item" system="true"> + <title xml:lang="en">Paid items</title> + <And> + <Attrib name="unpaid" type="int" value="0" /> + <Attrib name="no_teleport" type="int" value="0" /> + <Attrib name="monster" type="int" value="0" /> + <Attrib name="weight" type="int" op="ne" value="0" /> + </And> + </GameObjectMatcher> +</GameObjectMatchers> Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/GameObjectMatchers.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/TreasureLists.xml =================================================================== --- trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/TreasureLists.xml (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/TreasureLists.xml 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<!DOCTYPE lists SYSTEM "TreasureLists.dtd"> +<lists> +</lists> Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/TreasureLists.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/archdef.dat =================================================================== --- trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/archdef.dat (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/archdef.dat 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,16 @@ +0 0 +1 2 +2 1 +2 2 +2 3 +3 2 +3 3 +2 4 +4 2 +2 5 +5 2 +3 4 +4 3 +2 7 +7 2 +4 4 Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/archdef.dat ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Added: svn:eol-style + LF Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/autojoin.txt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/spells.xml =================================================================== --- trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/spells.xml (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/spells.xml 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE spells SYSTEM "spells.dtd"> +<spells> + <spell id="0" name="none"/> +</spells> Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/spells.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/types.xml =================================================================== --- trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/types.xml (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/types.xml 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,38 @@ +<?xml version="1.0" standalone="no" ?><!DOCTYPE types SYSTEM "types.dtd"> +<types> + <bitmasks/> + <lists> + <list name="event"> + <listentry value="1" name="apply"/> + </list> + </lists> + <ignorelists/> + + <default_type> + <attribute arch="name" editor="name" type="string"> + This is the name of the object, displayed to the player. + </attribute> + </default_type> + + <type number="0" name="Misc"/> + + <type number="66" name="Exit"> + <attribute arch="slaying" editor="exit path" type="map_path"/> + <attribute arch="hp" editor="destination X" type="int"/> + <attribute arch="sp" editor="destination Y" type="int"/> + </type> + + <type number="71" name="Floor"> + <attribute arch="z" editor="height" type="int"/> + </type> + + <type number="80" name="Monster & NPC"> + <attribute arch="dam" editor="damage" type="int"/> + </type> + + <type number="81" name="Spawn Point"/> + + <type number="83" name="Spawn Point Monster"> + <attribute arch="dam" editor="damage" type="int"/> + </type> +</types> Property changes on: trunk/test-mapvalidator/atrinik/arch/dev/editor/conf/types.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/floor_volcano_2.arc =================================================================== --- trunk/test-mapvalidator/atrinik/arch/floor_volcano_2.arc (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/floor_volcano_2.arc 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,8 @@ +Object floor_volcano_2 +name floor +layer 1 +terrain_type 1 +type 71 +no_pick 1 +is_floor 1 +end Property changes on: trunk/test-mapvalidator/atrinik/arch/floor_volcano_2.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/arch/stairs_stone_down.arc =================================================================== --- trunk/test-mapvalidator/atrinik/arch/stairs_stone_down.arc (rev 0) +++ trunk/test-mapvalidator/atrinik/arch/stairs_stone_down.arc 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,13 @@ +Object stairs_stone_down +name stairs going down +is_animated 0 +anim_speed 1 +is_turnable 1 +direction 3 +no_teleport 1 +layer 5 +hp -1 +sp -1 +type 66 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/atrinik/arch/stairs_stone_down.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Property changes on: trunk/test-mapvalidator/atrinik/arch/treasures ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/MapValidator =================================================================== --- trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/MapValidator (rev 0) +++ trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/MapValidator 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<script> + <name>MapValidator</name> + <code><![CDATA[import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStream; +import java.util.Iterator; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.RecursiveFileIterator; +import net.sf.gridarta.model.validation.ErrorCollector; +import net.sf.gridarta.model.validation.errors.ValidationError; + +String checkMap(File mapFile, String mapPath) { + try { + map = mapManager.openMapFile(mapFile, false); + } catch (IOException ex) { + print("Cannot load map '"+mapFile+"': "+ex.getMessage()); + return null; + } + if (map == null) { + print(mapPath + ":"); + print("- cannot load map file"); + return null; + } + + ErrorCollector errorCollector; + try { + try { + validators.validateAll(map.getMapModel()); + } finally { + errorCollector = map.getMapModel().getErrors(); + } + } finally { + mapManager.release(map); + } + + StringBuffer sb = new StringBuffer(); + Iterator it = errorCollector.iterator(); + while (it.hasNext()) { + ValidationError validationError = it.next(); + + sb.append(validationError); + + Iterator it2 = validationError.getGameObjects().iterator(); + while (it2.hasNext()) { + GameObject gameObject = it2.next(); + sb.append(" [").append(gameObject.getBestName()).append(']'); + } + + String parameter0 = validationError.getParameter(0); + if (parameter0 != null) { + sb.append(" [").append(parameter0); + String parameter1 = validationError.getParameter(1); + if (parameter1 != null) { + sb.append(", ").append(parameter1); + } + sb.append(']'); + } + sb.append("\n"); + } + + return sb.toString(); +} + +if (baseDirectory == null || baseDirectory.length() <= 0) { + baseDirectory = "/"; +} +print("Checking maps below " + baseDirectory + "..."); +if (baseDirectory.endsWith("/")) { + baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1); +} + +String mapDefaultFolder = globalSettings.getMapsDirectory().getPath(); +String rootDirectory = mapDefaultFolder + baseDirectory; +boolean ok = true; +Iterator it = new RecursiveFileIterator(new File(rootDirectory)); +while (it.hasNext()) { + File file = it.next(); + String name = file.getName(); + String path = file.getPath(); + if (file.isFile() + && path.startsWith(rootDirectory) + && !name.endsWith(".expected")) { + File expectedFile = new File(file.getPath() + ".expected"); + if (expectedFile.exists()) { + String result = checkMap(file, file.getPath().substring(mapDefaultFolder.length())); + + final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + final InputStream inputStream = new FileInputStream(expectedFile); + try { + final byte[] buf = new byte[1024]; + for (;;) { + final int len = inputStream.read(buf); + if (len == -1) { + break; + } + byteArrayOutputStream.write(buf, 0, len); + } + } finally { + inputStream.close(); + } + final String expected = byteArrayOutputStream.toString("UTF-8"); + if (result.equals(expected)) { + print(file + ": OK"); + } else { + print(file + ": unexpected result:"); + print(result); + print("expected result:"); + print(expected); + ok = false; + } + } + } +} +if (!ok) { + throw new AssertionError(); +} +]]></code> + <mode> + <autoboot>false</autoboot> + <bash>true</bash> + <filter>false</filter> + </mode> + <parameter> + <name>baseDirectory</name> + <description>Base Directory</description> + <type>java.lang.String</type> + <value>/</value> + </parameter> +</script> + Property changes on: trunk/test-mapvalidator/atrinik/maps/dev/editor/scripts/MapValidator ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/maps/random_stairs_test =================================================================== --- trunk/test-mapvalidator/atrinik/maps/random_stairs_test (rev 0) +++ trunk/test-mapvalidator/atrinik/maps/random_stairs_test 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,77 @@ +arch map +name /random/ +msg +Created: 2011-03-22 Alex Tokar +Modified: 2011-03-22 Alex Tokar +endmsg +width 24 +height 24 +difficulty 1 +darkness -1 +end +arch floor_volcano_2 +z 48 +x 6 +y 11 +end +arch stairs_stone_down +msg +layoutstyle snake +monsterstyle promethia_island +exitstyle stairs_stone +doorstyle none +dungeon_depth 114 +dungeon_level 48 +xsize 24 +ysize 24 +floorstyle volcano +wallstyle lava +num_monsters 10 +darkness 3 +level_increment 2 +orientation 1 +dungeon_name Promethia Island Volcano +bg_music escape.mid +decorstyle volcano +decorchance 5 +endmsg +slaying /random/ +hp 0 +sp 0 +direction 7 +x 6 +y 11 +end +arch floor_volcano_2 +z 48 +x 6 +y 12 +end +arch stairs_stone_down +msg +layoutstyle snake +monsterstyle promethia_island +exitstyle stairs_stone +doorstyle none +dungeon_depth 114 +dungeon_level 48 +xsize 24 +ysize 24 +floorstyle volcano +wallstyle lava +num_monsters 10 +darkness 3 +level_increment 2 +orientation 1 +dungeon_name Promethia Island Volcano +bg_music escape.mid +decorstyle volcano +decorchance 5 +endmsg +slaying /! +hp 0 +sp 0 +direction 7 +x 6 +y 12 +end Property changes on: trunk/test-mapvalidator/atrinik/maps/random_stairs_test ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Property changes on: trunk/test-mapvalidator/atrinik/maps/random_stairs_test.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/atrinik/regtest.conf =================================================================== --- trunk/test-mapvalidator/atrinik/regtest.conf (rev 0) +++ trunk/test-mapvalidator/atrinik/regtest.conf 2011-03-22 21:01:35 UTC (rev 8875) @@ -0,0 +1,94 @@ + +# Whether the map validator is enabled. +MapValidator.All=true + +UpdaterAutoCheck=false + +# Whether this map validator check is is enabled. +Validator.AttributeRange=true + +# Whether this map validator check is is enabled. +Validator.BlockedMobOrSpawnPoint=true + +# Whether this map validator check is is enabled. +Validator.BlockedSpawnPoint=true + +# Whether this map validator check is is enabled. +Validator.ConnectedInsideContainer=true + +# Whether this map validator check is is enabled. +Validator.ConnectedPickable=true + +# Whether this map validator check is is enabled. +Validator.Connection=true + +# Whether this map validator check is is enabled. +Validator.DoubleLayer=true + +# Whether this map validator check is is enabled. +Validator.EmptySpawnPoint=true + +# Whether this map validator check is is enabled. +Validator.Exit=true + +Validator.MapCheckerScript=false + +# Whether this map validator check is is enabled. +Validator.MapDifficulty=true + +# Whether this map validator check is is enabled. +Validator.MobOutsideSpawnPoint=true + +# Whether this map validator check is is enabled. +Validator.TilePaths=true + +# Whether this map validator check is is enabled. +Validator.UndefinedArchetype=true + +# Whether this map validator check is is enabled. +Validator.UndefinedFace=true + +# Whether this map validator check is is enabled. +Validator.UnsetSlaying=true + +# Main windows''s state (maximized, iconized, etc.) +WindowState=0 + +# Archetype directory. +archDirectory=test-mapvalidator/atrinik/arch + +# Whether the map validator is run automatically after each change. +autoValidate=true + +configSource=ARCH_DIRECTORY + +# Last displayed version of the help documentation. +docuVersion=1 + +filterRealMaps=true + +# Language for the user interface. +language=en + +# Maps directory. +mapDirectory=test-mapvalidator/atrinik/maps + +# The settings for alpha faces. +mapViewSettings.alphaType=0 + +# Whether autojoining is enabled. +mapViewSettings.autojoin=false + +# Whether double faces are shown. +mapViewSettings.doubleFaces=false + +# Whether the map grid is visible. +mapViewSettings.gridVisible=false + +# Whether smoothing is active. +mapViewSettings.smoothing=false + +mediaDirectory=test-mapvalidator/atrinik/client/media + +# The image set to use. +useImageSet= Property changes on: trunk/test-mapvalidator/atrinik/regtest.conf ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-24 03:39:32
|
Revision: 8876 http://gridarta.svn.sourceforge.net/gridarta/?rev=8876&view=rev Author: akirschbaum Date: 2011-03-24 03:39:26 +0000 (Thu, 24 Mar 2011) Log Message: ----------- Pass correct map file name to map-checker.py on Windows machines. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-22 21:01:35 UTC (rev 8875) +++ trunk/atrinik/ChangeLog 2011-03-24 03:39:26 UTC (rev 8876) @@ -1,3 +1,8 @@ +2011-03-24 Andreas Kirschbaum + + * Pass correct map file name to map-checker.py on Windows + machines. + 2011-03-22 Andreas Kirschbaum * Allow map paths starting with /random/. Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-22 21:01:35 UTC (rev 8875) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-24 03:39:26 UTC (rev 8876) @@ -362,8 +362,9 @@ errorCollector.collect(new MapCheckerScriptMissingError<G, A, R>(mapModel, args[0], ex.getMessage())); return null; } + final String mapPathQuoted = Matcher.quoteReplacement(mapPath); for (int i = 1; i < result.length; i++) { - result[i] = args[i].replaceAll(QUOTED_MAP_PLACEHOLDER, mapPath); + result[i] = args[i].replaceAll(QUOTED_MAP_PLACEHOLDER, mapPathQuoted); } return result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-25 20:35:41
|
Revision: 8879 http://gridarta.svn.sourceforge.net/gridarta/?rev=8879&view=rev Author: akirschbaum Date: 2011-03-25 20:35:35 +0000 (Fri, 25 Mar 2011) Log Message: ----------- Prepend "python.exe" to map-checker.py on Windows machines; Add hacks to allow spaces in file names. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-03-24 03:53:48 UTC (rev 8878) +++ trunk/atrinik/ChangeLog 2011-03-25 20:35:35 UTC (rev 8879) @@ -1,3 +1,10 @@ +2011-03-25 Andreas Kirschbaum + + * Prepend "python.exe" to map-checker.py on Windows machines. + + * Add hacks to allow spaces in file names for map-checker.py on + Windows machines. + 2011-03-24 Andreas Kirschbaum * Pass correct map file name to map-checker.py on Windows Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-24 03:53:48 UTC (rev 8878) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-03-25 20:35:35 UTC (rev 8879) @@ -85,19 +85,24 @@ private final MapWriter<G, A, R> mapWriter; /** - * The command to execute and the arguments to pass. + * The {@link CommandFinder} for the script to execute. */ @NotNull - private final String[] args; + private final CommandFinder commandFinder1 = new CommandFinder(); /** - * The command to execute. Set to <code>null</code> if unknown. Otherwise - * points to <code>{@link #args}[0]</code>. + * The {@link CommandFinder} for the script interpreter. */ - @Nullable - private File cachedCommand = null; + @NotNull + private final CommandFinder commandFinder2 = new CommandFinder(); /** + * The command to execute and the arguments to pass. + */ + @NotNull + private final String[] args; + + /** * The temp file for saving maps to be checked. Set to <code>null</code> * until created. */ @@ -355,36 +360,75 @@ return null; } - final String[] result = new String[args.length]; + final boolean isWindows = System.getProperty("os.name").contains("Windows"); + final String[] result; + int index = 0; try { - result[0] = getCommand(); + if (isWindows) { + if (args[0].toLowerCase().endsWith(".py")) { + result = new String[args.length + 1]; + String command; + try { + command = commandFinder2.getCommand("python.exe"); + } catch (final IOException ex) { + command = "C:" + File.separator + "python27" + File.separator + "python.exe"; + if (!new File(command).exists()) { + throw ex; + } + } + result[index++] = "\"" + command + "\""; + } else { + result = new String[args.length]; + } + result[index++] = "\"" + commandFinder1.getCommand(args[0]) + "\""; + } else { + result = new String[args.length]; + result[index++] = commandFinder1.getCommand(args[0]); + } } catch (final IOException ex) { errorCollector.collect(new MapCheckerScriptMissingError<G, A, R>(mapModel, args[0], ex.getMessage())); return null; } final String mapPathQuoted = Matcher.quoteReplacement(mapPath); - for (int i = 1; i < result.length; i++) { - result[i] = args[i].replaceAll(QUOTED_MAP_PLACEHOLDER, mapPathQuoted); + for (int i = 1; i < args.length; i++) { + final String tmp = args[i].replaceAll(QUOTED_MAP_PLACEHOLDER, mapPathQuoted); + result[index++] = isWindows ? "\"" + tmp + "\"" : tmp; } return result; } /** - * Returns the command to execute. Returns or updates {@link - * #cachedCommand}. - * @return the command to execute - * @throws IOException if the command cannot be found + * Searches for commands in the PATH environment variable. + * @author Andreas Kirschbaum */ - @NotNull - private String getCommand() throws IOException { - final File existingCommand = cachedCommand; - if (existingCommand != null && existingCommand.exists()) { - return existingCommand.getPath(); + private static class CommandFinder { + + /** + * The command to execute. Set to <code>null</code> if unknown. + * Otherwise points to <code>{@link #args}[0]</code>. + */ + @Nullable + private File cachedCommand = null; + + /** + * Returns the command to execute. Returns or updates {@link + * #cachedCommand}. + * @param commandName the command name to search + * @return the command to execute + * @throws IOException if the command cannot be found + */ + @NotNull + private String getCommand(@NotNull final String commandName) throws IOException { + final File existingCommand = cachedCommand; + if (existingCommand != null && existingCommand.exists()) { + return existingCommand.getPath(); + } + + final File command = IOUtils.findPathFile(commandName); + cachedCommand = command; + return command.getPath(); } - final File command = IOUtils.findPathFile(args[0]); - cachedCommand = command; - return command.getPath(); } } // class MapCheckerScriptChecker This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-26 21:49:35
|
Revision: 8880 http://gridarta.svn.sourceforge.net/gridarta/?rev=8880&view=rev Author: akirschbaum Date: 2011-03-26 21:49:29 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java Modified: trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -97,7 +97,7 @@ if (obj == null || obj.getClass() != getClass()) { return false; } - final NamedObject abstractNamedObject = (AbstractNamedObject) obj; + final NamedObject abstractNamedObject = (NamedObject) obj; return getName().equals(abstractNamedObject.getName()); } Modified: trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -97,6 +97,7 @@ * found */ @Nullable + @SuppressWarnings({ "TypeMayBeWeakened" }) public G getExit(@NotNull final MapModel<G, A, R> mapModel, @Nullable final Point point) { if (point == null || !mapModel.getMapArchObject().isPointValid(point)) { return null; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -61,6 +61,7 @@ * @return the key */ @NotNull + @SuppressWarnings({ "TypeMayBeWeakened" }) public K getKey() { return key; } Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -134,6 +134,7 @@ * @return the row content */ @NotNull + @SuppressWarnings({ "TypeMayBeWeakened" }) public R get(final int index) { return archetypes.get(sorting[index]); } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -498,6 +498,7 @@ * @return the game object, or <code>null</code> if the index is invalid */ @Nullable + @SuppressWarnings({ "TypeMayBeWeakened" }) G getListGameObject(final int index) { final int actualIndex = getValidIndex(index); if (actualIndex >= model.getSize()) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -191,7 +191,7 @@ * @return the container */ @NotNull - public Container getButtons() { + public Component getButtons() { return buttons; } Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java 2011-03-25 20:35:35 UTC (rev 8879) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java 2011-03-26 21:49:29 UTC (rev 8880) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.utils.tabbedpanel; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Container; import javax.swing.AbstractButton; import javax.swing.JPanel; @@ -128,7 +129,7 @@ * @return the container */ @NotNull - public Container getButtons() { + public Component getButtons() { return buttons; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-26 22:04:18
|
Revision: 8882 http://gridarta.svn.sourceforge.net/gridarta/?rev=8882&view=rev Author: akirschbaum Date: 2011-03-26 22:04:12 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Rename identifiers. Modified Paths: -------------- trunk/gridarta.ipr trunk/model/src/app/net/sf/gridarta/model/match/Operation.java trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2011-03-26 21:51:49 UTC (rev 8881) +++ trunk/gridarta.ipr 2011-03-26 22:04:12 UTC (rev 8882) @@ -432,7 +432,7 @@ </inspection_tool> <inspection_tool class="EnumeratedConstantNamingConvention" enabled="true" level="WARNING" enabled_by_default="true"> <option name="m_regex" value="[A-Z][A-Z_\d]*" /> - <option name="m_minLength" value="3" /> + <option name="m_minLength" value="2" /> <option name="m_maxLength" value="32" /> </inspection_tool> <inspection_tool class="EqualsAndHashcode" enabled="true" level="WARNING" enabled_by_default="true" /> @@ -499,8 +499,8 @@ </inspection_tool> <inspection_tool class="InstanceVariableNamingConvention" enabled="true" level="WARNING" enabled_by_default="true"> <option name="m_regex" value="[a-z][A-Za-z\d]*" /> - <option name="m_minLength" value="3" /> - <option name="m_maxLength" value="32" /> + <option name="m_minLength" value="1" /> + <option name="m_maxLength" value="64" /> </inspection_tool> <inspection_tool class="InstanceVariableUninitializedUse" enabled="true" level="WARNING" enabled_by_default="true"> <option name="m_ignorePrimitives" value="false" /> @@ -747,7 +747,7 @@ <inspection_tool class="StaticInheritance" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="StaticMethodNamingConvention" enabled="true" level="WARNING" enabled_by_default="true"> <option name="m_regex" value="[a-z][A-Za-z\d]*" /> - <option name="m_minLength" value="4" /> + <option name="m_minLength" value="3" /> <option name="m_maxLength" value="64" /> </inspection_tool> <inspection_tool class="StaticSuite" enabled="true" level="WARNING" enabled_by_default="true" /> Modified: trunk/model/src/app/net/sf/gridarta/model/match/Operation.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/Operation.java 2011-03-26 21:51:49 UTC (rev 8881) +++ trunk/model/src/app/net/sf/gridarta/model/match/Operation.java 2011-03-26 22:04:12 UTC (rev 8882) @@ -23,6 +23,7 @@ * Operator. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ +@SuppressWarnings({ "EnumeratedConstantNamingConvention" }) public enum Operation { eq, Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java 2011-03-26 21:51:49 UTC (rev 8881) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java 2011-03-26 22:04:12 UTC (rev 8882) @@ -97,13 +97,13 @@ * The {@link Pattern} to split a list of action categories. */ @NotNull - private static final Pattern patternCategories = Pattern.compile(","); + private static final Pattern PATTERN_CATEGORIES = Pattern.compile(","); /** * The {@link Pattern} to split a category into sub-categories. */ @NotNull - private static final Pattern patterSubCategories = Pattern.compile("/"); + private static final Pattern PATTERN_SUB_CATEGORIES = Pattern.compile("/"); /** * The {@link JButton} for ok. @@ -419,7 +419,7 @@ private void createNodes(@NotNull final DefaultMutableTreeNode root) { for (final Action action : shortcutsManager) { final String categories = ActionUtils.getActionCategory(action); - for (final String category : patternCategories.split(categories, -1)) { + for (final String category : PATTERN_CATEGORIES.split(categories, -1)) { addNode(root, category, action); } } @@ -446,7 +446,7 @@ @NotNull private static DefaultMutableTreeNode getOrCreateNodeForCategory(@NotNull final DefaultMutableTreeNode root, @NotNull final CharSequence category) { DefaultMutableTreeNode node = root; - for (final String subCategory : patterSubCategories.split(category, -1)) { + for (final String subCategory : PATTERN_SUB_CATEGORIES.split(category, -1)) { node = getOrCreateChildNode(node, subCategory); } return node; Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2011-03-26 21:51:49 UTC (rev 8881) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2011-03-26 22:04:12 UTC (rev 8882) @@ -35,7 +35,7 @@ * The {@link Pattern} for parameters. */ @NotNull - private static final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); + private static final Pattern PATTERN = Pattern.compile("\\$\\{([a-zA-Z]+)}"); /** * Maps parameter key to value. @@ -62,7 +62,7 @@ */ @NotNull public String replace(@NotNull final CharSequence spec) throws SyntaxErrorException { - final Matcher matcher = pattern.matcher(spec); + final Matcher matcher = PATTERN.matcher(spec); final StringBuffer sb = new StringBuffer(); while (matcher.find()) { final String key = matcher.group(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-27 00:15:42
|
Revision: 8885 http://gridarta.svn.sourceforge.net/gridarta/?rev=8885&view=rev Author: akirschbaum Date: 2011-03-27 00:15:31 +0000 (Sun, 27 Mar 2011) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/atrinik/README.txt trunk/atrinik/resource/resource/HelpFiles/faq.html trunk/atrinik/resource/resource/HelpFiles/guide.html trunk/atrinik/resource/resource/HelpFiles/pyfaq.html trunk/atrinik/resource/resource/HelpFiles/pyguide.html trunk/atrinik/resource/resource/HelpFiles/treasure_multi.html trunk/atrinik/resource/resource/HelpFiles/tut_DScript.html trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html trunk/atrinik/resource/resource/HelpFiles/tut_frames.html trunk/atrinik/resource/resource/HelpFiles/tut_intro.html trunk/atrinik/resource/resource/HelpFiles/tut_loading.html trunk/atrinik/resource/resource/HelpFiles/tut_map.html trunk/atrinik/resource/resource/HelpFiles/tut_objects.html trunk/atrinik/resource/resource/HelpFiles/tut_scriptev.html trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties trunk/build.xml trunk/crossfire/ChangeLog trunk/crossfire/Developer_README.txt trunk/crossfire/INSTALL.txt trunk/crossfire/resource/resource/HelpFiles/guide.html trunk/crossfire/resource/resource/HelpFiles/map_basic.html trunk/crossfire/resource/resource/HelpFiles/map_otcs.html trunk/crossfire/resource/resource/HelpFiles/map_start.html trunk/crossfire/resource/resource/HelpFiles/treasure_multi.html trunk/crossfire/resource/resource/HelpFiles/treasure_one.html trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html trunk/crossfire/resource/resource/HelpFiles/tut_loading.html trunk/crossfire/resource/resource/HelpFiles/tut_objects.html trunk/crossfire/resource/resource/conf/autojoin.txt trunk/crossfire/resource/resource/conf/types.xml trunk/daimonin/ChangeLog trunk/daimonin/README.txt trunk/daimonin/resource/resource/HelpFiles/faq.html trunk/daimonin/resource/resource/HelpFiles/guide.html trunk/daimonin/resource/resource/HelpFiles/pyfaq.html trunk/daimonin/resource/resource/HelpFiles/pyguide.html trunk/daimonin/resource/resource/HelpFiles/treasure_multi.html trunk/daimonin/resource/resource/HelpFiles/tut_DScript.html trunk/daimonin/resource/resource/HelpFiles/tut_copypaste.html trunk/daimonin/resource/resource/HelpFiles/tut_frames.html trunk/daimonin/resource/resource/HelpFiles/tut_intro.html trunk/daimonin/resource/resource/HelpFiles/tut_loading.html trunk/daimonin/resource/resource/HelpFiles/tut_map.html trunk/daimonin/resource/resource/HelpFiles/tut_objects.html trunk/daimonin/resource/resource/HelpFiles/tut_scriptev.html trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod.properties trunk/gridarta.ipr trunk/model/src/app/net/sf/gridarta/model/floodfill/FloodFill.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java trunk/model/src/app/net/sf/gridarta/model/match/SetEnabledAction.java trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/overview.html trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/dtd/xhtml-base-1.mod trunk/src/doc/dtd/xhtml-events-1.mod trunk/src/doc/dtd/xhtml-image-1.mod trunk/src/doc/dtd/xhtml-legacy-1.mod trunk/src/doc/dtd/xhtml-qname-1.mod trunk/src/doc/dtd/xhtml-ruby-1.mod trunk/src/doc/dtd/xhtml-struct-1.mod trunk/src/doc/dtd/xhtml11-flat.dtd trunk/src/doc/dtd/xhtml11-model-1.mod trunk/src/doc/dtd/xhtml11_xinclude10-model-1.mod trunk/src/doc/news/2006-05-27_1.xhtml trunk/test-mapvalidator/crossfire/maps/TilePaths trunk/test-mapvalidator/crossfire/maps/TilePaths.expected trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/SyntaxStyle.java trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java Modified: trunk/atrinik/README.txt =================================================================== --- trunk/atrinik/README.txt 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/README.txt 2011-03-27 00:15:31 UTC (rev 8885) @@ -85,7 +85,7 @@ Example user.properties file: user.ctags=yes debug=yes -user.ftp.host=www.myhost.com +user.ftp.host=www.example.com user.ftp.user=cheristheus1234 user.ftp.pass=12345678 user.ftp.dir=daimonin Modified: trunk/atrinik/resource/resource/HelpFiles/faq.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/faq.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/faq.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -67,8 +67,8 @@ "png.jar".</P> </UL> -<P><B>Whenever I start the JavaEditor, I get a bunch of errormessages concerning - some missing font. What does that mean?</B></P> +<P><B>Whenever I start the JavaEditor, I get a bunch of error messages + concerning some missing font. What does that mean?</B></P> <P>That appears to happen with several Linux distributions. The messages might be annoying, but it's completely harmless. Simply ignore it. If using Java Modified: trunk/atrinik/resource/resource/HelpFiles/guide.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/guide.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/guide.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -73,17 +73,17 @@ (That doesn't mean all puzzles have to be short and small, just "solvable".) Players could look at your maps via editor at any time. Don't force them doing this. Support the "honorable" players. - <LI>If you plan to create a big mapset, <B>include maps of all difficulty + <LI>If you plan to create a big map set, <B>include maps of all difficulty levels.</B> It's absolutely okay and reasonable to have areas where a certain difficulty level dominates. Just try not to overdo it. </UL> -<H2 align=center>Guidlines for creating Artifacts:</H2> +<H2 align=center>Guidelines for creating Artifacts:</H2> <UL> <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> <LI>When you create a new artifact (weapon, armor, etc), <B>always keep an - eye on playbalance.</B> Powerful items must NOT be reachable without + eye on play balance.</B> Powerful items must NOT be reachable without hard fighting AND questing. Look at other maps. Try to adopt the average taste of "difficulty". Make sure the artifact is always hard to get, not only for the first time. A hidden location, for instance, does not Modified: trunk/atrinik/resource/resource/HelpFiles/pyfaq.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/pyfaq.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/pyfaq.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -31,7 +31,7 @@ <P> </P> -<P align="center">Comming Soon!</P> +<P align="center">Coming Soon!</P> </BODY> </HTML> Modified: trunk/atrinik/resource/resource/HelpFiles/pyguide.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/pyguide.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/pyguide.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -31,7 +31,7 @@ <H2 align=center> </H2> -<H2 align=center>comming soon!</H2> +<H2 align=center>coming soon!</H2> </BODY> </HTML> Modified: trunk/atrinik/resource/resource/HelpFiles/treasure_multi.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/treasure_multi.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/treasure_multi.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -55,7 +55,7 @@ generated, automatically arrows are generated too. <br> There is a 5% chance for the sword to be generated. If that fails, the - shortsword has a 10% chance to be generated. If that fails again, there is a + short sword has a 10% chance to be generated. If that fails again, there is a 15% chance for the dagger. <br> </P> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_DScript.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_DScript.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_DScript.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -354,7 +354,7 @@ <br> map.GetFirstObjectOnSquare(x,y) <br> - Gets the bottom object on the tile. Use obj.above to browse objs + Gets the bottom object on the tile. Use obj.above to browse objects <br> Parameter types: <br> @@ -1036,7 +1036,7 @@ <br> Abilities are can be cast in magic-blocking areas, and do not <br> - use magicattack. + use magic attack. <br> Parameter types: <br> @@ -1232,7 +1232,7 @@ <br> object.CreatePlayerForce(force_name, time) <br> - Creates and insters a player force named force_name in object. + Creates and inserts a player force named force_name in object. <br> The values of a player force will effect the player. <br> @@ -1348,9 +1348,9 @@ <br> ------------------------------------------------------------ <br> - object.CreateObjectInside(archname, identified, value) + object.CreateObjectInside(archetype_name, identified, value) <br> - Creates an object from archname and inserts into object. + Creates an object from archetype_name and inserts into object. <br> identified is either Daimonin.IDENTIFIED or Daimonin.UNIDENTIFIED <br> @@ -1360,7 +1360,7 @@ <br> Parameter types: <br> - string archname + string archetype_name <br> integer identified <br> @@ -1683,11 +1683,11 @@ <br> ------------------------------------------------------------ <br> - object.SendCustomCommand(customcommand) + object.SendCustomCommand(custom_command) <br> Parameter types: <br> - string customcommand + string custom_command <br> Possible return types: <br> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_copypaste.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -81,7 +81,7 @@ <ol> <LI> Select *one* empty square and hit fill: All empty squares adjacent to - the selected one will get floodfilled. + the selected one will get flood filled. <LI> Select an area or a non-empty square: The currently selected default arch will be inserted on top of (or below) every square within the selected area. Modified: trunk/atrinik/resource/resource/HelpFiles/tut_frames.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_frames.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_frames.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -39,7 +39,7 @@ Contains shortcuts for certain commands. </P> -<P><B>Default-Archpanel:</B> +<P><B>Default-Archetype panel:</B> <br> This panel contains all the available default arches. You can select from @@ -50,8 +50,8 @@ <br> This small window contains some basic info about the selected arch from the - default-archpanel. Personally I prefer to squeeze this to zero height, in - order to have more space for the default-archpanel itself. + default-archetype panel. Personally I prefer to squeeze this to zero height, + in order to have more space for the default-archetype panel itself. </P> <P><B>Map View:</B> @@ -61,7 +61,7 @@ insert and delete objects. </P> -<P><B>Map-Archpanel:</B> +<P><B>Map-Archetype panel:</B> <br> This panel contains a list of all objects on the currently active @@ -79,7 +79,7 @@ Don't forget to click "Apply" to apply the new settings. </P> -<P><B>Archtext Window:</B> +<P><B>Archetype Text Window:</B> <br> This window contains the arch-attributes of the currently selected object. Modified: trunk/atrinik/resource/resource/HelpFiles/tut_intro.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_intro.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_intro.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -31,7 +31,7 @@ <P> </P> -<P align="center"> comming soon!</P> +<P align="center"> coming soon!</P> </BODY> </HTML> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_loading.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_loading.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -45,7 +45,7 @@ of the download sites from http://daimonin.real-time.com/. <br> Once you've got the arch folder, you must <B>set the path</B> to this - folder. Select the menu "File->Options...", uncheck the box "Load + folder. Select the menu "File->Options...", un-check the box "Load Arches from Collection", then enter the path in the arch-entry. When you're at it, you can also customize the default map-path. <br> @@ -56,17 +56,17 @@ </ol> <P>You might ask yourself now: "Why should I spend my time downloading the arch package only to find out it takes three times longer to load?". Well, at - some point during mapmaking you will probably want to modify an arch, create - new arches or new images. And for that task, you need to have the individual - arch files in extracted form. However, don't worry too much about the - loading time. You can collect the arches after modifying/adding what you + some point during map making you will probably want to modify an arch, + create new arches or new images. And for that task, you need to have the + individual arch files in extracted form. However, don't worry too much about + the loading time. You can collect the arches after modifying/adding what you want (see menu: "Resources->Collect CF Arches"). This will create new collected archives so you can both have your changes and load in short time.</P> <P>Concerning maps: You don't necessarily need to have the Daimonin maps. You can just head off creating your own maps. Though, most likely you will - notice that Daimonin mapmaking isn't all that easy, and you'll want to have + notice that Daimonin map making isn't all that easy, and you'll want to have working examples to look at. Besides, you will want to link your maps into the existing Daimonin world and probably you'll want to test them too. For all of that you need the Daimonin map package.</P> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_map.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_map.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_map.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -45,24 +45,25 @@ <P> To <B>select</B> an object, left click on it. You can do so either on the - map window or in the map-archpanel window to the right. If you want to + map window or in the map-archetype panel window to the right. If you want to select a group of squares on the map (e.g. for copy/paste actions), left click and drag. You will notice a rectangular area getting highlighted as you drag.</P> <P> To <B>insert</B> a new object, you must first select one of the arches from - the default-archpanel to the left. Right click to insert the selected arch - into the map. You can also right-click into the map-archpanel in order to - insert the object at a specific place in a pile of objects. You can drag the - mouse on the map view in order to insert the same arch on many squares.</P> + the default-archetype panel to the left. Right click to insert the selected + archetype into the map. You can also right-click into the map-archetype + panel in order to insert the object at a specific place in a pile of + objects. You can drag the mouse on the map view in order to insert the same + arch on many squares.</P> <P> To <B>delete</B> an object, simply middle click on it. You can drag the mouse to delete multiple objects. Deleting specific objects out of a stack - is possible by middle-clicking in the map-archpanel. + is possible by middle-clicking in the map-archetype panel. <br> - (If your mouse has no middle-button you can simulate it by pressing <Strg>+<any + (If your mouse has no middle-button you can simulate it by pressing <Ctrl>+<any mouse button>.) </P> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_objects.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_objects.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_objects.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -42,29 +42,30 @@ <br> <br> - Select the object you want to modify, then doubleclick on it in the - <A HREF="tut_frames.html">Map-Archpanel Window</A> (on the right side). - You could alternatively select it and press the "Attributes" button on - the <A HREF="tut_frames.html">Object Attribute Window</A>. A popup - window will appear, containing all object attributes in a graphical user - interface. + Select the object you want to modify, then double click on it in the + <A HREF="tut_frames.html">Map-Archetype panel Window</A> (on the right + side). You could alternatively select it and press the "Attributes" + button on the <A HREF="tut_frames.html">Object Attribute Window</A>. A + popup window will appear, containing all object attributes in a + graphical user interface. <br> Keep in mind that the syntax definitions for this entire thing are written in well-readable XML. So if you notice that some attribute is wrong, or missing, I strongly recommend you trying to edit the definitions file: "types.xml". - <LI><b>Modify the archtext directly</b> + <LI><b>Modify the archetype text directly</b> <br> <br> Select the object you want, then modify the attributes directly in the - <A HREF="tut_frames.html">Archtext Window</A> (in the bottom-right + <A HREF="tut_frames.html">Archetype Text Window</A> (in the bottom-right corner). <br> But beware! You need to know exactly what you are doing there. If you do typos or set wrong values, you won't receive a warning. Modifying the - archtext directly is advisable for more experienced map makers only. + archetype text directly is advisable for more experienced map makers + only. </ol> </BODY> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_scriptev.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_scriptev.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/resource/resource/HelpFiles/tut_scriptev.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -185,10 +185,10 @@ <br> - local events are managed using the event_... tags. The event_..._plugin tag should be Python. the event_... specifies the name of the Python script - to run. This path is relative to the crossfire map subdirectory. + to run. This path is relative to the crossfire map sub-directory. </p> <p>- global events are all registered by CFPython. If you want to react to one - of them, you need to create script files in a python/ subdirectory of your + of them, you need to create script files in a python/ sub-directory of your crossfire map directory. Those files should be called: <br> python_shout.py : for the shout global event; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties 2011-03-27 00:15:31 UTC (rev 8885) @@ -33,8 +33,8 @@ tod.text.9=<html>You can select all squares of a map at once.<p>Menu: <code>Edit -> Select All</code><br>Keyboard: <kbd>Ctrl-A</kbd>. tod.text.10=<html>You can random paint by selecting a pickmap and painting.<p>Try this:<br>Select the "plants1" pickmap,<br>then paint with the right mouse button. tod.text.11=<html>All tiled maps of Atrinik are of size 24\xD724?<p>Your maps should be 24\xD724 as well. -tod.text.12=<html>You can create random maps quite fast? Try this:<ol><li>Create a new map.<li>Select the entire map using Edit -> Select All or Ctrl-A<li>Select the "gras" pickmap (do not select a square in the pickmap)<li>Use Edit -> Random Fill Above or Ctrl-D<li>When asked for a fill seed value, simply press OK or Return (enter nothing).<li>Select the "trees1" pickmap (do not select a square in the pickmap)<li>Use Edit -> Random Fill Above or Ctrl-D<li>When asked for a fill seed value, now enter 3.</ol>Nice, isn''t it? -tod.text.13=<html>Maps can be tiled using absolute and relative paths.<p><em>Relative paths</em> are good for paths to maps from the same mapset.<br><em>Absolute paths</em> are good for paths to maps from another mapset.<p>The "RA"-Switch in the Map Properties can be used to indvidually convert absolute to relative paths and vice versa. +tod.text.12=<html>You can create random maps quite fast? Try this:<ol><li>Create a new map.<li>Select the entire map using Edit -> Select All or Ctrl-A<li>Select the "grass" pickmap (do not select a square in the pickmap)<li>Use Edit -> Random Fill Above or Ctrl-D<li>When asked for a fill seed value, simply press OK or Return (enter nothing).<li>Select the "trees1" pickmap (do not select a square in the pickmap)<li>Use Edit -> Random Fill Above or Ctrl-D<li>When asked for a fill seed value, now enter 3.</ol>Nice, isn''t it? +tod.text.13=<html>Maps can be tiled using absolute and relative paths.<p><em>Relative paths</em> are good for paths to maps from the same map set.<br><em>Absolute paths</em> are good for paths to maps from another map set.<p>The "RA"-Switch in the Map Properties can be used to individually convert absolute to relative paths and vice versa. tod.text.14=<html>The editor runs better on Linux than on Windows.\nIt runs faster and smoother on Linux. tod.text.15=<html>You can control the client.<p>Menu: <code>Tools -> Control Client</code>.<p>There you can start and stop the client as well as see its console output. tod.text.16=<html>You can control the server.<p>Menu: <code>Tools -> Control Server</code>.<p><em><strong>Warning</strong>: This feature is experimental and might result in stale servers (zombies).</em> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/build.xml 2011-03-27 00:15:31 UTC (rev 8885) @@ -752,7 +752,7 @@ <attribute name="Implementation-Title" value="Gridarta"/> <attribute name="Implementation-Vendor" value="The Gridarta Developers"/> <attribute name="Implementation-Version" value="${project.version}"/> - <attribute name="Implementation-URL" value="http://sourceforge.net/projets/gridarta/"/> + <attribute name="Implementation-URL" value="http://sourceforge.net/projects/gridarta/"/> </manifest> </jar> <pack200 src="${distLib}.jar" destfile="${distLib}.pack.gz" gzipoutput="true" stripdebug="true" effort="9" keepfileorder="false" modificationtime="latest" deflatehint="false"/> Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/ChangeLog 2011-03-27 00:15:31 UTC (rev 8885) @@ -1440,7 +1440,7 @@ 2007-11-17 Andreas Kirschbaum - * Fix #1833500 (Attacktypes in attributes displayed as number). + * Fix #1833500 (Attack types in attributes displayed as number). * Fix #1833514 (Map selection dialog doesn't work from unsaved map). Modified: trunk/crossfire/Developer_README.txt =================================================================== --- trunk/crossfire/Developer_README.txt 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/Developer_README.txt 2011-03-27 00:15:31 UTC (rev 8885) @@ -70,7 +70,7 @@ In case you are unexperienced with java and swing, note that the graphics look different on every system, and with every font. They also have different sizes/proportions and behave different. - A seemingly trivial and effectless change can wreck havock for + A seemingly trivial and effectless change can wreck havoc for the same GUI run on another system. Again, please don't be totally afraid of it, just keep it in mind. Modified: trunk/crossfire/INSTALL.txt =================================================================== --- trunk/crossfire/INSTALL.txt 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/INSTALL.txt 2011-03-27 00:15:31 UTC (rev 8885) @@ -1,7 +1,7 @@ How to run the editor: ^^^^^^^^^^^^^^^^^^^^^ Simply run the jar file "CrossfireEditor.jar" in the main directory. -In Windows this is done by a doubleclick on "CrossfireEditor.jar". +In Windows this is done by a double-click on "CrossfireEditor.jar". In Linux/Unix you type in the console: "java -jar CrossfireEditor.jar". If you have enough memory, it is recommended to run the editor @@ -32,7 +32,7 @@ Install Ant on your system. Make sure both the JAVA_HOME and ANT_HOME environment variables are set correctly. -Change into the crossfire subdirectory or the Gridarta directory. +Change into the crossfire sub-directory or the Gridarta directory. On the console type "ant" - that's all. Modified: trunk/crossfire/resource/resource/HelpFiles/guide.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/guide.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/guide.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -78,18 +78,18 @@ "solvable".) Players could look at your maps via editor at any time. Don't force them doing this. Support the "honorable" players. <LI><B>Avoid mixing difficulty levels</B> all over the place. When newbie - maps, mid level- and high level areas stay seperated, players have a + maps, mid level- and high level areas stay separated, players have a much easier time to find what is suitable for them. It is okay to place a harder map into a low level area, as long as it requires something to enter which keeps out too weak players. </UL> -<H2 align=center>Guidlines for creating artifacts:</H2> +<H2 align=center>Guidelines for creating artifacts:</H2> <UL> <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> <LI>When you create a new artifact (weapon, armor, etc), <B>always keep an - eye on playbalance.</B> Powerful items must not be reachable without + eye on play balance.</B> Powerful items must not be reachable without hard fighting AND questing. Look at other maps. Try to adopt the average taste of "difficulty". Make sure the artifact is always hard to get, not only for the first time. A hidden location, for instance, does not Modified: trunk/crossfire/resource/resource/HelpFiles/map_basic.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/map_basic.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/map_basic.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -47,9 +47,9 @@ <H2 align="center">Step 2 - Floor:</H2> <P>Now it's time to put some floor tiles on your map. Look at the - <A HREF="tut_frames.html">Default-Archpanel</A> on the left side. These are - the default objects you can choose from. Click on the "Pickmaps" tab and - "background". Now left-click on one of the floors you like, and then + <A HREF="tut_frames.html">Default-Archetype panel</A> on the left side. + These are the default objects you can choose from. Click on the "Pickmaps" + tab and "background". Now left-click on one of the floors you like, and then right-click on the map to insert. (Middle-click to delete misplaced objects.)</P> @@ -60,9 +60,9 @@ <H2 align="center">Step 3 - Walls:</H2> <P>Let's add some walls next. On the - <A HREF="tut_frames.html">Default-Archpanel</A> (left side) select "Arch - List" - "wall". Now pick one of the wall types. You can enable the menu - "Map->Auto-Joining". This will automatically join the wall parts as you + <A HREF="tut_frames.html">Default-Archetype panel</A> (left side) select + "Arch List" - "wall". Now pick one of the wall types. You can enable the + menu "Map->Auto-Joining". This will automatically join the wall parts as you insert them on the map. Later you can switch off Auto-Joining again and replace some wall parts with special parts, like a window as seen below.</P> @@ -77,9 +77,10 @@ fitting. Different types of maps need different style of decoration of course. An undead map could show some tombstones/mist, pillars belong in a castle, altars in a church, trees/bushes for outdoor maps etc. (At this - point I assume you know how to find things in the <A HREF="tut_frames.html">Default-Archpanel</A>.) + point I assume you know how to find things in the <A HREF="tut_frames.html">Default-Archetype + panel</A>.) <br> - You can place some doors between seperate rooms. And maybe add a little + You can place some doors between separate rooms. And maybe add a little food, because players are always hungry. </P> <P> Modified: trunk/crossfire/resource/resource/HelpFiles/map_otcs.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/map_otcs.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/map_otcs.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -38,8 +38,8 @@ <P>You should know that every object has a <i>type</i>, defining it's base functionality. Is it a monster, an exit, food, or a weapon? That is defined by the object type. Apart from the type, there are countless - <i>attributes</i>. A monster for example can have health points, attacktype, - a damage value, and many more.</P> + <i>attributes</i>. A monster for example can have health points, attack + type, a damage value, and many more.</P> <P>There are two "layers" for the Crossfire objects (see <A HREF="tut_objects.html">manipulating objects</A>):</P> @@ -51,7 +51,7 @@ This is how the objects are defined in the arch files and also how they are stored in maps. Except for the special cases like type, name, image, and scripting, you can see the real arch syntax for any selected object - in the <A HREF="tut_frames.html">Archtext Window</A>: + in the <A HREF="tut_frames.html">Archetype Text Window</A>: <P> <IMG SRC="archtext.png" WIDTH="361" HEIGHT="234" ALIGN="CENTER"> </P> @@ -62,7 +62,7 @@ <LI><b>The attribute dialog</b> is there to help you <br> <br> - Select an object on the map and doubleclick on it in the + Select an object on the map and double click on it in the <A HREF="tut_frames.html">Map-ArchPanel</A> (bottom-right window), or press the "attributes" button. You'll see a popup window: The so-called Attribute Dialog. This is an interface which tries to Modified: trunk/crossfire/resource/resource/HelpFiles/map_start.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/map_start.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/map_start.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -34,12 +34,12 @@ stories and mystical places... - But you don't know where to start?</p> <p>Don't worry, this is a common problem that all of us went through. My advice: - <b>Start small</b>. Too many people have started to work on a huge mapset, + <b>Start small</b>. Too many people have started to work on a huge map set, and they've never been able to complete it. At some point the interest was gone, finally the maps were forgotten and lost. What a pity! You wouldn't believe how often this has happened.</p> -<p>The other point is: You need to learn step by step. Crossfire mapmaking +<p>The other point is: You need to learn step by step. Crossfire map making requires quite a bit of learning. When you start with small and easy maps, working your way up later, this learning can be a joyful process.</p> @@ -49,7 +49,7 @@ a cave) which is really crappy designed and never played. There's quite a lot of those yet, unfortunately. So, take this map and re-create it from scratch. Make it look nice, choose monsters fitting into the place/area. - According to your mapmaking skills, you may even go so far as to add a + According to your map making skills, you may even go so far as to add a little secret perhaps, an NPC, a story, or a small treasure - whatever you like. But better not all at once. Not yet.</p> @@ -89,7 +89,7 @@ something else which is easier. Or ask for help on IRC or the crossfire-maps mailing list.</p> -<h2>Embarking on the big mapset</h2> +<h2>Embarking on the big map set</h2> <p>I recommend you work on a lot more small maps before you start working on a big set. Don't start unless you feel you have already acquired a good deal Modified: trunk/crossfire/resource/resource/HelpFiles/treasure_multi.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/treasure_multi.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/treasure_multi.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -59,8 +59,8 @@ generated, automatically arrows are generated too.</p> <p>There is a 5% chance for the sword to be generated. If that fails, the - shortsword has a 10% chance to be generated. If that fails again, there is a - 15% chance for the dagger.</p> + short sword has a 10% chance to be generated. If that fails again, there is + a 15% chance for the dagger.</p> <p> <img src="treasure4.jpg" width="277" height="366" align="center" alt="Treasurelist 'goblin"> Modified: trunk/crossfire/resource/resource/HelpFiles/treasure_one.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/treasure_one.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/treasure_one.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -40,7 +40,7 @@ <table border="1"> <tr> <td> - <img src="treasure1.jpg" width="219" height="155" align="center" alt="Treasure list 'dragon_paarts'"> + <img src="treasure1.jpg" width="219" height="155" align="center" alt="Treasure list 'dragon_parts'"> </td> <td> <img src="treasure2.jpg" width="257" height="87" align="center" alt="Treasure list 'traps'"> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/tut_copypaste.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -36,7 +36,7 @@ <h2>Undo and Redo</h2> <p> - Undo allows you to undo your edits if you did make a mistake. Redo undos an + Undo allows you to undo your edits if you did make a mistake. Redo undoes an undo operation. (Note that the number of possible undo operations is rather limited.)</p> @@ -93,8 +93,8 @@ selected map squares <li>Random Fill Below: same as "Fill Below" but fills only a fraction of the selected map squares - <li>Floodfill: if the cursor is on an empty map square, fills the cursor map - square and all adjacent empty map squares + <li>Flood fill: if the cursor is on an empty map square, fills the cursor + map square and all adjacent empty map squares </ul> </BODY> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_loading.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/tut_loading.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -49,9 +49,9 @@ </P> <P>Once you've got the arch folder, you must <B>set the path</B> to this - folder. Select the menu "File->Options...", uncheck the box "Load - Arches from Collection", then enter the path in "Archfiles". When - you're at it, you can also customize the default map-path.</P> + folder. Select the menu "File->Options...", un-check the box + "Load Arches from Collection", then enter the path in "Arch". + When you're at it, you can also customize the default map-path.</P> <P>Now you're ready to go. Click OK, quit the editor and restart it. This time the archetypes will load from all the individual arch and @@ -61,9 +61,9 @@ </ol> <P>You might ask yourself now: "Why should I spend my time downloading the arch package only to find out it takes three times longer to load?". Well, at - some point during mapmaking you will probably want to modify an archetype, + some point during map making you will probably want to modify an archetype, create new archetypes or new images. And for that task, you need to have the - individual archtype files in extracted form. However, don't worry too much + individual archetype files in extracted form. However, don't worry too much about the loading time. You can collect the arches after modifying/adding what you want (see menu: "Resources->Collect Arches"). This will create new collected archives so you can both have your changes and load in short @@ -73,10 +73,10 @@ <P>Concerning maps: You don't necessarily need to have the Crossfire maps. You can just head off creating your own maps. Though, most likely you will - notice that Crossfire mapmaking isn't all that easy, and you'll want to have - working examples to look at. Besides, you will want to link your maps into - the existing Crossfire world and probably you'll want to test them too. For - all of that you need the Crossfire map package.</P> + notice that Crossfire map making isn't all that easy, and you'll want to + have working examples to look at. Besides, you will want to link your maps + into the existing Crossfire world and probably you'll want to test them too. + For all of that you need the Crossfire map package.</P> <P>Like the archetypes, you can get the maps either directly from SVN or download the package. See Modified: trunk/crossfire/resource/resource/HelpFiles/tut_objects.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_objects.html 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/HelpFiles/tut_objects.html 2011-03-27 00:15:31 UTC (rev 8885) @@ -42,7 +42,7 @@ <ol> <li><p><b>Use the convenient attribute interface</b></p> - <p>Select the game object you want to modify, then doubleclick on it in + <p>Select the game object you want to modify, then double click on it in the <a href="tut_frames.html">Selected Square Display</a> (on the right side). You could alternatively select it and press the "Attributes" button on the <a href="tut_frames.html">Game Object @@ -53,7 +53,7 @@ Game Object Attributes Dialog" title="The Game Object Attributes Dialog"></p> - <li><p><b>Modify the archtext directly</b></p> + <li><p><b>Modify the archetype text directly</b></p> <p>Select the game object you want, then modify the attributes directly in the <a href="tut_frames.html">Game Object Text Editor</a> (in the @@ -62,8 +62,8 @@ <p>But beware! You need to know exactly what you are doing there. If you do typing mistakes or set otherwise wrong values, you won't receive - a warning. Modifying the archtext directly is only recommended for - experienced mapmakers.</p> + a warning. Modifying the archetype text directly is only recommended + for experienced mapmakers.</p> <p><img src="game-object-text-editor.png" width="257" height="247" alt="The Game Object Text Editor" title="The Game Object Text Editor"></p> Modified: trunk/crossfire/resource/resource/conf/autojoin.txt =================================================================== --- trunk/crossfire/resource/resource/conf/autojoin.txt 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/conf/autojoin.txt 2011-03-27 00:15:31 UTC (rev 8885) @@ -16,7 +16,7 @@ # # 0, N, E, NE, S, NS, ES, NES, W, WN, WE, WNE, SW, SWN, ESW, NESW # -# Autojoining works with anything except multisquare arches. +# Autojoining works with anything except multi-square arches. # # Creator: Andreas Vogl # Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2011-03-26 22:09:02 UTC (rev 8884) +++ trunk/crossfire/resource/resource/conf/types.xml 2011-03-27 00:15:31 UTC (rev 8885) @@ -853,8 +853,8 @@ This adds chaos resistance to the item. The number is a percent-value in the range 0-100. Treat this with CARE. Look at other maps and what they require to do for getting this-and-that - artifact. Note that chaos is not a stand-alone attacktype. Chaos - "contains" a combination of other attacktypes. + artifact. Note that chaos is not a stand-alone attack type. + Chaos "contains" a combination of other attack types. </attribute> <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"> This adds blinding resistance to the item. The number is a @@ -864,7 +864,7 @@ </attribute> <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"> This adds holy power resistance to the item. The number is a - percent-value in the range 0-100. Holy power is the attacktype + percent-value in the range 0-100. Holy power is the attack type that holyword-type spells use to hurt undead creatures. This kind of resistance is only reasonable for undead players (wraith or devourer cult). Generally, resistance to holy word should not @@ -904,7 +904,7 @@ <section name="misc"> <attribute arch="luck" editor="luck bonus" type="int" min="-128" max="127"> With positive luck bonus, the player is more likely to succeed - in all sorts of things (spellcasting, praying,...). Unless the + in all sorts of things (spell-casting, praying,...). Unless the <luck bonus> is very high, the effect will be barely visible in-game. Luck bonus on one piece of equipment should never exceed 3, and such bonus should not be too frequently @@ -1480,8 +1480,8 @@ <use><![CDATA[ There is one major specialty about detectors: You can detect spells blown over a detector! To detect a lighting bolt for example, set - "slaying lighting" and "speed 1.0". In combination with spellcasting - walls, this can be very useful for map-mechanisms. ]]> + "slaying lighting" and "speed 1.0". In combination with + spell-casting walls, this can be very useful for map-mechanisms. ]]> </use> <attribute arch="no_pick" value="1" type="fixed"/> <attribute arch="slaying" editor="match name" type="string"> @@ -1617,9 +1617,9 @@ </attribute> </section> <section name="symptoms"> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - The disease will attack the host with the given <attacktype>. - Godpower attacktype is commonly used for "unresistable" + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> + The disease will attack the host with the given <attack type>. + Godpower attack type is commonly used for "unresistable" diseases. </attribute> <attribute arch="dam" editor="damage" type="int" min="-100" max="32767"> @@ -2418,11 +2418,11 @@ <attribute arch="move_block" editor="blocked movement" type="bitmask_movement"> If set, the object cannot be passed by players nor monsters. </attribute> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - This attribute specifies the attacktypes that this floor uses to - damage it's victims. Attacktypes are: physical, fire, cold.. etc. If - you want a real tough hazard floor, add more than just one - attacktype. + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> + This attribute specifies the attack types that this floor uses to + damage it's victims. Attack types are: physical, fire, cold.. etc. + If you want a real tough hazard floor, add more than just one + attack type. </attribute> <attribute arch="dam" editor="base damage" type="int" min="0" max="32767"> The <base damage> defines how much damage is inflicted to the @@ -2870,7 +2870,7 @@ archetypes, and can be found on the "connected" Pickmap. ]]> </description> <use><![CDATA[ - Spellcasting walls pose an interesting alternative to monsters. + Spell-casting walls pose an interesting alternative to monsters. Usually they are set to be undestroyable. Thus, while monsters in a map can be cleared out, the magic walls remain. Low level characters for example will not be able to pass through their spell-area, hence @@ -2908,7 +2908,7 @@ this won't have much visible effect. </attribute> <attribute arch="speed" editor="casting speed" type="float"> - The <casting speed> defines the spellcasting speed of the + The <casting speed> defines the spell-casting speed of the wall. You can fine-tune how long the duration between two casts shall be. If you want to create a wall that can be activated (cast per trigger) via connected lever/button/etc, you must set "speed 0". @@ -3144,7 +3144,7 @@ If you create special monsters of tweaked strength/abilities, always make sure that the <experience> is set to a reasonable value. Compare with existing arches to get a feeling what reasonable means. - Keep in mind that spellcasting monsters are a lot harder to kill + Keep in mind that spell-casting monsters are a lot harder to kill than non spell casters! </attribute> <attribute arch="speed" editor="speed" type="float"> @@ -3187,8 +3187,8 @@ moves, there is a 1% chance to breed. If set to 20, each time the monster moves there is a 5% chance. - Warning: Do not create spellcasting and breeding monsters since this - field is also used as <max spellpoints>. + Warning: Do not create spell-casting and breeding monsters since + this field is also used as <max spellpoints>. </attribute> <attribute arch="use_content_on_gen" editor="template generation" type="bool"> This only takes effect if <multiply> is enabled. The monster @@ -3225,15 +3225,15 @@ </attribute> <section name="melee"> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - This number is a bitmask, specifying the monster's attacktypes - for melee damage. Attacktypes are: physical, magical, fire, + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> + This number is a bitmask, specifying the monster's attack types + for melee damage. Attack types are: physical, magical, fire, cold.. etc. Strong monsters often have more than just physical - attacktype. + attack type. - When a monster with multiple attacktypes hits an opponent, it - will do as much damage as the "best" of it's attacktypes does. - So, the more attacktypes, the more dangerous. Attacktypes + When a monster with multiple attack types hits an opponent, it + will do as much damage as the "best" of it's attack types does. + So, the more attack types, the more dangerous. Attack types "magic" and "chaos" are somehow exceptions. </attribute> <attribute arch="dam" editor="damage" type="int" min="0" max="32767"> @@ -3280,7 +3280,7 @@ Monsters with <hitback> enabled hurt the attacker in proportion to the amount of damage the *attacker* inflicted. This damage is additional to the regular melee damage of the - monster. As far as I know, hitback uses acid attacktype, and it + monster. As far as I know, hitback uses acid attack type, and it only takes effect if the monster actually has acid attacktype at it's disposal. Acid spheres for example use this feature. </attribute> @@ -3307,7 +3307,7 @@ Like players, monsters need <spellpoints> to do magic. Monsters use them for both wizard- and prayer-spells. However, this value defines only the amount of *initial* spellpoints the - monster starts with. When creating a spellcasting monster, + monster starts with. When creating a spell-casting monster, remember that <max spellpoints> and <spellpoint regen.> are more important than just initial <spellpoints>. </attribute> @@ -3317,14 +3317,14 @@ unless the monster has a decent <spellpoint regen.>, or the spell "regenerate mana" at it's disposal. - Warning: Do not create spellcasting and breeding monsters since + Warning: Do not create spell-casting and breeding monsters since this field is also used as <multiply speed>. </attribute> <attribute arch="Pow" editor="spellpoint regen." type="int" min="0" max="127"> Monsters regenerate this many spellpoints each 16 ticks. Hence, the spellpoint regeneration rate is independent of <speed>. - To make a real tough spellcasting monster, the rate of + To make a real tough spell-casting monster, the rate of spellpoint regeneration is most important. If your monster is still not casting fast enough, give it the spell-ability of "regenerate mana". That, paired with high <max spellpoints>, @@ -4013,11 +4013,11 @@ really fulfill a useful purpose. In fact, even bows and crossbows are rarely ever used. ]]> </use> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - This number is a bitmask, specifying the projectile's attacktypes. - Attacktypes are: physical, magical, fire, cold.. etc. This works + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> + This number is a bitmask, specifying the projectile's attack types. + Attack types are: physical, magical, fire, cold.. etc. This works identical to melee weapons. Note that shooting weapons cannot have - attacktypes. + attack types. </attribute> <attribute arch="race" editor="ammunition class" type="string"> Only shooting weapons with matching <ammunition class> can @@ -4082,7 +4082,7 @@ <description><![CDATA[ Rings are worn on the hands - one ring each. Wearing rings, the object's stats will directly be inherited to the player. Usually - enhancing his spellcasting potential. ]]> + enhancing his spell-casting potential. ]]> </description> <use><![CDATA[ When you create an artifact ring, never forget that players can @@ -4091,7 +4091,7 @@ <br> <br> Also keep in mind that rings are generally the wizard's tools. They - should primarily grant bonuses to spellcasting abilities and + should primarily grant bonuses to spell-casting abilities and non-physical resistances. ]]> </use> </type> @@ -4161,7 +4161,7 @@ <br> <br> Runes hit any monster or person who steps on them for 'dam' damage - in 'attacktype' attacktype. Alternatively, the rune could contain + in 'attack type' attack type. Alternatively, the rune could contain any spell, and will cast this spell when it detonates. Yet another kind is the "summoning rune", summoning predefined monsters of any kind, at detonation. @@ -4171,8 +4171,8 @@ </description> <use><![CDATA[ Avoid monsters stepping on your runes. For example, summoning runes - together with spellcasting- and attack-runes is usually a bad idea. - ]]> + together with spell-casting- and attack-runes is usually a bad + idea.]]> </use> <attribute arch="no_pick" value="1" type="fixed"/> <attribute arch="move_on" value="walk" type="fixed"/> @@ -4206,9 +4206,9 @@ if it doesn't contain a spell. This should be set in reasonable relation to the rune's level. </attribute> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> If there isn't any spell (and <summon monster> is unset), this - attribute defines what attacktype to use for direct damage when the + attribute defines what attack type to use for direct damage when the rune detonates. </attribute> <section name="spellcraft"> @@ -4233,7 +4233,7 @@ <attribute arch="race" editor="summon monster" type="string"> If this is set to the arch name of any monster, together with <spell name> "summon evil monster", the rune will summon a - bunch of those on detonation. (dam and attacktype will still be + bunch of those on detonation. (dam and attack type will still be ignored in this case). Runes are even capable of summoning multi-square monsters, given enough space. You'd better test it though. @@ -4465,7 +4465,7 @@ <section name="bonus"> <attribute arch="luck" editor="luck bonus" type="int" min="-128" max="127"> With positive luck bonus, the player is more likely to succeed - in all sorts of things (spellcasting, praying,...). Unless the + in all sorts of things (spell-casting, praying,...). Unless the <luck bonus> is very high, the effect will be barely visible in-game. Luck bonus on one piece of equipment should never exceed 3, and such bonus should not be too frequently @@ -5212,7 +5212,7 @@ <br> <br> Traps hit any monster or person who steps on them for 'dam' damage - in 'attacktype' attacktype and/or trigger a reaction. + in 'attack type' attacktype and/or trigger a reaction. <br> <br> Many traps are already defined in the archetypes. ]]> @@ -5249,9 +5249,9 @@ <direct damage> specifies how much damage is done by the trap. This should be set in reasonable relation to the trap's level. </attribute> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - This attribute defines what attacktype to use for direct damage when - the trap detonates. + <attribute arch="attacktype" editor="attack type" type="bitmask_attacktype"> + This attribute defines what attack type to use for direct damage + when the trap detonates. </attribute> <attribute arch="connected" editor="connection" type="int"> When the trap is detonated, all objects with the same connection @@ -5596,24 +5596,25 @@ Keep play balance in mind! Such items mustn't be reachable without hard fighting AND questing. ]]> </use> - <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - This number is a bitmask, specifying the weapon's attacktypes. - Attacktypes are: physical, magical, fire, cold.. etc. Most artifact - weapons have no more than one or two attacktypes. Keep in mind that + <attribute arch="attacktype... [truncated message content] |
From: <aki...@us...> - 2011-05-22 17:34:30
|
Revision: 8892 http://gridarta.svn.sourceforge.net/gridarta/?rev=8892&view=rev Author: akirschbaum Date: 2011-05-22 17:34:23 +0000 (Sun, 22 May 2011) Log Message: ----------- Fix crash in --singlepng command-line option. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-05-22 17:31:35 UTC (rev 8891) +++ trunk/atrinik/ChangeLog 2011-05-22 17:34:23 UTC (rev 8892) @@ -1,3 +1,7 @@ +2011-05-22 Andreas Kirschbaum + + * Fix crash in --singlepng command-line option. + 2011-03-29 Andreas Kirschbaum * Retain "z" attribute value of bottom-most game object when Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-05-22 17:31:35 UTC (rev 8891) +++ trunk/crossfire/ChangeLog 2011-05-22 17:34:23 UTC (rev 8892) @@ -1,3 +1,7 @@ +2011-05-22 Andreas Kirschbaum + + * Fix crash in --singlepng command-line option. + 2011-03-22 Andreas Kirschbaum * Allow map paths starting with /random/. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-05-22 17:31:35 UTC (rev 8891) +++ trunk/daimonin/ChangeLog 2011-05-22 17:34:23 UTC (rev 8892) @@ -1,3 +1,7 @@ +2011-05-22 Andreas Kirschbaum + + * Fix crash in --singlepng command-line option. + 2011-03-22 Andreas Kirschbaum * Allow map paths starting with /random/. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-05-22 17:31:35 UTC (rev 8891) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-05-22 17:34:23 UTC (rev 8892) @@ -296,7 +296,7 @@ break; case BATCH_PNG: - returnCode = new BatchPngCommand(args2, new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory)).execute(); + returnCode = new BatchPngCommand(args2, new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory, faceObjectProviders, animationObjects, archetypeSet)).execute(); break; case SINGLE_PNG: @@ -304,7 +304,7 @@ throw new SyntaxErrorException("input output"); } - returnCode = new SinglePngCommand(new File(args2.get(0)), new File(args2.get(1)), new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory)).execute(); + returnCode = new SinglePngCommand(new File(args2.get(0)), new File(args2.get(1)), new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory, faceObjectProviders, animationObjects, archetypeSet)).execute(); break; case COLLECT_ARCHES: Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-05-22 17:31:35 UTC (rev 8891) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-05-22 17:34:23 UTC (rev 8892) @@ -27,16 +27,13 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; -import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; @@ -86,23 +83,20 @@ /** * Creates a new {@link ImageCreator} instance. * @param editorFactory the editor factory to use + * @param faceObjectProviders the face object providers to use + * @param animationObjects the animation objects to use + * @param archetypeSet the archetype set to use * @return the new instance */ @NotNull - public ImageCreator<G, A, R> newImageCreator(@NotNull final EditorFactory<G, A, R> editorFactory) { + public ImageCreator<G, A, R> newImageCreator(@NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(globalSettings); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<G, A, R> faceObjects = editorFactory.createFaceObjects(archFaceProvider); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<G, A, R> animationObjects = editorFactory.newAnimationObjects(); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); - final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, faceObjectProviders); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-10 19:24:28
|
Revision: 8894 http://gridarta.svn.sourceforge.net/gridarta/?rev=8894&view=rev Author: akirschbaum Date: 2011-06-10 19:24:21 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Fix collection sometimes creating broken atrinik/crossfire/daimonin.0 file. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-06-10 19:23:03 UTC (rev 8893) +++ trunk/atrinik/ChangeLog 2011-06-10 19:24:21 UTC (rev 8894) @@ -1,3 +1,7 @@ +2011-06-10 Andreas Kirschbaum + + * Fix collection sometimes creating broken atrinik.0 file. + 2011-05-22 Andreas Kirschbaum * Fix crash in --singlepng command-line option. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-06-10 19:23:03 UTC (rev 8893) +++ trunk/crossfire/ChangeLog 2011-06-10 19:24:21 UTC (rev 8894) @@ -1,3 +1,7 @@ +2011-06-10 Andreas Kirschbaum + + * Fix collection sometimes creating broken crossfire.0 file. + 2011-05-22 Andreas Kirschbaum * Fix crash in --singlepng command-line option. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-06-10 19:23:03 UTC (rev 8893) +++ trunk/daimonin/ChangeLog 2011-06-10 19:24:21 UTC (rev 8894) @@ -1,3 +1,7 @@ +2011-06-10 Andreas Kirschbaum + + * Fix collection sometimes creating broken daimonin.0 file. + 2011-05-22 Andreas Kirschbaum * Fix crash in --singlepng command-line option. Modified: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2011-06-10 19:23:03 UTC (rev 8893) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2011-06-10 19:24:21 UTC (rev 8894) @@ -30,10 +30,11 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.PrintStream; import java.io.Reader; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.nio.charset.Charset; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.gridarta.model.archetype.Archetype; @@ -121,40 +122,40 @@ try { final FileChannel outChannel = fos.getChannel(); try { - final PrintStream binFile = new PrintStream(fos); - try { - final int numOfFaceObjects = size(); - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); - int i = 0; - for (final FaceObject faceObject : this) { - final String face = faceObject.getFaceName(); - final String path = archFaceProvider.getFilename(face); + final int numOfFaceObjects = size(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); + final ByteBuffer byteBuffer = ByteBuffer.allocate(1024); + final Charset charset = Charset.forName("ISO-8859-1"); + int i = 0; + for (final FaceObject faceObject : this) { + final String face = faceObject.getFaceName(); + final String path = archFaceProvider.getFilename(face); + try { + final FileInputStream fin = new FileInputStream(path); try { - final FileInputStream fin = new FileInputStream(path); - try { - final FileChannel inChannel = fin.getChannel(); - final long imageSize = inChannel.size(); - binFile.format("IMAGE %d %d %s\n", i, imageSize, face); - inChannel.transferTo(0L, imageSize, outChannel); - } finally { - fin.close(); - } - } catch (final FileNotFoundException ignored) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); - return; - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); - return; + final FileChannel inChannel = fin.getChannel(); + final long imageSize = inChannel.size(); + byteBuffer.clear(); + byteBuffer.put(("IMAGE " + i + " " + imageSize + " " + face + "\n").getBytes(charset)); + byteBuffer.flip(); + outChannel.write(byteBuffer); + inChannel.transferTo(0L, imageSize, outChannel); + } finally { + fin.close(); } + } catch (final FileNotFoundException ignored) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); + return; + } catch (final IOException e) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); + return; + } - if (i++ % 100 == 0) { - progress.setValue(i); - } + if (i++ % 100 == 0) { + progress.setValue(i); } - progress.setValue(size()); // finished - } finally { - binFile.close(); } + progress.setValue(size()); // finished } finally { outChannel.close(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-10 19:50:57
|
Revision: 8895 http://gridarta.svn.sourceforge.net/gridarta/?rev=8895&view=rev Author: akirschbaum Date: 2011-06-10 19:50:50 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Move ErrorViewCollector creation from XMLSpellLoader to DefaultMainControl. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java Modified: trunk/model/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2011-06-10 19:24:21 UTC (rev 8894) +++ trunk/model/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2011-06-10 19:50:50 UTC (rev 8895) @@ -19,16 +19,12 @@ package net.sf.gridarta.model.spells; -import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; -import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; -import net.sf.gridarta.utils.IOUtils; import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -58,57 +54,50 @@ /** * Load an XML spell definitions file. - * @param errorView the error view for reporting errors - * @param baseDir the base directory of <code>filename</code> - * @param filename the file name of the spell definitions file + * @param errorViewCollector the error view collector for reporting errors + * @param url the URL of the spell definitions file * @param documentBuilder the Document Builder to use for parsing * @param spells the <code>Spells</code> instance to add the spells to */ - public static void load(@NotNull final ErrorView errorView, @NotNull final File baseDir, @NotNull final String filename, @NotNull final DocumentBuilder documentBuilder, @NotNull final Spells<NumberSpell> spells) { + public static void load(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final URL url, @NotNull final DocumentBuilder documentBuilder, @NotNull final Spells<NumberSpell> spells) { try { - final URL url = IOUtils.getResource(baseDir, filename); - final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); - try { - final Document doc = documentBuilder.parse(new InputSource(url.toString())); + final Document doc = documentBuilder.parse(new InputSource(url.toString())); - // retrieve the spell data from the xml - final Element root = doc.getDocumentElement(); - if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "root element 'spells' is missing"); - } else { - // initialize array with appropriate size - int numSpells = 0; - final Iterator<Element> it = new NodeListIterator<Element>(root, "spell"); - while (it.hasNext()) { - final Element spellElem = it.next(); - if (spellElem.getAttribute("id") == null) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'id'"); - } else if (spellElem.getAttribute("name") == null) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'name'"); - } else { - try { - // parse spell number and -name - spells.add(new NumberSpell(spellElem.getAttribute("name").trim(), Integer.parseInt(spellElem.getAttribute("id")))); - numSpells++; - } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "parsing error: spell id '" + spellElem.getAttribute("id") + "' is not an integer."); - } + // retrieve the spell data from the xml + final Element root = doc.getDocumentElement(); + if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "root element 'spells' is missing"); + } else { + // initialize array with appropriate size + int numSpells = 0; + final Iterator<Element> it = new NodeListIterator<Element>(root, "spell"); + while (it.hasNext()) { + final Element spellElem = it.next(); + if (spellElem.getAttribute("id") == null) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'id'"); + } else if (spellElem.getAttribute("name") == null) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'name'"); + } else { + try { + // parse spell number and -name + spells.add(new NumberSpell(spellElem.getAttribute("name").trim(), Integer.parseInt(spellElem.getAttribute("id")))); + numSpells++; + } catch (final NumberFormatException ignored) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "parsing error: spell id '" + spellElem.getAttribute("id") + "' is not an integer."); } } + } - // loading successful - log.info("Loaded " + numSpells + " defined spells from '" + url + "'"); - if (numSpells == 0) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "no content"); - } + // loading successful + log.info("Loaded " + numSpells + " defined spells from '" + url + "'"); + if (numSpells == 0) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "no content"); } - } catch (final SAXException ex) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "parsing error:" + ex.getMessage()); - } catch (final IOException ex) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, ex.getMessage()); } - } catch (final FileNotFoundException ex) { - errorView.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, filename + ": " + ex.getMessage()); + } catch (final SAXException ex) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "parsing error:" + ex.getMessage()); + } catch (final IOException ex) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, ex.getMessage()); } } Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-10 19:24:21 UTC (rev 8894) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-10 19:50:50 UTC (rev 8895) @@ -295,7 +295,13 @@ gameObjectSpells.sort(); } if (spellFile != null) { - XMLSpellLoader.load(errorView, globalSettings.getConfigurationDirectory(), spellFile, xmlHelper.getDocumentBuilder(), numberSpells); + try { + final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), spellFile); + final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); + XMLSpellLoader.load(errorViewCollector, url, xmlHelper.getDocumentBuilder(), numberSpells); + } catch (final FileNotFoundException ex) { + errorView.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, spellFile + ": " + ex.getMessage()); + } numberSpells.sort(); } final File scriptsFile = new File(globalSettings.getMapsDirectory(), scriptsDir); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-10 20:04:49
|
Revision: 8896 http://gridarta.svn.sourceforge.net/gridarta/?rev=8896&view=rev Author: akirschbaum Date: 2011-06-10 20:04:42 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Add XML file parse errors to error dialog box. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-06-10 19:50:50 UTC (rev 8895) +++ trunk/atrinik/ChangeLog 2011-06-10 20:04:42 UTC (rev 8896) @@ -1,5 +1,7 @@ 2011-06-10 Andreas Kirschbaum + * Add XML file parse errors to error dialog box. + * Fix collection sometimes creating broken atrinik.0 file. 2011-05-22 Andreas Kirschbaum Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-06-10 19:50:50 UTC (rev 8895) +++ trunk/crossfire/ChangeLog 2011-06-10 20:04:42 UTC (rev 8896) @@ -1,5 +1,7 @@ 2011-06-10 Andreas Kirschbaum + * Add XML file parse errors to error dialog box. + * Fix collection sometimes creating broken crossfire.0 file. 2011-05-22 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-06-10 19:50:50 UTC (rev 8895) +++ trunk/daimonin/ChangeLog 2011-06-10 20:04:42 UTC (rev 8896) @@ -1,5 +1,7 @@ 2011-06-10 Andreas Kirschbaum + * Add XML file parse errors to error dialog box. + * Fix collection sometimes creating broken daimonin.0 file. 2011-05-22 Andreas Kirschbaum Added: trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java 2011-06-10 20:04:42 UTC (rev 8896) @@ -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.errorview; + +import org.jetbrains.annotations.NotNull; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +/** + * An {@link ErrorHandler} that adds all reported problems to an {@link + * ErrorViewCollector} instance. + * @author Andreas Kirschbaum + */ +public class ErrorViewCollectorErrorHandler implements ErrorHandler { + + /** + * The {@link ErrorViewCollector} instance for adding messages. + */ + @NotNull + private final ErrorViewCollector errorViewCollector; + + /** + * The {@link ErrorViewCategory} to use when adding messages to {@link + * #errorViewCollector}. + */ + @NotNull + private final ErrorViewCategory errorViewCategory; + + /** + * Creates a new instance. + * @param errorViewCollector the error view collector instance for adding + * messages + * @param errorViewCategory the error view category to use when adding + * messages to <code>errorViewCollector</code> + */ + public ErrorViewCollectorErrorHandler(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final ErrorViewCategory errorViewCategory) { + this.errorViewCollector = errorViewCollector; + this.errorViewCategory = errorViewCategory; + } + + /** + * {@inheritDoc} + */ + @Override + public void warning(final SAXParseException exception) throws SAXException { + errorViewCollector.addWarning(errorViewCategory, exception.getMessage()); + } + + /** + * {@inheritDoc} + */ + @Override + public void error(final SAXParseException exception) throws SAXException { + errorViewCollector.addError(errorViewCategory, exception.getMessage()); + } + + /** + * {@inheritDoc} + */ + @Override + public void fatalError(final SAXParseException exception) throws SAXException { + errorViewCollector.addError(errorViewCategory, exception.getMessage()); + } + +} // class ErrorViewCollectorErrorHandler Property changes on: trunk/model/src/app/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-10 19:50:50 UTC (rev 8895) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-10 20:04:42 UTC (rev 8896) @@ -30,6 +30,7 @@ import java.util.regex.Pattern; import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; +import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.gui.archetypetype.ArchetypeTypeChecks; import net.sf.gridarta.gui.filter.FilterControl; @@ -57,6 +58,7 @@ import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; @@ -188,12 +190,18 @@ throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); - final GameObjectMatchersParser gameObjectMatchersParser = new GameObjectMatchersParser(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); + final DocumentBuilder documentBuilder = xmlHelper.getDocumentBuilder(); try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, url); try { - gameObjectMatchersParser.readGameObjectMatchers(url, gameObjectMatchers, gameObjectMatchersErrorViewCollector); + documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(gameObjectMatchersErrorViewCollector, ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID)); + try { + final GameObjectMatchersParser gameObjectMatchersParser = new GameObjectMatchersParser(documentBuilder, xmlHelper.getXPath()); + gameObjectMatchersParser.readGameObjectMatchers(url, gameObjectMatchers, gameObjectMatchersErrorViewCollector); + } finally { + documentBuilder.setErrorHandler(null); + } } catch (final IOException ex) { gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); } @@ -225,8 +233,13 @@ try { final InputStream inputStream = url.openStream(); try { - final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(new InputSource(inputStream)); - specialTreasureLists = TreasureListsParser.parseTreasureLists(specialTreasureListsDocument); + documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(treasureListsErrorViewCollector, ErrorViewCategory.TREASURES_FILE_INVALID)); + try { + final Document specialTreasureListsDocument = documentBuilder.parse(new InputSource(inputStream)); + specialTreasureLists = TreasureListsParser.parseTreasureLists(specialTreasureListsDocument); + } finally { + documentBuilder.setErrorHandler(null); + } } finally { inputStream.close(); } @@ -246,12 +259,17 @@ final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); - final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeSet, archetypeTypeParser); ArchetypeTypeList eventTypeSet = null; try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); final ErrorViewCollector typesErrorViewCollector = new ErrorViewCollector(errorView, url); - archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, new InputSource(url.toString())); + documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(typesErrorViewCollector, ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID)); + try { + final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(documentBuilder, archetypeTypeSet, archetypeTypeParser); + archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, new InputSource(url.toString())); + } finally { + documentBuilder.setErrorHandler(null); + } final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); if (eventTypeSetTmp == null) { typesErrorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "list 'list_event' does not exist"); @@ -298,7 +316,12 @@ try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), spellFile); final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); - XMLSpellLoader.load(errorViewCollector, url, xmlHelper.getDocumentBuilder(), numberSpells); + documentBuilder.setErrorHandler(new ErrorViewCollectorErrorHandler(errorViewCollector, ErrorViewCategory.SPELLS_FILE_INVALID)); + try { + XMLSpellLoader.load(errorViewCollector, url, xmlHelper.getDocumentBuilder(), numberSpells); + } finally { + documentBuilder.setErrorHandler(null); + } } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, spellFile + ": " + ex.getMessage()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-18 09:46:28
|
Revision: 8899 http://gridarta.svn.sourceforge.net/gridarta/?rev=8899&view=rev Author: akirschbaum Date: 2011-06-18 09:46:17 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Simplify annotation declarations. Modified Paths: -------------- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java trunk/model/src/app/net/sf/gridarta/model/face/CollectedFaceProvider.java trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java trunk/model/src/app/net/sf/gridarta/model/match/Operation.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/script/src/app/net/sf/gridarta/script/ScriptModelParser.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/gui/utils/GList.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java trunk/utils/src/app/net/sf/gridarta/utils/EventListenerList2.java trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java trunk/utils/src/test/net/sf/gridarta/utils/Size2DTest.java trunk/utils/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -164,7 +164,7 @@ */ @NotNull @Override - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -567,7 +567,7 @@ /** * {@inheritDoc} */ - @SuppressWarnings({ "FloatingPointEquality" }) + @SuppressWarnings("FloatingPointEquality") @Override public boolean equals(@Nullable final Object obj) { if (obj == this) { Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -120,7 +120,7 @@ */ @NotNull @Override - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") protected ArchetypeSet getArchetypeSet() { if (archetypeSet == null) { throw new IllegalStateException(); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -184,7 +184,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public R clone() { //noinspection OverriddenMethodCallDuringObjectConstruction final AbstractArchetype<G, A, R> clone = (AbstractArchetype<G, A, R>) super.clone(); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -165,7 +165,7 @@ * Sets the selected {@link ArchetypeChooserPanel}. * @param selectedPanel the selected panel */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public void setSelectedPanel(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { if (!panels.contains(selectedPanel)) { throw new IllegalArgumentException("selected panel " + selectedPanel.getName() + " is not part of the model"); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -164,7 +164,7 @@ * @throws MissingAttributeException if the element cannot be parsed */ @Nullable - @SuppressWarnings({ "FeatureEnvy" }) + @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 { final String description = parseText(attributeElement); final int inputLength = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_LENGTH, 0, typeName, errorViewCollector); Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -154,7 +154,7 @@ * @return the description */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public String getDescription() { final String result = description; return result == null ? "" : result.trim(); @@ -165,7 +165,7 @@ * @return the usage notes */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public String getUse() { final String result = use; return result == null ? "" : result.trim(); Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -214,7 +214,7 @@ * Sets the face name. * @param faceName the new face name */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") private void setFaceName(@NotNull final String faceName) { final String effectiveFaceName = getEffectiveFaceName(faceName); //Strings are interned @@ -694,7 +694,7 @@ */ @Override @NotNull - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public T clone() { //noinspection OverriddenMethodCallDuringObjectConstruction final AbstractBaseObject<G, A, R, T> clone = (AbstractBaseObject<G, A, R, T>) super.clone(); @@ -923,7 +923,7 @@ * Sets object animation <code>animation <var>animName</var></code>. * @param animName object animation <code>animation <var>animName</var></code> */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") private void setAnimName(@NotNull final String animName) { final String newAnimName = animName.length() > 0 ? animName.intern() : null; // Using == on these Strings is okay, they are both interned. @@ -970,7 +970,7 @@ /** * {@inheritDoc} */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") @Override public void setMulti(@NotNull final MultiArchData<G, A, R, T> multi) { this.multi = multi; Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -44,7 +44,7 @@ * @todo In case of MapSquares, this class is most likely bogus regarding * multi-part objects. This needs to be fixed. */ -@SuppressWarnings({ "ClassReferencesSubclass" }) +@SuppressWarnings("ClassReferencesSubclass") public abstract class GameObjectContainer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Cloneable, Iterable<G>, Serializable { /** @@ -592,7 +592,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") protected Object clone() { try { final GameObjectContainer<G, A, R> clone = (GameObjectContainer<G, A, R>) super.clone(); @@ -689,7 +689,7 @@ * {@inheritDoc} */ // previous can throw NoSuchElementException but InspectionGadgets doesn't know about that. - @SuppressWarnings({ "IteratorNextCanNotThrowNoSuchElementException" }) + @SuppressWarnings("IteratorNextCanNotThrowNoSuchElementException") @NotNull @Override public T next() { Modified: trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -97,7 +97,7 @@ * found */ @Nullable - @SuppressWarnings({ "TypeMayBeWeakened" }) + @SuppressWarnings("TypeMayBeWeakened") public G getExit(@NotNull final MapModel<G, A, R> mapModel, @Nullable final Point point) { if (point == null || !mapModel.getMapArchObject().isPointValid(point)) { return null; Modified: trunk/model/src/app/net/sf/gridarta/model/face/CollectedFaceProvider.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/CollectedFaceProvider.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/face/CollectedFaceProvider.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -38,7 +38,7 @@ * @todo Move parsing of the face files to this class, so the faces can be * easily reloaded while the application is running. */ -@SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" }) +@SuppressWarnings("IOResourceOpenedButNotSafelyClosed") public class CollectedFaceProvider extends AbstractFaceProvider { /** Modified: trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -107,7 +107,7 @@ filterConfig.setEnabled(enabled); filterConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); //Element does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Iterable<Element> it = (Iterable<Element>) value.getChildren("subfilter"); for (final Element filterElement : it) { final String name = filterElement.getChildTextTrim("name"); @@ -132,7 +132,7 @@ final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); filterConfig.setEnabled(enabled); //Element does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Iterable<Element> properties = (Iterable<Element>) value.getChildren("property"); for (final Element property : properties) { final String pName = property.getChildTextTrim("name"); Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -136,7 +136,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public G clone() { //noinspection OverriddenMethodCallDuringObjectConstruction final AbstractGameObject<G, A, R> clone = (AbstractGameObject<G, A, R>) super.clone(); Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -138,7 +138,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public G clone() { //noinspection OverriddenMethodCallDuringObjectConstruction final DefaultIsoGameObject<G, A, R> clone = (DefaultIsoGameObject<G, A, R>) super.clone(); Modified: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -325,7 +325,7 @@ * @noinspection unchecked */ @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public void load(@NotNull final ObjectInputStream objectInputStream) throws IOException { synchronized (sync) { final Map<V, Long> tmpTimestamps; Modified: trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -658,7 +658,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public A clone() { final AbstractMapArchObject<A> clone; try { Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -126,7 +126,7 @@ */ @NotNull @Override - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") protected MapSquare<G, A, R> clone() { final MapSquare<G, A, R> clone = (MapSquare<G, A, R>) super.clone(); return clone; Modified: trunk/model/src/app/net/sf/gridarta/model/match/Operation.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/Operation.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/match/Operation.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -23,7 +23,7 @@ * Operator. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({ "EnumeratedConstantNamingConvention" }) +@SuppressWarnings("EnumeratedConstantNamingConvention") public enum Operation { eq, Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -133,7 +133,7 @@ @Override public Enumeration<TreasureTreeNode> children() { //DefaultMutableTreeNode does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Enumeration<TreasureTreeNode> tmp = (Enumeration<TreasureTreeNode>) super.children(); return tmp; } Modified: trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -79,7 +79,7 @@ * @throws IllegalStateException if changed map squares have been recorded * before */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public void setSavedSquares(@NotNull final SavedSquares<G, A, R> savedSquares) { if (this.savedSquares != null) { throw new IllegalStateException(); @@ -94,7 +94,7 @@ * @throws IllegalStateException if no saved squares have been recorded */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public SavedSquares<G, A, R> getSavedSquares() { if (savedSquares == null) { throw new IllegalStateException(); Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -125,7 +125,7 @@ throw new NoSuchValidatorException("class " + args[0] + " has more than one public constructor"); } //Class.getConstructors() did return the wrong type - @SuppressWarnings({ "unchecked" }) final Constructor<? extends Validator<G, A, R>> constructor = (Constructor<? extends Validator<G, A, R>>) constructors[0]; + @SuppressWarnings("unchecked") final Constructor<? extends Validator<G, A, R>> constructor = (Constructor<? extends Validator<G, A, R>>) constructors[0]; final Class<?>[] constructorParameterTypes = constructor.getParameterTypes(); final Object[] constructorArguments = new Object[constructorParameterTypes.length]; int pos = 1; Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -205,7 +205,7 @@ */ @NotNull @Override - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> getArchetypeSet() { final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> result = archetypeSet; if (result == null) { Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -45,7 +45,7 @@ * Test for {@link DefaultMapModel}. * @author Andreas Kirschbaum */ -@SuppressWarnings({ "FeatureEnvy" }) +@SuppressWarnings("FeatureEnvy") // This is a test. It has feature envy by definition. public class DefaultMapModelTest { Modified: trunk/script/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/script/src/app/net/sf/gridarta/script/ScriptModelParser.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/script/src/app/net/sf/gridarta/script/ScriptModelParser.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -95,7 +95,7 @@ isScript = true; } else { //Element does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Iterable<Element> modes = mode.getChildren(); for (final Element modeChild : modes) { final boolean value = Boolean.valueOf(modeChild.getTextTrim()); @@ -113,7 +113,7 @@ scriptModel.setFilter(isFilter); scriptModel.setScript(isScript); //Element does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Collection<Element> parameters = node.getChildren("parameter"); if (parameters != null && !parameters.isEmpty()) { for (final Element parameter : parameters) { Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -278,7 +278,7 @@ @NotNull private ArchetypePanel<G, A, R> getArchetypePanel(final int index) { //JTabbedPane does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final ArchetypePanel<G, A, R> archetypePanel = (ArchetypePanel<G, A, R>) tabDesktop.getComponentAt(index); return archetypePanel; } Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -277,7 +277,7 @@ @Nullable private ArchetypeChooserFolder<G, A, R> getSelectedFolder() { //JComboBox does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final ArchetypeChooserFolder<G, A, R> selectedFolder = (ArchetypeChooserFolder<G, A, R>) folders.getSelectedItem(); return selectedFolder; } Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -64,7 +64,7 @@ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //DefaultListCellRenderer does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Connection<K> connection = (Connection<K>) value; sbForFormat.setLength(0); Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -61,7 +61,7 @@ * @return the key */ @NotNull - @SuppressWarnings({ "TypeMayBeWeakened" }) + @SuppressWarnings("TypeMayBeWeakened") public K getKey() { return key; } Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/View.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -211,7 +211,7 @@ final Collection<Connection<K>> result = new ArrayList<Connection<K>>(); for (final Object selection : connectionList.getSelectedValues()) { //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Connection<K> connection = (Connection<K>) selection; result.add(connection); } Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -84,7 +84,7 @@ * @return the menu item */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public JMenuItem getMenuItem() { assert menuItem != null; return menuItem; Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -134,7 +134,7 @@ * @return the row content */ @NotNull - @SuppressWarnings({ "TypeMayBeWeakened" }) + @SuppressWarnings("TypeMayBeWeakened") public R get(final int index) { return archetypes.get(sorting[index]); } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -174,7 +174,7 @@ * Updates the text and icon of {@link #preview}. * @param image the icon to set or <code>null</code> */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") private void setPreview(@Nullable final Image image) { preview.setIcon(image == null ? null : new ImageIcon(image)); preview.setText(null); Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -27,7 +27,7 @@ * Event Listener Adapter for {@link net.sf.gridarta.gui.map.event.MouseOpListener}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({ "NoopMethodInAbstractClass" }) +@SuppressWarnings("NoopMethodInAbstractClass") public abstract class MouseOpAdapter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MouseOpListener<G, A, R> { /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -61,7 +61,7 @@ * Sets the active map view. The map view will be moved to the front. * @param mapView the map view to activate */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public void setActiveMapView(@NotNull final MapView<G, A, R> mapView) { assert mapViewsList.contains(mapView); mapViewsList.remove(mapView); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -28,7 +28,7 @@ * Base class for tools. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({ "AbstractClassWithOnlyOneDirectInheritor" }) +@SuppressWarnings("AbstractClassWithOnlyOneDirectInheritor") public abstract class AbstractTool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MouseOpAdapter<G, A, R> implements Tool<G, A, R> { /** Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -151,7 +151,7 @@ * Adds a tool to this tool selector. * @param tool the tool to add */ - @SuppressWarnings({ "MethodOverloadsMethodOfSuperclass" }) + @SuppressWarnings("MethodOverloadsMethodOfSuperclass") public void add(@NotNull final Tool<G, A, R> tool) { add(tool, false); } Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -181,7 +181,7 @@ @Override public void internalFrameActivated(@NotNull final InternalFrameEvent e) { //InternalFrameEvent does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final MapView<G, A, R> mapView = (MapView<G, A, R>) e.getSource(); mapViewFocusGainedNotify(mapView); } @@ -196,7 +196,7 @@ @Override public void internalFrameClosing(@NotNull final InternalFrameEvent e) { //InternalFrameEvent does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final MapView<G, A, R> mapView = (MapView<G, A, R>) e.getInternalFrame(); mapViewsManager.closeMapView(mapView); } @@ -217,7 +217,7 @@ @Override public void internalFrameIconified(@NotNull final InternalFrameEvent e) { //InternalFrameEvent does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final MapView<G, A, R> mapView = (MapView<G, A, R>) e.getSource(); mapViewFocusLostNotify(mapView); } Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -159,7 +159,7 @@ * @param mapFolder the active map folder or <code>null</code> if no folder * should be active */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public synchronized void setActiveMapFolder(@NotNull final MapFolder<G, A, R> mapFolder) { if (activeMapFolder == mapFolder) { return; Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -160,7 +160,7 @@ @Override public void apply() { //JComboBox does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Enum<Proxy.Type> typeEnum = (Enum<Proxy.Type>) proxyType.getSelectedItem(); PREFERENCES.put(NET_PREFERENCES_KEY_TYPE, typeEnum.name()); PREFERENCES.put(NET_PREFERENCES_KEY_HOST, proxyHost.getText()); Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -160,7 +160,7 @@ public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Script<G, A, R> script = (Script<G, A, R>) scripts.getSelectedValue(); showScript(script); } @@ -190,7 +190,7 @@ @Override public void actionPerformed(final ActionEvent e) { //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Script<G, A, R> script = (Script<G, A, R>) scripts.getSelectedValue(); if (script == null) { return; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -59,7 +59,7 @@ public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { //JComboBox does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final Archetype<G, A, R> archetype = (Archetype<G, A, R>) value.getSelectedItem(); parameter.setValue(archetype); } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -77,7 +77,7 @@ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //DefaultListCellRenderer does not use type parameters - @SuppressWarnings({ "unchecked" }) GameObject<G, A, R> arch = (GameObject<G, A, R>) value; + @SuppressWarnings("unchecked") GameObject<G, A, R> arch = (GameObject<G, A, R>) value; // arch == null should not happen, but it *can* happen when the active // window gets changed by user and java is still blitting here Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -498,7 +498,7 @@ * @return the game object, or <code>null</code> if the index is invalid */ @Nullable - @SuppressWarnings({ "TypeMayBeWeakened" }) + @SuppressWarnings("TypeMayBeWeakened") G getListGameObject(final int index) { final int actualIndex = getValidIndex(index); if (actualIndex >= model.getSize()) { @@ -506,7 +506,7 @@ } //DefaultListModel does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final G gameObject = (G) model.getElementAt(actualIndex); return gameObject; } @@ -549,7 +549,7 @@ list.setSelectedIndex(actualIndex); } //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final G gameObject = (G) list.getSelectedValue(); selectedSquareModel.setSelectedGameObject(gameObject, actualIndex); } Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeDialog.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -259,7 +259,7 @@ * @return the key stroke or <code>null</code> */ @Nullable - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public KeyStroke getKeyStroke() { return keyStroke.getKeyStroke(); } Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -123,7 +123,7 @@ * Updates the current key stroke. * @param keyStroke the new key stroke */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") private void setKeyStroke(@NotNull final KeyStroke keyStroke) { if (this.keyStroke == keyStroke) { return; Modified: trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -176,7 +176,7 @@ /** * {@inheritDoc} */ - @SuppressWarnings({ "ChainOfInstanceofChecks" }) + @SuppressWarnings("ChainOfInstanceofChecks") @Override public void addLayoutComponent(@NotNull final Component comp, @Nullable final Object constraints) { if (constraints == null) { @@ -239,7 +239,7 @@ * {@inheritDoc} */ @Override - @SuppressWarnings({ "ObjectEquality" }) + @SuppressWarnings("ObjectEquality") public void removeLayoutComponent(@NotNull final Component comp) { synchronized (comp.getTreeLock()) { if (cC == comp) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/GList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -79,7 +79,7 @@ } //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final T element = (T) getModel().getElementAt(index); if (toolTipProvider == null) { @@ -94,7 +94,7 @@ @Override public T getSelectedValue() { //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") final T selectedValue = (T) super.getSelectedValue(); return selectedValue; } Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -323,7 +323,7 @@ * @return <code>true</code> if this version is newer than * <var>other</var>, otherwise <code>false</code> */ - @SuppressWarnings({ "ObjectEquality" }) + @SuppressWarnings("ObjectEquality") boolean isNewerThan(@NotNull final VersionInfo other) { return this != UNAVAILABLE && (other == UNAVAILABLE || timestamp.compareTo(other.timestamp) > 0); } Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -727,7 +727,7 @@ * Returns the document this text area is editing. */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public SyntaxDocument getDocument() { if (document == null) { throw new IllegalStateException(); Modified: trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -123,7 +123,7 @@ * recorded. * @param failure the failure reason */ - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") private void setFailure(@NotNull final String failure) { synchronized (sync) { stopped = true; Modified: trunk/utils/src/app/net/sf/gridarta/utils/EventListenerList2.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/EventListenerList2.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/app/net/sf/gridarta/utils/EventListenerList2.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -53,7 +53,7 @@ */ //Assume the constructor call has passed the right type; can't use Class<T> //here since class literals do not work for parametrized types. - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings("unchecked") public EventListenerList2(@NotNull final Class<? extends EventListener> t) { this.t = (Class<T>) t; } Modified: trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -76,7 +76,7 @@ * {@inheritDoc} First checks whether the file should be hidden, if not, * checks the other FileFilter. */ - @SuppressWarnings({ "ParameterNameDiffersFromOverriddenParameter" }) + @SuppressWarnings("ParameterNameDiffersFromOverriddenParameter") @Override public boolean accept(@NotNull final File pathName) { if (pathName.getName().startsWith(".")) { Modified: trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -193,7 +193,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapCursorIcon() { if (mapCursorIcon == null) { mapCursorIcon = guiUtils.getResourceIcon(SQUARE_CURSOR); @@ -202,7 +202,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getEmptySquareIcon() { if (emptySquareIcon == null) { emptySquareIcon = guiUtils.getResourceIcon(SQUARE_EMPTY); @@ -211,7 +211,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getUnknownSquareIcon() { if (unknownSquareIcon == null) { unknownSquareIcon = guiUtils.getResourceIcon(SQUARE_UNKNOWN); @@ -220,7 +220,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; @@ -235,7 +235,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getNoFaceSquareIcon() { if (noFaceSquareIcon == null) { noFaceSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_FACE); @@ -244,7 +244,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getNoArchSquareIcon() { if (noArchSquareIcon == null) { noArchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); @@ -253,7 +253,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIcon() { if (mapSelIcon == null) { mapSelIcon = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE); @@ -262,7 +262,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconNorth() { if (mapSelIconNorth == null) { mapSelIconNorth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_NORTH); @@ -271,7 +271,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconEast() { if (mapSelIconEast == null) { mapSelIconEast = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_EAST); @@ -280,7 +280,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconSouth() { if (mapSelIconSouth == null) { mapSelIconSouth = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_SOUTH); @@ -289,7 +289,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapSelectedIconWest() { if (mapSelIconWest == null) { mapSelIconWest = guiUtils.getResourceIcon(SQUARE_SELECTED_SQUARE_WEST); @@ -298,7 +298,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getMapPreSelectedIcon() { if (mapPreSelIcon == null) { mapPreSelIcon = guiUtils.getResourceIcon(SQUARE_PRE_SELECTED_SQUARE); @@ -311,7 +311,7 @@ * @return the image */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Image getDefaultIcon() { if (defaultIcon == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_ICON); @@ -326,7 +326,7 @@ * @return the image */ @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Image getDefaultPreview() { if (defaultPreview == null) { final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_PREVIEW); @@ -337,7 +337,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getTreasureListIcon() { if (treasureListIcon == null) { treasureListIcon = guiUtils.getResourceIcon(TREASURE_LIST); @@ -346,7 +346,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getTreasureOneListIcon() { if (treasureOneListIcon == null) { treasureOneListIcon = guiUtils.getResourceIcon(TREASUREONE_LIST); @@ -355,7 +355,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getTreasureYesIcon() { if (treasureYesIcon == null) { treasureYesIcon = guiUtils.getResourceIcon(TREASURE_YES); @@ -364,7 +364,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getTreasureNoIcon() { if (treasureNoIcon == null) { treasureNoIcon = guiUtils.getResourceIcon(TREASURE_NO); @@ -373,7 +373,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getCloseTabSmallIcon() { if (closeTabSmallIcon == null) { closeTabSmallIcon = guiUtils.getResourceIcon(CLOSE_TAB_SMALL_ICON); @@ -382,7 +382,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getAutoRunSmallIcon() { if (autoRunSmallIcon == null) { autoRunSmallIcon = guiUtils.getResourceIcon(AUTO_RUN_SMALL_ICON); @@ -391,7 +391,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getFilterSmallIcon() { if (filterSmallIcon == null) { filterSmallIcon = guiUtils.getResourceIcon(FILTER_SMALL_ICON); @@ -400,7 +400,7 @@ } @NotNull - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public Icon getRunPluginSmallIcon() { if (runPluginSmallIcon == null) { runPluginSmallIcon = guiUtils.getResourceIcon(RUN_PLUGIN_SMALL_ICON); @@ -413,7 +413,7 @@ * @return the icon or <code>null</code> if none is available */ @Nullable - @SuppressWarnings({ "NullableProblems" }) + @SuppressWarnings("NullableProblems") public ImageIcon getAppIcon() { if (appIcon == null) { appIcon = guiUtils.getResourceIcon(APP_ICON); Modified: trunk/utils/src/test/net/sf/gridarta/utils/Size2DTest.java =================================================================== --- trunk/utils/src/test/net/sf/gridarta/utils/Size2DTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/test/net/sf/gridarta/utils/Size2DTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -26,7 +26,7 @@ * Test for {@link Size2D}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({ "FeatureEnvy" }) +@SuppressWarnings("FeatureEnvy") // This is a test. It has feature envy by definition. public class Size2DTest { Modified: trunk/utils/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java =================================================================== --- trunk/utils/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java 2011-06-13 20:39:59 UTC (rev 8898) +++ trunk/utils/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java 2011-06-18 09:46:17 UTC (rev 8899) @@ -26,7 +26,7 @@ * Test for {@link WrappingStringBuilder}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({ "FeatureEnvy" }) +@SuppressWarnings("FeatureEnvy") public class WrappingStringBuilderTest { /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-18 14:21:57
|
Revision: 8901 http://gridarta.svn.sourceforge.net/gridarta/?rev=8901&view=rev Author: akirschbaum Date: 2011-06-18 14:21:48 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Use Patterns where possible. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsHelper.java trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java trunk/preferences/src/app/net/sf/gridarta/preferences/Storage.java trunk/script/src/app/net/sf/gridarta/script/ScriptExecutor.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolder.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsManager.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java trunk/utils/src/app/net/sf/gridarta/utils/StringUtils.java trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -111,7 +111,7 @@ } facings = tmpFacings; boolean first = true; - for (final String line : animList.split("\n")) { + for (final String line : PATTERN_END_OF_LINE.split(animList, 0)) { if (first && line.startsWith("facings ")) { first = false; } else { Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -112,7 +112,7 @@ throw new IllegalArgumentException(); } - final String[] tmp = line.split(" +", 2); + final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); final String key = tmp[0]; if (tmp.length < 2) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName() + ": invalid attribute definition: " + line); @@ -143,7 +143,7 @@ final StringBuilder sb = new StringBuilder(); archetype = null; for (final String attribute : StringUtils.PATTERN_END_OF_LINE.split(result.getObjectText())) { - final String[] tmp = attribute.split(" +", 2); + final String[] tmp = StringUtils.PATTERN_SPACES.split(attribute, 2); if (tmp.length == 2 && !attributes.containsKey(tmp[0])) { sb.append(attribute).append('\n'); } Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -210,7 +211,7 @@ panel = panelName; folder = folderName; } else { - final String[] names = editorFolder.split("/", 3); + final String[] names = StringUtils.PATTERN_SLASH.split(editorFolder, 3); panel = names[0]; folder = names.length >= 2 ? names[1] : names[0]; } Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetypetype; +import java.util.regex.Pattern; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import org.jetbrains.annotations.NotNull; @@ -34,6 +35,12 @@ public class ArchetypeAttributeParser { /** + * Pattern to match line breaks in attribute text. + */ + @NotNull + private static final Pattern LINE_BREAK = Pattern.compile("\\s*\n\\s*"); + + /** * The name of the "attribute" element. */ @NotNull @@ -261,11 +268,7 @@ @NotNull private static String parseText(@NotNull final Node attributeElement) { final String tmp = attributeElement.getTextContent().trim(); - if (tmp.startsWith("<html>")) { - return tmp.replaceAll("\\s*\n\\s*", " "); - } else { - return tmp.replaceAll("\\s*\n\\s*", "\n"); - } + return LINE_BREAK.matcher(tmp).replaceAll(tmp.startsWith("<html>") ? " " : "\n"); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import net.sf.gridarta.utils.NumberUtils; +import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.utils.WrappingStringBuilder; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -84,12 +84,6 @@ private final Map<Integer, String> names = new HashMap<Integer, String>(); /** - * A pattern that matches one or more spaces. - */ - @NotNull - private static final Pattern PATTERN_SPACES = Pattern.compile(" +"); - - /** * Constructor of a bitmask from XML element. * @param isNamed whether this attribute's bitmask values are to be encoded * as strings in external representation @@ -208,7 +202,7 @@ } int result = 0; - for (final String word : PATTERN_SPACES.split(encodedValue, 0)) { + for (final String word : StringUtils.PATTERN_SPACES.split(encodedValue, 0)) { final boolean negated; final String name; if (word.startsWith("-")) { Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -1143,8 +1143,8 @@ } else { final int endPos = pos - 1; assert startPos <= endPos; - final String spec = new String(chars, startPos, endPos - startPos); - final String[] tmp = spec.split(":", 2); + final CharSequence spec = new String(chars, startPos, endPos - startPos); + final String[] tmp = StringUtils.PATTERN_COLON.split(spec, 2); if (tmp.length < 2) { if (tmp[0].equals("NAME")) { sb.append(getBestName()); Modified: trunk/model/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.MissingResourceException; import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -57,7 +58,7 @@ */ public DefaultConfigSourceFactory() { final String configSourceClassNames = ActionBuilderUtils.getString(ACTION_BUILDER, CONFIG_SOURCES_KEY); - for (final String configSourceClassName : configSourceClassNames.split(" ", -1)) { + for (final String configSourceClassName : StringUtils.PATTERN_SPACE.split(configSourceClassNames, -1)) { final Class<?> configSourceClass; try { configSourceClass = Class.forName(configSourceClassName); Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -32,6 +32,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.StringUtils; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -115,7 +116,7 @@ errorViewCollector.addWarning(ErrorViewCategory.ARCHDEF_ENTRY_INVALID, lnr.getLineNumber(), "too many entries"); break; } - final String[] numbers = line.split(" "); + final String[] numbers = StringUtils.PATTERN_SPACE.split(line); if (numbers.length != 2) { errorViewCollector.addError(ErrorViewCategory.ARCHDEF_ENTRY_INVALID, lnr.getLineNumber(), "syntax error"); hasErrors = true; Modified: trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.regex.Pattern; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.baseobject.BaseObject; @@ -55,11 +54,6 @@ private static final Category log = Logger.getLogger(AbstractGameObjectParser.class); /** - * Pattern to match spaces. - */ - private static final Pattern PATTERN_SPACES = Pattern.compile(" +"); - - /** * The game object factory for creating new game object instances. */ @NotNull @@ -245,7 +239,7 @@ final CharSequence objText = gameObject.getObjectText(); if (objText.length() != 0) { for (final String aTmp : StringUtils.PATTERN_END_OF_LINE.split(objText, 0)) { - final String[] line = PATTERN_SPACES.split(aTmp, 2); + final String[] line = StringUtils.PATTERN_SPACES.split(aTmp, 2); if (line.length == 2) { fields.put(line[0] + " ", line[1]); } else { Modified: trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -21,7 +21,9 @@ import java.io.File; import java.io.IOException; +import java.util.regex.Pattern; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -34,6 +36,19 @@ */ public class PathManager { + /** + * A {@link Pattern} that matches redundant directory parts like "dir/../". + */ + @NotNull + private static final Pattern PATTERN_REDUNDANT = Pattern.compile("[^/]+/\\.\\./"); + + /** + * A {@link Pattern} that matches redundant directory separators. + */ + @NotNull + private static final Pattern PATTERN_SLASHES = Pattern.compile("//*"); + + // NOTE: There are certainly faster algorithms. But these methods are rarely used. /** @@ -134,7 +149,7 @@ String work2; do { work2 = work; - work = work2.replaceAll("[^/]+/\\.\\./", ""); + work = PATTERN_REDUNDANT.matcher(work2).replaceAll(""); } while (!work2.equals(work)); return work; } @@ -216,11 +231,11 @@ * @return path */ @NotNull - public static String path(@NotNull final String str) { - String path = str.replaceAll("\\\\", "/"); + public static String path(@NotNull final CharSequence str) { + String path = StringUtils.PATTERN_BACKSLASH.matcher(str).replaceAll("/"); path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; path = path.startsWith("file:") ? path.substring("file:".length()) : path; - path = path.replaceAll("//*", "/"); + path = PATTERN_SLASHES.matcher(path).replaceAll("/"); return path; } @@ -230,7 +245,7 @@ * @return the absolute path */ @NotNull - public static String getAbsolutePath(@NotNull final String path) { + public static String getAbsolutePath(@NotNull final CharSequence path) { return relativeToAbsolute(System.getProperty("user.dir") + "/dummy", path(path)); } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -316,7 +316,7 @@ } final String stderrOutput = stderr.getOutput(); if (!stderrOutput.isEmpty()) { - errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, stderrOutput.replaceAll("\n", "<br>"))); + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, StringUtils.PATTERN_NEWLINE.matcher(stderrOutput).replaceAll("<br>"))); return false; } return true; Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -183,7 +183,7 @@ } else if (classValidator == CustomTypeChecker.class) { final CustomTypeChecker<?, ?, ?> customTypeChecker = (CustomTypeChecker<?, ?, ?>) validator; do { - final String[] tmp = args[pos].split(",", -1); + final String[] tmp = StringUtils.PATTERN_COMMA.split(args[pos], -1); if (tmp.length != 2 && tmp.length != 3) { throw new NoSuchValidatorException("invalid from,to or from,to,env type: " + args[pos]); } @@ -215,7 +215,7 @@ } else if (classValidator == SlayingChecker.class) { final SlayingChecker<?, ?, ?> slayingChecker = (SlayingChecker<?, ?, ?>) validator; do { - final String[] tmp = args[pos].split(",", 2); + final String[] tmp = StringUtils.PATTERN_COMMA.split(args[pos], 2); if (tmp.length != 2) { throw new NoSuchValidatorException("invalid matcher,pattern: " + args[pos]); } @@ -239,8 +239,8 @@ * incorrect */ @NotNull - private static Integer[] createIntegerArray(@NotNull final String arg) throws NoSuchValidatorException { - final String[] tmp = arg.split(",", -1); + private static Integer[] createIntegerArray(@NotNull final CharSequence arg) throws NoSuchValidatorException { + final String[] tmp = StringUtils.PATTERN_COMMA.split(arg, -1); final Integer[] result = new Integer[tmp.length]; for (int i = 0; i < tmp.length; i++) { try { Modified: trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsHelper.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsHelper.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsHelper.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -35,6 +36,12 @@ public class AutojoinListsHelper { /** + * A {@link Pattern} that matches alternative archetypes. + */ + @NotNull + private static final Pattern ALTERNATIVES_PATTERN = Pattern.compile("\\|"); + + /** * The {@link TestMapModelCreator} instance. */ @NotNull @@ -73,7 +80,7 @@ for (final String archetypeNameList : archetypeNames) { final List<TestArchetype> archetypeList = new ArrayList<TestArchetype>(); if (!archetypeNameList.isEmpty()) { - for (final String archetypeName : archetypeNameList.split("\\|", -1)) { + for (final String archetypeName : ALTERNATIVES_PATTERN.split(archetypeNameList, -1)) { archetypeList.add(mapModelCreator.getArchetype(archetypeName)); } } Modified: trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -32,6 +32,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.settings.TestGlobalSettings; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; @@ -99,7 +100,7 @@ @Nullable File directoryToDelete = mapsDirectory; try { for (final String spec : specs) { - final String[] tmp = spec.split(":", 2); + final String[] tmp = StringUtils.PATTERN_COLON.split(spec, 2); if (tmp.length != 2) { throw new IllegalArgumentException(); } Modified: trunk/preferences/src/app/net/sf/gridarta/preferences/Storage.java =================================================================== --- trunk/preferences/src/app/net/sf/gridarta/preferences/Storage.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/preferences/src/app/net/sf/gridarta/preferences/Storage.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -48,6 +48,12 @@ public class Storage { /** + * The pattern that matches a single equal sign ("="). + */ + @NotNull + public static final Pattern PATTERN_EQUAL = Pattern.compile("="); + + /** * The Logger for printing log messages. */ private static final Category log = Logger.getLogger(Storage.class); @@ -313,7 +319,7 @@ continue; } - final String[] tmp = line.split("=", 2); + final String[] tmp = PATTERN_EQUAL.split(line, 2); if (tmp.length != 2) { log.warn(file + ":" + lnr.getLineNumber() + ": syntax error"); continue; Modified: trunk/script/src/app/net/sf/gridarta/script/ScriptExecutor.java =================================================================== --- trunk/script/src/app/net/sf/gridarta/script/ScriptExecutor.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/script/src/app/net/sf/gridarta/script/ScriptExecutor.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -78,7 +79,7 @@ final Script<G, A, R> clonedScript = modelTemplate.cloneScript(); for (final String param : params) { - final String[] tmp = param.split("=", 2); + final String[] tmp = StringUtils.PATTERN_EQUAL.split(param, 2); if (tmp.length != 2) { throw new ScriptExecException("syntax error: " + param); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -20,7 +20,9 @@ package net.sf.gridarta.gui.map.mapactions; import java.awt.Point; +import java.util.regex.Pattern; import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,6 +34,12 @@ public class MapLocation { /** + * The {@link Pattern} that matches end of lines in random map parameters. + */ + @NotNull + private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+"); + + /** * The map path. */ @NotNull @@ -140,9 +148,9 @@ return null; } - final String[] lines = msg.split("[\r\n]+"); + final String[] lines = PATTERN_END_OF_LINE.split(msg); for (final String line : lines) { - final String[] tmp = line.split(" +", 2); + final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); if (tmp.length == 2 && tmp[0].equals(parameterName)) { return tmp[1]; } Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.validation.errors.ValidationError; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -107,7 +108,7 @@ @Nullable public String finish() { - return empty ? null : sb.toString().replaceAll("\n", "<br>"); + return empty ? null : StringUtils.PATTERN_NEWLINE.matcher(sb.toString()).replaceAll("<br>"); } /** Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFile.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; 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; @@ -44,6 +45,12 @@ public class MapFile<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** + * The {@link Pattern} that matches valid pickmap names. + */ + @NotNull + private static final Pattern PATTERN_VALID_PICKMAP_NAME = Pattern.compile("[-a-zA-Z_+ 0-9,]+"); + + /** * The folder this pickmap is part of. */ @NotNull @@ -120,8 +127,8 @@ * @param name the name to check * @return whether the name is valid */ - public static boolean isValidPickmapName(@NotNull final String name) { - return name.matches("[-a-zA-Z_+ 0-9,]+"); + public static boolean isValidPickmapName(@NotNull final CharSequence name) { + return PATTERN_VALID_PICKMAP_NAME.matcher(name).matches(); } /** Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolder.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolder.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.regex.Pattern; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -45,6 +46,12 @@ public class MapFolder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<MapFile<G, A, R>> { /** + * The {@link Pattern} that matches valid map folder names. + */ + @NotNull + private static final Pattern PATTERN_VALID_MAP_FOLDER_NAME = Pattern.compile("[-a-zA-Z_+ 0-9,]+"); + + /** * The registered event listeners. */ private final EventListenerList2<MapFolderListener<G, A, R>> listeners = new EventListenerList2<MapFolderListener<G, A, R>>(MapFolderListener.class); @@ -96,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 : !name.matches("[-a-zA-Z_+ 0-9,]+")) { + if (parent == null ? name.length() > 0 : !PATTERN_VALID_MAP_FOLDER_NAME.matcher(name).matches()) { throw new InvalidNameException(name); } Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -30,6 +30,7 @@ import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; +import net.sf.gridarta.utils.StringUtils; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -210,7 +211,7 @@ */ @NotNull public TreePath addMapMenuEntry(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { - final String[] paths = directory.split("/"); + final String[] paths = StringUtils.PATTERN_SLASH.split(directory); DefaultMutableTreeNode dir2 = root; for (final String path : paths) { if (!path.isEmpty()) { Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsDialog.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -55,6 +55,7 @@ import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.ActionUtils; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -103,7 +104,7 @@ * The {@link Pattern} to split a category into sub-categories. */ @NotNull - private static final Pattern PATTERN_SUB_CATEGORIES = Pattern.compile("/"); + private static final Pattern PATTERN_SUB_CATEGORIES = StringUtils.PATTERN_SLASH; /** * The {@link JButton} for ok. Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsManager.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/ShortcutsManager.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -37,6 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.ActionUtils; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.DummyAction; import org.jetbrains.annotations.NotNull; @@ -99,7 +100,7 @@ public ShortcutsManager(@NotNull final ActionBuilder actionBuilder) { this.actionBuilder = actionBuilder; - ignoreActions.addAll(Arrays.asList(ActionBuilderUtils.getString(actionBuilder, "shortcutsIgnoreActions").split(" +"))); + ignoreActions.addAll(Arrays.asList(StringUtils.PATTERN_SPACES.split(ActionBuilderUtils.getString(actionBuilder, "shortcutsIgnoreActions"), 0))); for (final Action action : this) { final Object acceleratorKey = action.getValue(Action.ACCELERATOR_KEY); Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -27,7 +27,6 @@ import java.util.Collections; import java.util.Map; import java.util.MissingResourceException; -import java.util.regex.Pattern; import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import javax.xml.parsers.DocumentBuilder; @@ -107,6 +106,7 @@ import net.sf.gridarta.utils.CommonConstants; import net.sf.gridarta.utils.GuiFileFilters; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.utils.XmlHelper; import net.sf.japi.swing.action.ActionBuilder; @@ -294,10 +294,9 @@ } configSource.read(globalSettings, resources, errorView); for (final R archetype : archetypeSet.getArchetypes()) { - final Pattern pattern = Pattern.compile("/"); final CharSequence editorFolder = archetype.getEditorFolder(); if (editorFolder != null && !editorFolder.equals(GameObject.EDITOR_FOLDER_INTERN)) { - final String[] tmp = pattern.split(editorFolder, 2); + final String[] tmp = StringUtils.PATTERN_SLASH.split(editorFolder, 2); if (tmp.length == 2) { final String panelName = tmp[0]; final String folderName = tmp[1]; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -27,6 +27,7 @@ import java.util.regex.Pattern; import javax.swing.text.Segment; import net.sf.gridarta.textedit.textarea.Token; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -128,7 +129,7 @@ while (it.hasNext()) { final int paramLength = it.next(); - final String[] tmp = new String(array, offset2, paramLength).split("=", 2); + final String[] tmp = StringUtils.PATTERN_EQUAL.split(new String(array, offset2, paramLength), 2); if (tmp.length == 2) { final String param = tmp[0]; final CharSequence arg = tmp[1]; Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringUtils.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringUtils.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -54,6 +54,54 @@ public static final Pattern PATTERN_END_OF_LINE = Pattern.compile("\\s*\n"); /** + * The pattern that matches a single space. + */ + @NotNull + public static final Pattern PATTERN_SPACE = Pattern.compile(" "); + + /** + * The pattern that matches a non-empty sequence of spaces. + */ + @NotNull + public static final Pattern PATTERN_SPACES = Pattern.compile(" +"); + + /** + * The pattern that matches a single slash ("/"). + */ + @NotNull + public static final Pattern PATTERN_SLASH = Pattern.compile("/"); + + /** + * The pattern that matches a single backslash ("\"). + */ + @NotNull + public static final Pattern PATTERN_BACKSLASH = Pattern.compile("\\\\"); + + /** + * The pattern that matches a single colon (":"). + */ + @NotNull + public static final Pattern PATTERN_COLON = Pattern.compile(":"); + + /** + * The pattern that matches a single comma (","). + */ + @NotNull + public static final Pattern PATTERN_COMMA = Pattern.compile(","); + + /** + * The pattern that matches a single equal sign ("="). + */ + @NotNull + public static final Pattern PATTERN_EQUAL = Pattern.compile("="); + + /** + * The pattern that matches a single newline ("\n"). + */ + @NotNull + public static final Pattern PATTERN_NEWLINE = Pattern.compile("\n"); + + /** * Private constructor to prevent instantiation. */ private StringUtils() { Modified: trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -24,11 +24,13 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.util.regex.Pattern; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -41,6 +43,12 @@ public class XmlHelper { /** + * The {@link Pattern} for matching the directory part of a system ID. + */ + @NotNull + private static final Pattern PATTERN_DIRECTORY_PART = Pattern.compile(".*/"); + + /** * DocumentBuilder. */ private final DocumentBuilder documentBuilder; @@ -102,7 +110,7 @@ } InputSource inputSource = null; - final URL url = IOUtils.getResource(new File("system/dtd"), systemId.replaceAll(".*/", "")); + final URL url = IOUtils.getResource(new File("system/dtd"), PATTERN_DIRECTORY_PART.matcher(systemId).replaceAll("")); final InputStream inputStream = url.openStream(); try { final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); Modified: trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java =================================================================== --- trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java 2011-06-18 10:49:28 UTC (rev 8900) +++ trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java 2011-06-18 14:21:48 UTC (rev 8901) @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.Map; import java.util.ResourceBundle; +import java.util.regex.Pattern; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.util.IteratorEnumeration; @@ -38,6 +39,12 @@ public class TestActionBuilder { /** + * The {@link Pattern} for matching validator keys for default values. + */ + @NotNull + private static final Pattern PATTERN_DEFAULT_KEY = Pattern.compile("Validator\\..*\\.default"); + + /** * Private constructor to prevent instantiation. */ private TestActionBuilder() { @@ -66,7 +73,7 @@ } final Object object; - if (key.matches("Validator\\..*\\.default")) { + if (PATTERN_DEFAULT_KEY.matcher(key).matches()) { object = "true"; } else { return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-18 14:39:24
|
Revision: 8903 http://gridarta.svn.sourceforge.net/gridarta/?rev=8903&view=rev Author: akirschbaum Date: 2011-06-18 14:39:17 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Move module files into module directories. Modified Paths: -------------- trunk/gridarta.ipr Added Paths: ----------- trunk/atrinik/atrinik.iml trunk/crossfire/crossfire.iml trunk/daimonin/daimonin.iml trunk/model/model.iml trunk/preferences/preferences.iml trunk/script/script.iml trunk/textedit/textedit.iml trunk/utils/utils.iml Removed Paths: ------------- trunk/atrinik.iml trunk/crossfire.iml trunk/daimonin.iml trunk/model.iml trunk/preferences.iml trunk/script.iml trunk/textedit.iml trunk/utils.iml Copied: trunk/atrinik/atrinik.iml (from rev 8901, trunk/atrinik.iml) =================================================================== --- trunk/atrinik/atrinik.iml (rev 0) +++ trunk/atrinik/atrinik.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/resource" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/class" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="gridarta" /> + <orderEntry type="module" module-name="model" /> + <orderEntry type="module" module-name="script" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-commands-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-misc-trunk-1398.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-prefs-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-tod-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-util-trunk-1410.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/atrinik.iml =================================================================== --- trunk/atrinik.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/atrinik.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,100 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/atrinik"> - <sourceFolder url="file://$MODULE_DIR$/atrinik/resource" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/atrinik/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/atrinik/src/test" isTestSource="true" /> - <excludeFolder url="file://$MODULE_DIR$/atrinik/class" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="gridarta" /> - <orderEntry type="module" module-name="model" /> - <orderEntry type="module" module-name="script" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-commands-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc-trunk-1398.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-prefs-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-tod-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/crossfire/crossfire.iml (from rev 8901, trunk/crossfire.iml) =================================================================== --- trunk/crossfire/crossfire.iml (rev 0) +++ trunk/crossfire/crossfire.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/resource" isTestSource="false" /> + <excludeFolder url="file://$MODULE_DIR$/class" /> + <excludeFolder url="file://$MODULE_DIR$/classes" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="gridarta" /> + <orderEntry type="module" module-name="model" /> + <orderEntry type="module" module-name="script" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-commands-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-core-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-util-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-misc-trunk-1398.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-prefs-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-tod-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-util-trunk-1410.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/java-getopt-1.0.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/jdom.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/crossfire.iml =================================================================== --- trunk/crossfire.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/crossfire.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/crossfire"> - <sourceFolder url="file://$MODULE_DIR$/crossfire/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/crossfire/src/test" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/crossfire/resource" isTestSource="false" /> - <excludeFolder url="file://$MODULE_DIR$/crossfire/class" /> - <excludeFolder url="file://$MODULE_DIR$/crossfire/classes" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="gridarta" /> - <orderEntry type="module" module-name="model" /> - <orderEntry type="module" module-name="script" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-commands-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-core-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-util-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc-trunk-1398.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-prefs-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-tod-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/java-getopt-1.0.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jdom.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/daimonin/daimonin.iml (from rev 8901, trunk/daimonin.iml) =================================================================== --- trunk/daimonin/daimonin.iml (rev 0) +++ trunk/daimonin/daimonin.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/resource" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/class" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="gridarta" /> + <orderEntry type="module" module-name="model" /> + <orderEntry type="module" module-name="script" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-commands-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-misc-trunk-1398.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-prefs-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-tod-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-util-trunk-1410.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/daimonin.iml =================================================================== --- trunk/daimonin.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/daimonin.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,100 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/daimonin"> - <sourceFolder url="file://$MODULE_DIR$/daimonin/resource" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/daimonin/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/daimonin/src/test" isTestSource="true" /> - <excludeFolder url="file://$MODULE_DIR$/daimonin/class" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="gridarta" /> - <orderEntry type="module" module-name="model" /> - <orderEntry type="module" module-name="script" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-commands-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc-trunk-1398.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-prefs-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-tod-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/gridarta.ipr 2011-06-18 14:39:17 UTC (rev 8903) @@ -2155,15 +2155,15 @@ </component> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/atrinik.iml" filepath="$PROJECT_DIR$/atrinik.iml" /> - <module fileurl="file://$PROJECT_DIR$/crossfire.iml" filepath="$PROJECT_DIR$/crossfire.iml" /> - <module fileurl="file://$PROJECT_DIR$/daimonin.iml" filepath="$PROJECT_DIR$/daimonin.iml" /> + <module fileurl="file://$PROJECT_DIR$/atrinik/atrinik.iml" filepath="$PROJECT_DIR$/atrinik/atrinik.iml" /> + <module fileurl="file://$PROJECT_DIR$/crossfire/crossfire.iml" filepath="$PROJECT_DIR$/crossfire/crossfire.iml" /> + <module fileurl="file://$PROJECT_DIR$/daimonin/daimonin.iml" filepath="$PROJECT_DIR$/daimonin/daimonin.iml" /> <module fileurl="file://$PROJECT_DIR$/gridarta.iml" filepath="$PROJECT_DIR$/gridarta.iml" /> - <module fileurl="file://$PROJECT_DIR$/model.iml" filepath="$PROJECT_DIR$/model.iml" /> - <module fileurl="file://$PROJECT_DIR$/preferences.iml" filepath="$PROJECT_DIR$/preferences.iml" /> - <module fileurl="file://$PROJECT_DIR$/script.iml" filepath="$PROJECT_DIR$/script.iml" /> - <module fileurl="file://$PROJECT_DIR$/textedit.iml" filepath="$PROJECT_DIR$/textedit.iml" /> - <module fileurl="file://$PROJECT_DIR$/utils.iml" filepath="$PROJECT_DIR$/utils.iml" /> + <module fileurl="file://$PROJECT_DIR$/model/model.iml" filepath="$PROJECT_DIR$/model/model.iml" /> + <module fileurl="file://$PROJECT_DIR$/preferences/preferences.iml" filepath="$PROJECT_DIR$/preferences/preferences.iml" /> + <module fileurl="file://$PROJECT_DIR$/script/script.iml" filepath="$PROJECT_DIR$/script/script.iml" /> + <module fileurl="file://$PROJECT_DIR$/textedit/textedit.iml" filepath="$PROJECT_DIR$/textedit/textedit.iml" /> + <module fileurl="file://$PROJECT_DIR$/utils/utils.iml" filepath="$PROJECT_DIR$/utils/utils.iml" /> </modules> </component> <component name="ProjectResources"> Copied: trunk/model/model.iml (from rev 8901, trunk/model.iml) =================================================================== --- trunk/model/model.iml (rev 0) +++ trunk/model/model.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-misc-trunk-1398.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-util-trunk-1410.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-xml-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/jdom.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/model.iml =================================================================== --- trunk/model.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/model.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,86 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/model"> - <sourceFolder url="file://$MODULE_DIR$/model/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/model/src/test" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc-trunk-1398.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-xml-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jdom.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/preferences/preferences.iml (from rev 8901, trunk/preferences.iml) =================================================================== --- trunk/preferences/preferences.iml (rev 0) +++ trunk/preferences/preferences.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/preferences.iml =================================================================== --- trunk/preferences.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/preferences.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <content url="file://$MODULE_DIR$/preferences"> - <sourceFolder url="file://$MODULE_DIR$/preferences/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/preferences/src/test" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/script/script.iml (from rev 8901, trunk/script.iml) =================================================================== --- trunk/script/script.iml (rev 0) +++ trunk/script/script.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="model" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/jdom.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-core-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/bsh-util-2.0b4.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/script.iml =================================================================== --- trunk/script.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/script.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/script"> - <sourceFolder url="file://$MODULE_DIR$/script/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/script/src/test" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="model" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jdom.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-core-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-util-2.0b4.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/textedit/textedit.iml (from rev 8901, trunk/textedit.iml) =================================================================== --- trunk/textedit/textedit.iml (rev 0) +++ trunk/textedit/textedit.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/textedit.iml =================================================================== --- trunk/textedit.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/textedit.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <content url="file://$MODULE_DIR$/textedit"> - <sourceFolder url="file://$MODULE_DIR$/textedit/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/textedit/src/test" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="utils" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - Copied: trunk/utils/utils.iml (from rev 8901, trunk/utils.iml) =================================================================== --- trunk/utils/utils.iml (rev 0) +++ trunk/utils/utils.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/japi-lib-util-trunk-1410.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Deleted: trunk/utils.iml =================================================================== --- trunk/utils.iml 2011-06-18 14:23:40 UTC (rev 8902) +++ trunk/utils.iml 2011-06-18 14:39:17 UTC (rev 8903) @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <content url="file://$MODULE_DIR$/utils"> - <sourceFolder url="file://$MODULE_DIR$/utils/src/app" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/utils/src/test" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - </component> -</module> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-18 14:57:00
|
Revision: 8906 http://gridarta.svn.sourceforge.net/gridarta/?rev=8906&view=rev Author: akirschbaum Date: 2011-06-18 14:56:54 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Simplify XML declarations. Modified Paths: -------------- trunk/crossfire/resource/resource/conf/types.xml trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/TreasureLists.xml Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2011-06-18 14:54:39 UTC (rev 8905) +++ trunk/crossfire/resource/resource/conf/types.xml 2011-06-18 14:56:54 UTC (rev 8906) @@ -2602,18 +2602,18 @@ recipes. By themselves, they have no special functionality. ]]> </description> <section name="resistance"> - <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"></attribute> - <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"></attribute> - <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"></attribute> - <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"></attribute> - <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"></attribute> - <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"></attribute> - <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"></attribute> - <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"></attribute> - <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"></attribute> - <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"></attribute> - <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"></attribute> - <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"></attribute> + <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"/> + <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"/> + <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"/> + <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"/> + <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"/> + <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"/> + <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"/> + <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"/> + <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"/> + <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"/> + <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"/> + <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"/> </section> </type> @@ -2947,27 +2947,27 @@ </attribute> </section> <section name="resistance"> - <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"></attribute> - <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"></attribute> - <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"></attribute> - <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"></attribute> - <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"></attribute> - <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"></attribute> - <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"></attribute> - <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"></attribute> - <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"></attribute> - <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"></attribute> - <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"></attribute> - <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"></attribute> - <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"></attribute> - <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"></attribute> - <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"></attribute> - <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"></attribute> - <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"></attribute> - <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"></attribute> - <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"></attribute> - <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"></attribute> - <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"></attribute> + <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"/> + <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"/> + <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"/> + <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"/> + <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"/> + <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"/> + <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"/> + <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"/> + <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"/> + <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"/> + <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"/> + <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"/> + <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"/> + <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"/> + <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"/> + <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"/> + <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"/> + <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"/> + <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"/> + <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"/> + <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"/> </section> </type> @@ -3453,7 +3453,7 @@ 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> + <attribute arch="attack_movement" editor="attack movement" type="int"/> <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 @@ -3462,27 +3462,27 @@ </section> <section name="resistance"> - <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"></attribute> - <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"></attribute> - <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"></attribute> - <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"></attribute> - <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"></attribute> - <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"></attribute> - <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"></attribute> - <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"></attribute> - <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"></attribute> - <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"></attribute> - <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"></attribute> - <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"></attribute> - <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"></attribute> - <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"></attribute> - <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"></attribute> - <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"></attribute> - <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"></attribute> - <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"></attribute> - <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"></attribute> - <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"></attribute> - <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"></attribute> + <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"/> + <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"/> + <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"/> + <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"/> + <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"/> + <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"/> + <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"/> + <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"/> + <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"/> + <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"/> + <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"/> + <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"/> + <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"/> + <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"/> + <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"/> + <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"/> + <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"/> + <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"/> + <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"/> + <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"/> + <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"/> </section> <attribute arch_begin="msg" arch_end="endmsg" editor="npc message" type="text" marker="crossfire-dialog"> This text field contains the keyword-matching-syntax. The text @@ -4662,8 +4662,8 @@ Skill types are hard-coded in the Crossfire server. It isn't hard to create new skill types, but it requires a bit of server-coding. </attribute> - <attribute arch="level" editor="level" type="int" min="-32768" max="32767" check_min="1" check_max="250"></attribute> - <attribute arch="exp" editor="experience" type="int" min="0"></attribute> + <attribute arch="level" editor="level" type="int" min="-32768" max="32767" check_min="1" check_max="250"/> + <attribute arch="exp" editor="experience" type="int" min="0"/> <attribute arch="perm_exp" editor="permanent experience" type="long"> <Permanent experience> is the experience the player gained permanently. Even if a player dies multiple times or gets drained, @@ -5560,27 +5560,27 @@ class>. </attribute> <section name="resistance"> - <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"></attribute> - <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"></attribute> - <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"></attribute> - <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"></attribute> - <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"></attribute> - <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"></attribute> - <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"></attribute> - <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"></attribute> - <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"></attribute> - <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"></attribute> - <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"></attribute> - <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"></attribute> - <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"></attribute> - <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"></attribute> - <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"></attribute> - <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"></attribute> - <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"></attribute> - <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"></attribute> - <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"></attribute> - <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"></attribute> - <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"></attribute> + <attribute arch="resist_physical" editor="resist physical %" length="15" type="int"/> + <attribute arch="resist_magic" editor="resist magic %" length="15" type="int"/> + <attribute arch="resist_fire" editor="resist fire %" length="15" type="int"/> + <attribute arch="resist_electricity" editor="resist electricity %" length="15" type="int"/> + <attribute arch="resist_cold" editor="resist cold %" length="15" type="int"/> + <attribute arch="resist_confusion" editor="resist confusion %" length="15" type="int"/> + <attribute arch="resist_acid" editor="resist acid %" length="15" type="int"/> + <attribute arch="resist_drain" editor="resist draining %" length="15" type="int"/> + <attribute arch="resist_weaponmagic" editor="resist weaponmagic %" length="15" type="int"/> + <attribute arch="resist_ghosthit" editor="resist ghosthit %" length="15" type="int"/> + <attribute arch="resist_poison" editor="resist poison %" length="15" type="int"/> + <attribute arch="resist_slow" editor="resist slow %" length="15" type="int"/> + <attribute arch="resist_paralyze" editor="resist paralyze %" length="15" type="int"/> + <attribute arch="resist_fear" editor="resist fear %" length="15" type="int"/> + <attribute arch="resist_deplete" editor="resist depletion %" length="15" type="int"/> + <attribute arch="resist_turn_undead" editor="resist turn undead %" length="15" type="int"/> + <attribute arch="resist_death" editor="resist death-attack %" length="15" type="int"/> + <attribute arch="resist_chaos" editor="resist chaos %" length="15" type="int"/> + <attribute arch="resist_blind" editor="resist blinding %" length="15" type="int"/> + <attribute arch="resist_holyword" editor="resist holy power %" length="15" type="int"/> + <attribute arch="resist_godpower" editor="resist godpower %" length="15" type="int"/> </section> </type> Modified: trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/TreasureLists.xml =================================================================== --- trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/TreasureLists.xml 2011-06-18 14:54:39 UTC (rev 8905) +++ trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/TreasureLists.xml 2011-06-18 14:56:54 UTC (rev 8906) @@ -1,2 +1,2 @@ <?xml version="1.0"?><!DOCTYPE lists SYSTEM "TreasureLists.dtd"> -<lists></lists> +<lists/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-26 11:05:27
|
Revision: 8911 http://gridarta.svn.sourceforge.net/gridarta/?rev=8911&view=rev Author: akirschbaum Date: 2011-06-26 11:05:20 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Fix #3331957 (False positive for duplicate attribute name). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/atrinik/ChangeLog 2011-06-26 11:05:20 UTC (rev 8911) @@ -1,3 +1,9 @@ +2011-06-26 Andreas Kirschbaum + + * Fix #3331957 (False positive for duplicate attribute name). Do + not report spurious warning message for artifacts with a "name" + which inherit from archetypes not having a "name". + 2011-06-10 Andreas Kirschbaum * Add XML file parse errors to error dialog box. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/daimonin/ChangeLog 2011-06-26 11:05:20 UTC (rev 8911) @@ -1,3 +1,9 @@ +2011-06-26 Andreas Kirschbaum + + * Fix #3331957 (False positive for duplicate attribute name). Do + not report spurious warning message for artifacts with a "name" + which inherit from archetypes not having a "name". + 2011-06-10 Andreas Kirschbaum * Add XML file parse errors to error dialog box. Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-06-26 11:05:20 UTC (rev 8911) @@ -40,6 +40,13 @@ public abstract class AbstractArchetypeBuilder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** + * The base {@link Archetype} for artifacts. Set to <code>null</code> when + * parsing archetypes. + */ + @Nullable + private R prototype; + + /** * The {@link ErrorViewCollector} for reporting errors. */ @Nullable @@ -74,7 +81,12 @@ this.gameObjectFactory = gameObjectFactory; } - public void init(@Nullable final BaseObject<G, A, R, R> prototype, @NotNull final ErrorViewCollector errorViewCollector) { + /** + * @param prototype the base archetype for artifacts; <code>null</code> when + * parsig archetypes + */ + public void init(@Nullable final R prototype, @NotNull final ErrorViewCollector errorViewCollector) { + this.prototype = prototype; this.errorViewCollector = errorViewCollector; // start with new clean GameObject instance if (prototype == null) { @@ -136,6 +148,11 @@ */ @NotNull public R finish() { + if (prototype != null && prototype.getAttributeString(BaseObject.NAME).isEmpty() && !attributes.containsKey(BaseObject.NAME)) { + assert prototype != null; + addObjectText(BaseObject.NAME + " " + prototype.getArchetypeName()); + } + if (archetype == null) { throw new IllegalStateException(); } Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2011-06-26 11:05:20 UTC (rev 8911) @@ -25,7 +25,6 @@ import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DuplicateAnimationException; import net.sf.gridarta.model.anim.IllegalAnimationException; -import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; @@ -140,9 +139,6 @@ final String archetypeName = archName != null ? archName : thisLine2.trim().substring(7); archetypeBuilder.reInit(archetypeName); - if (prototype != null && prototype.getAttributeString(BaseObject.NAME).isEmpty()) { - archetypeBuilder.addObjectText(BaseObject.NAME + " " + prototype.getArchetypeName()); - } if (!archMore) { if (firstArch != null) { finishParseArchetype(firstArch); Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java 2011-06-26 11:05:20 UTC (rev 8911) @@ -57,7 +57,7 @@ */ @Override protected boolean isStartLine(@NotNull final String line) { - return line.startsWith("Object "); + return line.startsWith("Object"); } /** Modified: trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2011-06-19 16:10:12 UTC (rev 8910) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2011-06-26 11:05:20 UTC (rev 8911) @@ -58,7 +58,7 @@ Assert.assertFalse(errorView.hasErrors()); Assert.assertEquals(2, parser.getArchetypeCount()); final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = parser.getArchetype("art"); - Assert.assertEquals("name base\nsp 3\n", archetype.getObjectText()); + Assert.assertEquals("sp 3\nname base\n", archetype.getObjectText()); } /** @@ -146,4 +146,56 @@ Assert.assertEquals("special_horn of fools", parser.getArchetype("horn_fools").getBestName()); } + /** + * Checks for spurious error messages when setting an artifact's name when + * the base archetype doesn't has an explicit name. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName5a() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("note", "face note.101", "layer 3", "identified 1", "type 8", "material 1", "value 8", "weight 75", "level 1", "exp 10"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("Allowed none\n"); + artifacts.append("chance 1\n"); + artifacts.append("artifact my_notebook_item\n"); + artifacts.append("def_arch note\n"); + artifacts.append("Object\n"); + artifacts.append("name A notebook\n"); + artifacts.append("msg\n"); + artifacts.append("This should be giving a false positive for duplicate attributes.\n"); + artifacts.append("endmsg\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); + Assert.assertEquals("A notebook", parser.getArchetype("my_notebook_item").getBestName()); + } + + /** + * Checks for spurious error messages when setting an artifact's name when + * the base archetype doesn't has an explicit name. + * @throws DuplicateArchetypeException if the test fails + * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails + */ + @Test + public void testDefaultName5b() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { + final TestParser parser = new TestParser(); + parser.addArchetype("note", "face note.101", "name note", "layer 3", "identified 1", "type 8", "material 1", "value 8", "weight 75", "level 1", "exp 10"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("Allowed none\n"); + artifacts.append("chance 1\n"); + artifacts.append("artifact my_notebook_item\n"); + artifacts.append("def_arch note\n"); + artifacts.append("Object\n"); + artifacts.append("name A notebook\n"); + artifacts.append("msg\n"); + artifacts.append("This should be giving a false positive for duplicate attributes.\n"); + artifacts.append("endmsg\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); + Assert.assertEquals("A notebook", parser.getArchetype("my_notebook_item").getBestName()); + } + } // class ArtifactParserTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-26 14:19:10
|
Revision: 8912 http://gridarta.svn.sourceforge.net/gridarta/?rev=8912&view=rev Author: akirschbaum Date: 2011-06-26 14:19:03 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Fix #3332031 (animated ammunition is given an incorrect face). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-06-26 11:05:20 UTC (rev 8911) +++ trunk/atrinik/ChangeLog 2011-06-26 14:19:03 UTC (rev 8912) @@ -1,5 +1,7 @@ 2011-06-26 Andreas Kirschbaum + * Fix #3332031 (animated ammunition is given an incorrect face). + * Fix #3331957 (False positive for duplicate attribute name). Do not report spurious warning message for artifacts with a "name" which inherit from archetypes not having a "name". Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-06-26 11:05:20 UTC (rev 8911) +++ trunk/crossfire/ChangeLog 2011-06-26 14:19:03 UTC (rev 8912) @@ -1,3 +1,7 @@ +2011-06-26 Andreas Kirschbaum + + * Fix #3332031 (animated ammunition is given an incorrect face). + 2011-06-10 Andreas Kirschbaum * Add XML file parse errors to error dialog box. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-06-26 11:05:20 UTC (rev 8911) +++ trunk/daimonin/ChangeLog 2011-06-26 14:19:03 UTC (rev 8912) @@ -1,5 +1,7 @@ 2011-06-26 Andreas Kirschbaum + * Fix #3332031 (animated ammunition is given an incorrect face). + * Fix #3331957 (False positive for duplicate attribute name). Do not report spurious warning message for artifacts with a "name" which inherit from archetypes not having a "name". Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2011-06-26 11:05:20 UTC (rev 8911) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2011-06-26 14:19:03 UTC (rev 8912) @@ -48,7 +48,9 @@ @Override public void createInventory(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Iterable<G> archetype) { for (final G invGameObject : archetype) { - gameObject.addLast(cloneGameObject(invGameObject)); + final G clone = cloneGameObject(invGameObject); + clone.setObjectFace(); + gameObject.addLast(clone); } } Modified: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2011-06-26 11:05:20 UTC (rev 8911) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2011-06-26 14:19:03 UTC (rev 8912) @@ -20,13 +20,18 @@ package net.sf.gridarta.model.gameobject; import java.awt.Point; +import javax.swing.ImageIcon; +import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.mapmodel.TestMapModelHelper; +import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -65,4 +70,58 @@ Assert.assertSame(ob1Clone, ob2Clone.getContainer()); } + /** + * Checks that face information is updated for inventory objects cloned from + * an archetype. + * @throws CannotInsertGameObjectException if the test fails + * @throws DuplicateArchetypeException if the test fails + */ + @Test + public void testUpdateFaceInformation() throws CannotInsertGameObjectException, DuplicateArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final TestMapModelHelper mapModelHelper = mapModelCreator.newTestMapModelHelper(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(1, 1); + + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = mapModelCreator.getGameObjectFactory(); + final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = mapModelCreator.getArchetypeSet(); + + final TestArchetype invArchetype = gameObjectFactory.newArchetype("inv"); + invArchetype.setAttributeString(BaseObject.FACE, "face"); + archetypeSet.addArchetype(invArchetype); + + final TestArchetype envArchetype = gameObjectFactory.newArchetype("env"); + envArchetype.setAttributeString(BaseObject.FACE, "face"); + envArchetype.addLast(gameObjectFactory.createGameObject(invArchetype)); + archetypeSet.addArchetype(envArchetype); + + final FaceProvider faceProvider = new FaceProvider() { + + @Override + public ImageIcon getImageIconForFacename(@NotNull final String faceName) { + if (faceName.equals("face")) { + return new ImageIcon(); + } + return null; + } + + @Override + public void reload() { + // do nothing + } + + }; + mapModelCreator.getFaceObjectProviders().setNormal(faceProvider); + + final Point point = new Point(0, 0); + mapModel.beginTransaction("TEST"); + final TestGameObject env = mapModelHelper.insertArchetype(mapModel, point, envArchetype, false); + + Assert.assertNotNull(env); + Assert.assertEquals(FaceSource.ARCHETYPE_FACE, env.getFaceObjSource()); + + final TestGameObject inv = env.getFirst(); + Assert.assertNotNull(inv); + Assert.assertEquals(FaceSource.ARCHETYPE_FACE, inv.getFaceObjSource()); + } + } // class GameObjectFactoryTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-28 19:39:29
|
Revision: 8917 http://gridarta.svn.sourceforge.net/gridarta/?rev=8917&view=rev Author: akirschbaum Date: 2011-06-28 19:39:20 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Implement map, inv, and allows_all_inv attributes for <type> in types.xml. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/crossfire/resource/resource/conf/types.xml trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/doc/ref/validators.xhtml trunk/test-mapvalidator/atrinik/regtest.conf trunk/test-mapvalidator/crossfire/maps/AttributeRange.expected trunk/test-mapvalidator/crossfire/maps/ConnectedInsideContainer.expected trunk/test-mapvalidator/crossfire/maps/ConnectedPickable.expected trunk/test-mapvalidator/crossfire/maps/CustomType.expected trunk/test-mapvalidator/crossfire/maps/UnsetSlaying.expected trunk/test-mapvalidator/crossfire/regtest.conf trunk/test-mapvalidator/daimonin/regtest.conf Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/validation/checks/EnvironmentChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java trunk/test-mapvalidator/crossfire/arch/creator1.arc trunk/test-mapvalidator/crossfire/arch/disease1.arc trunk/test-mapvalidator/crossfire/arch/player1.arc trunk/test-mapvalidator/crossfire/maps/Environment trunk/test-mapvalidator/crossfire/maps/Environment.expected Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/atrinik/ChangeLog 2011-06-28 19:39:20 UTC (rev 8917) @@ -1,3 +1,12 @@ +2011-06-28 Andreas Kirschbaum + + * Implement map, inv, and allows_all_inv attributes for <type> in + types.xml. Allows to restrict the use of archetype types to maps + and/or inventories. For details see comments in types.xml. + + Implements #3079988 (putting some things in containers can cause + server crash). + 2011-06-26 Andreas Kirschbaum * Fix #3332031 (animated ammunition is given an incorrect face). Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/crossfire/ChangeLog 2011-06-28 19:39:20 UTC (rev 8917) @@ -1,3 +1,12 @@ +2011-06-28 Andreas Kirschbaum + + * Implement map, inv, and allows_all_inv attributes for <type> in + types.xml. Allows to restrict the use of archetype types to maps + and/or inventories. For details see comments in types.xml. + + Implements #3079988 (putting some things in containers can cause + server crash). + 2011-06-26 Andreas Kirschbaum * Collect resources. Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/crossfire/resource/resource/conf/types.xml 2011-06-28 19:39:20 UTC (rev 8917) @@ -42,7 +42,8 @@ # # # about the 'type' elements: # # # -# <type number="15" name="Type Name"> # +# <type number="15" name="Type Name" map="no" inv="1,2" # +# allows_all_inv="yes"> # # <import_type name="Type Name" /> import attributes of this type; # # Attributes explicitly defined in a type are not imported. # # <required> # @@ -60,6 +61,19 @@ # ... attributes ... # # </type> # # # +# map="yes|no" is optional and defaults to "yes". If set to "no", a # +# validator warning is generated if this this game object is # +# directly on the map. # +# # +# inv="type,type,...|*" is optional and defaults to "*". If this # +# game object is in the inventory of another game object and this # +# other game object has a type not in the list "type,type,...", a # +# validator warning is generated. # +# # +# allows_all_inv="yes" is optional and defaults to "no". If set to # +# "yes", this type number is implicitly added to all "inv" # +# attributes. # +# # # about the 'attribute' type: <attribute ... type="XXX" > # # # # bool - This attribute can only be set to '1' or '0' # @@ -545,7 +559,7 @@ </type> <!--####################################################################--> - <type number="18" name="Altar"> + <type number="18" name="Altar" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -597,7 +611,7 @@ </type> <!--####################################################################--> - <type number="31" name="Altar Trigger"> + <type number="31" name="Altar Trigger" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -988,7 +1002,7 @@ </type> <!--####################################################################--> - <type number="58" name="Battleground"> + <type number="58" name="Battleground" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -1151,7 +1165,7 @@ </type> <!--####################################################################--> - <type number="92" name="Button"> + <type number="92" name="Button" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -1183,7 +1197,7 @@ </type> <!--####################################################################--> - <type number="30" name="Button Trigger"> + <type number="30" name="Button Trigger" inv=""> <import_type name="Button"/> <ignore> <ignore_list name="non_pickable"/> @@ -1196,7 +1210,7 @@ </type> <!--####################################################################--> - <type number="37" name="Class Changer"> + <type number="37" name="Class Changer" inv="57"> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -1363,7 +1377,7 @@ </type> <!--####################################################################--> - <type number="103" name="Converter"> + <type number="103" name="Converter" inv=""> <ignore> <attribute arch="value"/> <attribute arch="nrof"/> @@ -1417,7 +1431,7 @@ </type> <!--####################################################################--> - <type number="42" name="Creator"> + <type number="42" name="Creator" inv="" allows_all_inv="yes"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -1463,7 +1477,7 @@ </type> <!--####################################################################--> - <type number="51" name="Detector"> + <type number="51" name="Detector" inv=""> <ignore> <ignore_list name="system_object"/> </ignore> @@ -1502,7 +1516,7 @@ </type> <!--####################################################################--> - <type number="112" name="Director"> + <type number="112" name="Director" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -1536,7 +1550,7 @@ </type> <!--####################################################################--> - <type number="158" name="Disease"> + <type number="158" name="Disease" map="no"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -1704,7 +1718,7 @@ </type> <!--####################################################################--> - <type number="23" name="Door"> + <type number="23" name="Door" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -1765,7 +1779,7 @@ </type> <!--####################################################################--> - <type number="83" name="Duplicator"> + <type number="83" name="Duplicator" inv=""> <ignore> <ignore_list name="system_object"/> </ignore> @@ -1837,7 +1851,7 @@ </type> <!--####################################################################--> - <type number="66" name="Exit"> + <type number="66" name="Exit" inv="0"> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2105,7 +2119,7 @@ </type> <!--####################################################################--> - <type number="0" name="Floor"> + <type number="0" name="Floor" inv=""> <required> <attribute arch="is_floor" value="1"/> <attribute arch="alive" value="0"/> @@ -2162,7 +2176,7 @@ </type> <!--####################################################################--> - <type number="67" name="Floor (Encounter)"> + <type number="67" name="Floor (Encounter)" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2243,7 +2257,7 @@ </type> <!--####################################################################--> - <type number="91" name="Gate"> + <type number="91" name="Gate" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2337,7 +2351,7 @@ </type> <!--####################################################################--> - <type number="93" name="Handle"> + <type number="93" name="Handle" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2368,7 +2382,7 @@ </type> <!--####################################################################--> - <type number="27" name="Handle Trigger"> + <type number="27" name="Handle Trigger" inv=""> <import_type name="Handle"/> <ignore> <ignore_list name="non_pickable"/> @@ -2391,7 +2405,7 @@ </type> <!--####################################################################--> - <type number="88" name="Hazard Floor"> + <type number="88" name="Hazard Floor" inv=""> <required> <attribute arch="is_floor" value="1"/> </required> @@ -2510,7 +2524,7 @@ </type> <!--####################################################################--> - <type number="56" name="Holy Altar"> + <type number="56" name="Holy Altar" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2618,7 +2632,7 @@ </type> <!--####################################################################--> - <type number="64" name="Inventory Checker"> + <type number="64" name="Inventory Checker" inv=""> <ignore> <ignore_list name="system_object"/> </ignore> @@ -2767,7 +2781,7 @@ </type> <!--####################################################################--> - <type number="20" name="Locked Door"> + <type number="20" name="Locked Door" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2815,7 +2829,7 @@ </type> <!--####################################################################--> - <type number="29" name="Magic Ear"> + <type number="29" name="Magic Ear" inv="0"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -2855,7 +2869,7 @@ </type> <!--####################################################################--> - <type number="62" name="Magic Wall"> + <type number="62" name="Magic Wall" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -2972,7 +2986,7 @@ </type> <!--####################################################################--> - <type number="55" name="Marker"> + <type number="55" name="Marker" inv="122"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -3059,7 +3073,7 @@ </type> <!--####################################################################--> - <type number="0" name="Monster & NPC" display="level ${level}${generator?*:}"> + <type number="0" name="Monster & NPC" display="level ${level}${generator?*:}" inv=""> <required> <attribute arch="is_floor" value="0"/> <attribute arch="alive" value="1"/> @@ -3498,7 +3512,7 @@ </type> <!--####################################################################--> - <type number="28" name="Monster (Grimreaper)"> + <type number="28" name="Monster (Grimreaper)" inv=""> <import_type name="Monster & NPC"/> <ignore> <attribute arch="material"/> @@ -3519,7 +3533,7 @@ </type> <!--####################################################################--> - <type number="65" name="Mood Floor"> + <type number="65" name="Mood Floor" inv=""> <ignore> <ignore_list name="system_object"/> </ignore> @@ -3588,7 +3602,7 @@ </type> <!--####################################################################--> - <type number="40" name="Mover"> + <type number="40" name="Mover" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -3680,7 +3694,7 @@ </type> <!--####################################################################--> - <type number="17" name="Pedestal"> + <type number="17" name="Pedestal" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -3719,7 +3733,7 @@ </type> <!--####################################################################--> - <type number="94" name="Pit"> + <type number="94" name="Pit" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -3776,7 +3790,7 @@ </type> <!--####################################################################--> - <type number="1" name="Player"> + <type number="1" name="Player" map="no" inv=""> <description><![CDATA[ This type of objects must not be used on a map. They will be ignored during map load by server.]]> @@ -4146,7 +4160,7 @@ </type> <!--####################################################################--> - <type number="154" name="Rune"> + <type number="154" name="Rune" inv="4,23,122"> <ignore> <attribute arch="no_pick"/> <attribute arch="title"/> @@ -4251,7 +4265,7 @@ </type> <!--####################################################################--> - <type number="106" name="Savebed"> + <type number="106" name="Savebed" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4485,7 +4499,7 @@ </type> <!--####################################################################--> - <type number="68" name="Shop Floor"> + <type number="68" name="Shop Floor" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4536,7 +4550,7 @@ </type> <!--####################################################################--> - <type number="69" name="Shop Mat"> + <type number="69" name="Shop Mat" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4562,7 +4576,7 @@ </type> <!--####################################################################--> - <type number="98" name="Sign & Magic Mouth"> + <type number="98" name="Sign & Magic Mouth" inv="0"> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4617,7 +4631,7 @@ </type> <!--####################################################################--> - <type number="43" name="Skill"> + <type number="43" name="Skill" map="no" inv="0"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -4767,7 +4781,7 @@ </type> <!--####################################################################--> - <type number="101" name="Spell"> + <type number="101" name="Spell" map="no"> <ignore> <ignore_list name="system_object"/> </ignore> @@ -4903,7 +4917,7 @@ </type> <!--####################################################################--> - <type number="90" name="Spinner"> + <type number="90" name="Spinner" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4936,7 +4950,7 @@ </type> <!--####################################################################--> - <type number="138" name="Swamp"> + <type number="138" name="Swamp" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -4978,7 +4992,7 @@ </type> <!--####################################################################--> - <type number="41" name="Teleporter"> + <type number="41" name="Teleporter" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -5068,7 +5082,7 @@ </type> <!--####################################################################--> - <type number="26" name="Timed Gate"> + <type number="26" name="Timed Gate" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -5118,7 +5132,7 @@ </type> <!--####################################################################--> - <type number="2" name="Transport"> + <type number="2" name="Transport" inv=""> <description><![CDATA[ A transport is an object that helps the player move. It should not be confused an EXIT, which instantaneously transport a player from @@ -5265,7 +5279,7 @@ </type> <!--####################################################################--> - <type number="95" name="Trapdoor"> + <type number="95" name="Trapdoor" inv=""> <ignore> <ignore_list name="non_pickable"/> </ignore> @@ -5358,7 +5372,7 @@ </type> <!--####################################################################--> - <type number="52" name="Trigger Marker"> + <type number="52" name="Trigger Marker" inv=""> <ignore> <ignore_list name="system_object"/> </ignore> @@ -5419,7 +5433,7 @@ </type> <!--####################################################################--> - <type number="0" name="Wall"> + <type number="0" name="Wall" inv=""> <required> <attribute arch="is_floor" value="0"/> <attribute arch="alive" value="0"/> @@ -5503,7 +5517,7 @@ </type> <!--####################################################################--> - <type number="0" name="Weak Wall"> + <type number="0" name="Weak Wall" inv=""> <required> <attribute arch="is_floor" value="0"/> <attribute arch="alive" value="1"/> Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/daimonin/ChangeLog 2011-06-28 19:39:20 UTC (rev 8917) @@ -1,3 +1,12 @@ +2011-06-28 Andreas Kirschbaum + + * Implement map, inv, and allows_all_inv attributes for <type> in + types.xml. Allows to restrict the use of archetype types to maps + and/or inventories. For details see comments in types.xml. + + Implements #3079988 (putting some things in containers can cause + server crash). + 2011-06-26 Andreas Kirschbaum * Fix #3332031 (animated ammunition is given an incorrect face). Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -51,6 +51,24 @@ private final String display; /** + * Whether this archetype type is allowed on maps. + */ + private final boolean map; + + /** + * Which archetype types allow this archetype type in their inventories or + * <code>null</code> for no restrictions. + */ + @Nullable + private final int[] inv; + + /** + * Whether this archetype type allows any inventory game objects, whether + * these types have "inv" specifications. + */ + private final boolean allowsAllInv; + + /** * The description. */ @Nullable @@ -88,16 +106,24 @@ * @param typeName the type name (artificial) * @param typeNo the type number * @param display additional description text + * @param map whether this archetype type is allowed on maps + * @param inv which archetype types allow this archetype type in their + * inventories or <code>null</code> for no restrictions + * @param allowsAllInv whether this archetype type allows any inventory game objects, whether + * these types have "inv" specifications * @param description the description * @param use the usage notes * @param sectionNum the number of attribute sections * @param archetypeAttributes the list of archetype attributes * @param typeAttributes the list of additional attributes */ - public ArchetypeType(@NotNull final String typeName, final int typeNo, @NotNull final String display, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final ArchetypeAttributes archetypeAttributes, @NotNull final ArchetypeAttributesDefinition typeAttributes) { + public ArchetypeType(@NotNull final String typeName, final int typeNo, @NotNull final String display, final boolean map, @Nullable final int[] inv, final boolean allowsAllInv, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final ArchetypeAttributes archetypeAttributes, @NotNull final ArchetypeAttributesDefinition typeAttributes) { this.typeName = typeName; this.typeNo = typeNo; this.display = display; + this.map = map; + this.inv = inv == null ? null : inv.clone(); + this.allowsAllInv = allowsAllInv; this.description = description; this.use = use; this.sectionNum = sectionNum; @@ -150,6 +176,34 @@ } /** + * Returns whether this archetype is allowed on maps. + * @return whether this archetype is allowed on maps + */ + public boolean isMap() { + return map; + } + + /** + * Returns which archetype types allow this archetype type in their + * inventories. + * @return the allowed environment types or <code>null</code> for no + * restrictions + */ + @Nullable + public int[] getInv() { + return inv == null ? null : inv.clone(); + } + + /** + * Returns whether this archetype type allows any inventory game objects, + * regardless whether these types have "inv" specifications. + * @return whether this archetype type allows any inveotry game objects + */ + public boolean isAllowsAllInv() { + return allowsAllInv; + } + + /** * Returns the description. * @return the description */ Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -25,6 +25,7 @@ import java.util.LinkedHashSet; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.xml.NodeListIterator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -119,6 +120,12 @@ private static final String XML_USE = "use"; /** + * An empty array of <code>int</code>s. + */ + @NotNull + public static final int[] EMPTY_INT_ARRAY = new int[0]; + + /** * The parser to use. */ @NotNull @@ -149,6 +156,9 @@ final String typeName = parseTypeName(typeElement, isDefaultType); final int typeNo = parseTypeNo(typeElement, isDefaultType, typeName, errorViewCollector); final String display = typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_DISPLAY); + final boolean map = parseMap(typeElement); + final int[] inv = parseInv(typeElement, typeName, errorViewCollector); + final boolean allowsAllInv = parseAllowsAllInv(typeElement); final Collection<String> ignoreTable = new HashSet<String>(); final ArchetypeAttributesDefinition typeAttributes = isDefaultType ? new ArchetypeAttributesDefinition() : parseTypeAttributes(typeElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition); @@ -181,7 +191,7 @@ } attributes.setSectionNames(sectionNames); - return new ArchetypeType(typeName, typeNo, display, parseDescription(typeElement), parseUse(typeElement), sectionNames.getSectionNames(), attributes, typeAttributes); + return new ArchetypeType(typeName, typeNo, display, map, inv, allowsAllInv, parseDescription(typeElement), parseUse(typeElement), sectionNames.getSectionNames(), attributes, typeAttributes); } /** @@ -296,6 +306,61 @@ } /** + * Parses the "map" attribute of a "type" {@link Element}. + * @param typeElement the element + * @return whether this archetype is allowed on maps + */ + private static boolean parseMap(@NotNull final Element typeElement) { + final String map = typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_MAP); + return map.equals("yes"); + } + + /** + * Parses the "inv" attribute of a "type" {@link Element}. + * @param typeElement the element + * @param typeName the type name for error messages + * @param errorViewCollector the error view collector for error messages + * @return the archetype types this game object is allowed in or + * <code>null</code> for no restrictions + */ + @Nullable + private static int[] parseInv(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { + if (!typeElement.hasAttribute(ArchetypeTypeSetParser.XML_TYPE_INV)) { + return null; + } + + final String inv = typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_INV); + if (inv.isEmpty()) { + return EMPTY_INT_ARRAY; + } + if (inv.equals("*")) { + return null; + } + + final String[] types = StringUtils.PATTERN_COMMA.split(inv, -1); + final int[] result = new int[types.length]; + for (int i = 0; i < types.length; i++) { + try { + result[i] = Integer.parseInt(types[i]); + } catch (final NumberFormatException ignored) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid inv specification '" + types[i] + "'."); + result[i] = -1; + } + } + return result; + } + + /** + * Parses the "allows_all_inv" attribute of a "type" {@link Element}. + * @param typeElement the element + * @return whether this archetype allows all inventory game objects + */ + private static boolean parseAllowsAllInv(@NotNull final Element typeElement) { + final String allowsAllInv = typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_ALLOWS_ALL_INV); + return allowsAllInv.equals("yes"); + } + + /** * Parses the type attributes of a "type" or "default_type" {@link * Element}. * @param typeElement the element Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -277,7 +277,7 @@ public void defineFallbackArchetypeType() { fallbackArchetypeType = archetypeTypeNames.get("Misc"); if (fallbackArchetypeType == null) { - fallbackArchetypeType = new ArchetypeType("", 0, "", null, null, 2, new ArchetypeAttributes(), new ArchetypeAttributesDefinition()); + fallbackArchetypeType = new ArchetypeType("", 0, "", true, null, false, null, null, 2, new ArchetypeAttributes(), new ArchetypeAttributesDefinition()); } } Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -176,6 +176,27 @@ public static final String XML_TYPE_NUMBER = "number"; /** + * The name of the "map" attribute within {@link #XML_ELEMENT_TYPE} + * elements. + */ + @NotNull + public static final String XML_TYPE_MAP = "map"; + + /** + * The name of the "inv" attribute within {@link #XML_ELEMENT_TYPE} + * elements. + */ + @NotNull + public static final String XML_TYPE_INV = "inv"; + + /** + * The name of the "allows_all_inv" attribute within {@link + * #XML_ELEMENT_TYPE} elements. + */ + @NotNull + public static final String XML_TYPE_ALLOWS_ALL_INV = "allows_all_inv"; + + /** * The name of the "display" attribute within {@link #XML_ELEMENT_TYPE} * elements. */ Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/EnvironmentChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/EnvironmentChecker.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/EnvironmentChecker.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -0,0 +1,118 @@ +/* + * 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.validation.checks; + +import java.util.Arrays; +import java.util.IdentityHashMap; +import java.util.Map; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypetype.ArchetypeType; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.validation.AbstractValidator; +import net.sf.gridarta.model.validation.ErrorCollector; +import net.sf.gridarta.model.validation.GameObjectValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.errors.EnvironmentInvError; +import net.sf.gridarta.model.validation.errors.EnvironmentMapError; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link GameObjectValidator} that checks for valid environment. Warnings can + * be generated for game objects placed directly on maps, or for game objects + * placed into inventories of game objects not having some type. + * @author Andreas Kirschbaum + */ +public class EnvironmentChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator<G, A, R> implements GameObjectValidator<G, A, R> { + + /** + * The {@link ArchetypeType ArchetypeTypes} that are not allowed on maps. + */ + @NotNull + private final Map<ArchetypeType, Void> noMap = new IdentityHashMap<ArchetypeType, Void>(); + + /** + * Maps {@link ArchetypeType ArchetypeTypes} to allowed environment types. + * Game object types not included are allowed in any inventory. + */ + @NotNull + private final Map<ArchetypeType, int[]> inv = new IdentityHashMap<ArchetypeType, int[]>(); + + /** + * Creates a new instance. + * @param validatorPreferences the validator preferences to use + */ + public EnvironmentChecker(@NotNull final ValidatorPreferences validatorPreferences) { + super(validatorPreferences); + } + + /** + * Marks an {@link ArchetypeType} to not be allowed directly on maps. + * @param archetypeType the archetype type + */ + public void addNoMap(@NotNull final ArchetypeType archetypeType) { + noMap.put(archetypeType, null); + } + + /** + * Sets the allowed environment game object types for an {@link + * ArchetypeType}. + * @param archetypeType the archetype type + * @param types the allowed environment types + */ + public void addInv(@NotNull final ArchetypeType archetypeType, @NotNull final int[] types) { + if (inv.containsKey(archetypeType)) { + throw new IllegalArgumentException(); + } + + final int[] tmp = types.clone(); + Arrays.sort(tmp); + inv.put(archetypeType, tmp); + } + + /** + * {@inheritDoc} + */ + @Override + public void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final G envGameObject = gameObject.getContainerGameObject(); + if (envGameObject == null) { + for (final ArchetypeType archetypeType : noMap.keySet()) { + if (archetypeType.matches(gameObject)) { + errorCollector.collect(new EnvironmentMapError<G, A, R>(gameObject, archetypeType.getTypeName())); + break; + } + } + } else { + for (final Map.Entry<ArchetypeType, int[]> entry : inv.entrySet()) { + final ArchetypeType archetypeType = entry.getKey(); + if (archetypeType.matches(gameObject)) { + final int[] types = entry.getValue(); + if (types != null && Arrays.binarySearch(types, envGameObject.getTypeNo()) < 0) { + final String typeDescription = archetypeType.getTypeName(); + final String envTypeDescription = Integer.toString(envGameObject.getTypeNo()); // XXX: use envArchetypeType.getTypeName() + errorCollector.collect(new EnvironmentInvError<G, A, R>(gameObject, typeDescription, envTypeDescription)); + } + } + } + } + } + +} // class EnvironmentChecker Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/EnvironmentChecker.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -0,0 +1,80 @@ +/* + * 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.validation.errors; + +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; +import org.jetbrains.annotations.Nullable; + +/** + * Validation error that's used when the EnvironmentChecker detected a + * possible error on the map. + * @author Andreas Kirschbaum + */ +public class EnvironmentInvError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The type's description. + */ + @NotNull + private final String typeDescription; + + /** + * The environment type's description. + */ + @NotNull + private final String envTypeDescription; + + /** + * Creates a new instance. + * @param gameObject the game object on which the error occurred + * @param typeDescription the type's description + * @param envTypeDescription the environment type's description + */ + public EnvironmentInvError(@NotNull final G gameObject, @NotNull final String typeDescription, @NotNull final String envTypeDescription) { + super(gameObject); + this.typeDescription = typeDescription; + this.envTypeDescription = envTypeDescription; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return typeDescription; + + case 1: + return envTypeDescription; + } + return super.getParameter(id); + } + +} // class EnvironmentInvError Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -0,0 +1,69 @@ +/* + * 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.validation.errors; + +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; +import org.jetbrains.annotations.Nullable; + +/** + * Validation error that's used when the EnvironmentChecker detected a + * possible error on the map. + * @author Andreas Kirschbaum + */ +public class EnvironmentMapError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The type's description. + */ + @NotNull + private final String typeDescription; + + /** + * Creates a new instance. + * @param gameObject the game object on which the error occurred + * @param typeDescription the type's description + */ + public EnvironmentMapError(@NotNull final G gameObject, @NotNull final String typeDescription) { + super(gameObject); + this.typeDescription = typeDescription; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return typeDescription; + } + return super.getParameter(id); + } + +} // class EnvironmentMapError Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -53,7 +53,7 @@ final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); - final ArchetypeType archetypeType1 = new ArchetypeType("name1", 1, "", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType1 = new ArchetypeType("name1", 1, "", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); Assert.assertEquals("name1 (1)", archetypeType1.getDisplayName(archetype)); } @@ -71,7 +71,7 @@ final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); - final ArchetypeType archetypeType2 = new ArchetypeType("name2", 1, "a=${a}${a}", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType2 = new ArchetypeType("name2", 1, "a=${a}${a}", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); Assert.assertEquals("name2 (1) [a=]", archetypeType2.getDisplayName(archetype)); archetype.setObjectText("a xyz\n"); @@ -81,10 +81,10 @@ Assert.assertEquals("name2 (1) [a=${a}${a}]", archetypeType2.getDisplayName(archetype)); // syntax errors are not fatal - final ArchetypeType archetypeType3 = new ArchetypeType("name", 1, "${}", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType3 = new ArchetypeType("name", 1, "${}", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); Assert.assertEquals("name (1) []", archetypeType3.getDisplayName(archetype)); - final ArchetypeType archetypeType4 = new ArchetypeType("name", 1, "${a", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType4 = new ArchetypeType("name", 1, "${a", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); Assert.assertEquals("name (1) [${a]", archetypeType4.getDisplayName(archetype)); } @@ -102,7 +102,7 @@ final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); - final ArchetypeType archetypeType2 = new ArchetypeType("name2", 1, "a=${a?True:False}", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType2 = new ArchetypeType("name2", 1, "a=${a?True:False}", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); Assert.assertEquals("name2 (1) [a=False]", archetypeType2.getDisplayName(archetype)); archetype.setObjectText("a xyz\n"); @@ -112,33 +112,33 @@ Assert.assertEquals("name2 (1) [a=False]", archetypeType2.getDisplayName(archetype)); // empty replacements are allowed - final ArchetypeType archetypeType3 = new ArchetypeType("name", 1, "${a?:}", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType3 = new ArchetypeType("name", 1, "${a?:}", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); archetype.setObjectText("a 0\n"); Assert.assertEquals("name (1) []", archetypeType3.getDisplayName(archetype)); archetype.setObjectText("a 1\n"); Assert.assertEquals("name (1) []", archetypeType3.getDisplayName(archetype)); // replacements with multiple colons - final ArchetypeType archetypeType4 = new ArchetypeType("name", 1, "${a?b:c:d}", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType4 = new ArchetypeType("name", 1, "${a?b:c:d}", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); archetype.setObjectText("a 0\n"); Assert.assertEquals("name (1) [c:d]", archetypeType4.getDisplayName(archetype)); archetype.setObjectText("a 1\n"); Assert.assertEquals("name (1) [b]", archetypeType4.getDisplayName(archetype)); // syntax errors are not fatal - final ArchetypeType archetypeType5 = new ArchetypeType("name", 1, "${?", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType5 = new ArchetypeType("name", 1, "${?", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); archetype.setObjectText("a 0\n"); Assert.assertEquals("name (1) [${?]", archetypeType5.getDisplayName(archetype)); archetype.setObjectText("a 1\n"); Assert.assertEquals("name (1) [${?]", archetypeType5.getDisplayName(archetype)); - final ArchetypeType archetypeType6 = new ArchetypeType("name", 1, "${a?", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType6 = new ArchetypeType("name", 1, "${a?", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); archetype.setObjectText("a 0\n"); Assert.assertEquals("name (1) [${a?]", archetypeType6.getDisplayName(archetype)); archetype.setObjectText("a 1\n"); Assert.assertEquals("name (1) [${a?]", archetypeType6.getDisplayName(archetype)); - final ArchetypeType archetypeType7 = new ArchetypeType("name", 1, "${a?:", "description", "use", 1, archetypeAttributes, typeAttributes); + final ArchetypeType archetypeType7 = new ArchetypeType("name", 1, "${a?:", true, null, false, "description", "use", 1, archetypeAttributes, typeAttributes); archetype.setObjectText("a 0\n"); Assert.assertEquals("name (1) [${a?:]", archetypeType7.getDisplayName(archetype)); archetype.setObjectText("a 1\n"); Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.utils.Size2D; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -239,7 +240,7 @@ final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); Assert.assertEquals(lines.length, mapSize.getHeight()); final Pattern pattern1 = Pattern.compile("\\|"); - final Pattern pattern2 = Pattern.compile(","); + final Pattern pattern2 = StringUtils.PATTERN_COMMA; final Point pos = new Point(); for (int y = 0; y < lines.length; y++) { final CharSequence line = lines[y]; Modified: trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -142,6 +142,16 @@ } /** + * Checks that {@link net.sf.gridarta.model.validation.checks.EnvironmentChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewEnvironmentChecker() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.EnvironmentChecker"); + } + + /** * Checks that {@link net.sf.gridarta.model.validation.checks.ExitChecker} * can be instantiated. * @throws NoSuchValidatorException if the test fails Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/resource/system/dtd/types.dtd 2011-06-28 19:39:20 UTC (rev 8917) @@ -96,6 +96,13 @@ references are replaced with attribute values; ${attr?true:false} references are replaced by "true" if the attribute exists and is not zero, or else by "false". --> +<!-- map: when set to 'no', generate a map warning if this game object is placed + directly on a map. --> +<!-- inv: comma-separated list of game object types that allow this object as + their inventory. If this game object is part of any other inventory, a map + warning is generated. Defaults to '*' which disables the check. --> +<!-- allows_all_inv: when set to 'yes', implicitly adds this game object type to + 'inv' of all <type> definitions. --> <!ELEMENT type (import_type*,required?,ignore?,description?,use?,(section | attribute)*)> <!ATTLIST type xml:base CDATA #IMPLIED @@ -103,6 +110,9 @@ number CDATA #REQUIRED available (yes|no) 'yes' display CDATA #IMPLIED + map (yes|no) 'yes' + inv CDATA #IMPLIED + allows_all_inv (yes|no) 'no' > <!ELEMENT description (#PCDATA)> Modified: trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -19,6 +19,9 @@ package net.sf.gridarta.gui.archetypetype; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypetype.ArchetypeAttribute; import net.sf.gridarta.model.archetypetype.ArchetypeAttributeAnimationName; @@ -46,6 +49,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; +import net.sf.gridarta.model.validation.checks.EnvironmentChecker; import net.sf.gridarta.model.validation.checks.InvalidCheckException; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -71,11 +75,35 @@ /** * Adds attribute range checks for all defined attributes. * @param attributeRangeChecker the attribute range checker to add to + * @param environmentChecker the environment checker to add to * @param archetypeTypeSet the archetype type set to use */ - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final EnvironmentChecker<G, A, R> environmentChecker) { + final Set<Integer> allowsAllInvTypes = new HashSet<Integer>(); for (final ArchetypeType archetypeType : archetypeTypeSet) { + if (archetypeType.isAllowsAllInv()) { + allowsAllInvTypes.add(archetypeType.getTypeNo()); + } + } + for (final ArchetypeType archetypeType : archetypeTypeSet) { addChecks(archetypeTypeSet, attributeRangeChecker, archetypeType); + if (!archetypeType.isMap()) { + environmentChecker.addNoMap(archetypeType); + } + final int[] types = archetypeType.getInv(); + if (types != null) { + final Set<Integer> tmp = new HashSet<Integer>(allowsAllInvTypes); + for (final int type : types) { + tmp.add(type); + } + final int[] tmp2 = new int[tmp.size()]; + final Iterator<Integer> it = tmp.iterator(); + for (int i = 0; i < tmp2.length; i++) { + tmp2[i] = it.next(); + } + assert !it.hasNext(); + environmentChecker.addInv(archetypeType, tmp2); + } } } Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2011-06-28 19:39:20 UTC (rev 8917) @@ -94,6 +94,7 @@ import net.sf.gridarta.model.validation.NoSuchValidatorException; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; +import net.sf.gridarta.model.validation.checks.EnvironmentChecker; import net.sf.gridarta.model.validation.checks.PaidItemShopSquareChecker; import net.sf.gridarta.model.validation.checks.ShopSquareChecker; import net.sf.gridarta.model.validation.checks.ValidatorFactory; @@ -190,6 +191,7 @@ throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); + final EnvironmentChecker<G, A, R> environmentChecker = new EnvironmentChecker<G, A, R>(validatorPreferences); final DocumentBuilder documentBuilder = xmlHelper.getDocumentBuilder(); try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml"); @@ -210,6 +212,7 @@ loadValidators(validators, validatorFactory, errorView); editorFactory.initMapValidators(validators, gameObjectMatchersErrorViewCollector, globalSettings, gameObjectMatchers, attributeRangeChecker, validatorPreferences); validators.addValidator(attributeRangeChecker); + validators.addValidator(environmentChecker); } catch (final FileNotFoundException ex) { errorView.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, "GameObjectMatchers.xml: " + ex.getMessage()); } @@ -330,7 +333,7 @@ final ScriptModelParser<G, A, R> scriptModelParser = new ScriptModelParser<G, A, R>(pluginParameterFactory); new ScriptModelLoader<G, A, R>(scriptModelParser).loadScripts(errorView, scriptsFile, scriptModel); new AutojoinListsParser<G, A, R>(errorView, archetypeSet, autojoinLists).loadList(globalSettings.getConfigurationDirectory()); - ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker); + ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker, environmentChecker); } /** Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-06-27 22:49:06 UTC (rev 8916) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-06-28 19:39:20 UTC (rev 8917) @@ -1171,6 +1171,7 @@ prefs.Validator.DoubleLayer=Whether this map validator check is is enabled. prefs.Validator.DoubleType... [truncated message content] |