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...> - 2011-10-15 17:26:49
|
Revision: 9010 http://gridarta.svn.sourceforge.net/gridarta/?rev=9010&view=rev Author: akirschbaum Date: 2011-10-15 17:26:43 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Add explicit clone() methods. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java trunk/src/app/net/sf/gridarta/gui/panel/tools/ToolSelector.java trunk/utils/src/app/net/sf/gridarta/utils/AlphaImageFilter.java Modified: trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java 2011-10-15 17:23:07 UTC (rev 9009) +++ trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java 2011-10-15 17:26:43 UTC (rev 9010) @@ -120,4 +120,12 @@ return checkBoxMenuItem; } + /** + * {@inheritDoc} + */ + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + } // class ViewAction Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java 2011-10-15 17:23:07 UTC (rev 9009) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java 2011-10-15 17:26:43 UTC (rev 9010) @@ -111,4 +111,12 @@ } } + /** + * {@inheritDoc} + */ + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + } Modified: trunk/src/app/net/sf/gridarta/gui/panel/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2011-10-15 17:23:07 UTC (rev 9009) +++ trunk/src/app/net/sf/gridarta/gui/panel/tools/ToolSelector.java 2011-10-15 17:26:43 UTC (rev 9010) @@ -260,6 +260,14 @@ setSelectedTool(tool); } + /** + * {@inheritDoc} + */ + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + } // class SelectionAction } // class ToolSelector Modified: trunk/utils/src/app/net/sf/gridarta/utils/AlphaImageFilter.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/AlphaImageFilter.java 2011-10-15 17:23:07 UTC (rev 9009) +++ trunk/utils/src/app/net/sf/gridarta/utils/AlphaImageFilter.java 2011-10-15 17:26:43 UTC (rev 9010) @@ -36,4 +36,12 @@ return rgb >>> 24 == 0 ? rgb : rgb & 0x00FFFFFF | 0x80000000; } + /** + * {@inheritDoc} + */ + @Override + public Object clone() { + return super.clone(); + } + } // class AlphaImageFilter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:23:14
|
Revision: 9009 http://gridarta.svn.sourceforge.net/gridarta/?rev=9009&view=rev Author: akirschbaum Date: 2011-10-15 17:23:07 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Suppress warnings. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-10-15 17:21:33 UTC (rev 9008) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-10-15 17:23:07 UTC (rev 9009) @@ -595,6 +595,7 @@ @Override public MapArchObject clone() { final MapArchObject clone = super.clone(); + //noinspection CloneCallsConstructors clone.loreText = new StringBuilder(loreText.toString()); return clone; } Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-10-15 17:21:33 UTC (rev 9008) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-10-15 17:23:07 UTC (rev 9009) @@ -701,6 +701,7 @@ // clone.archetype = archetype; // will NOT be cloned: archetypes are unique clone.gameObjectText = gameObjectText.clone(); if (msgText != null) { + //noinspection CloneCallsConstructors clone.msgText = new StringBuilder(msgText); } clone.multi = null; Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java 2011-10-15 17:21:33 UTC (rev 9008) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java 2011-10-15 17:23:07 UTC (rev 9009) @@ -107,6 +107,7 @@ } catch (final CloneNotSupportedException ex) { throw new AssertionError(ex); } + //noinspection CloneCallsConstructors clone.objectText = new StringBuilder(objectText); clone.attributeCache = new HashMap<String, String>(attributeCache); return clone; Modified: trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-10-15 17:21:33 UTC (rev 9008) +++ trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-10-15 17:23:07 UTC (rev 9009) @@ -667,6 +667,7 @@ } catch (final CloneNotSupportedException ex) { throw new AssertionError(ex); } + //noinspection CloneCallsConstructors clone.msgText = new StringBuilder(msgText.toString()); clone.tilePaths = tilePaths.clone(); return clone.getThis(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:21:40
|
Revision: 9008 http://gridarta.svn.sourceforge.net/gridarta/?rev=9008&view=rev Author: akirschbaum Date: 2011-10-15 17:21:33 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/doc/dev/SafeCopy.java Modified: trunk/src/doc/dev/SafeCopy.java =================================================================== --- trunk/src/doc/dev/SafeCopy.java 2011-10-15 17:18:47 UTC (rev 9007) +++ trunk/src/doc/dev/SafeCopy.java 2011-10-15 17:21:33 UTC (rev 9008) @@ -25,28 +25,24 @@ public class SafeCopy { - public static void main(final String... args) { + public static void main(final String... args) throws IOException { + final InputStream in = new FileInputStream(args[0]); try { - final InputStream in = new FileInputStream(args[0]); + final OutputStream out = new FileOutputStream(args[1]); try { - final OutputStream out = new FileOutputStream(args[1]); - try { - final byte[] buf = new byte[4096]; - while (true) { - final int bytesRead = in.read(buf); - if (bytesRead == -1) { - break; - } - out.write(buf, 0, bytesRead); + final byte[] buf = new byte[4096]; + while (true) { + final int bytesRead = in.read(buf); + if (bytesRead == -1) { + break; } - } finally { - out.close(); + out.write(buf, 0, bytesRead); } } finally { - in.close(); + out.close(); } - } catch (final IOException e) { - System.err.println(e); + } finally { + in.close(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:18:53
|
Revision: 9007 http://gridarta.svn.sourceforge.net/gridarta/?rev=9007&view=rev Author: akirschbaum Date: 2011-10-15 17:18:47 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove call to printStackTrace(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/plugin/parameter/IntegerParameterView.java Modified: trunk/src/app/net/sf/gridarta/gui/dialog/plugin/parameter/IntegerParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/plugin/parameter/IntegerParameterView.java 2011-10-15 17:05:52 UTC (rev 9006) +++ trunk/src/app/net/sf/gridarta/gui/dialog/plugin/parameter/IntegerParameterView.java 2011-10-15 17:18:47 UTC (rev 9007) @@ -59,11 +59,7 @@ @Override public void stateChanged(final ChangeEvent e) { - try { - IntegerParameterView.this.parameter.setValue((Integer) ((SpinnerNumberModel) value.getModel()).getNumber()); - } catch (final Exception ex) { - ex.printStackTrace(); - } + IntegerParameterView.this.parameter.setValue((Integer) ((SpinnerNumberModel) value.getModel()).getNumber()); } }); config = new JButton("..."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:05:58
|
Revision: 9006 http://gridarta.svn.sourceforge.net/gridarta/?rev=9006&view=rev Author: akirschbaum Date: 2011-10-15 17:05:52 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Detect truncated spells file. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2011-10-15 17:03:43 UTC (rev 9005) +++ trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2011-10-15 17:05:52 UTC (rev 9006) @@ -137,7 +137,12 @@ int counter = 0; while (true) { - readUntil(in, "{", "}"); + try { + readUntil(in, "{", "}"); + } catch (final EOFException ignored) { + // Eventually expected exception, don't handle. + break; + } readUntil(in, "\"", null); final String name = readUntil(in, "\"").trim(); readUntil(in, "}", null); @@ -155,8 +160,6 @@ } } catch (final FileNotFoundException ignored) { log.error("File '" + spellFile.getAbsolutePath() + "' not found!"); - } catch (final EOFException ignored) { - // Eventually expected exception, don't handle. } catch (final IOException ex) { log.error("Cannot read file '" + spellFile.getAbsolutePath() + "': " + ex.getMessage()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:03:49
|
Revision: 9005 http://gridarta.svn.sourceforge.net/gridarta/?rev=9005&view=rev Author: akirschbaum Date: 2011-10-15 17:03:43 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Suppress warnings. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/app/net/sf/gridarta/gui/panel/tools/DeletionTool.java Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2011-10-15 17:02:30 UTC (rev 9004) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2011-10-15 17:03:43 UTC (rev 9005) @@ -329,6 +329,7 @@ * linking * @throws IOException in case of I/O problems reading from * <var>reader</var>. + * @noinspection IfStatementWithIdenticalBranches */ private static void readInsideList(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final TreasureTreeNode parentNode, @NotNull final BufferedReader reader, @NotNull final List<TreasureTreeNode> needLink) throws IOException { TreasureTreeNode node = null; Modified: trunk/src/app/net/sf/gridarta/gui/panel/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2011-10-15 17:02:30 UTC (rev 9004) +++ trunk/src/app/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2011-10-15 17:03:43 UTC (rev 9005) @@ -235,6 +235,7 @@ * Delete an arch. * @param mapLoc position to delete topmost arch at * @param mapControl map control of map to delete arch from + * @noinspection IfStatementWithIdenticalBranches */ private void deleteArch(final Point mapLoc, final MapControl<G, A, R> mapControl) { if (mapControl.isPickmap() && pickmapSettings.isLocked()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 17:02:37
|
Revision: 9004 http://gridarta.svn.sourceforge.net/gridarta/?rev=9004&view=rev Author: akirschbaum Date: 2011-10-15 17:02:30 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/plugin/src/app/net/sf/gridarta/plugin/Plugin.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-10-15 16:59:01 UTC (rev 9003) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-10-15 17:02:30 UTC (rev 9004) @@ -197,7 +197,7 @@ /** * Returns whether this archetype type allows any inventory game objects, * regardless whether these types have "inv" specifications. - * @return whether this archetype type allows any inveotry game objects + * @return whether this archetype type allows any inventory game objects */ public boolean isAllowsAllInv() { return allowsAllInv; Modified: trunk/plugin/src/app/net/sf/gridarta/plugin/Plugin.java =================================================================== --- trunk/plugin/src/app/net/sf/gridarta/plugin/Plugin.java 2011-10-15 16:59:01 UTC (rev 9003) +++ trunk/plugin/src/app/net/sf/gridarta/plugin/Plugin.java 2011-10-15 17:02:30 UTC (rev 9004) @@ -58,7 +58,7 @@ private static final Category log = Logger.getLogger(Plugin.class); /** - * The plugin plugin's executable code. + * The executable code. */ @NotNull private String code = ""; @@ -70,7 +70,7 @@ private final List<PluginParameter<G, A, R>> parameters = new ArrayList<PluginParameter<G, A, R>>(); /** - * The plugin plugin's name. + * The plugin name. */ @NotNull private final String name; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2011-10-15 16:59:01 UTC (rev 9003) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2011-10-15 17:02:30 UTC (rev 9004) @@ -610,7 +610,7 @@ * @param oldIconWidth the width of the icon before rotation in pixel * @param oldIconHeight the height of the icon before rotation in pixel * @param newIconWidth the width of the icon after rotation in pixel - * @param newIconHeight the height of the icon atfer rotation in pixel + * @param newIconHeight the height of the icon after rotation in pixel */ private void paintScaledIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int zoom, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) { if (zoom <= 0 || zoom == 100) { @@ -638,7 +638,7 @@ * @param oldIconWidth the width of the icon before rotation in pixel * @param oldIconHeight the height of the icon before rotation in pixel * @param newIconWidth the width of the icon after rotation in pixel - * @param newIconHeight the height of the icon atfer rotation in pixel + * @param newIconHeight the height of the icon after rotation in pixel */ private void paintAlphaIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) { if (alpha <= 0 || alpha >= 255) { @@ -664,7 +664,7 @@ * @param oldIconWidth the width of the icon before rotation in pixel * @param oldIconHeight the height of the icon before rotation in pixel * @param newIconWidth the width of the icon after rotation in pixel - * @param newIconHeight the height of the icon atfer rotation in pixel + * @param newIconHeight the height of the icon after rotation in pixel */ private void paintRotatedIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) { if (rotate < 0.001) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:59:08
|
Revision: 9003 http://gridarta.svn.sourceforge.net/gridarta/?rev=9003&view=rev Author: akirschbaum Date: 2011-10-15 16:59:01 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Suppress warnings. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java 2011-10-15 16:55:11 UTC (rev 9002) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java 2011-10-15 16:59:01 UTC (rev 9003) @@ -180,6 +180,7 @@ */ @NotNull private String generateFaceName(@NotNull final String name) { + //noinspection VariableNotUsedInsideIf 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) Modified: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 16:55:11 UTC (rev 9002) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 16:59:01 UTC (rev 9003) @@ -352,6 +352,7 @@ line3.add(Box.createVerticalStrut(5)); replaceWithBox = new JComboBox(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByObject"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByCopyBuffer"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByPickmap"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByNothing") }); replaceWithBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceBy.shortdescription")); + //noinspection VariableNotUsedInsideIf if (replaceArch == null) { replaceWithBox.setSelectedIndex(REPLACE_WITH_NOTHING); } else { Modified: trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java 2011-10-15 16:55:11 UTC (rev 9002) +++ trunk/src/app/net/sf/gridarta/gui/panel/gameobjectattributes/ArchTab.java 2011-10-15 16:59:01 UTC (rev 9003) @@ -269,6 +269,7 @@ */ @Override protected final void refresh(@Nullable final G gameObject) { + //noinspection VariableNotUsedInsideIf setTabSeverity(gameObject == null ? Severity.DEFAULT : Severity.MODIFIED); // archNameField Modified: trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-10-15 16:55:11 UTC (rev 9002) +++ trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-10-15 16:59:01 UTC (rev 9003) @@ -382,6 +382,7 @@ final int innerWidth = size.width - padding.left - padding.right; final int innerHeight = size.height - padding.top - padding.bottom; int rows = 0; + //noinspection VariableNotUsedInsideIf if (cNW != null) { rows++; } @@ -394,6 +395,7 @@ if (cS != null || cE != null) { rows++; } + //noinspection VariableNotUsedInsideIf if (cSE != null) { rows++; } Modified: trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2011-10-15 16:55:11 UTC (rev 9002) +++ trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2011-10-15 16:59:01 UTC (rev 9003) @@ -197,6 +197,7 @@ if (actionListeners.size() != 2) { actionListeners.clear(); } + //noinspection VariableNotUsedInsideIf if (this.defaultDividerLocation != null) { addHierarchyListener(hierarchyListener); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:55:17
|
Revision: 9002 http://gridarta.svn.sourceforge.net/gridarta/?rev=9002&view=rev Author: akirschbaum Date: 2011-10-15 16:55:11 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Add nullable annotation. Modified Paths: -------------- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2011-10-15 16:53:10 UTC (rev 9001) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2011-10-15 16:55:11 UTC (rev 9002) @@ -125,7 +125,7 @@ * @param source the event source * @param actionCommand the action command */ - public void executeAction(final ActionListener listener, final Object source, final String actionCommand) { + public void executeAction(final ActionListener listener, final Object source, @Nullable final String actionCommand) { // create event final ActionEvent evt = new ActionEvent(source, ActionEvent.ACTION_PERFORMED, actionCommand); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:53:16
|
Revision: 9001 http://gridarta.svn.sourceforge.net/gridarta/?rev=9001&view=rev Author: akirschbaum Date: 2011-10-15 16:53:10 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-10-15 16:52:49 UTC (rev 9000) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-10-15 16:53:10 UTC (rev 9001) @@ -83,7 +83,7 @@ /** * @param prototype the base archetype for artifacts; <code>null</code> when - * parsig archetypes + * parsing archetypes */ public void init(@Nullable final R prototype, @NotNull final ErrorViewCollector errorViewCollector) { this.prototype = prototype; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:52:55
|
Revision: 9000 http://gridarta.svn.sourceforge.net/gridarta/?rev=9000&view=rev Author: akirschbaum Date: 2011-10-15 16:52:49 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Fix warnings about possible NullPointerExceptions. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-10-15 16:40:57 UTC (rev 8999) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-10-15 16:52:49 UTC (rev 9000) @@ -107,15 +107,24 @@ } public void setMsgText(@NotNull final String msgText) { + if (archetype == null) { + throw new IllegalStateException(); + } archetype.setMsgText(msgText); } @NotNull public String getArchetypeName() { + if (archetype == null) { + throw new IllegalStateException(); + } return archetype.getArchetypeName(); } public void addObjectText(@NotNull final String line) { + if (archetype == null) { + throw new IllegalStateException(); + } if (errorViewCollector == null) { throw new IllegalStateException(); } @@ -127,17 +136,26 @@ final String[] tmp = StringUtils.PATTERN_SPACES.split(line, 2); final String key = tmp[0]; if (tmp.length < 2) { - errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName() + ": invalid attribute definition: " + line); + assert archetype != null; + final String archetypeName = archetype.getArchetypeName(); + assert errorViewCollector != null; + errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetypeName + ": invalid attribute definition: " + line); return; } final String value = tmp[1]; final String previousValue = attributes.put(key, value); if (previousValue != null) { - errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName() + ": duplicate attribute definition: " + line + ", previous value was " + previousValue); + assert archetype != null; + final String archetypeName = archetype.getArchetypeName(); + assert errorViewCollector != null; + errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetypeName + ": duplicate attribute definition: " + line + ", previous value was " + previousValue); } } public void addLast(@NotNull final G invObject) { + if (archetype == null) { + throw new IllegalStateException(); + } archetype.addLast(invObject); } @@ -174,15 +192,21 @@ } public void setMultiX(final int multiX) { + if (archetype == null) { + throw new IllegalStateException(); + } archetype.setMultiX(multiX); } public void setMultiY(final int multiY) { + if (archetype == null) { + throw new IllegalStateException(); + } archetype.setMultiY(multiY); } /** - * @noinspection NullableProblems, TypeMayBeWeakened + * @noinspection TypeMayBeWeakened */ @NotNull protected R getArchetype() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:41:04
|
Revision: 8999 http://gridarta.svn.sourceforge.net/gridarta/?rev=8999&view=rev Author: akirschbaum Date: 2011-10-15 16:40:57 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove calls to default toString(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java trunk/model/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/model/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2011-10-15 16:39:45 UTC (rev 8998) +++ trunk/model/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2011-10-15 16:40:57 UTC (rev 8999) @@ -82,7 +82,7 @@ this.enabled = enabled; if (log.isDebugEnabled()) { - log.debug((enabled ? "enabling" : "disabling") + " filter " + this); + log.debug((enabled ? "enabling" : "disabling") + " filter"); } fireEvent(enabled ? FilterConfigChangeType.ENABLE : FilterConfigChangeType.DISABLE, this); } Modified: trunk/model/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2011-10-15 16:39:45 UTC (rev 8998) +++ trunk/model/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2011-10-15 16:40:57 UTC (rev 8999) @@ -84,7 +84,7 @@ oldConfig.removeConfigChangeListener(filterConfigListener); } if (log.isDebugEnabled()) { - log.debug(this + " removing config for " + filterName); + log.debug("removing config for " + filterName); } map.remove(filterName); break; @@ -93,7 +93,7 @@ final FilterConfig<?, ?> newConfig = filter.createConfig(); newConfig.addConfigChangeListener(filterConfigListener); if (log.isDebugEnabled()) { - log.debug(this + " adding config for " + filterName); + log.debug("adding config for " + filterName); } map.put(filterName, newConfig); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:39:52
|
Revision: 8998 http://gridarta.svn.sourceforge.net/gridarta/?rev=8998&view=rev Author: akirschbaum Date: 2011-10-15 16:39:45 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Make ValidationError.getParameter() abstract. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/AttributeRangeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/CustomTypeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareValidationError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/TilePathsError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedAnimError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedFaceError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -77,7 +77,7 @@ return reason; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -77,7 +77,7 @@ return message; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -66,7 +66,7 @@ return message; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -66,7 +66,7 @@ return message; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -77,7 +77,7 @@ return reason; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -66,7 +66,7 @@ return exitPath; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/AttributeRangeError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/AttributeRangeError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/AttributeRangeError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -100,7 +100,7 @@ return maxValue; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -62,10 +62,12 @@ @Nullable @Override public String getParameter(final int id) { - if (id == 0) { + switch (id) { + case 0: return Integer.toString(connected); - } else { - return super.getParameter(id); + + default: + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/CustomTypeError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/CustomTypeError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/CustomTypeError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -64,12 +64,15 @@ @Nullable @Override public String getParameter(final int id) { - if (id == 0) { + switch (id) { + case 0: return Integer.toString(archetypeType); - } else if (id == 1) { + + case 1: return Integer.toString(gameObjectType); - } else { - return super.getParameter(id); + + default: + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentInvError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -73,8 +73,10 @@ case 1: return envTypeDescription; + + default: + return null; } - return super.getParameter(id); } } // class EnvironmentInvError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentMapError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -62,8 +62,10 @@ switch (id) { case 0: return typeDescription; + + default: + return null; } - return super.getParameter(id); } } // class EnvironmentMapError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -59,4 +59,15 @@ return difficulty; } + /** + * {@inheritDoc} + */ + @Override + public String getParameter(final int id) { + switch(id){ + default: + return null; + } + } + } // class MapDifficultyError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareValidationError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareValidationError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareValidationError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -45,4 +45,15 @@ addMapSquare(mapSquare); } + /** + * {@inheritDoc} + */ + @Override + public String getParameter(final int id) { + switch(id){ + default: + return null; + } + } + } // class SquareValidationError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/TilePathsError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/TilePathsError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/TilePathsError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -74,7 +74,7 @@ return tilePath; default: - return super.getParameter(id); + return null; } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedAnimError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedAnimError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedAnimError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -59,7 +59,13 @@ @Nullable @Override public String getParameter(final int id) { - return id == 0 ? animationName : null; + switch (id) { + case 0: + return animationName; + + default: + return null; + } } } // class UnsetSlayingError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedFaceError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedFaceError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedFaceError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -59,7 +59,13 @@ @Nullable @Override public String getParameter(final int id) { - return id == 0 ? faceName : null; + switch (id) { + case 0: + return faceName; + + default: + return null; + } } } // class UnsetSlayingError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java 2011-10-15 16:31:03 UTC (rev 8997) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java 2011-10-15 16:39:45 UTC (rev 8998) @@ -195,9 +195,7 @@ * @return the error string */ @Nullable - public String getParameter(final int id) { - return null; - } + public abstract String getParameter(final int id); /** * Returns the error message for this validation error. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:31:09
|
Revision: 8997 http://gridarta.svn.sourceforge.net/gridarta/?rev=8997&view=rev Author: akirschbaum Date: 2011-10-15 16:31:03 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Suppress warning. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2011-10-15 16:25:29 UTC (rev 8996) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2011-10-15 16:31:03 UTC (rev 8997) @@ -86,6 +86,10 @@ return clone; } + /** + * {@inheritDoc} + * @noinspection RefusedBequest + */ @Override public String toString() { return content.toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:25:36
|
Revision: 8996 http://gridarta.svn.sourceforge.net/gridarta/?rev=8996&view=rev Author: akirschbaum Date: 2011-10-15 16:25:29 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Fix unchecked warning. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2011-10-15 16:18:02 UTC (rev 8995) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2011-10-15 16:25:29 UTC (rev 8996) @@ -133,7 +133,7 @@ * {@inheritDoc} */ @Override - public boolean isEqual(@NotNull final GameObject gameObject) { + public boolean isEqual(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { return super.isEqual(gameObject) && gameObject.getLoreText().equals(getLoreText()); } Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-10-15 16:18:02 UTC (rev 8995) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2011-10-15 16:25:29 UTC (rev 8996) @@ -848,11 +848,11 @@ * {@inheritDoc} */ @Override - public boolean isEqual(@NotNull final T gameObject) { + public boolean isEqual(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { if (!(gameObject instanceof AbstractBaseObject)) { return false; } - final AbstractBaseObject<G, A, R, T> abstractBaseObject = (AbstractBaseObject<G, A, R, T>) gameObject; + final AbstractBaseObject<?, ?, ?, ?> abstractBaseObject = (AbstractBaseObject<?, ?, ?, ?>) gameObject; if (!hasSameContents(abstractBaseObject)) { return false; } Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2011-10-15 16:18:02 UTC (rev 8995) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2011-10-15 16:25:29 UTC (rev 8996) @@ -516,7 +516,7 @@ * @param gameObject the other game object * @return <code>true</code> if this object equals the other object */ - boolean isEqual(@NotNull T gameObject); + boolean isEqual(@NotNull BaseObject<?, ?, ?, ?> gameObject); /** * Returns the direction of this Archetype or GameObject. Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2011-10-15 16:18:02 UTC (rev 8995) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2011-10-15 16:25:29 UTC (rev 8996) @@ -624,7 +624,7 @@ * @param gameObjectContainer the other game object container * @return <code>true</code> if this object equals the other object */ - public boolean hasSameContents(@NotNull final GameObjectContainer<G, A, R> gameObjectContainer) { + public boolean hasSameContents(@NotNull final GameObjectContainer<?, ?, ?> gameObjectContainer) { if (gameObjectContainer.contents.size() != contents.size()) { return false; } Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-10-15 16:18:02 UTC (rev 8995) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-10-15 16:25:29 UTC (rev 8996) @@ -22,6 +22,7 @@ import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -202,7 +203,7 @@ * {@inheritDoc} */ @Override - public boolean isEqual(@NotNull final G gameObject) { + public boolean isEqual(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { return super.isEqual(gameObject); // ignore "scriptArchData" // ignore "transFace" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:18:08
|
Revision: 8995 http://gridarta.svn.sourceforge.net/gridarta/?rev=8995&view=rev Author: akirschbaum Date: 2011-10-15 16:18:02 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Disable warning. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2011-10-15 16:13:34 UTC (rev 8994) +++ trunk/gridarta.ipr 2011-10-15 16:18:02 UTC (rev 8995) @@ -335,6 +335,7 @@ <inspection_tool class="BeforeClassOrAfterClassIsPublicStaticVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="BeforeOrAfterIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="BigDecimalEquals" enabled="true" level="WARNING" enabled_by_default="true" /> + <inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="CStyleArrayDeclaration" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="CachedNumberConstructorCall" enabled="true" level="WARNING" enabled_by_default="true" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 16:13:40
|
Revision: 8994 http://gridarta.svn.sourceforge.net/gridarta/?rev=8994&view=rev Author: akirschbaum Date: 2011-10-15 16:13:34 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Suppress warning. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java Modified: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java 2011-10-15 15:42:42 UTC (rev 8993) +++ trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java 2011-10-15 16:13:34 UTC (rev 8994) @@ -24,6 +24,7 @@ /** * Indexes maps by map name. Allows searching for maps by partial map name. * @author Andreas Kirschbaum + * @noinspection EmptyClass */ public class MapsIndex extends AbstractIndex<File> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 15:42:49
|
Revision: 8993 http://gridarta.svn.sourceforge.net/gridarta/?rev=8993&view=rev Author: akirschbaum Date: 2011-10-15 15:42:42 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Move MatchCriteria and implementations into model module. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/select/ trunk/model/src/app/net/sf/gridarta/model/select/ArchetypeNameMatchCriteria.java trunk/model/src/app/net/sf/gridarta/model/select/MatchCriteria.java trunk/model/src/app/net/sf/gridarta/model/select/ObjectNameMatchCriteria.java trunk/src/app/net/sf/gridarta/model/ Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ArchetypeNameMatchCriteria.java trunk/src/app/net/sf/gridarta/gui/dialog/replace/MatchCriteria.java trunk/src/app/net/sf/gridarta/gui/dialog/replace/ObjectNameMatchCriteria.java Copied: trunk/model/src/app/net/sf/gridarta/model/select/ArchetypeNameMatchCriteria.java (from rev 8991, trunk/src/app/net/sf/gridarta/gui/dialog/replace/ArchetypeNameMatchCriteria.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/select/ArchetypeNameMatchCriteria.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/select/ArchetypeNameMatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -0,0 +1,57 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.select; + +import java.util.regex.Pattern; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.japi.util.filter.file.GlobFileFilter; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link MatchCriteria} that matches by archetype name. + * @author Andreas Kirschbaum + */ +public class ArchetypeNameMatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MatchCriteria<G, A, R> { + + /** + * The archetype name to match. + */ + @NotNull + private final Pattern archetypeName; + + /** + * Creates a new instance. + * @param archetypeName the archetype name to match + */ + public ArchetypeNameMatchCriteria(@NotNull final String archetypeName) { + this.archetypeName = Pattern.compile(GlobFileFilter.createPatternForGlob(archetypeName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean matches(@NotNull final G gameObject) { + return archetypeName.matcher(gameObject.getArchetype().getArchetypeName()).matches(); + } + +} // class ArchetypeNameMatchCriteria Copied: trunk/model/src/app/net/sf/gridarta/model/select/MatchCriteria.java (from rev 8991, trunk/src/app/net/sf/gridarta/gui/dialog/replace/MatchCriteria.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/select/MatchCriteria.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/select/MatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -0,0 +1,40 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.select; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * Criteria for game object matchers. + * @author Andreas Kirschbaum + */ +public interface MatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Whether a {@link GameObject} matches this criteria. + * @param gameObject the game object to check + * @return whether the game object matches + */ + boolean matches(@NotNull G gameObject); + +} // interface MatchCriteria Copied: trunk/model/src/app/net/sf/gridarta/model/select/ObjectNameMatchCriteria.java (from rev 8991, trunk/src/app/net/sf/gridarta/gui/dialog/replace/ObjectNameMatchCriteria.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/select/ObjectNameMatchCriteria.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/select/ObjectNameMatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -0,0 +1,57 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.select; + +import java.util.regex.Pattern; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.japi.util.filter.file.GlobFileFilter; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link MatchCriteria} that matches by object name. + * @author Andreas Kirschbaum + */ +public class ObjectNameMatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MatchCriteria<G, A, R> { + + /** + * The object name to match. + */ + @NotNull + private final Pattern objectName; + + /** + * Creates a new instance. + * @param objectName the object name to match + */ + public ObjectNameMatchCriteria(@NotNull final String objectName) { + this.objectName = Pattern.compile(GlobFileFilter.createPatternForGlob(objectName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean matches(@NotNull final G gameObject) { + return objectName.matcher(gameObject.getBestName()).matches(); + } + +} Deleted: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ArchetypeNameMatchCriteria.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ArchetypeNameMatchCriteria.java 2011-10-15 15:31:43 UTC (rev 8992) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ArchetypeNameMatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -1,57 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.dialog.replace; - -import java.util.regex.Pattern; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.japi.util.filter.file.GlobFileFilter; -import org.jetbrains.annotations.NotNull; - -/** - * A {@link MatchCriteria} that matches by archetype name. - * @author Andreas Kirschbaum - */ -public class ArchetypeNameMatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MatchCriteria<G, A, R> { - - /** - * The archetype name to match. - */ - @NotNull - private final Pattern archetypeName; - - /** - * Creates a new instance. - * @param archetypeName the archetype name to match - */ - public ArchetypeNameMatchCriteria(@NotNull final String archetypeName) { - this.archetypeName = Pattern.compile(GlobFileFilter.createPatternForGlob(archetypeName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean matches(@NotNull final G gameObject) { - return archetypeName.matcher(gameObject.getArchetype().getArchetypeName()).matches(); - } - -} // class ArchetypeNameMatchCriteria Deleted: trunk/src/app/net/sf/gridarta/gui/dialog/replace/MatchCriteria.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/MatchCriteria.java 2011-10-15 15:31:43 UTC (rev 8992) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/MatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -1,40 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.dialog.replace; - -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * Criteria for game object matchers. - * @author Andreas Kirschbaum - */ -public interface MatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * Whether a {@link GameObject} matches this criteria. - * @param gameObject the game object to check - * @return whether the game object matches - */ - boolean matches(@NotNull G gameObject); - -} // interface MatchCriteria Deleted: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ObjectNameMatchCriteria.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ObjectNameMatchCriteria.java 2011-10-15 15:31:43 UTC (rev 8992) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ObjectNameMatchCriteria.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -1,57 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.dialog.replace; - -import java.util.regex.Pattern; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.japi.util.filter.file.GlobFileFilter; -import org.jetbrains.annotations.NotNull; - -/** - * A {@link MatchCriteria} that matches by object name. - * @author Andreas Kirschbaum - */ -public class ObjectNameMatchCriteria<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MatchCriteria<G, A, R> { - - /** - * The object name to match. - */ - @NotNull - private final Pattern objectName; - - /** - * Creates a new instance. - * @param objectName the object name to match - */ - public ObjectNameMatchCriteria(@NotNull final String objectName) { - this.objectName = Pattern.compile(GlobFileFilter.createPatternForGlob(objectName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean matches(@NotNull final G gameObject) { - return objectName.matcher(gameObject.getBestName()).matches(); - } - -} Modified: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 15:31:43 UTC (rev 8992) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 15:42:42 UTC (rev 8993) @@ -57,6 +57,9 @@ import net.sf.gridarta.model.mapmodel.InsertionModeSet; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.select.ArchetypeNameMatchCriteria; +import net.sf.gridarta.model.select.MatchCriteria; +import net.sf.gridarta.model.select.ObjectNameMatchCriteria; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.RandomUtils; import net.sf.japi.swing.action.ActionBuilder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-15 15:31:50
|
Revision: 8992 http://gridarta.svn.sourceforge.net/gridarta/?rev=8992&view=rev Author: akirschbaum Date: 2011-10-15 15:31:43 +0000 (Sat, 15 Oct 2011) Log Message: ----------- Remove redundant else statements. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-09-22 08:41:52 UTC (rev 8991) +++ trunk/src/app/net/sf/gridarta/gui/dialog/replace/ReplaceDialog.java 2011-10-15 15:31:43 UTC (rev 8992) @@ -616,41 +616,41 @@ // user selected "replace highlighted" but nothing is highlighted ACTION_BUILDER.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapModel().getMapArchObject().getMapName()); return false; + } + + final MatchCriteria<G, A, R> matchCriteria; + if (replaceCriteria.getSelectedIndex() == 0) { + matchCriteria = new ArchetypeNameMatchCriteria<G, A, R>(matchString); + } else if (replaceCriteria.getSelectedIndex() == 1) { + matchCriteria = new ObjectNameMatchCriteria<G, A, R>(matchString); } else { - final MatchCriteria<G, A, R> matchCriteria; - if (replaceCriteria.getSelectedIndex() == 0) { - matchCriteria = new ArchetypeNameMatchCriteria<G, A, R>(matchString); - } else if (replaceCriteria.getSelectedIndex() == 1) { - matchCriteria = new ObjectNameMatchCriteria<G, A, R>(matchString); - } else { - return false; - } + return false; + } - final int replaceDensity; - try { - replaceDensity = Integer.parseInt(replaceDensityInput.getText()); - } catch (final NumberFormatException ignored) { - ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity"); - return false; - } - if (replaceDensity < 1 || replaceDensity > 100) { - ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity"); - return false; - } + final int replaceDensity; + try { + replaceDensity = Integer.parseInt(replaceDensityInput.getText()); + } catch (final NumberFormatException ignored) { + ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity"); + return false; + } + if (replaceDensity < 1 || replaceDensity > 100) { + ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity"); + return false; + } - final int replaceCount = doReplace(matchCriteria, entireMap, deleteOnly, replaceDensity); - if (replaceCount > 0) { - if (replaceCount == 1) { - ACTION_BUILDER.showMessageDialog(this, "replacedOne"); - } else { - ACTION_BUILDER.showMessageDialog(this, "replacedMany", replaceCount); - } - return true; - } else { - ACTION_BUILDER.showMessageDialog(this, "replacedZero"); - return false; - } + final int replaceCount = doReplace(matchCriteria, entireMap, deleteOnly, replaceDensity); + if (replaceCount <= 0) { + ACTION_BUILDER.showMessageDialog(this, "replacedZero"); + return false; } + + if (replaceCount == 1) { + ACTION_BUILDER.showMessageDialog(this, "replacedOne"); + } else { + ACTION_BUILDER.showMessageDialog(this, "replacedMany", replaceCount); + } + return true; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-22 08:41:59
|
Revision: 8991 http://gridarta.svn.sourceforge.net/gridarta/?rev=8991&view=rev Author: akirschbaum Date: 2011-09-22 08:41:52 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Remove "Exits" panel from main window. It is redundant with Map|Go To Exit... Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsControl.java trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsView.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/atrinik/ChangeLog 2011-09-22 08:41:52 UTC (rev 8991) @@ -1,3 +1,8 @@ +2011-09-22 Andreas Kirschbaum + + * Remove "Exits" panel from main window. It is redundant with + Map|Go To Exit... + 2011-09-21 Andreas Kirschbaum * Do not index backup files (*~). Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/crossfire/ChangeLog 2011-09-22 08:41:52 UTC (rev 8991) @@ -1,3 +1,8 @@ +2011-09-22 Andreas Kirschbaum + + * Remove "Exits" panel from main window. It is redundant with + Map|Go To Exit... + 2011-09-21 Andreas Kirschbaum * Do not index backup files (*~). Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/daimonin/ChangeLog 2011-09-22 08:41:52 UTC (rev 8991) @@ -1,3 +1,8 @@ +2011-09-22 Andreas Kirschbaum + + * Remove "Exits" panel from main window. It is redundant with + Map|Go To Exit... + 2011-09-21 Andreas Kirschbaum * Do not index backup files (*~). Deleted: trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsControl.java 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsControl.java 2011-09-22 08:41:52 UTC (rev 8991) @@ -1,84 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.panel.connectionview; - -import java.io.File; -import net.sf.gridarta.gui.delayedmapmodel.DelayedMapModelListenerManager; -import net.sf.gridarta.gui.map.mapactions.MapActions; -import net.sf.gridarta.gui.map.mapactions.MapLocation; -import net.sf.gridarta.gui.map.mapview.MapViewManager; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.match.GameObjectMatcher; -import net.sf.gridarta.model.settings.GlobalSettings; -import org.jetbrains.annotations.NotNull; - -/** - * The controller of the "Exits" panel. - * @author Andreas Kirschbaum - */ -public class ExitsControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Control<MapLocation, G, A, R> { - - /** - * The {@link GlobalSettings} instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The {@link MapActions} instance for entering maps. - */ - @NotNull - private final MapActions<G, A, R> mapActions; - - /** - * Create a new instance. - * @param mapViewManager the map view manager - * @param delayedMapModelListenerManager the delayed map model listener - * manager to use - * @param exitGameObjectMatcher the game object matcher for selecting exits - * @param pathManager the path manager for converting relative exit paths - * @param globalSettings the global settings instance - * @param mapActions the map actions instance for entering maps - */ - public ExitsControl(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final PathManager pathManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapActions<G, A, R> mapActions) { - super(new ExitsView<G, A, R>(mapViewManager, delayedMapModelListenerManager, exitGameObjectMatcher, pathManager)); - this.globalSettings = globalSettings; - this.mapActions = mapActions; - } - - /** - * {@inheritDoc} - */ - @Override - protected void doubleClick(@NotNull final Connection<MapLocation> connection) { - final MapLocation mapLocation = connection.getKey(); - final String mapPath = mapLocation.getMapPath(); - if (!mapPath.startsWith("/")) { - return; - } - - final File mapFile = new File(globalSettings.getMapsDirectory().getAbsolutePath(), mapPath.substring(1)); - mapActions.enterMap(mapFile, mapLocation.getMapCoordinate()); - } - -} // class ExitsControl Deleted: trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsView.java 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/gui/panel/connectionview/ExitsView.java 2011-09-22 08:41:52 UTC (rev 8991) @@ -1,157 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.panel.connectionview; - -import java.awt.Point; -import java.util.Comparator; -import net.sf.gridarta.gui.delayedmapmodel.DelayedMapModelListenerManager; -import net.sf.gridarta.gui.map.mapactions.MapLocation; -import net.sf.gridarta.gui.map.mapactions.NoExitPathException; -import net.sf.gridarta.gui.map.mapview.MapViewManager; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.match.GameObjectMatcher; -import org.jetbrains.annotations.NotNull; - -/** - * The view part of the "Exits" panel. - * @author Andreas Kirschbaum - */ -public class ExitsView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends View<MapLocation, G, A, R> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * A {@link Comparator} that compares {@link MapLocation} instances by map - * path and map coordinate. - */ - @NotNull - private static final Comparator<MapLocation> mapLocationComparator = new Comparator<MapLocation>() { - - @Override - public int compare(@NotNull final MapLocation o1, @NotNull final MapLocation o2) { - final int cmp = o1.getMapPath().compareTo(o2.getMapPath()); - if (cmp != 0) { - return cmp; - } - - final Point p1 = o1.getMapCoordinate(); - final Point p2 = o2.getMapCoordinate(); - if (p1.x < p2.x) { - return -1; - } - if (p1.x > p2.x) { - return +1; - } - if (p1.y < p2.y) { - return -1; - } - if (p1.y > p2.y) { - return +1; - } - - return 0; - } - - }; - - /** - * The {@link GameObjectMatcher} for selecting exits. - */ - @NotNull - private final GameObjectMatcher exitGameObjectMatcher; - - /** - * The {@link PathManager} for converting relative exit paths. - */ - @NotNull - private final PathManager pathManager; - - /** - * Creates a new instance. - * @param mapViewManager the map view manager - * @param delayedMapModelListenerManager the delayed map model listener - * manager to use - * @param exitGameObjectMatcher the game object matcher for selecting exits - * @param pathManager the path manager for converting relative exit paths - */ - public ExitsView(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final PathManager pathManager) { - super(mapLocationComparator, new ExitsCellRenderer(), mapViewManager, delayedMapModelListenerManager); - this.exitGameObjectMatcher = exitGameObjectMatcher; - this.pathManager = pathManager; - } - - /** - * {@inheritDoc} - */ - @Override - protected void scanGameObjectForConnections(@NotNull final G gameObject) { - if (!exitGameObjectMatcher.isMatching(gameObject)) { - return; - } - - final MapLocation mapLocation; - try { - mapLocation = MapLocation.newAbsoluteMapLocation(gameObject, true, pathManager); - } catch (final NoExitPathException ignored) { - return; - } - addConnection(mapLocation, gameObject); - } - - /** - * A {@link CellRenderer} for the locked items view. - * @author Andreas Kirschbaum - */ - private static class ExitsCellRenderer extends CellRenderer<MapLocation> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * {@inheritDoc} - */ - @NotNull - @Override - protected String formatKey(@NotNull final MapLocation key) { - final Point mapCoordinate = key.getMapCoordinate(); - return key.getMapPath() + "@" + mapCoordinate.x + "/" + mapCoordinate.y; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - protected String formatValue(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { - return gameObject.getBestName(); - } - - } - -} // class ExitsView Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2011-09-22 08:41:52 UTC (rev 8991) @@ -91,7 +91,6 @@ import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.panel.connectionview.ConnectionControl; import net.sf.gridarta.gui.panel.connectionview.Control; -import net.sf.gridarta.gui.panel.connectionview.ExitsControl; import net.sf.gridarta.gui.panel.connectionview.LockedItemsControl; import net.sf.gridarta.gui.panel.connectionview.MonsterControl; import net.sf.gridarta.gui.panel.gameobjectattributes.ArchTab; @@ -499,7 +498,6 @@ final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(mainViewFrame, directionMap, mapPathNormalizer, fileControl, mapViewsManager); final MapActions<G, A, R> mapActions = new MapActions<G, A, R>(mainViewFrame, mapManager, mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); - final Control<?, G, A, R> exitsControl = new ExitsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, exitGameObjectMatcher, pathManager, globalSettings, mapActions); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, selectedSquareView, gameObjectFactory); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager, faceObjectProviders); @@ -594,9 +592,8 @@ mainView.addTab(new Tab("monsters", new MonsterControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, monsterMatcher).getView(), Location.BOTTOM, false, 4, false)); mainView.addTab(new Tab("connections", new ConnectionControl<G, A, R>(mapViewManager, delayedMapModelListenerManager).getView(), Location.BOTTOM, false, 5, false)); mainView.addTab(new Tab("lockedItems", lockedItemsControl.getView(), Location.BOTTOM, false, 6, false)); - mainView.addTab(new Tab("exits", exitsControl.getView(), Location.BOTTOM, false, 7, false)); - mainView.addTab(new WarningsTab<G, A, R>("warnings", errorListView, Location.BOTTOM, false, 8, false)); - mainView.addTab(new GameObjectTextEditorTab<G, A, R>("textEditor", new GameObjectTextEditor(archetypeTypeSet), Location.RIGHT, true, 9, false, selectedSquareModel, mapManager)); + mainView.addTab(new WarningsTab<G, A, R>("warnings", errorListView, Location.BOTTOM, false, 7, false)); + mainView.addTab(new GameObjectTextEditorTab<G, A, R>("textEditor", new GameObjectTextEditor(archetypeTypeSet), Location.RIGHT, true, 8, false, selectedSquareModel, mapManager)); new ArchetypeValidator(animationObjects, faceObjects, errorView).validate(archetypeSet); new AnimationValidator(faceObjects, errorView).validate(animationObjects); Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-09-22 08:41:52 UTC (rev 8991) @@ -1647,9 +1647,6 @@ tabButton.lockedItems.title1=Locked Items tabButton.lockedItems.title2={0}: Locked Items tabButton.lockedItems.shortdescription=Display the locked items of the current map. -tabButton.exits.title1=Exits -tabButton.exits.title2={0}: Exits -tabButton.exits.shortdescription=Display the exits from the current map. tabButton.textEditor.title1=Text Editor tabButton.textEditor.title2={0}: Text Editor tabButton.textEditor.shortdescription=Display the game object text editor for the selected game object. Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2011-09-22 08:41:52 UTC (rev 8991) @@ -1412,9 +1412,6 @@ tabButton.lockedItems.title1=Verriegelte Objekte tabButton.lockedItems.title2={0}: Verriegelte Objekte tabButton.lockedItems.shortdescription=Zeigt verriegelte T\u00fcren und Schl\u00fcssel in der aktuellen Karte. -tabButton.exits.title1=Ausg\xE4nge -tabButton.exits.title2={0}: Ausga\xE4nge -tabButton.exits.shortdescription=Zeigt Ausg\xE4nge aus der aktuellen Karte. tabButton.textEditor.title1=Text Editor tabButton.textEditor.title2={0}: Text Editor tabButton.textEditor.shortdescription=Zeigt den Objekt-Text des ausgew\u00e4hlten Objekts an. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-09-22 08:41:52 UTC (rev 8991) @@ -1401,9 +1401,6 @@ tabButton.lockedItems.title1=Objets verrouill\u00e9s tabButton.lockedItems.title2={0} : Objets verrouill\u00e9s #tabButton.lockedItems.shortdescription= -#tabButton.exits.title1= -#tabButton.exits.title2= -#tabButton.exits.shortdescription= #tabButton.textEditor.title1= #tabButton.textEditor.title2= #tabButton.textEditor.shortdescription= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-09-22 08:15:47 UTC (rev 8990) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-09-22 08:41:52 UTC (rev 8991) @@ -1400,9 +1400,6 @@ #tabButton.lockedItems.title1= #tabButton.lockedItems.title2= #tabButton.lockedItems.shortdescription= -#tabButton.exits.title1= -#tabButton.exits.title2= -#tabButton.exits.shortdescription= #tabButton.textEditor.title1= #tabButton.textEditor.title2= #tabButton.textEditor.shortdescription= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-22 08:15:54
|
Revision: 8990 http://gridarta.svn.sourceforge.net/gridarta/?rev=8990&view=rev Author: akirschbaum Date: 2011-09-22 08:15:47 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Replace in/out parameter with return value. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResources.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-09-22 07:53:40 UTC (rev 8989) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2011-09-22 08:15:47 UTC (rev 8990) @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; @@ -125,10 +126,13 @@ /** * {@inheritDoc} */ + @NotNull @Override - protected void readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + protected List<GameObject> readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView) { + final List<GameObject> invObjects = new ArrayList<GameObject>(); faceObjectProviders.setNormal(new CollectedResourcesReader(globalSettings.getCollectedDirectory(), archetypeSet, archetypeParser, faceObjects, animationObjects).read(errorView, invObjects)); loadArtifacts(errorView, invObjects, globalSettings.getCollectedDirectory()); + return invObjects; } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-09-22 07:53:40 UTC (rev 8989) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2011-09-22 08:15:47 UTC (rev 8990) @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; @@ -131,9 +132,12 @@ /** * {@inheritDoc} */ + @NotNull @Override - protected void readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + protected List<GameObject> readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView) { + final List<GameObject> invObjects = new ArrayList<GameObject>(); faceObjectProviders.setNormal(new CollectedResourcesReader(globalSettings.getConfigurationDirectory(), globalSettings.getCollectedDirectory(), archetypeSet, archetypeParser, faceObjects, animationObjects, smoothFaces).read(errorView, invObjects)); + return invObjects; } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-09-22 07:53:40 UTC (rev 8989) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2011-09-22 08:15:47 UTC (rev 8990) @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; @@ -125,10 +126,13 @@ /** * {@inheritDoc} */ + @NotNull @Override - protected void readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView, @NotNull final List<GameObject> invObjects) { + protected List<GameObject> readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView) { + final List<GameObject> invObjects = new ArrayList<GameObject>(); faceObjectProviders.setNormal(new CollectedResourcesReader(globalSettings.getCollectedDirectory(), archetypeSet, archetypeParser, faceObjects, animationObjects).read(errorView, invObjects)); loadArtifacts(errorView, invObjects, globalSettings.getCollectedDirectory(), globalSettings.getMapsDirectory()); + return invObjects; } /** Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResources.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResources.java 2011-09-22 07:53:40 UTC (rev 8989) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResources.java 2011-09-22 08:15:47 UTC (rev 8990) @@ -114,8 +114,7 @@ if (loaded) { throw new IllegalStateException(); } - final List<G> invObjects = new ArrayList<G>(); - readCollectedInt(globalSettings, errorView, invObjects); + final List<G> invObjects = readCollectedInt(globalSettings, errorView); finishRead(invObjects); loadedFromFiles = false; loaded = true; @@ -157,9 +156,10 @@ * Reads the resources from a collection. * @param globalSettings the global settings to read from * @param errorView the error view for reporting problems - * @param invObjects all read archetypes + * @return all read archetypes */ - protected abstract void readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView, @NotNull final List<G> invObjects); + @NotNull + protected abstract List<G> readCollectedInt(@NotNull final GlobalSettings globalSettings, @NotNull final ErrorView errorView); /** * Writes the resources in collected form. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-22 07:53:46
|
Revision: 8989 http://gridarta.svn.sourceforge.net/gridarta/?rev=8989&view=rev Author: akirschbaum Date: 2011-09-22 07:53:40 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Fix Javadoc issue. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java Modified: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-09-22 06:29:09 UTC (rev 8988) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-09-22 07:53:40 UTC (rev 8989) @@ -33,8 +33,8 @@ import org.jetbrains.annotations.Nullable; /** - * A {@link net.sf.gridarta.gui.panel.connectionview.} for the locked items - * view. + * A {@link net.sf.gridarta.gui.panel.connectionview.CellRenderer} for the + * locked items view. * @author Andreas Kirschbaum */ public class MapListCellRenderer extends DefaultListCellRenderer implements Comparator<GameObject<?, ?, ?>> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-22 06:29:16
|
Revision: 8988 http://gridarta.svn.sourceforge.net/gridarta/?rev=8988&view=rev Author: akirschbaum Date: 2011-09-22 06:29:09 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Remove unused import statement. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java Modified: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-09-21 19:09:50 UTC (rev 8987) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-09-22 06:29:09 UTC (rev 8988) @@ -26,7 +26,6 @@ import javax.swing.JList; import net.sf.gridarta.gui.map.mapactions.MapLocation; import net.sf.gridarta.gui.map.mapactions.NoExitPathException; -import net.sf.gridarta.gui.panel.connectionview.CellRenderer; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; @@ -34,7 +33,8 @@ import org.jetbrains.annotations.Nullable; /** - * A {@link CellRenderer} for the locked items view. + * A {@link net.sf.gridarta.gui.panel.connectionview.} for the locked items + * view. * @author Andreas Kirschbaum */ public class MapListCellRenderer extends DefaultListCellRenderer implements Comparator<GameObject<?, ?, ?>> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-21 19:09:57
|
Revision: 8987 http://gridarta.svn.sourceforge.net/gridarta/?rev=8987&view=rev Author: akirschbaum Date: 2011-09-21 19:09:50 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Do not index backup files (*~). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) +++ trunk/atrinik/ChangeLog 2011-09-21 19:09:50 UTC (rev 8987) @@ -1,5 +1,7 @@ 2011-09-21 Andreas Kirschbaum + * Do not index backup files (*~). + * Implement Map|Go To Exit... which opens a dialog listing all exits out of the current map. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) +++ trunk/crossfire/ChangeLog 2011-09-21 19:09:50 UTC (rev 8987) @@ -1,5 +1,7 @@ 2011-09-21 Andreas Kirschbaum + * Do not index backup files (*~). + * Implement Map|Go To Exit... which opens a dialog listing all exits out of the current map. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) +++ trunk/daimonin/ChangeLog 2011-09-21 19:09:50 UTC (rev 8987) @@ -1,5 +1,7 @@ 2011-09-21 Andreas Kirschbaum + * Do not index backup files (*~). + * Implement Map|Go To Exit... which opens a dialog listing all exits out of the current map. Modified: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java 2011-09-21 19:04:54 UTC (rev 8986) +++ trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java 2011-09-21 19:09:50 UTC (rev 8987) @@ -466,7 +466,7 @@ } for (final File file : files) { - if (file.isFile()) { + if (file.isFile() && !file.getName().endsWith("~")) { mapsIndex.add(file, file.lastModified()); } else if (file.isDirectory() && !file.getName().equalsIgnoreCase(".svn") && !file.getName().equalsIgnoreCase(".dedit")) { scanMapsDirectoryInt(file, mapPath + "/" + file.getName()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-09-21 19:05:03
|
Revision: 8986 http://gridarta.svn.sourceforge.net/gridarta/?rev=8986&view=rev Author: akirschbaum Date: 2011-09-21 19:04:54 +0000 (Wed, 21 Sep 2011) Log Message: ----------- Implement Map|Go To Exit... which opens a dialog listing all exits out of the current map. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod_de.properties trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod_de.properties trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod.properties trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod_de.properties trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapLocation.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/atrinik/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) @@ -1,3 +1,8 @@ +2011-09-21 Andreas Kirschbaum + + * Implement Map|Go To Exit... which opens a dialog listing all + exits out of the current map. + 2011-09-03 Andreas Kirschbaum * Remember last saved directory in save/save as dialogs. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -42,7 +42,7 @@ mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection -mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects +mapwindowMap.menu=gridVisible - goExit enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes ########## Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -56,3 +56,4 @@ tod.text.32=<html>Beware when editing large maps. You might run out of memory.<br>Be sure to increase the heap size (-Xmx parameter) of Gridarta''s Virtual Machine when editing large maps (e.g. 240\xD7240). tod.text.33=<html>It''s amazing how much archetypes you could find using "Search archetype".<p>Menu: <code>Archetypes -> Find archetype</code>. tod.text.34=<html>You can quickly switch to the game object text editor with <code>CTRl-ALT-E</code>. Press these keys again to close it. +tod.text.35=<html>To navigate to maps connected through exits, select Map|Go To Exit... or press <kbd>Ctrl-F12</kbd>. Then select the exit and press <kbd>Enter</kbd>. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod_de.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod_de.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/tod_de.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -52,3 +52,4 @@ tod.text.32=<html>Vorsicht beim Bearbeiten von gro\xDFen Karten: der Platz im Hauptspeicher k\xF6nnte nicht ausreichen.<br>Vergr\xF6\xDFern Sie die "heap size" (Parameter -Xmx beim Aufruf von java) von Gridarta, wenn Sie gro\xDFe Karten (bspw. 240\xD7240) bearbeiten m\xF6chten. tod.text.33=<html>Es ist verbl\xFCffend, wie viele Archetypen man mit "Archetypen finden" entdecken kann.<p>Men\xFC: <code>Archetypen -> Archetypen finden</code>. tod.text.34=<html>Sie k\xF6nnen den Objekt-Editor \xFCber die Tastenkombination <code>CTRl-ALT-E</code> \xF6ffnen. Dieselbe Tastenkombination schlie\xDFt ihn wieder. +tod.text.35=<html>Sie k\xF6nnen Karten hinter Ausg\xE4ngen \xFCber <code>Karte -> Folge Ausgang...</code> oder \xFCber die Tastenkombination <code>CTRL-F12</code> \xF6ffnen. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/crossfire/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) @@ -1,3 +1,8 @@ +2011-09-21 Andreas Kirschbaum + + * Implement Map|Go To Exit... which opens a dialog listing all + exits out of the current map. + 2011-09-03 Andreas Kirschbaum * Remember last saved directory in save/save as dialogs. Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -42,7 +42,7 @@ mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection -mapwindowMap.menu=gridVisible smoothing enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects +mapwindowMap.menu=gridVisible smoothing - goExit enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes ########## Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -37,3 +37,4 @@ tod.text.13=<html>Beware when editing large maps. You might run out of memory.<br>Be sure to increase the heap size (-Xmx parameter) of Gridarta''s Virtual Machine when editing large maps (e.g. 240\xD7240). tod.text.14=<html>It''s amazing how many archetypes you could find using "Search archetype".<p>Menu: <code>Archetypes -> Find archetype</code>. tod.text.15=<html>You can quickly switch to the game object text editor with <code>CTRl-ALT-E</code>. Press these keys again to close it. +tod.text.16=<html>To navigate to maps connected through exits, select Map|Go To Exit... or press <kbd>Ctrl-F12</kbd>. Then select the exit and press <kbd>Enter</kbd>. Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod_de.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod_de.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/tod_de.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -37,3 +37,4 @@ tod.text.13=<html>Vorsicht beim Bearbeiten von gro\xDFen Karten: der Platz im Hauptspeicher k\xF6nnte nicht ausreichen.<br>Vergr\xF6\xDFern Sie die "heap size" (Parameter -Xmx beim Aufruf von java) von Gridarta, wenn Sie gro\xDFe Karten (bspw. 240\xD7240) bearbeiten m\xF6chten. tod.text.14=<html>Es ist verbl\xFCffend, wie viele Archetypen man mit "Archetypen finden" entdecken kann.<p>Men\xFC: <code>Archetypen -> Archetypen finden</code>. tod.text.15=<html>Sie k\xF6nnen den Objekt-Editor \xFCber die Tastenkombination <code>CTRl-ALT-E</code> \xF6ffnen. Dieselbe Tastenkombination schlie\xDFt ihn wieder. +tod.text.16=<html>Sie k\xF6nnen Karten hinter Ausg\xE4ngen \xFCber <code>Karte -> Folge Ausgang...</code> oder \xFCber die Tastenkombination <code>CTRL-F12</code> \xF6ffnen. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/daimonin/ChangeLog 2011-09-21 19:04:54 UTC (rev 8986) @@ -1,3 +1,8 @@ +2011-09-21 Andreas Kirschbaum + + * Implement Map|Go To Exit... which opens a dialog listing all + exits out of the current map. + 2011-09-03 Andreas Kirschbaum * Remember last saved directory in save/save as dialogs. Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -42,7 +42,7 @@ mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection -mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects +mapwindowMap.menu=gridVisible - goExit enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes ########## Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -56,3 +56,4 @@ tod.text.32=<html>Beware when editing large maps. You might run out of memory.<br>Be sure to increase the heap size (-Xmx parameter) of Gridarta''s Virtual Machine when editing large maps (e.g. 240\xD7240). tod.text.33=<html>It''s amazing how much archetypes you could find using "Search archetype".<p>Menu: <code>Archetypes -> Find archetype</code>. tod.text.34=<html>You can quickly switch to the game object text editor with <code>CTRl-ALT-E</code>. Press these keys again to close it. +tod.text.35=<html>To navigate to maps connected through exits, select Map|Go To Exit... or press <kbd>Ctrl-F12</kbd>. Then select the exit and press <kbd>Enter</kbd>. Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod_de.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod_de.properties 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/tod_de.properties 2011-09-21 19:04:54 UTC (rev 8986) @@ -52,3 +52,4 @@ tod.text.32=<html>Vorsicht beim Bearbeiten von gro\xDFen Karten: der Platz im Hauptspeicher k\xF6nnte nicht ausreichen.<br>Vergr\xF6\xDFern Sie die "heap size" (Parameter -Xmx beim Aufruf von java) von Gridarta, wenn Sie gro\xDFe Karten (bspw. 240\xD7240) bearbeiten m\xF6chten. tod.text.33=<html>Es ist verbl\xFCffend, wie viele Archetypen man mit "Archetypen finden" entdecken kann.<p>Men\xFC: <code>Archetypen -> Archetypen finden</code>. tod.text.34=<html>Sie k\xF6nnen den Objekt-Editor \xFCber die Tastenkombination <code>CTRl-ALT-E</code> \xF6ffnen. Dieselbe Tastenkombination schlie\xDFt ihn wieder. +tod.text.35=<html>Sie k\xF6nnen Karten hinter Ausg\xE4ngen \xFCber <code>Karte -> Folge Ausgang...</code> oder \xFCber die Tastenkombination <code>CTRL-F12</code> \xF6ffnen. Added: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java 2011-09-21 19:04:54 UTC (rev 8986) @@ -0,0 +1,356 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.goexit; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Collection; +import java.util.TreeSet; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.WindowConstants; +import net.sf.gridarta.gui.map.mapactions.EnterMap; +import net.sf.gridarta.gui.map.mapactions.MapLocation; +import net.sf.gridarta.gui.map.mapactions.NoExitPathException; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.utils.SwingUtils; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * A dialog to ask the user for a map to open. + * @author Andreas Kirschbaum + */ +public class GoExitDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * An empty array of {@link JButton} instances. + */ + @NotNull + private static final JButton[] EMPTY_BUTTON_ARRAY = new JButton[0]; + + /** + * The {@link MapView} for this dialog. + */ + @NotNull + private final MapView<G, A, R> mapView; + + /** + * The {@link GameObjectMatcher} for selecting exits. + */ + @NotNull + private final GameObjectMatcher exitGameObjectMatcher; + + /** + * The {@link PathManager} for converting relative exit paths. + */ + @NotNull + private final PathManager pathManager; + + /** + * The {@link EnterMap} instance for entering maps. + */ + @NotNull + private final EnterMap<G, A, R> enterMap; + + /** + * The {@link JDialog} instance.} + */ + @NotNull + private final JDialog dialog; + + /** + * The list model containing the search results. + */ + @NotNull + private final DefaultListModel listModel = new DefaultListModel(); + + /** + * The {@link JList} showing the matching maps. + */ + @NotNull + private final JList list = new JList(listModel); + + /** + * The {@link MapListCellRenderer} for {@link #list}. + */ + @NotNull + private final MapListCellRenderer mapListCellRenderer; + + /** + * Creates a new instance. + * @param parent the parent component for this dialog + * @param mapView the map view for this dialog + * @param exitGameObjectMatcher the game object matcher for selecting exits + * @param pathManager the path manager for converting relative exit paths + * @param enterMap the enter map instance to use + * @param faceObjectProviders the face object providers for looking up + * faces + */ + public GoExitDialog(@NotNull final Component parent, @NotNull final MapView<G, A, R> mapView, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final PathManager pathManager, @NotNull final EnterMap<G, A, R> enterMap, @NotNull final FaceObjectProviders faceObjectProviders) { + this.mapView = mapView; + this.exitGameObjectMatcher = exitGameObjectMatcher; + this.pathManager = pathManager; + this.enterMap = enterMap; + SwingUtils.addAction(list, ACTION_BUILDER.createAction(false, "goExitApply", this)); + list.setFocusable(false); + final Component scrollPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + mapListCellRenderer = new MapListCellRenderer(pathManager, faceObjectProviders); + list.setCellRenderer(mapListCellRenderer); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + final MouseListener mouseListener = new MouseListener() { + + @Override + public void mouseClicked(final MouseEvent e) { + // ignore + } + + @Override + public void mousePressed(final MouseEvent e) { + if (e.getClickCount() > 1) { + goExitApply(); + } + } + + @Override + public void mouseReleased(final MouseEvent e) { + // ignore + } + + @Override + public void mouseEntered(final MouseEvent e) { + // ignore + } + + @Override + public void mouseExited(final MouseEvent e) { + // ignore + } + + }; + list.addMouseListener(mouseListener); + list.setFocusable(true); + + final JPanel panel = new JPanel(new BorderLayout()); + panel.add(scrollPane, BorderLayout.CENTER); + final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, EMPTY_BUTTON_ARRAY, list); + dialog = optionPane.createDialog(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "goExitTitle")); + dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + dialog.setResizable(true); + dialog.setSize(500, 250); + dialog.setLocationRelativeTo(parent); + } + + /** + * Opens the dialog. + */ + public void showDialog() { + final MapControl<G, A, R> mapControl = mapView.getMapControl(); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + final Collection<G> exits = new TreeSet<G>(mapListCellRenderer); + for (final Iterable<G> mapSquare : mapModel) { + for (final G gameObject : mapSquare) { + if (exitGameObjectMatcher.isMatching(gameObject)) { + try { + MapLocation.newAbsoluteMapLocation(gameObject, true, pathManager); + exits.add(gameObject); + } catch (final NoExitPathException ignored) { + // ignore + } + } + } + } + for (final G exit : exits) { + listModel.addElement(exit); + } + + list.setSelectedIndex(0); + list.ensureIndexIsVisible(0); + dialog.setVisible(true); + } + + /** + * Action method for apply. + */ + @ActionMethod + public void goExitApply() { + if (goExit()) { + dialog.dispose(); + } + } + + /** + * Action method for cancel. + */ + @ActionMethod + public void goExitCancel() { + dialog.dispose(); + } + + /** + * Action method for scroll up. + */ + @ActionMethod + public void goExitScrollUp() { + final int index = list.getMinSelectionIndex(); + final int newIndex = index > 0 ? index - 1 : listModel.size() - 1; + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for scroll down. + */ + @ActionMethod + public void goExitScrollDown() { + final int index = list.getMaxSelectionIndex() + 1; + final int newIndex = index < listModel.size() ? index : 0; + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for scroll page up. + */ + @ActionMethod + public void goExitScrollPageUp() { + final int index = list.getMinSelectionIndex(); + final int firstIndex = list.getFirstVisibleIndex(); + final int newIndex; + if (firstIndex == -1) { + newIndex = -1; + } else if (index == -1) { + newIndex = firstIndex; + } else if (index > firstIndex) { + newIndex = firstIndex; + } else { + newIndex = Math.max(firstIndex - (list.getLastVisibleIndex() - firstIndex), 0); + } + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for scroll page down. + */ + @ActionMethod + public void goExitScrollPageDown() { + final int index = list.getMaxSelectionIndex(); + final int lastIndex = list.getLastVisibleIndex(); + final int newIndex; + if (lastIndex == -1) { + newIndex = -1; + } else if (index == -1) { + newIndex = lastIndex; + } else if (index < lastIndex) { + newIndex = lastIndex; + } else { + newIndex = Math.min(lastIndex + (lastIndex - list.getFirstVisibleIndex()), listModel.size() - 1); + } + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for scroll top. + */ + @ActionMethod + public void goExitScrollTop() { + final int newIndex = 0; + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for scroll bottom. + */ + @ActionMethod + public void goExitScrollBottom() { + final int newIndex = listModel.size() - 1; + list.setSelectedIndex(newIndex); + list.ensureIndexIsVisible(newIndex); + } + + /** + * Action method for select up. + */ + @ActionMethod + public void goExitSelectUp() { + final int index = list.getMinSelectionIndex(); + if (index != 0) { + final int newIndex = index > 0 ? index - 1 : listModel.size() - 1; + list.addSelectionInterval(newIndex, newIndex); + list.ensureIndexIsVisible(newIndex); + } + } + + /** + * Action method for select down. + */ + @ActionMethod + public void goExitSelectDown() { + final int index = list.getMaxSelectionIndex(); + if (index + 1 < listModel.size()) { + final int newIndex = index + 1; + list.addSelectionInterval(newIndex, newIndex); + list.ensureIndexIsVisible(newIndex); + } + } + + /** + * Opens the selected maps. + * @return whether at least one map was opened + */ + private boolean goExit() { + final Object selectedValue = list.getSelectedValue(); + if (selectedValue == null) { + return false; + } + @SuppressWarnings("unchecked") final GameObject<G, A, R> exit = (GameObject<G, A, R>) selectedValue; + return enterMap.enterExit(mapView, exit, true); + } + +} // class GoExitDialog Property changes on: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java 2011-09-21 19:04:54 UTC (rev 8986) @@ -0,0 +1,123 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.goexit; + +import java.awt.Window; +import net.sf.gridarta.gui.map.mapactions.EnterMap; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * Manager for {@link GoExitDialog} instances. + * @author Andreas Kirschbaum + */ +public class GoExitDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The parent {@link Window} for go map dialogs. + */ + @NotNull + private final Window parent; + + /** + * The map manager to use. + */ + @NotNull + private final MapManager<G, A, R> mapManager; + + /** + * The {@link MapViewManager} instance. + */ + @NotNull + private final MapViewManager<G, A, R> mapViewManager; + + /** + * The {@link GameObjectMatcher} for selecting exits. + */ + @NotNull + private final GameObjectMatcher exitGameObjectMatcher; + + /** + * The {@link PathManager} for converting relative exit paths. + */ + @NotNull + private final PathManager pathManager; + + /** + * The {@link EnterMap} instance to use. + */ + @NotNull + private final EnterMap<G, A, R> enterMap; + + /** + * The {@link FaceObjectProviders} for looking up faces. + */ + @NotNull + private final FaceObjectProviders faceObjectProviders; + + /** + * Creates a new instance. + * @param parent the parent window for go map dialogs + * @param mapManager the map manager to use + * @param mapViewManager the map view manager instance + * @param exitGameObjectMatcher the game object matcher for selecting exits + * @param pathManager the path manager for converting relative exit paths + * @param enterMap the enter map instance to use + * @param faceObjectProviders the face object providers for looking up + * faces + */ + public GoExitDialogManager(@NotNull final Window parent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final PathManager pathManager, @NotNull final EnterMap<G, A, R> enterMap, @NotNull final FaceObjectProviders faceObjectProviders) { + this.parent = parent; + this.mapManager = mapManager; + this.mapViewManager = mapViewManager; + this.exitGameObjectMatcher = exitGameObjectMatcher; + this.pathManager = pathManager; + this.enterMap = enterMap; + this.faceObjectProviders = faceObjectProviders; + } + + /** + * Action method to open the "go exit" dialog. + */ + @ActionMethod + public void goExit() { + final MapControl<G, A, R> mapControl = mapManager.getCurrentMap(); + if (mapControl == null) { + return; + } + + final MapView<G, A, R> mapView = mapViewManager.getActiveMapView(); + if (mapView == null) { + return; + } + new GoExitDialog<G, A, R>(parent, mapView, exitGameObjectMatcher, pathManager, enterMap, faceObjectProviders).showDialog(); + } + +} // class GoExitDialogManager Property changes on: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java 2011-09-21 19:04:54 UTC (rev 8986) @@ -0,0 +1,157 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.goexit; + +import java.awt.Component; +import java.awt.Point; +import java.util.Comparator; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import net.sf.gridarta.gui.map.mapactions.MapLocation; +import net.sf.gridarta.gui.map.mapactions.NoExitPathException; +import net.sf.gridarta.gui.panel.connectionview.CellRenderer; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link CellRenderer} for the locked items view. + * @author Andreas Kirschbaum + */ +public class MapListCellRenderer extends DefaultListCellRenderer implements Comparator<GameObject<?, ?, ?>> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link PathManager} for converting relative exit paths. + */ + @NotNull + private final PathManager pathManager; + + /** + * The {@link FaceObjectProviders} for looking up faces. + */ + @NotNull + private final FaceObjectProviders faceObjectProviders; + + /** + * Creates a new instance. + * @param pathManager the path manager for converting relative exit paths + * @param faceObjectProviders the face object providers for looking up + * faces + */ + public MapListCellRenderer(@NotNull final PathManager pathManager, @NotNull final FaceObjectProviders faceObjectProviders) { + this.pathManager = pathManager; + this.faceObjectProviders = faceObjectProviders; + } + + /** + * {@inheritDoc} + */ + @Override + public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + final GameObject<?, ?, ?> gameObject = (GameObject<?, ?, ?>) value; + final MapLocation mapLocation = getMapLocation(gameObject); + setIcon(faceObjectProviders.getFace(gameObject)); + final StringBuilder sb = new StringBuilder(); + sb.append(gameObject.getBestName()); + sb.append(" ["); + if (mapLocation == null) { + sb.append("?"); + } else { + sb.append(mapLocation.getMapPath()); + sb.append("@"); + final Point mapCoordinate = mapLocation.getMapCoordinate(); + sb.append(mapCoordinate.x); + sb.append("/"); + sb.append(mapCoordinate.y); + } + sb.append("]"); + setText(sb.toString()); + return this; + } + + /** + * Returns the {@link MapLocation} for a {@link GameObject}. + * @param gameObject the game object + * @return the map location or <code>null</code> if unknown + */ + @Nullable + private MapLocation getMapLocation(@NotNull final GameObject<?, ?, ?> gameObject) { + try { + return MapLocation.newAbsoluteMapLocation(gameObject, true, pathManager); + } catch (final NoExitPathException ignored) { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public int compare(final GameObject<?, ?, ?> o1, final GameObject<?, ?, ?> o2) { + final String name1 = o1.getBestName(); + final String name2 = o2.getBestName(); + final int cmp1 = name1.compareToIgnoreCase(name2); + if (cmp1 != 0) { + return cmp1; + } + + final MapLocation mapLocation1 = getMapLocation(o1); + final MapLocation mapLocation2 = getMapLocation(o2); + if (mapLocation1 == null) { + if (mapLocation2 != null) { + return -1; + } + } else if (mapLocation2 == null) { + return +1; + } else { + final int cmp2 = mapLocation1.compareTo(mapLocation2); + if (cmp2 != 0) { + return cmp2; + } + } + + final String faceObjName1 = o1.getFaceObjName(); + final String faceObjName2 = o2.getFaceObjName(); + if (faceObjName1 == null) { + if (faceObjName2 != null) { + return -1; + } + } else if (faceObjName2 == null) { + return +1; + } else { + final int cmp3 = faceObjName1.compareTo(faceObjName2); + if (cmp3 != 0) { + return cmp3; + } + } + + return 0; + } + +} Property changes on: trunk/src/app/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2011-09-21 19:04:54 UTC (rev 8986) @@ -0,0 +1,271 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map.mapactions; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.io.File; +import java.io.IOException; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewsManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.direction.Direction; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmanager.FileControl; +import net.sf.gridarta.model.mappathnormalizer.IOErrorException; +import net.sf.gridarta.model.mappathnormalizer.InvalidPathException; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mappathnormalizer.RelativePathOnUnsavedMapException; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Helper class for entering maps. + * @author Andreas Kirschbaum + */ +public class EnterMap<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Action Builder to create Actions. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The component for showing dialog boxes. + */ + @NotNull + private final Component parent; + + /** + * Maps map relative direction to map window direction. + */ + @NotNull + private final Direction[] directionMap; + + /** + * The {@link MapPathNormalizer} to use. + */ + @NotNull + private final MapPathNormalizer mapPathNormalizer; + + /** + * The {@link FileControl}. + */ + @NotNull + private final FileControl<G, A, R> fileControl; + + /** + * The {@link MapViewsManager}. + */ + @NotNull + private final MapViewsManager<G, A, R> mapViewsManager; + + /** + * Creates a new instance. + * @param parent the component for showing dialog boxes + * @param directionMap maps relative direction to map window direction + * @param mapPathNormalizer the map path normalizer to use + * @param fileControl the file control + * @param mapViewsManager the map views + */ + public EnterMap(@NotNull final Component parent, @NotNull final Direction[] directionMap, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final FileControl<G, A, R> fileControl, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { + this.parent = parent; + this.directionMap = directionMap.clone(); + this.mapPathNormalizer = mapPathNormalizer; + this.fileControl = fileControl; + this.mapViewsManager = mapViewsManager; + } + + /** + * Enters a map wanted. + * @param mapView the map view to leave + * @param path path to map that should be loaded + * @param direction the direction to go + * @param destinationPoint the desired destination point on the map (pass + * 0|0 if unknown, and note that the point gets modified) + * @return whether the destination map has been entered + */ + public boolean enterMap(@NotNull final MapView<G, A, R> mapView, @NotNull final String path, @NotNull final Direction direction, @Nullable final Point destinationPoint) { + final File canonicalNewFile; + try { + canonicalNewFile = mapPathNormalizer.normalizeMapPath(mapView.getMapControl().getMapModel(), path); + } catch (final InvalidPathException ex) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitInvalidPath", ex.getFile().getAbsolutePath()); + return false; + } catch (final IOErrorException ex) { + ACTION_BUILDER.showMessageDialog(parent, "enterTileIOException", ex.getFile().getAbsolutePath()); + return false; + } catch (final RelativePathOnUnsavedMapException ex) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved", ex.getMessage()); + return false; + } catch (final SameMapException ignored) { + // path points to the same map + if (destinationPoint != null) { + showLocation(mapView, destinationPoint); + } + return true; + } + return enterMap(mapView, canonicalNewFile, destinationPoint, direction); + } + + /** + * Enters a map. + * @param mapView the current map view; may be closed it + * non-<code>null</code> + * @param mapFile the map file to enter + * @param destinationPoint the desired destination point on the map or + * <code>null</code> for default + * @param direction the direction to go + * @return whether the destination map has been entered + */ + public boolean enterMap(@Nullable final MapView<G, A, R> mapView, @NotNull final File mapFile, @Nullable final Point destinationPoint, @NotNull final Direction direction) { + final MapView<G, A, R> newMapView; + try { + newMapView = mapViewsManager.openMapFileWithView(mapFile, null, destinationPoint); + } catch (final IOException ex) { + fileControl.reportLoadError(mapFile, ex.getMessage()); + return false; + } + + if (destinationPoint != null) { + showLocation(newMapView, destinationPoint); + } else if (mapView != null) { + newMapView.getMapViewBasic().getScrollPane().getViewport().setViewPosition(calculateNewViewPosition(mapView.getMapViewBasic().getScrollPane(), newMapView.getMapViewBasic().getScrollPane(), direction)); + } + + if (mapView != null && ACTION_BUILDER.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { + // only close current map if a new file was opened and user wants to close it + mapViewsManager.closeMapView(mapView); + } + + return true; + } + + /** + * Scrolls a map view to make a give tile visible. + * @param mapView the map view + * @param point the square + */ + public void showLocation(@NotNull final MapView<G, A, R> mapView, @NotNull final Point point) { + final Point point2 = point.x == -1 && point.y == -1 ? mapView.getMapControl().getMapModel().getMapArchObject().getEnter() : point; + if (!mapView.getMapControl().getMapModel().getMapArchObject().isPointValid(point2)) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitOutside"); + return; + } + + mapView.getMapViewBasic().getMapCursor().setLocation(point2); + } + + /** + * Opens the map an exit game object points to. + * @param mapView the map view to leave + * @param exit the game object + * @param allowRandomMapParameters whether exit paths may point to random + * maps + * @return whether the destination map could be opened + */ + public boolean enterExit(@NotNull final MapView<G, A, R> mapView, @NotNull final GameObject<G, A, R> exit, final boolean allowRandomMapParameters) { + final MapLocation mapLocation; + try { + mapLocation = new MapLocation(exit, allowRandomMapParameters); + } catch (final NoExitPathException ex) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitRandomDestination", ex.getMessage()); + return false; + } + + return enterMap(mapView, mapLocation.getMapPath(), Direction.NORTH, mapLocation.getMapCoordinate()); + } + + /** + * Calculate the view position for the new viewport. + * @param oldMapView the old map view + * @param newMapView the new map view + * @param direction the direction to scroll + * @return the new view position + * @noinspection TypeMayBeWeakened + */ + @NotNull + private Point calculateNewViewPosition(@NotNull final JScrollPane oldMapView, @NotNull final JScrollPane newMapView, @NotNull final Direction direction) { + final Dimension newViewSize = newMapView.getViewport().getViewSize(); + final Rectangle oldViewRectangle = oldMapView.getViewport().getViewRect(); + + final Rectangle scrollTo; + switch (directionMap[direction.ordinal()]) { + case SOUTH: + scrollTo = new Rectangle(oldViewRectangle.x, 0, oldViewRectangle.width, oldViewRectangle.height); + break; + + case NORTH: + scrollTo = new Rectangle(oldViewRectangle.x, newViewSize.height - oldViewRectangle.height, oldViewRectangle.width, oldViewRectangle.height); + break; + + case EAST: + scrollTo = new Rectangle(0, oldViewRectangle.y, oldViewRectangle.width, oldViewRectangle.height); + break; + + case WEST: + scrollTo = new Rectangle(newViewSize.width - oldViewRectangle.width, oldViewRectangle.y, oldViewRectangle.width, oldViewRectangle.height); + break; + + case NORTH_EAST: + scrollTo = new Rectangle(0, newViewSize.height - oldViewRectangle.height, oldViewRectangle.width, oldViewRectangle.height); + break; + + case SOUTH_EAST: + scrollTo = new Rectangle(0, 0, oldViewRectangle.width, oldViewRectangle.height); + break; + + case SOUTH_WEST: + scrollTo = new Rectangle(newViewSize.width - oldViewRectangle.width, 0, oldViewRectangle.width, oldViewRectangle.height); + break; + + case NORTH_WEST: + scrollTo = new Rectangle(newViewSize.width - oldViewRectangle.width, newViewSize.height - oldViewRectangle.height, oldViewRectangle.width, oldViewRectangle.height); + break; + + default: + throw new AssertionError(); + } + + if (scrollTo.x + scrollTo.width > newViewSize.width) { + scrollTo.x = newViewSize.width - scrollTo.width; + } + if (scrollTo.x < 0) { + scrollTo.x = 0; + } + if (scrollTo.y + scrollTo.height > newViewSize.height) { + scrollTo.y = newViewSize.height - scrollTo.height; + } + if (scrollTo.y < 0) { + scrollTo.y = 0; + } + return scrollTo.getLocation(); + } + +} // class EnterMap Property changes on: trunk/src/app/net/sf/gridarta/gui/map/mapactions/EnterMap.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-09-21 18:56:25 UTC (rev 8985) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2011-09-21 19:04:54 UTC (rev 8986) @@ -19,18 +19,12 @@ package net.sf.gridarta.gui.map.mapactions; -import java.awt.Component; -import java.awt.Dimension; import java.awt.Point; -import java.awt.Rectangle; import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import javax.swing.Action; import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.gui.dialog.shrinkmapsize.ShrinkMapSizeDialogManager; @@ -49,15 +43,9 @@ import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorEvent; import net.sf.gridarta.model.mapcursor.MapCursorListener; -import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmanager.MapManagerListener; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.IOErrorException; -import net.sf.gridarta.model.mappathnormalizer.InvalidPathException; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; -import net.sf.gridarta.model.mappathnormalizer.RelativePathOnUnsavedMapException; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettingsListener; import net.sf.gridarta.utils.ActionUtils; @@ -172,12 +160,6 @@ } /** - * The component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** * The parent frame for help windows. */ @NotNull @@ -202,16 +184,16 @@ private final SelectedSquareModel<G, A, R> selectedSquareModel; /** - * The {@link ShrinkMapSizeDialogManager} instance. + * The {@link EnterMap} instance to use. */ @NotNull - private final ShrinkMapSizeDialogManager<G, A, R> shrinkMapSizeDialogManager; + private final EnterMap<G, A, R> enterMap; /** - * Maps map relative direction to map window direction. + * The {@link ShrinkMapSizeDialogManager} instance. */ @NotNull - private final Direction[] directionMap; + private final ShrinkMapSizeDialogManager<G, A, R> shrinkMapSizeDialogManager; /** * Whether exit paths may point to random maps. @@ -231,24 +213,12 @@ private final MapViewSettings mapViewSettings; /** - * The {@link MapPathNormalizer} to use. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * The {@link MapViewsManager}. */ @NotNull private final MapViewsManager<G, A, R> mapViewsManager; /** - * The {@link FileControl}. - */ - @NotNull - private final FileControl<G, A, R> fileControl; - - /** * The current map view, or <code>null</code> if no map view is active. */ @Nullable @@ -409,36 +379,30 @@ /** * Create a new instance. - * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows * @param mapManager the map manager * @param mapViewManager the map view manager * @param exitMatcher the exit matcher for selecting exit game objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareModel the selected square model to use - * @param directionMap maps relative direction to map window direction * @param allowRandomMapParameters whether exit paths may point to random * maps * @param mapPropertiesDialogFactory the map properties dialog factory to * use * @param mapViewSettings the map view settings instance to use - * @param mapPathNormalizer the map path normalizer to use * @param mapViewsManager the map views - * @param fileControl the file control + * @param enterMap the enter map instance to use */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final Direction[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final FileControl<G, A, R> fileControl) { - this.parent = parent; + public MapActions(@NotNull final JFrame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final EnterMap<G, A, R> enterMap) { this.helpParent = helpParent; this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; this.selectedSquareModel = selectedSquareModel; - this.directionMap = directionMap.clone(); + this.enterMap = enterMap; this.allowRandomMapParameters = allowRandomMapParameters; this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; this.mapViewSettings = mapViewSettings; - this.mapPathNormalizer = mapPathNormalizer; this.mapViewsManager = mapViewsManager; - this.fileControl = fileControl; shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<G, A, R>(mapViewManager); mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener); @@ -724,96 +688,16 @@ } /** - * Enter a map wanted. - * @param mapView the map view to leave - * @param path path to map that should be loaded - * @param direction the direction to go - * @param destinationPoint the desired destination point on the map (pass - * 0|0 if unknown, and note that the point gets modified) - * @return whether the destination map has been entered - */ - private boolean enterMap(@NotNull final MapView<G, A, R> mapView, @NotNull final String path, @NotNull final Direction direction, @Nullable final Point destinationPoint) { - final File canonicalNewFile; - try { - canonicalNewFile = mapPathNormalizer.normalizeMapPath(mapView.getMapControl().getMapModel(), path); - } catch (final InvalidPathException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitInvalidPath", ex.getFile().getAbsolutePath()); - return false; - } catch (final IOErrorException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterTileIOException", ex.getFile().getAbsolutePath()); - return false; - } catch (final RelativePathOnUnsavedMapException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved", ex.getMessage()); - return false; - } catch (final SameMapException ignored) { - // path points to the same map - if (destinationPoint != null) { - showLocation(mapView, destinationPoint); - } - return true; - } - return enterMap(mapView, canonicalNewFile, destinationPoint, direction); - } - - /** * Enters a map. * @param mapFile the map file to enter * @param destinationPoint the desired destination point on the map or * <code>null</code> for default */ public void enterMap(@NotNull final File mapFile, @Nullable final Point destinationPoint) { - enterMap(currentMapView, mapFile, destinationPoint, Direction.NORTH); + enterMap.enterMap(currentMapView, mapFile, destinationPoint, Direction.NORTH); } /** - * Enters a map. - * @param mapView the current map view; may be closed it - * non-<code>null</code> - * @param mapFile the map file to enter - * @param destinationPoint the desired destination point on the map or - * <code>null</code> for default - * @param direction the direction to go - * @return whether the destination map has been entered - */ - private boolean enterMap(@Nullable final MapView<G, A, R> mapView, @NotNull final File mapFile, @Nullable final Point destinationPoint, @NotNull final Direction direction) { - final MapView<G, A, R> newMapView; - try { - newMapView = mapViewsManager.openMapFileWithView(mapFile, null, destinationPoint); - } catch (final IOException ex) { - fileControl.reportLoadError(mapFile, ex.getMessage()); - return false; - } - - if (destinationPoint != null) { - showLocation(newMapView, destinationPoint); - } else if (mapView != null) { - newMapView.getMapViewBasic().getScrollPane().getViewport().setViewPosition(calculateNewViewPosition(mapView.getMapViewBasic().getScrollPane(), newMapView.getMapViewBasic().getScrollPane(), direction)); - } - - if (mapView != null && ACTION_BUILDER.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { - // only close current map if a new file was opened and user wants to close it - mapViewsManager.closeMapView(mapView); - } - - return true; - } - - /** - * Scrolls a map view to make a give tile visible. - * @param mapView the map view - * @param point the square - */ - private void showLocation(@NotNull final MapView<G, A, R> mapView, @NotNull final Point point) { - final Point point2 = point.x == -1 && point.y == -1 ? mapView.ge... [truncated message content] |