You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-06-10 07:38:54
|
Revision: 8335 http://gridarta.svn.sourceforge.net/gridarta/?rev=8335&view=rev Author: akirschbaum Date: 2010-06-10 07:38:47 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Add support for "*.face" files in arch directory. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-06-10 07:35:54 UTC (rev 8334) +++ trunk/atrinik/ChangeLog 2010-06-10 07:38:47 UTC (rev 8335) @@ -1,3 +1,7 @@ +2010-06-10 Andreas Kirschbaum + + * Add support for "*.face" files in arch directory. + 2010-06-09 Andreas Kirschbaum * Do not crash when reverting a resized map. Properly revert Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:35:54 UTC (rev 8334) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:38:47 UTC (rev 8335) @@ -24,6 +24,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -194,6 +195,8 @@ if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } + } else if (FileFilters.faceFileFilter.accept(f)) { + parseDefFace(errorView, f.getAbsolutePath(), path); } else if (FileFilters.animFileFilter.accept(f)) { animFiles.add(new Pair<String, File>(path, f)); } @@ -211,6 +214,38 @@ } /** + * Loads a .face file. + * @param errorView the error view for reporting errors + * @param path the base directory relative path of <code>filename</code> + * @param filename filename + */ + private void parseDefFace(@NotNull final ErrorView errorView, @NotNull final String path, @NotNull final String filename) { + final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, new File(path)); + try { + final FileInputStream fis = new FileInputStream(path); + try { + final InputStreamReader isr = new InputStreamReader(fis); + try { + final Reader in = new BufferedReader(isr); + try { + AnimationObjectsReader.loadAnimations(animationObjects, errorViewCollector, in, "animation ", true, filename, null); + } finally { + in.close(); + } + } finally { + isr.close(); + } + } finally { + fis.close(); + } + } catch (final IOException ex) { + errorViewCollector.addWarning(ErrorViewCategory.FACE_FILE_INVALID, ex.getMessage()); + } catch (final AnimationParseException ex) { + errorViewCollector.addWarning(ErrorViewCategory.FACE_FILE_INVALID, "line " + ex.getLineNumber() + ": parsing error: " + ex.getMessage()); + } + } + + /** * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-06-10 07:35:54 UTC (rev 8334) +++ trunk/daimonin/ChangeLog 2010-06-10 07:38:47 UTC (rev 8335) @@ -1,3 +1,7 @@ +2010-06-10 Andreas Kirschbaum + + * Add support for "*.face" files in arch directory. + 2010-06-09 Andreas Kirschbaum * Do not crash when reverting a resized map. Properly revert Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:35:54 UTC (rev 8334) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:38:47 UTC (rev 8335) @@ -24,6 +24,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -194,6 +195,8 @@ if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } + } else if (FileFilters.faceFileFilter.accept(f)) { + parseDefFace(errorView, f.getAbsolutePath(), path); } else if (FileFilters.animFileFilter.accept(f)) { animFiles.add(new Pair<String, File>(path, f)); } @@ -211,6 +214,38 @@ } /** + * Loads a .face file. + * @param errorView the error view for reporting errors + * @param path the base directory relative path of <code>filename</code> + * @param filename filename + */ + private void parseDefFace(@NotNull final ErrorView errorView, @NotNull final String path, @NotNull final String filename) { + final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, new File(path)); + try { + final FileInputStream fis = new FileInputStream(path); + try { + final InputStreamReader isr = new InputStreamReader(fis); + try { + final Reader in = new BufferedReader(isr); + try { + AnimationObjectsReader.loadAnimations(animationObjects, errorViewCollector, in, "animation ", true, filename, null); + } finally { + in.close(); + } + } finally { + isr.close(); + } + } finally { + fis.close(); + } + } catch (final IOException ex) { + errorViewCollector.addWarning(ErrorViewCategory.FACE_FILE_INVALID, ex.getMessage()); + } catch (final AnimationParseException ex) { + errorViewCollector.addWarning(ErrorViewCategory.FACE_FILE_INVALID, "line " + ex.getLineNumber() + ": parsing error: " + ex.getMessage()); + } + } + + /** * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:36:00
|
Revision: 8334 http://gridarta.svn.sourceforge.net/gridarta/?rev=8334&view=rev Author: akirschbaum Date: 2010-06-10 07:35:54 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Fix possible file handle leak. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java Modified: trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-10 07:34:56 UTC (rev 8333) +++ trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-10 07:35:54 UTC (rev 8334) @@ -66,11 +66,16 @@ * errors */ public static void loadAnimations(@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String path, @NotNull final File animFile, @NotNull final String startKey, final boolean ignoreOtherText) throws IOException, AnimationParseException { - final Reader in = new InputStreamReader(new FileInputStream(animFile), IOUtils.MAP_ENCODING); + final FileInputStream fileInputStream = new FileInputStream(animFile); try { - loadAnimations(animationObjects, errorViewCollector, in, startKey, ignoreOtherText, path, null); + final Reader inputStreamReader = new InputStreamReader(fileInputStream, IOUtils.MAP_ENCODING); + try { + loadAnimations(animationObjects, errorViewCollector, inputStreamReader, startKey, ignoreOtherText, path, null); + } finally { + inputStreamReader.close(); + } } finally { - in.close(); + fileInputStream.close(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:35:02
|
Revision: 8333 http://gridarta.svn.sourceforge.net/gridarta/?rev=8333&view=rev Author: akirschbaum Date: 2010-06-10 07:34:56 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Update comment. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:32:32 UTC (rev 8332) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:34:56 UTC (rev 8333) @@ -213,8 +213,7 @@ } /** - * Parsing face files (*.face). I think such files are no longer used and so - * is this code. + * Loads a .face file. * @param errorView the error view for reporting errors * @param path the base directory relative path of <code>filename</code> * @param filename filename This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:32:39
|
Revision: 8332 http://gridarta.svn.sourceforge.net/gridarta/?rev=8332&view=rev Author: akirschbaum Date: 2010-06-10 07:32:32 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Add support for "*.anim" files in arch directory. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-06-10 07:11:15 UTC (rev 8331) +++ trunk/crossfire/ChangeLog 2010-06-10 07:32:32 UTC (rev 8332) @@ -1,3 +1,7 @@ +2010-06-10 Andreas Kirschbaum + + * Add support for "*.anim" files in arch directory. + 2010-06-09 Andreas Kirschbaum * Do not crash when reverting a resized map. Properly revert Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:11:15 UTC (rev 8331) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:32:32 UTC (rev 8332) @@ -25,7 +25,9 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.List; import net.sf.gridarta.gui.io.FileFilters; import net.sf.gridarta.model.anim.AnimationObjects; @@ -40,6 +42,7 @@ import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.io.AnimationObjectsReader; import net.sf.gridarta.model.resource.AbstractResourcesReader; +import net.sf.gridarta.utils.Pair; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -116,8 +119,10 @@ archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); + final Collection<Pair<String, File>> animFiles = new ArrayList<Pair<String, File>>(); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", invObjects, archFaceProvider, errorView); + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", invObjects, archFaceProvider, errorView, animFiles); + loadAnimationsFromFiles(archDirectoryErrorViewCollector, animFiles); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); } @@ -143,8 +148,9 @@ * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to * @param errorView the error view to use + * @param animFiles the found animation files */ - private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView) { + private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -156,7 +162,7 @@ final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { - loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, invObjects, archFaceProvider, errorView); + loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, invObjects, archFaceProvider, errorView, animFiles); } } else { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); @@ -190,6 +196,8 @@ } } else if (FileFilters.faceFileFilter.accept(f)) { parseDefFace(errorView, f.getAbsolutePath(), path); + } else if (FileFilters.animFileFilter.accept(f)) { + animFiles.add(new Pair<String, File>(path, f)); } } } @@ -237,4 +245,28 @@ } } + /** + * This method loads animations that are separately defined by looping + * through all files that were previously collected by {@link + * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, + * String, File, int, String, String, List, ArchFaceProvider, ErrorView, + * Collection)}. Do not invoke this method if <code>loadArchetypesFromFiles()</code> + * wasn't invoked. + * @param errorViewCollector the error view collector for reporting errors + * @param animFiles the animation files + */ + private void loadAnimationsFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Iterable<Pair<String, File>> animFiles) { + for (final Pair<String, File> pair : animFiles) { + final String animPath = pair.getFirst(); + final File animFile = pair.getSecond(); + try { + AnimationObjectsReader.loadAnimations(animationObjects, errorViewCollector, animPath, animFile, "anim ", false); + } catch (final IOException ex) { + errorViewCollector.addWarning(ErrorViewCategory.ANIM_FILE_INVALID, ex.getMessage() + ", " + animFile); + } catch (final AnimationParseException ex) { + errorViewCollector.addWarning(ErrorViewCategory.ANIM_ENTRY_INVALID, "line " + ex.getLineNumber() + ": parsing error: " + ex.getMessage() + ", " + animFile); + } + } + } + } // class FilesResourcesReader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:11:22
|
Revision: 8331 http://gridarta.svn.sourceforge.net/gridarta/?rev=8331&view=rev Author: akirschbaum Date: 2010-06-10 07:11:15 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Inline functions. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:09:56 UTC (rev 8330) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:11:15 UTC (rev 8331) @@ -191,7 +191,7 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - if (isValidAnimationFile(name)) { + if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } } else if (FileFilters.animFileFilter.accept(f)) { @@ -201,15 +201,6 @@ } /** - * Returns whether an animation file name should be processed. - * @param name the base name of the animation file name - * @return whether the file is valid and should be processed - */ - private boolean isValidAnimationFile(final String name) { - return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); - } - - /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:09:56 UTC (rev 8330) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:11:15 UTC (rev 8331) @@ -185,7 +185,7 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - if (isValidAnimationFile(name)) { + if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } } else if (FileFilters.faceFileFilter.accept(f)) { @@ -195,15 +195,6 @@ } /** - * Returns whether an animation file name should be processed. - * @param name the base name of the animation file name - * @return whether the file is valid and should be processed - */ - private boolean isValidAnimationFile(final String name) { - return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); - } - - /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:09:56 UTC (rev 8330) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:11:15 UTC (rev 8331) @@ -191,7 +191,7 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - if (isValidAnimationFile(name)) { + if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } } else if (FileFilters.animFileFilter.accept(f)) { @@ -201,15 +201,6 @@ } /** - * Returns whether an animation file name should be processed. - * @param name the base name of the animation file name - * @return whether the file is valid and should be processed - */ - private boolean isValidAnimationFile(final String name) { - return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); - } - - /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:10:03
|
Revision: 8330 http://gridarta.svn.sourceforge.net/gridarta/?rev=8330&view=rev Author: akirschbaum Date: 2010-06-10 07:09:56 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:08:24 UTC (rev 8329) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:09:56 UTC (rev 8330) @@ -206,7 +206,7 @@ * @return whether the file is valid and should be processed */ private boolean isValidAnimationFile(final String name) { - return true; + return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:08:24 UTC (rev 8329) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:09:56 UTC (rev 8330) @@ -206,7 +206,7 @@ * @return whether the file is valid and should be processed */ private boolean isValidAnimationFile(final String name) { - return true; + return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:08:31
|
Revision: 8329 http://gridarta.svn.sourceforge.net/gridarta/?rev=8329&view=rev Author: akirschbaum Date: 2010-06-10 07:08:24 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Extract code into functions. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:08:24 UTC (rev 8329) @@ -191,7 +191,9 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); + if (isValidAnimationFile(name)) { + addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); + } } else if (FileFilters.animFileFilter.accept(f)) { animFiles.add(new Pair<String, File>(path, f)); } @@ -199,6 +201,15 @@ } /** + * Returns whether an animation file name should be processed. + * @param name the base name of the animation file name + * @return whether the file is valid and should be processed + */ + private boolean isValidAnimationFile(final String name) { + return true; + } + + /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:08:24 UTC (rev 8329) @@ -185,7 +185,7 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - if (archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + ".")) { + if (isValidAnimationFile(name)) { addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); } } else if (FileFilters.faceFileFilter.accept(f)) { @@ -195,6 +195,15 @@ } /** + * Returns whether an animation file name should be processed. + * @param name the base name of the animation file name + * @return whether the file is valid and should be processed + */ + private boolean isValidAnimationFile(final String name) { + return archetypeSet.getImageSet() == null || name.contains("." + archetypeSet.getImageSet() + "."); + } + + /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:08:24 UTC (rev 8329) @@ -191,7 +191,9 @@ new ErrorViewCollector(errorView, f).addWarning(ErrorViewCategory.ARCHETYPE_FILE_INVALID, ex.getMessage()); } } else if (FileFilters.pngFileFilter.accept(f)) { - addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); + if (isValidAnimationFile(name)) { + addPNGFace(f.getAbsolutePath(), path, name, errorView, archFaceProvider); + } } else if (FileFilters.animFileFilter.accept(f)) { animFiles.add(new Pair<String, File>(path, f)); } @@ -199,6 +201,15 @@ } /** + * Returns whether an animation file name should be processed. + * @param name the base name of the animation file name + * @return whether the file is valid and should be processed + */ + private boolean isValidAnimationFile(final String name) { + return true; + } + + /** * Returns whether a file name should be processed. * @param folderLevel the folder level * @param name the base name of the file name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:04:57
|
Revision: 8328 http://gridarta.svn.sourceforge.net/gridarta/?rev=8328&view=rev Author: akirschbaum Date: 2010-06-10 07:04:51 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Remove unused parameters. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) @@ -121,7 +121,7 @@ final Collection<Pair<String, File>> animFiles = new ArrayList<Pair<String, File>>(); addPNGFace(new File(archDirectory, "dev/editor/bug.101.png").getAbsolutePath(), "/dev/editor", "bug.101.png", errorView, archFaceProvider); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", invObjects, archFaceProvider, errorView, animFiles); loadAnimationsFromFiles(archDirectoryErrorViewCollector, animFiles); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); @@ -145,14 +145,12 @@ * @param folderLevel level of the folder * @param panelName the panel to add archetypes to * @param folderName the folder to add archetypes to - * @param noPanel set this to true if the file should be omitted from the - * panel. * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to * @param errorView the error view to use * @param animFiles the found animation files */ - private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { + private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -164,7 +162,7 @@ final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { - loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, noPanel || name.equalsIgnoreCase("intern"), invObjects, archFaceProvider, errorView, animFiles); + loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, invObjects, archFaceProvider, errorView, animFiles); } } else { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); @@ -214,9 +212,9 @@ * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, - * String, File, int, String, String, boolean, List, ArchFaceProvider, - * ErrorView, Collection)}. Do not invoke this method if - * <code>loadArchetypesFromFiles()</code> wasn't invoked. + * String, File, int, String, String, List, ArchFaceProvider, ErrorView, + * Collection)}. Do not invoke this method if <code>loadArchetypesFromFiles()</code> + * wasn't invoked. * @param errorViewCollector the error view collector for reporting errors * @param animFiles the animation files */ Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) @@ -117,7 +117,7 @@ final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView); + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", invObjects, archFaceProvider, errorView); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); } @@ -140,13 +140,11 @@ * @param folderLevel level of the folder * @param panelName the panel to add archetypes to * @param folderName the folder to add archetypes to - * @param noPanel set this to true if the file should be omitted from the - * panel. * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to * @param errorView the error view to use */ - private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView) { + private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -158,7 +156,7 @@ final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { - loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, false, invObjects, archFaceProvider, errorView); + loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, invObjects, archFaceProvider, errorView); } } else { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:04:51 UTC (rev 8328) @@ -121,7 +121,7 @@ final Collection<Pair<String, File>> animFiles = new ArrayList<Pair<String, File>>(); addPNGFace(new File(archDirectory, "dev/editor/bug.101.png").getAbsolutePath(), "/dev/editor", "bug.101.png", errorView, archFaceProvider); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", invObjects, archFaceProvider, errorView, animFiles); loadAnimationsFromFiles(archDirectoryErrorViewCollector, animFiles); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); @@ -145,14 +145,12 @@ * @param folderLevel level of the folder * @param panelName the panel to add archetypes to * @param folderName the folder to add archetypes to - * @param noPanel set this to true if the file should be omitted from the - * panel. * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to * @param errorView the error view to use * @param animFiles the found animation files */ - private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { + private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -164,7 +162,7 @@ final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { - loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, noPanel || name.equalsIgnoreCase("intern"), invObjects, archFaceProvider, errorView, animFiles); + loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, invObjects, archFaceProvider, errorView, animFiles); } } else { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); @@ -214,9 +212,9 @@ * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, - * String, File, int, String, String, boolean, List, ArchFaceProvider, - * ErrorView, Collection)}. Do not invoke this method if - * <code>loadArchetypesFromFiles()</code> wasn't invoked. + * String, File, int, String, String, List, ArchFaceProvider, ErrorView, + * Collection)}. Do not invoke this method if <code>loadArchetypesFromFiles()</code> + * wasn't invoked. * @param errorViewCollector the error view collector for reporting errors * @param animFiles the animation files */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 07:02:31
|
Revision: 8327 http://gridarta.svn.sourceforge.net/gridarta/?rev=8327&view=rev Author: akirschbaum Date: 2010-06-10 07:02:25 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Extract code into functions. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) @@ -156,7 +156,7 @@ final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels - if (!(folderLevel == 1 && name.equalsIgnoreCase("dev"))) { + if (isValidEntry(folderLevel, name)) { final String[] entries = f.list(); if (entries != null) { Arrays.sort(entries); @@ -201,6 +201,16 @@ } /** + * Returns whether a file name should be processed. + * @param folderLevel the folder level + * @param name the base name of the file name + * @return whether the entry is valid and shoudl be processed + */ + private boolean isValidEntry(final int folderLevel, final String name) { + return folderLevel != 1 || !name.equalsIgnoreCase("dev"); + } + + /** * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) @@ -150,7 +150,7 @@ final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels - if (!name.equalsIgnoreCase("cvs") && !name.equalsIgnoreCase("dev") && !name.startsWith(".")) { + if (isValidEntry(folderLevel, name)) { final String[] entries = f.list(); if (entries != null) { Arrays.sort(entries); @@ -197,6 +197,16 @@ } /** + * Returns whether a file name should be processed. + * @param folderLevel the folder level + * @param name the base name of the file name + * @return whether the entry is valid and shoudl be processed + */ + private boolean isValidEntry(final int folderLevel, final String name) { + return !name.equalsIgnoreCase("cvs") && !name.equalsIgnoreCase("dev") && !name.startsWith("."); + } + + /** * Parsing face files (*.face). I think such files are no longer used and so * is this code. * @param errorView the error view for reporting errors Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 07:02:25 UTC (rev 8327) @@ -156,7 +156,7 @@ final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels - if (!(folderLevel == 1 && name.equalsIgnoreCase("dev"))) { + if (isValidEntry(folderLevel, name)) { final String[] entries = f.list(); if (entries != null) { Arrays.sort(entries); @@ -201,6 +201,16 @@ } /** + * Returns whether a file name should be processed. + * @param folderLevel the folder level + * @param name the base name of the file name + * @return whether the entry is valid and shoudl be processed + */ + private boolean isValidEntry(final int folderLevel, final String name) { + return folderLevel != 1 || !name.equalsIgnoreCase("dev"); + } + + /** * This method loads animations that are separately defined by looping * through all files that were previously collected by {@link * #loadArchetypesFromFiles(ErrorViewCollector, AbstractArchetypeParser, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:55:29
|
Revision: 8326 http://gridarta.svn.sourceforge.net/gridarta/?rev=8326&view=rev Author: akirschbaum Date: 2010-06-10 06:55:22 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Remove AbstractResourcesReader classes. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java Removed Paths: ------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java Deleted: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -1,58 +0,0 @@ -/* - * 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.var.atrinik.resource; - -import java.io.File; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.var.atrinik.model.archetype.Archetype; -import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; -import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * Loader for archetype files. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { - - /** - * Creates a new instance. - * @param collectedDirectory the collected directory - * @param animationObjects the animation objects instance - * @param faceObjects the face objects instance - */ - protected AbstractResourcesReader(@NotNull final File collectedDirectory, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { - super(collectedDirectory, animationObjects, faceObjects); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - protected String generateFaceName(@NotNull final String name) { - return name.substring(0, name.length() - 4); - } - -} // class AbstractResourcesReader Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/CollectedResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -37,6 +37,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; @@ -50,7 +51,7 @@ * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader { +public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -90,7 +91,7 @@ * @param animationObjects the animation objects instance */ public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects) { - super(collectedDirectory, animationObjects, faceObjects); + super(collectedDirectory, null, animationObjects, faceObjects); this.collectedDirectory = collectedDirectory; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.io.AnimationObjectsReader; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.utils.Pair; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -52,7 +53,7 @@ * Loads all resources from individual files. * @author Andreas Kirschbaum */ -public class FilesResourcesReader extends AbstractResourcesReader { +public class FilesResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -100,7 +101,7 @@ * @param archFaceProvider the arch face provider to use */ public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { - super(collectedDirectory, animationObjects, faceObjects); + super(collectedDirectory, null, animationObjects, faceObjects); this.archDirectory = archDirectory; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; Deleted: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -1,90 +0,0 @@ -/* - * 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.var.crossfire.resource; - -import java.io.File; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.archetype.ArchetypeSet; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.var.crossfire.model.archetype.Archetype; -import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; -import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * Loader for archetype files. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { - - /** - * The archetype set to update. - */ - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - - /** - * Creates a new instance. - * @param collectedDirectory the collected directory - * @param archetypeSet the archetype set to update - * @param faceObjects the face objects instance - * @param animationObjects the animation objects instance faces - */ - protected AbstractResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects) { - super(collectedDirectory, animationObjects, faceObjects); - this.archetypeSet = archetypeSet; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - protected String generateFaceName(@NotNull final String name) { - if (archetypeSet.getImageSet() != null) { - // we have to snip out the image set information here from - // the 'name', and the ".png": (e.g. blocked.base.111.png -> blocked.111) - int firstDot = 0; - int secondDot = 0; - for (int t = 0; t < name.length() && secondDot == 0; t++) { - if (name.charAt(t) == '.') { - if (firstDot == 0) { - firstDot = t; - } else { - secondDot = t; - } - } - } - - if (firstDot != 0 && secondDot != 0) { - return name.substring(0, firstDot) + name.substring(secondDot, name.length() - 4); - } else { - return name.substring(0, name.length() - 4); - } - } - - // no image set: we need only cut off the ".png" - return name.substring(0, name.length() - 4); - } - -} // class AbstractResourcesReader Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -37,6 +37,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; @@ -52,7 +53,7 @@ * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader { +public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -106,7 +107,7 @@ * @param smoothFaces the smooth faces to update */ public CollectedResourcesReader(@NotNull final File configurationDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final SmoothFaces smoothFaces) { - super(collectedDirectory, archetypeSet, faceObjects, animationObjects); + super(collectedDirectory, archetypeSet.getImageSet(), animationObjects, faceObjects); this.configurationDirectory = configurationDirectory; this.collectedDirectory = collectedDirectory; this.archetypeSet = archetypeSet; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -39,6 +39,7 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.io.AnimationObjectsReader; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -50,7 +51,7 @@ * Loads all resources from individual files. * @author Andreas Kirschbaum */ -public class FilesResourcesReader extends AbstractResourcesReader { +public class FilesResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -98,7 +99,7 @@ * @param archFaceProvider the arch face provider to use */ public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { - super(collectedDirectory, archetypeSet, faceObjects, animationObjects); + super(collectedDirectory, archetypeSet.getImageSet(), animationObjects, faceObjects); this.archDirectory = archDirectory; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; Deleted: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -1,58 +0,0 @@ -/* - * 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.var.daimonin.resource; - -import java.io.File; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.var.daimonin.model.archetype.Archetype; -import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; -import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * Loader for archetype files. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { - - /** - * Creates a new instance. - * @param collectedDirectory the collected directory - * @param animationObjects the animation objects instance - * @param faceObjects the face objects instance - */ - protected AbstractResourcesReader(@NotNull final File collectedDirectory, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { - super(collectedDirectory, animationObjects, faceObjects); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - protected String generateFaceName(@NotNull final String name) { - return name.substring(0, name.length() - 4); - } - -} // class AbstractResourcesReader Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/CollectedResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -37,6 +37,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; @@ -50,7 +51,7 @@ * Loads all resources from collected files. * @author Andreas Kirschbaum */ -public class CollectedResourcesReader extends AbstractResourcesReader { +public class CollectedResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -90,7 +91,7 @@ * @param animationObjects the animation objects instance */ public CollectedResourcesReader(@NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects) { - super(collectedDirectory, animationObjects, faceObjects); + super(collectedDirectory, null, animationObjects, faceObjects); this.collectedDirectory = collectedDirectory; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.io.AnimationObjectsReader; +import net.sf.gridarta.model.resource.AbstractResourcesReader; import net.sf.gridarta.utils.Pair; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; @@ -52,7 +53,7 @@ * Loads all resources from individual files. * @author Andreas Kirschbaum */ -public class FilesResourcesReader extends AbstractResourcesReader { +public class FilesResourcesReader extends AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The logger for printing log messages. @@ -100,7 +101,7 @@ * @param archFaceProvider the arch face provider to use */ public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { - super(collectedDirectory, animationObjects, faceObjects); + super(collectedDirectory, null, animationObjects, faceObjects); this.archDirectory = archDirectory; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java 2010-06-10 06:55:22 UTC (rev 8326) @@ -50,6 +50,7 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Abstract base class for archetype set loader classes. @@ -77,6 +78,13 @@ private final File collectedDirectory; /** + * The current image set. Set to <code>null</code> if no explicit image set + * is used. + */ + @Nullable + private final String imageSet; + + /** * The animation objects instance. */ @NotNull @@ -91,11 +99,13 @@ /** * Creates a new instance. * @param collectedDirectory the collected directory + * @param imageSet the active image set or <code>null</code> * @param animationObjects the animation objects instance * @param faceObjects the face objects instance */ - protected AbstractResourcesReader(@NotNull final File collectedDirectory, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { + protected AbstractResourcesReader(@NotNull final File collectedDirectory, @Nullable final String imageSet, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { this.collectedDirectory = collectedDirectory; + this.imageSet = imageSet; this.animationObjects = animationObjects; this.faceObjects = faceObjects; } @@ -169,8 +179,33 @@ * @return facename generated from <var>name</var> */ @NotNull - protected abstract String generateFaceName(@NotNull final String name); + private String generateFaceName(@NotNull final String name) { + if (imageSet != null) { + // we have to snip out the image set information here from + // the 'name', and the ".png": (e.g. blocked.base.111.png -> blocked.111) + int firstDot = 0; + int secondDot = 0; + for (int t = 0; t < name.length() && secondDot == 0; t++) { + if (name.charAt(t) == '.') { + if (firstDot == 0) { + firstDot = t; + } else { + secondDot = t; + } + } + } + if (firstDot != 0 && secondDot != 0) { + return name.substring(0, firstDot) + name.substring(secondDot, name.length() - 4); + } else { + return name.substring(0, name.length() - 4); + } + } + + // no image set: we need only cut off the ".png" + return name.substring(0, name.length() - 4); + } + /** * Reads the resources. * @param errorView the error view for reporting problems This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:41:14
|
Revision: 8325 http://gridarta.svn.sourceforge.net/gridarta/?rev=8325&view=rev Author: akirschbaum Date: 2010-06-10 06:41:08 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:39:09 UTC (rev 8324) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) @@ -91,7 +91,7 @@ /** * Creates a new instance. - * @param archDirectory the "arch" directory + * @param archDirectory the "arch" directory to read * @param collectedDirectory the collected directory * @param archetypeSet the archetype set to update * @param archetypeParser the archetype parser to use @@ -139,7 +139,7 @@ * <code>arch/</code> directory tree. * @param errorViewCollector the error view collector for reporting errors * @param archetypeParser the archetype parser to use - * @param path the base directory relative path for <code>f</code> + * @param path the base directory relative path of <code>f</code> * @param f file path where we currently are * @param folderLevel level of the folder * @param panelName the panel to add archetypes to Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:39:09 UTC (rev 8324) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:41:08 UTC (rev 8325) @@ -139,7 +139,7 @@ * <code>arch/</code> directory tree. * @param errorViewCollector the error view collector for reporting errors * @param archetypeParser the archetype parser to use - * @param path the base directory relative path for <code>f</code> + * @param path the base directory relative path of <code>f</code> * @param f file path where we currently are * @param folderLevel level of the folder * @param panelName the panel to add archetypes to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:39:15
|
Revision: 8324 http://gridarta.svn.sourceforge.net/gridarta/?rev=8324&view=rev Author: akirschbaum Date: 2010-06-10 06:39:09 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Reorder fields. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:38:00 UTC (rev 8323) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:39:09 UTC (rev 8324) @@ -58,12 +58,6 @@ private static final Category log = Logger.getLogger(FilesResourcesReader.class); /** - * The {@link ArchFaceProvider} to use. - */ - @NotNull - private final ArchFaceProvider archFaceProvider; - - /** * The "arch" directory to read. */ @NotNull @@ -88,6 +82,12 @@ private final AnimationObjects animationObjects; /** + * The {@link ArchFaceProvider} to use. + */ + @NotNull + private final ArchFaceProvider archFaceProvider; + + /** * Creates a new instance. * @param archDirectory the "arch" directory to read * @param collectedDirectory the collected directory @@ -100,10 +100,10 @@ public FilesResourcesReader(@NotNull final File archDirectory, @NotNull final File collectedDirectory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects animationObjects, @NotNull final ArchFaceProvider archFaceProvider) { super(collectedDirectory, archetypeSet, faceObjects, animationObjects); this.archDirectory = archDirectory; - this.archFaceProvider = archFaceProvider; this.archetypeSet = archetypeSet; this.archetypeParser = archetypeParser; this.animationObjects = animationObjects; + this.archFaceProvider = archFaceProvider; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:38:08
|
Revision: 8323 http://gridarta.svn.sourceforge.net/gridarta/?rev=8323&view=rev Author: akirschbaum Date: 2010-06-10 06:38:00 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:33:51 UTC (rev 8322) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-06-10 06:38:00 UTC (rev 8323) @@ -60,7 +60,7 @@ private static final Category log = Logger.getLogger(FilesResourcesReader.class); /** - * The "arch" directory. + * The "arch" directory to read. */ @NotNull private final File archDirectory; @@ -78,7 +78,7 @@ private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; /** - * The {@link AnimationObjects} instance. + * The {@link AnimationObjects} to use. */ @NotNull private final AnimationObjects animationObjects; @@ -114,13 +114,13 @@ @NotNull @Override protected FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - archetypeSet.setLoadedFromArchive(false); // don't load from the collected files + archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); final Collection<Pair<String, File>> animFiles = new ArrayList<Pair<String, File>>(); addPNGFace(new File(archDirectory, "dev/editor/bug.101.png").getAbsolutePath(), "/dev/editor", "bug.101.png", errorView, archFaceProvider); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); // load arches & images from individual files + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); loadAnimationsFromFiles(archDirectoryErrorViewCollector, animFiles); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:33:51 UTC (rev 8322) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:38:00 UTC (rev 8323) @@ -47,7 +47,7 @@ import org.jetbrains.annotations.NotNull; /** - * Loaders for resources from individual files. + * Loads all resources from individual files. * @author Andreas Kirschbaum */ public class FilesResourcesReader extends AbstractResourcesReader { @@ -70,19 +70,19 @@ private final File archDirectory; /** - * The archetype set to update. + * The {@link ArchetypeSet} to update. */ @NotNull private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; /** - * The archetype parser to use. + * The {@link AbstractArchetypeParser} to use. */ @NotNull private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; /** - * The animation objects instance. + * The {@link AnimationObjects} to use. */ @NotNull private final AnimationObjects animationObjects; @@ -116,7 +116,7 @@ final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView); // load arches & images from individual files + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:33:51 UTC (rev 8322) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-06-10 06:38:00 UTC (rev 8323) @@ -60,7 +60,7 @@ private static final Category log = Logger.getLogger(FilesResourcesReader.class); /** - * The "arch" directory. + * The "arch" directory to read. */ @NotNull private final File archDirectory; @@ -78,7 +78,7 @@ private final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser; /** - * The {@link AnimationObjects} instance. + * The {@link AnimationObjects} to use. */ @NotNull private final AnimationObjects animationObjects; @@ -91,7 +91,7 @@ /** * Creates a new instance. - * @param archDirectory the "arch" directory + * @param archDirectory the "arch" directory to read * @param collectedDirectory the collected directory * @param archetypeSet the archetype set to update * @param archetypeParser the archetype parser to use @@ -114,13 +114,13 @@ @NotNull @Override protected FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { - archetypeSet.setLoadedFromArchive(false); // don't load from the collected files + archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); final Collection<Pair<String, File>> animFiles = new ArrayList<Pair<String, File>>(); addPNGFace(new File(archDirectory, "dev/editor/bug.101.png").getAbsolutePath(), "/dev/editor", "bug.101.png", errorView, archFaceProvider); final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); - loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); // load arches & images from individual files + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView, animFiles); loadAnimationsFromFiles(archDirectoryErrorViewCollector, animFiles); if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:33:58
|
Revision: 8322 http://gridarta.svn.sourceforge.net/gridarta/?rev=8322&view=rev Author: akirschbaum Date: 2010-06-10 06:33:51 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Unify error reporting. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:23:48 UTC (rev 8321) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:33:51 UTC (rev 8322) @@ -115,7 +115,8 @@ archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); - loadArchetypesFromFiles(errorView, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider); // load arches & images from individual files + final ErrorViewCollector archDirectoryErrorViewCollector = new ErrorViewCollector(errorView, archDirectory); + loadArchetypesFromFiles(archDirectoryErrorViewCollector, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider, errorView); // load arches & images from individual files if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); } @@ -131,7 +132,7 @@ /** * Loads all archetypes and faces by recursing through the * <code>arch/</code> directory tree. - * @param errorView the error view for reporting errors + * @param errorViewCollector the error view collector for reporting errors * @param archetypeParser the archetype parser to use * @param path the base directory relative path of <code>f</code> * @param f file path where we currently are @@ -142,8 +143,9 @@ * panel. * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to + * @param errorView the error view to use */ - private void loadArchetypesFromFiles(@NotNull final ErrorView errorView, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider) { + private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -155,10 +157,10 @@ final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { - loadArchetypesFromFiles(errorView, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, false, invObjects, archFaceProvider); + loadArchetypesFromFiles(errorViewCollector, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, false, invObjects, archFaceProvider, errorView); } } else { - errorView.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); + errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_DIR_INVALID, f.getPath()); } } } else if (f.isFile()) { // watch out for stuff that's not a file and not a directory!!! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:23:55
|
Revision: 8321 http://gridarta.svn.sourceforge.net/gridarta/?rev=8321&view=rev Author: akirschbaum Date: 2010-06-10 06:23:48 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:21:11 UTC (rev 8320) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:23:48 UTC (rev 8321) @@ -45,7 +45,6 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Loaders for resources from individual files. @@ -116,7 +115,7 @@ archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); - loadArchetypesFromFiles(errorView, archetypeParser, null, archDirectory, 0, "default", "default", false, invObjects, archFaceProvider); // load arches & images from individual files + loadArchetypesFromFiles(errorView, archetypeParser, "", archDirectory, 0, "default", "default", false, invObjects, archFaceProvider); // load arches & images from individual files if (log.isInfoEnabled()) { log.info("Loaded " + (animationObjects.size() - animationObjectsSize) + " animations from '" + archDirectory + "'."); } @@ -144,7 +143,7 @@ * @param invObjects collects all inventory objects * @param archFaceProvider the arch face provider to add to */ - private void loadArchetypesFromFiles(@NotNull final ErrorView errorView, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @Nullable final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider) { + private void loadArchetypesFromFiles(@NotNull final ErrorView errorView, @NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, final boolean noPanel, @NotNull final List<GameObject> invObjects, @NotNull final ArchFaceProvider archFaceProvider) { final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels @@ -154,7 +153,7 @@ Arrays.sort(entries); final String thisPanelName = folderLevel == 1 ? name : panelName; final String thisFolderName = folderLevel == 1 || folderLevel == 2 ? name : folderName; - final String newPath = path == null ? "" : path + "/" + name; + final String newPath = path.length() == 0 ? "" : path + "/" + name; for (final String entry : entries) { loadArchetypesFromFiles(errorView, archetypeParser, newPath, new File(f, entry), folderLevel + 1, thisPanelName, thisFolderName, false, invObjects, archFaceProvider); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-10 06:21:17
|
Revision: 8320 http://gridarta.svn.sourceforge.net/gridarta/?rev=8320&view=rev Author: akirschbaum Date: 2010-06-10 06:21:11 +0000 (Thu, 10 Jun 2010) Log Message: ----------- Make functions protected. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2010-06-09 18:41:40 UTC (rev 8319) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/CollectedResourcesReader.java 2010-06-10 06:21:11 UTC (rev 8320) @@ -120,7 +120,7 @@ */ @NotNull @Override - public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + protected FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { archetypeSet.setLoadedFromArchive(true); Map<String, String> animations = null; try { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-09 18:41:40 UTC (rev 8319) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-06-10 06:21:11 UTC (rev 8320) @@ -112,7 +112,7 @@ */ @NotNull @Override - public FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + protected FaceProvider read(@NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { archetypeSet.setLoadedFromArchive(false); final int animationObjectsSize = animationObjects.size(); final int archetypeCount = archetypeSet.getArchetypeCount(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 18:41:47
|
Revision: 8319 http://gridarta.svn.sourceforge.net/gridarta/?rev=8319&view=rev Author: akirschbaum Date: 2010-06-09 18:41:40 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Select text field contents in map properties dialog when they gain focus. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:47:21 UTC (rev 8318) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 18:41:40 UTC (rev 8319) @@ -35,7 +35,6 @@ import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JDialog; -import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -52,6 +51,7 @@ import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.IsoMapTilePane; import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; @@ -141,14 +141,14 @@ * @serial */ @NotNull - private final JFormattedTextField mapWidthField = new JFormattedTextField(); + private final JTextField mapWidthField = new JTextField(); /** * The height in squares. * @serial */ @NotNull - private final JFormattedTextField mapHeightField = new JFormattedTextField(); + private final JTextField mapHeightField = new JTextField(); /** * The outdoor attribute. @@ -162,42 +162,42 @@ * @serial */ @NotNull - private final JFormattedTextField fieldEnterX = new JFormattedTextField(); + private final JTextField fieldEnterX = new JTextField(); /** * The enter y attribute. * @serial */ @NotNull - private final JFormattedTextField fieldEnterY = new JFormattedTextField(); + private final JTextField fieldEnterY = new JTextField(); /** * The swap time attribute. * @serial */ @NotNull - private final JFormattedTextField fieldSwapTime = new JFormattedTextField(); + private final JTextField fieldSwapTime = new JTextField(); /** * The reset timeout attribute. * @serial */ @NotNull - private final JFormattedTextField fieldResetTimeout = new JFormattedTextField(); + private final JTextField fieldResetTimeout = new JTextField(); /** * The map difficulty attribute. * @serial */ @NotNull - private final JFormattedTextField fieldDifficulty = new JFormattedTextField(); + private final JTextField fieldDifficulty = new JTextField(); /** * The map darkness attribute. * @serial */ @NotNull - private final JFormattedTextField fieldDarkness = new JFormattedTextField(); + private final JTextField fieldDarkness = new JTextField(); /** * The fixed reset attribute. @@ -347,6 +347,19 @@ final Container layoutHack = new JPanel(new BorderLayout()); layoutHack.add(tabs); setMessage(layoutHack); + + TextComponentUtils.setAutoSelectOnFocus(mapDescription); + TextComponentUtils.setAutoSelectOnFocus(mapName); + TextComponentUtils.setAutoSelectOnFocus(mapRegion); + TextComponentUtils.setAutoSelectOnFocus(mapBackgroundMusic); + TextComponentUtils.setAutoSelectOnFocus(mapWidthField); + TextComponentUtils.setAutoSelectOnFocus(mapHeightField); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterX); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterY); + TextComponentUtils.setAutoSelectOnFocus(fieldSwapTime); + TextComponentUtils.setAutoSelectOnFocus(fieldResetTimeout); + TextComponentUtils.setAutoSelectOnFocus(fieldDifficulty); + TextComponentUtils.setAutoSelectOnFocus(fieldDarkness); } /** @@ -467,14 +480,14 @@ mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapWidth")), labelGbc); mapWidthField.setColumns(5); - mapWidthField.setValue(mapModel.getMapArchObject().getMapSize().getWidth()); + mapWidthField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getWidth())); gbc.gridwidth = 1; gbc.weightx = 1.0; mapPanel.add(mapWidthField, gbc); mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapHeight")), labelGbc); mapHeightField.setColumns(5); - mapHeightField.setValue(mapModel.getMapArchObject().getMapSize().getHeight()); + mapHeightField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getHeight())); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; mapPanel.add(mapHeightField, gbc); @@ -573,18 +586,18 @@ * @return the created panel */ @NotNull - private static Component createPanelLine(@NotNull final JFormattedTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { + private static Component createPanelLine(@NotNull final JTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { final Container lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); lineLayout.add(new JLabel(ACTION_BUILDER.getString(labelKey))); textField.setColumns(n); - textField.setValue(defaultValue); + textField.setText(Integer.toString(defaultValue)); lineLayout.add(textField); return lineLayout; } /** * Creates a checkbox-line, similar to {@link - * #createPanelLine(JFormattedTextField, int, int, String)}. + * #createPanelLine(JTextField, int, int, String)}. * @param checkBox the checkbox * @param state the initial state * @param labelKey the (attribute-)label key Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:47:21 UTC (rev 8318) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 18:41:40 UTC (rev 8319) @@ -30,7 +30,6 @@ import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; -import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -44,6 +43,7 @@ import net.sf.gridarta.gui.help.Help; import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.FlatMapTilePane; +import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; @@ -163,14 +163,14 @@ * @serial */ @NotNull - private final JTextField mapWidthField = new JFormattedTextField(); + private final JTextField mapWidthField = new JTextField(); /** * The height in squares. * @serial */ @NotNull - private final JTextField mapHeightField = new JFormattedTextField(); + private final JTextField mapHeightField = new JTextField(); /** * The unique attribute. @@ -198,49 +198,49 @@ * @serial */ @NotNull - private final JTextField fieldEnterX = new JFormattedTextField(); + private final JTextField fieldEnterX = new JTextField(); /** * The enter y attribute. * @serial */ @NotNull - private final JTextField fieldEnterY = new JFormattedTextField(); + private final JTextField fieldEnterY = new JTextField(); /** * The swap time. * @serial */ @NotNull - private final JTextField fieldSwapTime = new JFormattedTextField(); + private final JTextField fieldSwapTime = new JTextField(); /** * The reset timeout. * @serial */ @NotNull - private final JTextField fieldResetTimeout = new JFormattedTextField(); + private final JTextField fieldResetTimeout = new JTextField(); /** * The background music. * @serial */ @NotNull - private final JTextField fieldBackgroundMusic = new JFormattedTextField(); + private final JTextField fieldBackgroundMusic = new JTextField(); /** * The map difficulty. * @serial */ @NotNull - private final JTextField fieldDifficulty = new JFormattedTextField(); + private final JTextField fieldDifficulty = new JTextField(); /** * The map darkness. * @serial */ @NotNull - private final JTextField fieldDarkness = new JFormattedTextField(); + private final JTextField fieldDarkness = new JTextField(); /** * The fixed reset attribute. @@ -261,21 +261,21 @@ * @serial */ @NotNull - private final JTextField fieldShopgreed = new JFormattedTextField(); + private final JTextField fieldShopgreed = new JTextField(); /** * The shop maximum price. * @serial */ @NotNull - private final JTextField fieldShopMax = new JFormattedTextField(); + private final JTextField fieldShopMax = new JTextField(); /** * The shop minimum price. * @serial */ @NotNull - private final JTextField fieldShopMin = new JFormattedTextField(); + private final JTextField fieldShopMin = new JTextField(); /** * The shop's preferred race. @@ -289,42 +289,42 @@ * @serial */ @NotNull - private final JTextField fieldTemperature = new JFormattedTextField(); + private final JTextField fieldTemperature = new JTextField(); /** * The pressure. * @serial */ @NotNull - private final JTextField fieldPressure = new JFormattedTextField(); + private final JTextField fieldPressure = new JTextField(); /** * The humidity. * @serial */ @NotNull - private final JTextField fieldHumidity = new JFormattedTextField(); + private final JTextField fieldHumidity = new JTextField(); /** * The wind speed. * @serial */ @NotNull - private final JTextField fieldWindSpeed = new JFormattedTextField(); + private final JTextField fieldWindSpeed = new JTextField(); /** * The wind direction. * @serial */ @NotNull - private final JTextField fieldWindDirection = new JFormattedTextField(); + private final JTextField fieldWindDirection = new JTextField(); /** * The sky settings. * @serial */ @NotNull - private final JTextField fieldSkySetting = new JFormattedTextField(); + private final JTextField fieldSkySetting = new JTextField(); /** * The button for ok. @@ -420,6 +420,31 @@ final Container layoutHack = new JPanel(new BorderLayout()); layoutHack.add(tabs); setMessage(layoutHack); + + TextComponentUtils.setAutoSelectOnFocus(mapDescription); + TextComponentUtils.setAutoSelectOnFocus(mapLore); + TextComponentUtils.setAutoSelectOnFocus(mapName); + TextComponentUtils.setAutoSelectOnFocus(mapRegion); + TextComponentUtils.setAutoSelectOnFocus(mapWidthField); + TextComponentUtils.setAutoSelectOnFocus(mapHeightField); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterX); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterY); + TextComponentUtils.setAutoSelectOnFocus(fieldSwapTime); + TextComponentUtils.setAutoSelectOnFocus(fieldResetTimeout); + TextComponentUtils.setAutoSelectOnFocus(fieldBackgroundMusic); + TextComponentUtils.setAutoSelectOnFocus(fieldDifficulty); + TextComponentUtils.setAutoSelectOnFocus(fieldDarkness); + TextComponentUtils.setAutoSelectOnFocus(fieldShopItems); + TextComponentUtils.setAutoSelectOnFocus(fieldShopgreed); + TextComponentUtils.setAutoSelectOnFocus(fieldShopMax); + TextComponentUtils.setAutoSelectOnFocus(fieldShopMin); + TextComponentUtils.setAutoSelectOnFocus(fieldShopRace); + TextComponentUtils.setAutoSelectOnFocus(fieldTemperature); + TextComponentUtils.setAutoSelectOnFocus(fieldPressure); + TextComponentUtils.setAutoSelectOnFocus(fieldHumidity); + TextComponentUtils.setAutoSelectOnFocus(fieldWindSpeed); + TextComponentUtils.setAutoSelectOnFocus(fieldWindDirection); + TextComponentUtils.setAutoSelectOnFocus(fieldSkySetting); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:47:21 UTC (rev 8318) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 18:41:40 UTC (rev 8319) @@ -36,7 +36,6 @@ import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFileChooser; -import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -53,6 +52,7 @@ import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.IsoMapTilePane; import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; @@ -142,14 +142,14 @@ * @serial */ @NotNull - private final JFormattedTextField mapWidthField = new JFormattedTextField(); + private final JTextField mapWidthField = new JTextField(); /** * The height in squares. * @serial */ @NotNull - private final JFormattedTextField mapHeightField = new JFormattedTextField(); + private final JTextField mapHeightField = new JTextField(); /** * The "outdoor" attribute. @@ -163,42 +163,42 @@ * @serial */ @NotNull - private final JFormattedTextField fieldEnterX = new JFormattedTextField(); + private final JTextField fieldEnterX = new JTextField(); /** * The enter y coordinate. * @serial */ @NotNull - private final JFormattedTextField fieldEnterY = new JFormattedTextField(); + private final JTextField fieldEnterY = new JTextField(); /** * The swap time. * @serial */ @NotNull - private final JFormattedTextField fieldSwapTime = new JFormattedTextField(); + private final JTextField fieldSwapTime = new JTextField(); /** * The reset timeout. * @serial */ @NotNull - private final JFormattedTextField fieldResetTimeout = new JFormattedTextField(); + private final JTextField fieldResetTimeout = new JTextField(); /** * The map difficulty. * @serial */ @NotNull - private final JFormattedTextField fieldDifficulty = new JFormattedTextField(); + private final JTextField fieldDifficulty = new JTextField(); /** * The map darkness. * @serial */ @NotNull - private final JFormattedTextField fieldDarkness = new JFormattedTextField(); + private final JTextField fieldDarkness = new JTextField(); /** * The fixed reset attribute. @@ -342,6 +342,18 @@ final Container layoutHack = new JPanel(new BorderLayout()); layoutHack.add(tabs); setMessage(layoutHack); + + TextComponentUtils.setAutoSelectOnFocus(mapDescription); + TextComponentUtils.setAutoSelectOnFocus(mapName); + TextComponentUtils.setAutoSelectOnFocus(mapBackgroundMusic); + TextComponentUtils.setAutoSelectOnFocus(mapWidthField); + TextComponentUtils.setAutoSelectOnFocus(mapHeightField); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterX); + TextComponentUtils.setAutoSelectOnFocus(fieldEnterY); + TextComponentUtils.setAutoSelectOnFocus(fieldSwapTime); + TextComponentUtils.setAutoSelectOnFocus(fieldResetTimeout); + TextComponentUtils.setAutoSelectOnFocus(fieldDifficulty); + TextComponentUtils.setAutoSelectOnFocus(fieldDarkness); } /** @@ -459,14 +471,14 @@ mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapWidth")), labelGbc); mapWidthField.setColumns(5); - mapWidthField.setValue(mapModel.getMapArchObject().getMapSize().getWidth()); + mapWidthField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getWidth())); gbc.gridwidth = 1; gbc.weightx = 1.0; mapPanel.add(mapWidthField, gbc); mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapHeight")), labelGbc); mapHeightField.setColumns(5); - mapHeightField.setValue(mapModel.getMapArchObject().getMapSize().getHeight()); + mapHeightField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getHeight())); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; mapPanel.add(mapHeightField, gbc); @@ -565,11 +577,11 @@ * @return created panel */ @NotNull - private static Component createPanelLine(@NotNull final JFormattedTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { + private static Component createPanelLine(@NotNull final JTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { final Container lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); lineLayout.add(new JLabel(ACTION_BUILDER.getString(labelKey))); textField.setColumns(n); - textField.setValue(defaultValue); + textField.setText(Integer.toString(defaultValue)); lineLayout.add(textField); return lineLayout; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 17:47:27
|
Revision: 8318 http://gridarta.svn.sourceforge.net/gridarta/?rev=8318&view=rev Author: akirschbaum Date: 2010-06-09 17:47:21 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Fix comment. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java Modified: trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-09 17:46:25 UTC (rev 8317) +++ trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-09 17:47:21 UTC (rev 8318) @@ -171,7 +171,7 @@ } /** - * Processes a single line of an anim..mina block. + * Processes a complete anim..mina block. * @param animationObjects the animation objects to update * @param errorViewCollector the error view collector for reporting errors * @param path Path relative to the arch directory, used to create tree This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 17:46:32
|
Revision: 8317 http://gridarta.svn.sourceforge.net/gridarta/?rev=8317&view=rev Author: akirschbaum Date: 2010-06-09 17:46:25 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Rewrite expressions. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -707,7 +707,7 @@ } final int r = Integer.parseInt(s); // trying to parse // negative values are not allowed - if (r < 0 && !"Darkness".equals(label)) { + if (r < 0 && !label.equals("Darkness")) { throw new IllegalArgumentException(label + ": '" + s + "' is negative."); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -696,7 +696,7 @@ } final int r = Integer.parseInt(s); // trying to parse // negative values are not allowed - if (r < 0 && !"Darkness".equals(label)) { + if (r < 0 && !label.equals("Darkness")) { throw new IllegalArgumentException(label + ": '" + s + "' is negative."); } Modified: trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -160,7 +160,7 @@ /* ignore comment lines. */ } else if (line4.startsWith(startKey)) { throw new AnimationParseException("mina", line4, lineNumber); - } else if ("mina".equals(line4)) { + } else if (line4.equals("mina")) { processAnimationLine(animationObjects, errorViewCollector, path, animations, animName, animText.toString()); break; } else { Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -64,7 +64,7 @@ public NamedGameObjectMatcher parseMatcher(@NotNull final Element el, final int editType) throws ParsingException { final String currentLanguage = Locale.getDefault().getLanguage(); final String localName = el.getLocalName(); - if (!"GameObjectMatcher".equals(localName)) { + if (localName == null || !localName.equals("GameObjectMatcher")) { throw new ParsingException("wrong local element name: expected \"GameObjectMatcher\" but got \" + localName + \""); } final String id = el.getAttribute("id"); @@ -117,13 +117,15 @@ @NotNull private static GameObjectMatcher createMatcher(@NotNull final Element el) throws ParsingException { final String localName = el.getLocalName(); - if ("TypeNrs".equals(localName)) { + if (localName == null) { + // ignore + } else if (localName.equals("TypeNrs")) { return createTypeNrsArchObjectMatcher(el); - } else if ("Attrib".equals(localName)) { + } else if (localName.equals("Attrib")) { return createAttributeArchObjectMatcher(el); - } else if ("Or".equals(localName)) { + } else if (localName.equals("Or")) { return createOrMatcher(el); - } else if ("And".equals(localName)) { + } else if (localName.equals("And")) { return createAndMatcher(el); } throw new ParsingException("expected element node name to be one of \"TypeNrs\", \"Attrib\", \"Or\", \"And\"."); Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -340,7 +340,7 @@ // get stored path final String path = tabs.get(view.getSelectedIndex()); - if (path == null || path.length() == 0 || "<>".equals(path)) { + if (path == null || path.length() == 0 || path.equals("<>")) { return null; } else { return path; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java 2010-06-09 17:40:38 UTC (rev 8316) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java 2010-06-09 17:46:25 UTC (rev 8317) @@ -58,7 +58,7 @@ if (caretPos >= 7 && cfPythonPopup.isInitialized()) { final String fileName = textArea.getDocument().getText(textArea.getCaretPosition() - 9, 8); - if ("cfpython".equalsIgnoreCase(fileName)) { + if (fileName.equalsIgnoreCase("cfpython")) { final int line = textArea.getCaretLine(); final int offset = textArea.getCaretPosition() - textArea.getLineStartOffset(line); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 17:40:45
|
Revision: 8316 http://gridarta.svn.sourceforge.net/gridarta/?rev=8316&view=rev Author: akirschbaum Date: 2010-06-09 17:40:38 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Separate MapModelListener and MapArchObjectListener. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java trunk/model/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -243,22 +243,6 @@ * {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void errorsChanged(@NotNull final ErrorCollector<GameObject, MapArchObject, Archetype> errors) { // ignore } Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -346,7 +346,6 @@ @Override public void addMapModelListener(@NotNull final MapModelListener<G, A, R> listener) { mapModelListeners.add(listener); - mapArchObject.addMapArchObjectListener(listener); } /** @@ -355,7 +354,6 @@ @Override public void removeMapModelListener(@NotNull final MapModelListener<G, A, R> listener) { mapModelListeners.remove(listener); - mapArchObject.removeMapArchObjectListener(listener); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -20,11 +20,11 @@ package net.sf.gridarta.model.map.mapmodel; import java.io.File; +import java.util.EventListener; import java.util.Set; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.map.validation.ErrorCollector; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -34,7 +34,7 @@ * Interface for listeners listening on {@link MapModel} events. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapArchObjectListener { +public interface MapModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { /** * The size of a map has changed. Modified: trunk/model/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/model/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -42,6 +42,7 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; +import net.sf.gridarta.model.map.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; import net.sf.gridarta.model.map.validation.ErrorCollector; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; @@ -129,7 +130,15 @@ public void modifiedChanged(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel) { // ignore } + }; + /** + * The {@link MapArchObjectListener} registered to {@link #mapModel} to + * record map changes. + */ + @NotNull + private final MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { + /** * {@inheritDoc} */ @@ -450,6 +459,7 @@ result.setLength(0); mapModel.addMapModelListener(mapModelListener); + mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); Assert.assertEquals("", result.toString()); } Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.map.mapcontrol.MapControl; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; @@ -75,6 +76,13 @@ private final Map<MapModel<G, A, R>, MapModelListenerImpl> mapModelListeners = new IdentityHashMap<MapModel<G, A, R>, MapModelListenerImpl>(); /** + * All known {@link MapModel} instances. Maps map model instance to attached + * {@link MapArchObjectListenerImpl} instance. + */ + @NotNull + private final Map<MapModel<G, A, R>, MapArchObjectListenerImpl> mapArchObjectListeners = new IdentityHashMap<MapModel<G, A, R>, MapArchObjectListenerImpl>(); + + /** * The timestamp when to deliver scheduled map models. Set to zero when not * active. */ @@ -118,6 +126,9 @@ final MapModelListenerImpl mapModelListener = new MapModelListenerImpl(mapModel); mapModel.addMapModelListener(mapModelListener); mapModelListeners.put(mapModel, mapModelListener); + final MapArchObjectListenerImpl mapArchObjectListener = new MapArchObjectListenerImpl(mapModel); + mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); + mapArchObjectListeners.put(mapModel, mapArchObjectListener); scheduleMapModel(mapModel); } @@ -135,6 +146,10 @@ if (mapModelListener != null) { mapModel.removeMapModelListener(mapModelListener); } + final MapArchObjectListener mapArchObjectListener = mapArchObjectListeners.remove(mapModel); + if (mapArchObjectListener != null) { + mapModel.getMapArchObject().removeMapArchObjectListener(mapArchObjectListener); + } synchronized (sync) { scheduledMapModels.remove(mapControl.getMapModel()); } @@ -364,7 +379,29 @@ // ignore } + } + + /** + * A {@link MapArchObjectListener} attached to all existing maps. It calls + * {@link DelayedMapModelListenerManager#scheduleMapModel(MapModel)} for all + * map changes. + */ + private class MapArchObjectListenerImpl implements MapArchObjectListener { + /** + * The tracked {@link MapModel} instance. + */ + private final MapModel<G, A, R> mapModel; + + /** + * Creates a new instance. + * @param mapModel the map model to track + */ + private MapArchObjectListenerImpl(@NotNull final MapModel<G, A, R> mapModel) { + this.mapModel = mapModel; + } + + /** * {@inheritDoc} */ @Override Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -712,20 +712,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -183,20 +183,6 @@ /** {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -240,20 +240,6 @@ /** {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -177,20 +177,6 @@ updateActions(); } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.map.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.map.mapcontrol.MapControl; import net.sf.gridarta.model.map.mapcontrol.MapControlListener; @@ -113,36 +114,44 @@ /** {@inheritDoc} */ @Override - public void mapMetaChanged() { - updateTitle(); - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { + public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { // ignore } /** {@inheritDoc} */ @Override - public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { - // ignore + public void mapFileChanged(@Nullable final File oldMapFile) { + updateTitle(); } /** {@inheritDoc} */ @Override - public void mapFileChanged(@Nullable final File oldMapFile) { + public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { updateTitle(); } + }; + + /** + * The {@link MapArchObjectListener} used to detect changes in the map model + * that should be reflected in the window title. + */ + private final MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { + /** {@inheritDoc} */ @Override - public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { + public void mapMetaChanged() { updateTitle(); } + /** + * {@inheritDoc} + */ + @Override + public void mapSizeChanged(@NotNull final Size2D mapSize) { + // ignore + } + }; /** @@ -172,7 +181,9 @@ this.number = number; this.mapViewBasic = mapViewBasic; this.pathManager = pathManager; - mapControl.getMapModel().addMapModelListener(mapModelListener); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + mapModel.addMapModelListener(mapModelListener); + mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); mapControl.addMapControlListener(mapControlListener); getContentPane().setLayout(new BorderLayout()); getContentPane().add(mapViewBasic, BorderLayout.CENTER); @@ -187,7 +198,9 @@ getContentPane().remove(mapViewBasic); mapViewBasic.closeNotify(); mapControl.removeMapControlListener(mapControlListener); - mapControl.getMapModel().removeMapModelListener(mapModelListener); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + mapModel.getMapArchObject().removeMapArchObjectListener(mapArchObjectListener); + mapModel.removeMapModelListener(mapModelListener); //mapFileActions.closeNotify(); MenuUtils.disposeMenuElement(getJMenuBar()); } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -160,20 +160,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -238,22 +238,6 @@ * {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -148,20 +148,6 @@ updateName(); } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -274,22 +274,6 @@ * {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -264,20 +264,6 @@ refresh(); } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -109,20 +109,6 @@ } } - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -146,20 +146,6 @@ /** {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** {@inheritDoc} */ - @Override public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { // ignore } Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-09 16:50:25 UTC (rev 8315) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-09 17:40:38 UTC (rev 8316) @@ -567,20 +567,6 @@ /** {@inheritDoc} */ @Override - public void mapMetaChanged() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override - public void mapSizeChanged(@NotNull final Size2D mapSize) { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { // ignore } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 16:50:33
|
Revision: 8315 http://gridarta.svn.sourceforge.net/gridarta/?rev=8315&view=rev Author: akirschbaum Date: 2010-06-09 16:50:25 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Do not leave stray file after regression tests. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java Modified: trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java 2010-06-09 16:47:42 UTC (rev 8314) +++ trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java 2010-06-09 16:50:25 UTC (rev 8315) @@ -94,11 +94,17 @@ }; final MapMenuManager<TestGameObject, TestMapArchObject, TestArchetype> mapMenuManager = new MapMenuManager<TestGameObject, TestMapArchObject, TestArchetype>(testMapControlCreator.getMapManager(), mapMenuPreferences); - final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl1 = testMapControlCreator.newMapControl(new File("file"), "name1", new Size2D(1, 1)); - mapMenuManager.addRecent(mapControl1.getMapModel(), "title1"); - Assert.assertEquals(1, mapMenuPreferences.getSize()); - mapControl1.save(); - Assert.assertEquals(1, mapMenuPreferences.getSize()); + final File file = File.createTempFile("gridarta", null); + try { + final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl1 = testMapControlCreator.newMapControl(file, "name1", new Size2D(1, 1)); + mapMenuManager.addRecent(mapControl1.getMapModel(), "title1"); + Assert.assertEquals(1, mapMenuPreferences.getSize()); + mapControl1.save(); + Assert.assertEquals(1, mapMenuPreferences.getSize()); + } finally { + //noinspection ResultOfMethodCallIgnored + file.delete(); + } } } // class MapMenuManagerTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 16:47:48
|
Revision: 8314 http://gridarta.svn.sourceforge.net/gridarta/?rev=8314&view=rev Author: akirschbaum Date: 2010-06-09 16:47:42 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Fix NullPointerException if a map file cannot be saved. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java 2010-06-09 16:47:10 UTC (rev 8313) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java 2010-06-09 16:47:42 UTC (rev 8314) @@ -19,11 +19,11 @@ package net.sf.gridarta.gui.mapmenu; +import java.awt.Image; import java.awt.event.ActionEvent; import java.io.File; import java.io.IOException; import javax.swing.AbstractAction; -import javax.swing.Icon; import javax.swing.ImageIcon; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.mapimagecache.MapImageCache; @@ -127,15 +127,6 @@ } /** - * Get the icon of this file. - * @return icon of this file - */ - @Nullable - private Icon getIcon() { - return new ImageIcon(mapImageCache.getOrCreateIcon(mapFile)); - } - - /** * Returns the map file. * @return the map file */ @@ -177,7 +168,10 @@ * Updates the preview icon from the map model. */ public final void updateIcon() { - putValue(SMALL_ICON, getIcon()); + final Image icon = mapImageCache.getOrCreateIcon(mapFile); + if (icon != null) { + putValue(SMALL_ICON, new ImageIcon(icon)); + } } } // class MapMenuEntry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 16:47:16
|
Revision: 8313 http://gridarta.svn.sourceforge.net/gridarta/?rev=8313&view=rev Author: akirschbaum Date: 2010-06-09 16:47:10 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Fix incorrect @NotNull annotation. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java Modified: trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java 2010-06-09 11:06:06 UTC (rev 8312) +++ trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java 2010-06-09 16:47:10 UTC (rev 8313) @@ -250,7 +250,7 @@ * @param imageType the type of the image to return * @return the image or <code>null</code> if the image cannot be created */ - @NotNull + @Nullable private Image updateCaches(@NotNull final File mapFile, final ImageType imageType) { try { final MapControl<G, A, R> mapControl = mapManager.openMapFile(mapFile, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 11:06:17
|
Revision: 8312 http://gridarta.svn.sourceforge.net/gridarta/?rev=8312&view=rev Author: akirschbaum Date: 2010-06-09 11:06:06 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Include stack trace in error message. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-06-09 11:04:54 UTC (rev 8311) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-06-09 11:06:06 UTC (rev 8312) @@ -186,7 +186,7 @@ } }); } catch (final InvocationTargetException ex) { - log.error("InvocationTargetException: " + ex.getMessage()); + log.error("InvocationTargetException: " + ex.getMessage(), ex); } mapModels.clear(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-09 11:05:03
|
Revision: 8311 http://gridarta.svn.sourceforge.net/gridarta/?rev=8311&view=rev Author: akirschbaum Date: 2010-06-09 11:04:54 +0000 (Wed, 09 Jun 2010) Log Message: ----------- Remove unneeded type parameter. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObjectListener.java trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java Modified: trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-06-09 11:02:33 UTC (rev 8310) +++ trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-06-09 11:04:54 UTC (rev 8311) @@ -135,7 +135,7 @@ /** * The registered event listeners. */ - private final EventListenerList2<MapArchObjectListener<A>> listenerList = new EventListenerList2<MapArchObjectListener<A>>(MapArchObjectListener.class); + private final EventListenerList2<MapArchObjectListener> listenerList = new EventListenerList2<MapArchObjectListener>(MapArchObjectListener.class); /** * The transaction depth. A value of 0 means there's no transaction going @@ -184,7 +184,7 @@ this.mapSize = mapSize; setModified(); - for (final MapArchObjectListener<A> listener : listenerList.getListeners()) { + for (final MapArchObjectListener listener : listenerList.getListeners()) { listener.mapSizeChanged(mapSize); } } @@ -468,7 +468,7 @@ * {@inheritDoc} */ @Override - public void addMapArchObjectListener(@NotNull final MapArchObjectListener<A> listener) { + public void addMapArchObjectListener(@NotNull final MapArchObjectListener listener) { listenerList.add(listener); } @@ -476,7 +476,7 @@ * {@inheritDoc} */ @Override - public void removeMapArchObjectListener(@NotNull final MapArchObjectListener<A> listener) { + public void removeMapArchObjectListener(@NotNull final MapArchObjectListener listener) { listenerList.remove(listener); } @@ -550,7 +550,7 @@ * Fires a MapMetaChangedEvent. */ private void fireMetaChangedEvent() { - for (final MapArchObjectListener<A> listener : listenerList.getListeners()) { + for (final MapArchObjectListener listener : listenerList.getListeners()) { listener.mapMetaChanged(); } } Modified: trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-06-09 11:02:33 UTC (rev 8310) +++ trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-06-09 11:04:54 UTC (rev 8311) @@ -210,13 +210,13 @@ * Register an event listener. * @param listener MapArchObjectListener to register */ - void addMapArchObjectListener(@NotNull MapArchObjectListener<A> listener); + void addMapArchObjectListener(@NotNull MapArchObjectListener listener); /** * Unregister an event listener. * @param listener MapArchObjectListener to unregister */ - void removeMapArchObjectListener(@NotNull MapArchObjectListener<A> listener); + void removeMapArchObjectListener(@NotNull MapArchObjectListener listener); /** * Start a new transaction. Transactions may be nested. Transactions serve Modified: trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObjectListener.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObjectListener.java 2010-06-09 11:02:33 UTC (rev 8310) +++ trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObjectListener.java 2010-06-09 11:04:54 UTC (rev 8311) @@ -27,7 +27,7 @@ * Interface for listeners listening on map arch object changes. * @author Andreas Kirschbaum */ -public interface MapArchObjectListener<A extends MapArchObject<A>> extends EventListener { +public interface MapArchObjectListener extends EventListener { /** * Meta information of a map has changed. Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-06-09 11:02:33 UTC (rev 8310) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-06-09 11:04:54 UTC (rev 8311) @@ -195,7 +195,7 @@ * The {@link MapArchObjectListener} used to detect changes in {@link * #mapArchObject} and set the {@link #modified} flag accordingly. */ - private final transient MapArchObjectListener<A> mapArchObjectListener = new MapArchObjectListener<A>() { + private final transient MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { /** {@inheritDoc} */ @Override Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-06-09 11:02:33 UTC (rev 8310) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-06-09 11:04:54 UTC (rev 8311) @@ -34,7 +34,7 @@ * Interface for listeners listening on {@link MapModel} events. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapArchObjectListener<A> { +public interface MapModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapArchObjectListener { /** * The size of a map has changed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |