From: <aki...@us...> - 2010-11-17 19:39:44
|
Revision: 8800 http://gridarta.svn.sourceforge.net/gridarta/?rev=8800&view=rev Author: akirschbaum Date: 2010-11-17 19:39:35 +0000 (Wed, 17 Nov 2010) Log Message: ----------- Implement File|Goto Map... which opens maps by map name. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/gridarta.ipr trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java trunk/resource/log4j.properties trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/messages.properties Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/index/ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java trunk/model/src/app/net/sf/gridarta/model/index/Index.java trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java trunk/model/src/test/net/sf/gridarta/model/index/ trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java trunk/src/app/net/sf/gridarta/gui/gomapdialog/ trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialogManager.java trunk/src/app/net/sf/gridarta/gui/gomapdialog/MapListCellRenderer.java trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeListener.java trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeManager.java trunk/utils/src/app/net/sf/gridarta/utils/Xtea.java trunk/utils/src/test/net/sf/gridarta/utils/XteaTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/atrinik/ChangeLog 2010-11-17 19:39:35 UTC (rev 8800) @@ -1,3 +1,7 @@ +2010-11-17 Andreas Kirschbaum + + * Implement File|Goto Map... which opens maps by map name. + 2010-11-07 Andreas Kirschbaum * Force non-GUI mode when using --script. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-11-17 19:39:35 UTC (rev 8800) @@ -25,7 +25,7 @@ ######## # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help -file.menu=newMap openFile recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit +file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/crossfire/ChangeLog 2010-11-17 19:39:35 UTC (rev 8800) @@ -1,3 +1,7 @@ +2010-11-17 Andreas Kirschbaum + + * Implement File|Goto Map... which opens maps by map name. + 2010-11-07 Andreas Kirschbaum * Force non-GUI mode when using --script. Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-11-17 19:39:35 UTC (rev 8800) @@ -25,7 +25,7 @@ ######## # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help -file.menu=newMap openFile recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit +file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/daimonin/ChangeLog 2010-11-17 19:39:35 UTC (rev 8800) @@ -1,3 +1,7 @@ +2010-11-17 Andreas Kirschbaum + + * Implement File|Goto Map... which opens maps by map name. + 2010-11-07 Andreas Kirschbaum * Force non-GUI mode when using --script. Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-11-17 19:39:35 UTC (rev 8800) @@ -25,7 +25,7 @@ ######## # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view bookmarks plugins window help -file.menu=newMap openFile recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit +file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps revertMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/gridarta.ipr 2010-11-17 19:39:35 UTC (rev 8800) @@ -1400,6 +1400,7 @@ <w>xnoagent</w> <w>xrunhprof</w> <w>xrunjdwp</w> + <w>xtea</w> <w>yoyodyne</w> <w>zergus</w> </words> Added: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,369 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import net.sf.gridarta.utils.EventListenerList2; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract base class for {@link Index} implementations. + * @author Andreas Kirschbaum + * @param <V> the value's type + */ +public class AbstractIndex<V extends Serializable> implements Index<V> { + + /** + * Objects used to synchronize accesses to other fields. + * @serial + */ + @NotNull + private final Object sync = new Object(); + + /** + * The registered listeners. + */ + @NotNull + private final EventListenerList2<IndexListener<V>> indexListeners = new EventListenerList2<IndexListener<V>>(IndexListener.class); + + /** + * Maps value to timestamp. + * @serial + */ + @NotNull + private Map<V, Long> timestamps = new HashMap<V, Long>(); + + /** + * Maps value to name. + * @serial + */ + @NotNull + private Map<V, String> names = new HashMap<V, String>(); + + /** + * Pending values. + * @serial + */ + @NotNull + private Set<V> pending = new HashSet<V>(); + + /** + * Whether the state ({@link #timestamps} or {@link #names}) was modified + * since last save. + */ + private boolean modified = false; + + /** + * Whether a transaction is active. + */ + private boolean transaction = false; + + /** + * The values to delete at the end of the current transaction. Empty if no + * transaction is active. + * @serial + */ + @NotNull + private final Collection<V> transactionDelete = new HashSet<V>(); + + /** + * {@inheritDoc} + */ + @Override + public int size() { + return timestamps.size(); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Collection<V> findPartialName(@NotNull final String name) { + synchronized (sync) { + final String nameLowerCase = name.toLowerCase(); + final Collection<V> result = new HashSet<V>(); + for (final Map.Entry<V, String> e : names.entrySet()) { + if (e.getValue().toLowerCase().contains(nameLowerCase)) { + result.add(e.getKey()); + } + } + return result; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void beginUpdate() { + synchronized (sync) { + transaction = true; + transactionDelete.clear(); + transactionDelete.addAll(timestamps.keySet()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void endUpdate() { + synchronized (sync) { + if (!transaction) { + throw new IllegalStateException(); + } + transaction = false; + + final Collection<V> tmp = new ArrayList<V>(transactionDelete); + transactionDelete.clear(); + if (!tmp.isEmpty()) { + modified = true; + for (final V value : tmp) { + timestamps.remove(value); + pending.remove(value); + names.remove(value); + } + for (final V value : tmp) { + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.valueRemoved(value); + listener.nameChanged(); + } + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void add(@NotNull final V value, final long timestamp) { + synchronized (sync) { + final Long oldTimestamp = timestamps.put(value, timestamp); + final boolean notifyPending; + final boolean notifyAdded; + if (oldTimestamp == null || oldTimestamp != timestamp) { + notifyPending = pending.add(value) && pending.size() == 1; + notifyAdded = oldTimestamp == null; + modified = true; + } else { + notifyPending = false; + notifyAdded = false; + } + transactionDelete.remove(value); + if (notifyAdded) { + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.valueAdded(value); + } + } + if (notifyPending) { + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.pendingChanged(); + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void remove(@NotNull final V value) { + synchronized (sync) { + if (timestamps.remove(value) == null) { + return; + } + modified = true; + pending.remove(value); + names.remove(value); + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.valueRemoved(value); + listener.nameChanged(); + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void setPending(@NotNull final V value) { + synchronized (sync) { + final boolean notifyPending = pending.add(value) && pending.size() == 1; + if (!timestamps.containsKey(value)) { + modified = true; + timestamps.put(value, 0L); + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.valueAdded(value); + } + } + if (notifyPending) { + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.pendingChanged(); + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void setName(@NotNull final V value, final long timestamp, @NotNull final String name) { + synchronized (sync) { + timestamps.put(value, timestamp); + final String oldName = names.put(value, name); + if (oldName != null && oldName.equals(name)) { + return; + } + modified = true; + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.nameChanged(); + } + } + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getName(@NotNull final V value) { + synchronized (sync) { + return names.get(value); + } + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public V removePending() { + synchronized (sync) { + final Iterator<V> it = pending.iterator(); + if (!it.hasNext()) { + return null; + } + + final V result = it.next(); + it.remove(); + return result; + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isModified() { + synchronized (sync) { + return modified; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void addIndexListener(@NotNull final IndexListener<V> listener) { + indexListeners.add(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void removeIndexListener(@NotNull final IndexListener<V> listener) { + indexListeners.remove(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void save(@NotNull final ObjectOutputStream objectOutputStream) throws IOException { + objectOutputStream.writeObject(timestamps); + objectOutputStream.writeObject(names); + modified = false; + } + + /** + * {@inheritDoc} + * @noinspection unchecked + */ + @Override + @SuppressWarnings({ "unchecked" }) + public void load(@NotNull final ObjectInputStream objectInputStream) throws IOException { + final Map<V, Long> tmpTimestamps; + final Map<V, String> tmpNames; + try { + tmpTimestamps = (Map<V, Long>) objectInputStream.readObject(); + tmpNames = (Map<V, String>) objectInputStream.readObject(); + } catch (final ClassNotFoundException ex) { + throw new IOException(ex.getMessage(), ex); + } + if (transaction) { + throw new IOException("cannot restore state within active transaction"); + } + + // drop excess elements from tmpNames to force a consistent state + tmpNames.keySet().retainAll(tmpTimestamps.keySet()); + + clear(); + timestamps.putAll(tmpTimestamps); + names.putAll(tmpNames); + } + + /** + * {@inheritDoc} + */ + @Override + public void clear() { + timestamps.clear(); + names.clear(); + pending.clear(); + transactionDelete.clear(); + modified = false; + } + + /** + * {@inheritDoc} + */ + @Override + public void indexingFinished() { + for (final IndexListener<V> listener : indexListeners.getListeners()) { + listener.indexingFinished(); + } + } + +} // class AbstractIndex Property changes on: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/index/Index.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/Index.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/index/Index.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,161 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Collection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An index of values. Values are associated with a timestamp and zero or one + * name. The timestamp is used to mark values as pending whenever they have + * changed. Pending values may be retrieved for re-indexing. + * <p/> + * Values may be looked up by partial names. + * <p/> + * All methods are synchronized: concurrent access from multiple threads is + * supported. + * @author Andreas Kirschbaum + * @param <V> the value's type + */ +public interface Index<V> { + + /** + * Returns the number of values in this cache. + * @return the number of values + */ + int size(); + + /** + * Returns all matching values for a (possibly partial) key name. + * @param name the partial name to look up + * @return the matching values + */ + @NotNull + Collection<V> findPartialName(@NotNull String name); + + /** + * Starts an update. Updates do not nest. This function and {@link + * #endUpdate()} should be called from only a single thread. + */ + void beginUpdate(); + + /** + * Ends an update. Removes all values from the index that were not {@link + * #add(Object, long) added} since the last call to {@link #beginUpdate()}. + * Must not be called unless a directly preceding call to + * <code>beginUpdate()</code> was made. + */ + void endUpdate(); + + /** + * Adds a value to the cache. Newly added values and existing values for + * which the new timestamp does not match the old timestamp are marked as + * pending. + * @param value the value to add + * @param timestamp a timestamp associated with the value + */ + void add(@NotNull V value, long timestamp); + + /** + * Removes a value from the cache. Does nothing if the values does not + * exist. + * @param value the value to remove + */ + void remove(@NotNull V value); + + /** + * Marks a value as pending. The value is added if it does not exist. + * @param value the value to mark pending + */ + void setPending(@NotNull V value); + + /** + * Associates a value with a name. Adds the value if it does not exist. + * @param value the value to associate with a name + * @param timestamp the value's timestamp + * @param name the name associated with the value + */ + void setName(@NotNull V value, long timestamp, @NotNull String name); + + /** + * Returns the name associated with a value. + * @param value the value + * @return the name or <code>null</code> if the value does not exist or has + * no associated name + */ + @Nullable + String getName(@NotNull V value); + + /** + * Returns one pending value. + * @return a pending value or <code>null</code> if no pending values exist + */ + @Nullable + V removePending(); + + /** + * Returns whether the state was modified since last save. + * @return whether the state was modified + */ + boolean isModified(); + + /** + * Adds an {@link IndexListener} to be notified of changes. + * @param listener the index listener to add + */ + void addIndexListener(@NotNull IndexListener<V> listener); + + /** + * Removes an {@link IndexListener} to be notified of changes. + * @param listener the index listener to remove + */ + void removeIndexListener(@NotNull IndexListener<V> listener); + + /** + * Saves the state to an {@link ObjectOutputStream}. Pending maps are not + * saved. + * @param objectOutputStream the object output stream to write to + * @throws IOException if an I/O error occurs + */ + void save(@NotNull ObjectOutputStream objectOutputStream) throws IOException; + + /** + * Restores the state from an {@link ObjectInputStream}. The previous state + * is overwritten. + * @param objectInputStream the input stream to read from + * @throws IOException if an I/O error occurs + */ + void load(@NotNull ObjectInputStream objectInputStream) throws IOException; + + /** + * Clears all values from the index. + */ + void clear(); + + /** + * Should be called after indexing has finished. + */ + void indexingFinished(); + +} // interface Index Property changes on: trunk/model/src/app/net/sf/gridarta/model/index/Index.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,59 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.util.EventListener; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for listeners interested in {@link Index} related events. + * @param <V> the index's value's type + * @author Andreas Kirschbaum + */ +public interface IndexListener<V> extends EventListener { + + /** + * A new value has been added to the index. + * @param value the value + */ + void valueAdded(@NotNull V value); + + /** + * A value has been removed from the index. + * @param value the value + */ + void valueRemoved(@NotNull V value); + + /** + * A name mapping has changed. + */ + void nameChanged(); + + /** + * At least one pending value has become available. + */ + void pendingChanged(); + + /** + * Called after indexing has finished. + */ + void indexingFinished(); + +} // interface IndexListener Property changes on: trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,30 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.File; + +/** + * Indexes maps by map name. Allows searching for maps by partial map name. + * @author Andreas Kirschbaum + */ +public class MapsIndex extends AbstractIndex<File> { + +} // class MapsIndex Property changes on: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndex.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,585 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.concurrent.Semaphore; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.DefaultMapControl; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcontrol.MapControlListener; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.mapmanager.MapManagerListener; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.model.settings.GlobalSettingsListener; +import net.sf.gridarta.utils.ConfigFileUtils; +import net.sf.gridarta.utils.Xtea; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Maintains a {@link MapsIndex} for the maps directory. Changed maps are + * tracked and the index is updated. + * @author Andreas Kirschbaum + */ +public class MapsIndexer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The Logger for printing log messages. + */ + @NotNull + private static final Category log = Logger.getLogger(MapsIndexer.class); + + /** + * A pending map may exist in {@link #mapsIndex} if a permit is available. + */ + @NotNull + private final Semaphore mapsIndexSemaphore = new Semaphore(1); + + /** + * The {@link MapsIndex} being updated. + */ + @NotNull + private final MapsIndex mapsIndex; + + /** + * The {@link MapManager} for loading map files. + */ + @NotNull + private final MapManager<G, A, R> mapManager; + + /** + * The {@link GlobalSettings} instance. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** + * The object for synchronizing access to {@link #mapsDirectory} and {@link + * #newMapsDirectory}. + */ + @NotNull + private final Object syncMapsDirectory = new Object(); + + /** + * The currently indexed maps directory. + */ + @Nullable + private File mapsDirectory = null; + + /** + * The maps directory to index. If <code>null</code>, {@link #mapsDirectory} + * is valid. + */ + @Nullable + private File newMapsDirectory = null; + + /** + * The object for synchronizing access to {@link #state}. + */ + @NotNull + private final Object syncState = new Object(); + + /** + * The indexer state. + */ + @NotNull + private State state = State.INIT; + + /** + * Indexer states. + */ + private enum State { + + /** + * Indexer has been created but is not yet running. + */ + INIT, + + /** + * Indexer is scanning the maps directory searching for files differing + * to the current index. + */ + SCAN, + + /** + * Indexer is indexing maps differing from the current index. + */ + INDEX, + + /** + * Indexer is idle; the current index is up-to-date. + */ + IDLE + + } + + /** + * The {@link MapManagerListener} attached to {@link #mapManager} to detect + * current map changes. + */ + private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { + + @Override + public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { + // ignore + } + + @Override + public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { + if (!mapControl.isPickmap()) { + mapControl.addMapControlListener(mapControlListener); + } + } + + @Override + public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + @Override + public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { + if (!mapControl.isPickmap()) { + mapControl.removeMapControlListener(mapControlListener); + } + } + + }; + + /** + * The {@link MapControlListener} attached to all opened maps. + */ + @NotNull + private final MapControlListener<G, A, R> mapControlListener = new MapControlListener<G, A, R>() { + + @Override + public void saved(@NotNull final DefaultMapControl<G, A, R> mapControl) { + final File file = mapControl.getMapModel().getMapFile(); + if (file != null) { + mapsIndex.setPending(file); + } + } + + }; + + /** + * The {@link GlobalSettingsListener} attached to {@link #globalSettings} + * for tracking changed maps directories. + */ + @NotNull + private final GlobalSettingsListener globalSettingsListener = new GlobalSettingsListener() { + + @Override + public void showMainToolbarChanged(final boolean visible) { + // ignore + } + + @Override + public void mapsDirectoryChanged(@NotNull final File mapsDirectory) { + synchronized (syncMapsDirectory) { + newMapsDirectory = globalSettings.getMapsDirectory(); + } + } + + }; + + /** + * The {@link IndexListener} attached to {@link #mapsIndex} to detect newly + * added pending maps. + */ + @NotNull + private final IndexListener<File> indexListener = new IndexListener<File>() { + + /** + * {@inheritDoc} + */ + @Override + public void valueAdded(@NotNull final File value) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void valueRemoved(@NotNull final File value) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void nameChanged() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void pendingChanged() { + mapsIndexSemaphore.release(); + } + + @Override + public void indexingFinished() { + // ignore + } + + }; + + /** + * The {@link Runnable} scanning the maps directory and updating the index. + */ + @NotNull + private final Runnable runnable = new Runnable() { + + @Override + public void run() { + while (!Thread.currentThread().isInterrupted()) { + updateMapsDirectory(); + indexPendingMaps(); + if (state == State.IDLE) { + try { + mapsIndexSemaphore.acquire(); + } catch (final InterruptedException ignored) { + Thread.currentThread().interrupt(); + break; + } + } + } + } + + }; + + /** + * The {@link Thread} executing {@link #runnable}. + */ + @NotNull + private final Thread thread = new Thread(runnable, "indexer"); + + /** + * Creates a new instance. + * @param mapsIndex the maps index to update + * @param mapManager the map manager for loading map files + * @param globalSettings the global settings instance; defines the indexed + * maps directory + */ + public MapsIndexer(@NotNull final MapsIndex mapsIndex, @NotNull final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings) { + this.mapsIndex = mapsIndex; + this.mapManager = mapManager; + this.globalSettings = globalSettings; + reportStateChange(); + } + + /** + * Starts indexing. Must not be called more than once. + */ + public void start() { + globalSettings.addGlobalSettingsListener(globalSettingsListener); + mapManager.addMapManagerListener(mapManagerListener); + synchronized (syncMapsDirectory) { + newMapsDirectory = globalSettings.getMapsDirectory(); + } + mapsIndex.addIndexListener(indexListener); + thread.start(); + } + + /** + * Stops indexing. Must not be called more than once or before {@link + * #start()} has been called. + * @throws InterruptedException if the current thread was interrupted + */ + public void stop() throws InterruptedException { + try { + thread.interrupt(); + thread.join(); + } finally { + globalSettings.removeGlobalSettingsListener(globalSettingsListener); + mapManager.removeMapManagerListener(mapManagerListener); + for (final MapControl<G, A, R> mapControl : mapManager.getOpenedMaps()) { + if (!mapControl.isPickmap()) { + mapControl.removeMapControlListener(mapControlListener); + } + } + mapsIndex.removeIndexListener(indexListener); + } + + synchronized (syncMapsDirectory) { + saveMapsIndex(); + } + } + + /** + * Blocks the calling thread until all pending maps have been indexed. + * @throws InterruptedException if the current thread was interrupted during + * wait + */ + public void waitForIdle() throws InterruptedException { + synchronized (syncState) { + while (state != State.IDLE) { + syncState.wait(1000); + } + } + } + + /** + * Checks whether {@link #newMapsDirectory} has been set and updates {@link + * #mapsDirectory} accordingly. + */ + private void updateMapsDirectory() { + final File tmpMapsDirectory; + synchronized (syncMapsDirectory) { + if (newMapsDirectory == null || (mapsDirectory != null && mapsDirectory.equals(newMapsDirectory))) { + return; + } + + setState(State.SCAN); + + saveMapsIndex(); + + tmpMapsDirectory = newMapsDirectory; + assert tmpMapsDirectory != null; + mapsDirectory = tmpMapsDirectory; + newMapsDirectory = null; + + loadMapsIndex(); + } + mapsIndex.beginUpdate(); + scanMapsDirectoryInt(tmpMapsDirectory, ""); + mapsIndex.endUpdate(); + } + + /** + * Saves {@link #mapsIndex} to its cache file if modified. + */ + private void saveMapsIndex() { + assert Thread.holdsLock(syncMapsDirectory); + if (mapsDirectory == null) { + return; + } + + if (!globalSettings.saveIndices()) { + return; + } + + if (!mapsIndex.isModified()) { + return; + } + + assert mapsDirectory != null; + final File cacheFile = getCacheFile(mapsDirectory); + try { + final OutputStream outputStream = new FileOutputStream(cacheFile); + try { + final ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream); + try { + mapsIndex.save(objectOutputStream); + } finally { + objectOutputStream.close(); + } + } finally { + outputStream.close(); + } + if (log.isInfoEnabled()) { + log.info(cacheFile + ": saved " + mapsIndex.size() + " entries"); + } + } catch (final IOException ex) { + log.warn(cacheFile + ": cannot save cache file: " + ex.getMessage()); + } + } + + /** + * Loads {@link #mapsIndex} from its cache file. + */ + private void loadMapsIndex() { + assert Thread.holdsLock(syncMapsDirectory); + assert mapsDirectory != null; + final File cacheFile = getCacheFile(mapsDirectory); + try { + final InputStream inputStream = new FileInputStream(cacheFile); + try { + final ObjectInputStream objectInputStream = new ObjectInputStream(inputStream); + try { + mapsIndex.load(objectInputStream); + } finally { + objectInputStream.close(); + } + } finally { + inputStream.close(); + } + if (log.isInfoEnabled()) { + log.info(cacheFile + ": loaded " + mapsIndex.size() + " entries"); + } + } catch (final FileNotFoundException ex) { + if (log.isDebugEnabled()) { + log.debug(cacheFile + ": cache file does not exist: " + ex.getMessage()); + } + mapsIndex.clear(); + } catch (final IOException ex) { + log.warn(cacheFile + ": cannot load cache file: " + ex.getMessage()); + mapsIndex.clear(); + } + } + + /** + * Scans a directory for files. Adds all files found to {@link #mapsIndex}. + * @param dir the directory to scan + * @param mapPath the map path corresponding to <code>dir</code> + */ + private void scanMapsDirectoryInt(@NotNull final File dir, @NotNull final String mapPath) { + final File[] files = dir.listFiles(); + if (files == null) { + return; + } + + for (final File file : files) { + if (file.isFile()) { + mapsIndex.add(file, file.lastModified()); + } else if (file.isDirectory() && !file.getName().equalsIgnoreCase(".svn") && !file.getName().equalsIgnoreCase(".dedit")) { + scanMapsDirectoryInt(file, mapPath + "/" + file.getName()); + } + } + } + + /** + * Indexes one pending map from {@link #mapsIndex}. Does nothing if no + * pending map exists. + */ + private void indexPendingMaps() { + final File file = mapsIndex.removePending(); + if (file == null) { + setState(State.IDLE); + return; + } + + setState(State.INDEX); + final long timestamp = file.lastModified(); + final MapControl<G, A, R> mapControl; + try { + mapControl = mapManager.openMapFile(file, false); + } catch (final IOException ex) { + if (log.isInfoEnabled()) { + log.info(file + ": load failed:" + ex.getMessage()); + } + return; + } + try { + final String mapName = mapControl.getMapModel().getMapArchObject().getMapName(); + if (log.isDebugEnabled()) { + log.debug(file + ": indexing as '" + mapName + "'"); + } + mapsIndex.setName(file, timestamp, mapName); + } finally { + mapManager.release(mapControl); + } + } + + /** + * Returns the cache file for a given maps directory. + * @param mapsDirectory the maps directory + * @return the cache file + */ + @NotNull + private static File getCacheFile(@NotNull final File mapsDirectory) { + final byte[] key = new byte[16]; + final Xtea xtea = new Xtea(key); + final byte[] data; + try { + data = mapsDirectory.getAbsoluteFile().toString().getBytes("UTF-8"); + } catch (final UnsupportedEncodingException ex) { + throw new AssertionError(ex); // UTF-8 must be supported + } + final byte[] hash = new byte[8]; + final byte[] in = new byte[8]; + final byte[] out = new byte[8]; + int i; + for (i = 0; i + 8 < data.length; i++) { + System.arraycopy(data, i, in, 0, 8); + xtea.encrypt(in, out); + for (int j = 0; j < 8; j++) { + hash[j] ^= out[j]; + } + } + final int len = data.length % 8; + System.arraycopy(data, i, in, 0, len); + in[len] = (byte) 1; + Arrays.fill(in, len + 1, 8, (byte) 0); + xtea.encrypt(in, out); + for (int j = 0; j < 8; j++) { + hash[j] ^= out[j]; + } + + final StringBuilder sb = new StringBuilder("index/maps/"); + for (int j = 0; j < 8; j++) { + sb.append(String.format("%02x", hash[j] & 0xff)); + } + sb.append(mapsDirectory.getName()); + final File file = ConfigFileUtils.getHomeFile(sb.toString()); + final File dir = file.getParentFile(); + if (dir != null && !dir.exists() && !dir.mkdirs()) { + log.warn("cannot create directory: " + dir); + } + return file; + } + + /** + * Sets a new value to {@link #state}. Logs changed values. + * @param state the new state + */ + private void setState(@NotNull final State state) { + synchronized (syncState) { + if (this.state == state) { + return; + } + + this.state = state; + reportStateChange(); + syncState.notifyAll(); + } + } + + /** + * Logs a changed value of {@link #state}. + */ + private void reportStateChange() { + if (log.isDebugEnabled()) { + log.debug("state=" + state); + } + + mapsIndex.indexingFinished(); + } + +} // class MapsIndexer Property changes on: trunk/model/src/app/net/sf/gridarta/model/index/MapsIndexer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/model/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -530,4 +530,12 @@ preferences.put(PREFERENCES_USER_NAME, userName); } + /** + * {@inheritDoc} + */ + @Override + public boolean saveIndices() { + return true; + } + } // class DefaultGlobalSettings Modified: trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java 2010-11-17 18:25:31 UTC (rev 8799) +++ trunk/model/src/app/net/sf/gridarta/model/settings/GlobalSettings.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -231,4 +231,10 @@ */ void removeGlobalSettingsListener(@NotNull GlobalSettingsListener listener); + /** + * Returns whether indices should be saved to disk. + * @return whether indices should be saved to disk + */ + boolean saveIndices(); + } // interface GlobalSettings Added: trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,256 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.TreeSet; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; +import org.junit.Test; + +/** + * Regression tests for {@link MapsIndex}. + * @author Andreas Kirschbaum + */ +public class MapsIndexTest { + + /** + * Checks that values are correctly marked as pending. + */ + @Test + public void test1() { + final Index<File> index = new MapsIndex(); + index.add(new File("a"), 1); + index.add(new File("b"), 1); + index.add(new File("c"), 1); + Assert.assertEquals("a,b,c", getPending(index)); + Assert.assertEquals("", getPending(index)); + index.add(new File("d"), 1); + Assert.assertEquals("d", getPending(index)); + index.add(new File("b"), 1); + index.add(new File("d"), 1); + Assert.assertEquals("", getPending(index)); + index.add(new File("b"), 2); + index.add(new File("d"), 2); + Assert.assertEquals("b,d", getPending(index)); + index.setPending(new File("a")); + Assert.assertEquals("a", getPending(index)); + index.setPending(new File("a")); + index.add(new File("b"), 3); + index.add(new File("c"), 3); + index.remove(new File("b")); + Assert.assertEquals("a,c", getPending(index)); + } + + /** + * Checks that {@link Index#findPartialName(String)} works as expected. + */ + @Test + public void testFind1() { + final Index<File> index = new MapsIndex(); + Assert.assertEquals("", findPartialName(index, "a")); + index.add(new File("abc"), 1); + index.setName(new File("abc"), 1, "abC"); + Assert.assertEquals("abc", findPartialName(index, "a")); + Assert.assertEquals("abc", findPartialName(index, "b")); + Assert.assertEquals("", findPartialName(index, "x")); + index.add(new File("bcd"), 1); + index.setName(new File("bcd"), 1, "BcD"); + Assert.assertEquals("abc", findPartialName(index, "a")); + Assert.assertEquals("abc,bcd", findPartialName(index, "b")); + Assert.assertEquals("abc,bcd", findPartialName(index, "Bc")); + Assert.assertEquals("", findPartialName(index, "x")); + } + + /** + * Checks that {@link Index#beginUpdate()} and {@link Index#endUpdate()} + * works as expected. + */ + @Test + public void testTransaction() { + final Index<File> index = new MapsIndex(); + index.add(new File("a"), 1); + index.add(new File("b"), 1); + index.add(new File("c"), 1); + index.setName(new File("a"), 2, "a"); + index.setName(new File("b"), 2, "a"); + index.setName(new File("c"), 2, "a"); + index.beginUpdate(); + index.add(new File("b"), 1); + index.add(new File("c"), 2); + index.add(new File("d"), 2); + index.endUpdate(); + index.setName(new File("b"), 2, "a"); + index.setName(new File("c"), 2, "a"); + index.setName(new File("d"), 2, "a"); + Assert.assertEquals("b,c,d", findPartialName(index, "a")); + } + + /** + * Checks that listeners are notified. + */ + @Test + public void testListener() { + final Index<File> index = new MapsIndex(); + final Listener listener = new Listener(); + index.addIndexListener(listener); + + index.add(new File("a"), 1); + Assert.assertEquals("add a\n" + "pending changed\n", listener.getAndClearEvents()); + + index.add(new File("a"), 1); + Assert.assertEquals("", listener.getAndClearEvents()); + + index.add(new File("a"), 2); + Assert.assertEquals("", listener.getAndClearEvents()); + + index.add(new File("b"), 2); + index.add(new File("c"), 2); + Assert.assertEquals("add b\n" + "add c\n", listener.getAndClearEvents()); + + index.remove(new File("b")); + Assert.assertEquals("del b\n" + "name changed\n", listener.getAndClearEvents()); + + index.setName(new File("a"), 2, "name1"); + index.setName(new File("b"), 2, "name2"); + index.setName(new File("c"), 2, "name3"); + Assert.assertEquals("name changed\n" + "name changed\n" + "name changed\n", listener.getAndClearEvents()); + } + + /** + * Returns all pending values of a {@link MapsIndex}. Afterwards the pending + * entries have been removed from the index. + * @param index the index + * @return the pending values + */ + @NotNull + private static String getPending(@NotNull final Index<File> index) { + final Collection<File> pendingFiles = new HashSet<File>(); + for (; ;) { + final File pendingFile = index.removePending(); + if (pendingFile == null) { + break; + } + pendingFiles.add(pendingFile); + } + return format(pendingFiles); + } + + /** + * Calls {@link Index#findPartialName(String)} on the given {@link Index} + * and name and returns a string representation of the result. + * @param index the index + * @param name the name + * @return the string representation + */ + @NotNull + private static String findPartialName(@NotNull final Index<File> index, @NotNull final String name) { + return format(index.findPartialName(name)); + } + + /** + * Returns a text representation of a {@link Collection}. + * @param files the collection + * @return the text representation + */ + @NotNull + private static String format(@NotNull final Collection<File> files) { + final TreeSet<File> tmp = new TreeSet<File>(files); + final StringBuilder sb = new StringBuilder(); + final Iterator<File> it = tmp.iterator(); + if (it.hasNext()) { + sb.append(it.next()); + while (it.hasNext()) { + sb.append(','); + sb.append(it.next()); + } + } + return sb.toString(); + } + + /** + * An {@link IndexListener} that records a text representation of all + * generated events. + */ + private static class Listener implements IndexListener<File> { + + /** + * The recorded events in text representation. + */ + @NotNull + private final StringBuilder stringBuilder = new StringBuilder(); + + /** + * {@inheritDoc} + */ + @Override + public void valueAdded(@NotNull final File value) { + stringBuilder.append("add ").append(value).append("\n"); + } + + /** + * {@inheritDoc} + */ + @Override + public void valueRemoved(@NotNull final File value) { + stringBuilder.append("del ").append(value).append("\n"); + } + + /** + * {@inheritDoc} + */ + @Override + public void nameChanged() { + stringBuilder.append("name changed\n"); + } + + /** + * {@inheritDoc} + */ + @Override + public void pendingChanged() { + stringBuilder.append("pending changed\n"); + } + + /** + * {@inheritDoc} + */ + @Override + public void indexingFinished() { + stringBuilder.append("indexing finished"); + } + + /** + * Returns the accumulated events. + * @return the events + */ + @NotNull + public String getAndClearEvents() { + final String result = stringBuilder.toString(); + stringBuilder.setLength(0); + return result; + } + + } + +} // class MapsIndexTest Property changes on: trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexerTest.java 2010-11-17 19:39:35 UTC (rev 8800) @@ -0,0 +1,179 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.index; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.Iterator; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapcontrol.DefaultMapControl; +import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.mapmodel.... [truncated message content] |
From: <aki...@us...> - 2010-11-18 19:13:44
|
Revision: 8802 http://gridarta.svn.sourceforge.net/gridarta/?rev=8802&view=rev Author: akirschbaum Date: 2010-11-18 19:13:37 +0000 (Thu, 18 Nov 2010) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java trunk/src/app/net/sf/gridarta/gui/gomapdialog/MapListCellRenderer.java trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeManager.java Modified: trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java 2010-11-17 20:48:59 UTC (rev 8801) +++ trunk/model/src/test/net/sf/gridarta/model/index/MapsIndexTest.java 2010-11-18 19:13:37 UTC (rev 8802) @@ -146,7 +146,7 @@ @NotNull private static String getPending(@NotNull final Index<File> index) { final Collection<File> pendingFiles = new HashSet<File>(); - for (; ;) { + while (true) { final File pendingFile = index.removePending(); if (pendingFile == null) { break; Modified: trunk/src/app/net/sf/gridarta/gui/gomapdialog/MapListCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gomapdialog/MapListCellRenderer.java 2010-11-17 20:48:59 UTC (rev 8801) +++ trunk/src/app/net/sf/gridarta/gui/gomapdialog/MapListCellRenderer.java 2010-11-18 19:13:37 UTC (rev 8802) @@ -27,7 +27,8 @@ import org.jetbrains.annotations.NotNull; /** - * A {@link DefaultListCellRenderer} that renders values of a {@link MapsIndex}. + * A {@link DefaultListCellRenderer} that renders values of a {@link + * MapsIndex}. * @author Andreas Kirschbaum */ public class MapListCellRenderer extends DefaultListCellRenderer { @@ -60,7 +61,7 @@ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final File file = (File) value; final String name = mapsIndex.getName(file); - setText((name == null ? "?" : name)+" ("+file.getName()+")"); + setText((name == null ? "?" : name) + " (" + file.getName() + ")"); setToolTipText(value.toString()); return this; } Modified: trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeManager.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeManager.java 2010-11-17 20:48:59 UTC (rev 8801) +++ trunk/utils/src/app/net/sf/gridarta/utils/DelayedChangeManager.java 2010-11-18 19:13:37 UTC (rev 8802) @@ -101,26 +101,26 @@ * The state "idle" of the FSM. */ @NotNull - private State IDLE = new State() { + private final State idle = new State() { @NotNull @Override public State change() { timer.schedule(new TimeoutTimerTask(), initialDelay); - return PENDING; + return pending; } @NotNull @Override public State finish() { - return IDLE; + return idle; } @NotNull @Override public State timeout() { assert false; - return IDLE; + return idle; } }; @@ -129,19 +129,19 @@ * The state "pending" of the FSM. */ @NotNull - private State PENDING = new State() { + private final State pending = new State() { @NotNull @Override public State change() { - return PENDING; + return pending; } @NotNull @Override public State finish() { delayedChangeListener.change(); - return WAIT; + return wait; } @NotNull @@ -149,7 +149,7 @@ public State timeout() { timer.schedule(new TimeoutTimerTask(), notificationDelay); delayedChangeListener.change(); - return WAIT; + return wait; } }; @@ -158,24 +158,24 @@ * The state "wait" of the FSM. */ @NotNull - private State WAIT = new State() { + private final State wait = new State() { @NotNull @Override public State change() { - return PENDING; + return pending; } @NotNull @Override public State finish() { - return WAIT; + return wait; } @NotNull @Override public State timeout() { - return IDLE; + return idle; } @@ -185,7 +185,7 @@ * The FSM's current state. */ @NotNull - private State state = IDLE; + private State state = idle; /** * Creates a new instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-11-24 08:33:41
|
Revision: 8804 http://gridarta.svn.sourceforge.net/gridarta/?rev=8804&view=rev Author: akirschbaum Date: 2010-11-24 08:33:34 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/SectionNames.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/package.html trunk/src/app/net/sf/gridarta/package.html Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/package.html Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeInvSpell.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -22,7 +22,8 @@ import org.jetbrains.annotations.NotNull; /** - * Abstract base class for {@link ArchetypeAttribute}s for inventory spells. + * Abstract base class for {@link ArchetypeAttribute ArchetypeAttributes} for + * inventory spells. * @author Andreas Kirschbaum */ public abstract class AbstractArchetypeAttributeInvSpell extends ArchetypeAttribute { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -22,7 +22,8 @@ import org.jetbrains.annotations.NotNull; /** - * Abstract base class for {@link ArchetypeAttribute}s for lists. + * Abstract base class for {@link ArchetypeAttribute ArchetypeAttributes} for + * lists. * @author Andreas Kirschbaum */ public abstract class AbstractArchetypeAttributeList extends ArchetypeAttribute { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -24,7 +24,8 @@ import org.jetbrains.annotations.NotNull; /** - * Abstract base class for {@link ArchetypeAttribute}s for spells. + * Abstract base class for {@link ArchetypeAttribute ArchetypeAttributes} for + * spells. * @author Andreas Kirschbaum */ public abstract class AbstractArchetypeAttributeSpell extends ArchetypeAttribute { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -28,7 +28,7 @@ import org.w3c.dom.Node; /** - * Utility class for parsing {@link ArchetypeAttribute}s. + * Utility class for parsing {@link ArchetypeAttribute ArchetypeAttributes}. * @author Andreas Kirschbaum */ public class ArchetypeAttributeParser { @@ -139,7 +139,7 @@ /** * The {@link ArchetypeAttributeFactory} for creating {@link - * ArchetypeAttribute}s. + * ArchetypeAttribute ArchetypeAttributes}. */ @NotNull private final ArchetypeAttributeFactory archetypeAttributeFactory; Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; /** - * Interface for visitors of {@link ArchetypeAttribute}s. + * Interface for visitors of {@link ArchetypeAttribute ArchetypeAttributes}. * @author Andreas Kirschbaum */ public interface ArchetypeAttributeVisitor { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -71,7 +71,7 @@ private final int sectionNum; /** - * The list of {@link ArchetypeAttribute}s. + * The list of {@link ArchetypeAttribute ArchetypeAttributes}. */ @NotNull private final ArchetypeAttributes archetypeAttributes; Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -50,8 +50,8 @@ private ArchetypeType fallbackArchetypeType = null; /** - * Lists with all {@link ArchetypeType}s. Contains all but the default - * archetype type. + * Lists with all {@link ArchetypeType ArchetypeTypes}. Contains all but the + * default archetype type. * @todo verify whether the default ArchetypeType really is not included in * this list. */ Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/SectionNames.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/SectionNames.java 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/SectionNames.java 2010-11-24 08:33:34 UTC (rev 8804) @@ -24,7 +24,8 @@ import org.jetbrains.annotations.NotNull; /** - * Maintains a list of section names while parsing {@link ArchetypeAttribute}s. + * Maintains a list of section names while parsing {@link ArchetypeAttribute + * ArchetypeAttributes}. * @author Andreas Kirschbaum */ public class SectionNames { Added: trunk/model/src/app/net/sf/gridarta/model/archetypetype/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/package.html (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/package.html 2010-11-24 08:33:34 UTC (rev 8804) @@ -0,0 +1,35 @@ +<!-- + ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + ~ Copyright (C) 2000-2010 The Gridarta Developers. + ~ + ~ This program is free software; you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation; either version 2 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License along + ~ with this program; if not, write to the Free Software Foundation, Inc., + ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + --> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> +<body> +<p>Defines types of {@link net.sf.gridarta.model.gameobject.GameObject + GameObjects} with corresponding attributes. The game servers use different + types of game objects, such as floors, monsters, traps, etc. Each of these + types uses a specific set of attributes. Gridarta has no built-in knowledge + about these. Instead it reads a configuration file, "types.xml", which + defines game object types with corresponding attributes.</p> + +<p>{@link net.sf.gridarta.model.archetypetype.ArchetypeTypeSetParser} implements + a parser for the "types.xml" file. {@link + net.sf.gridarta.model.archetypetype.ArchetypeTypeSet} is a model class that + stores all type definitions.</p> +</body> +</html> Property changes on: trunk/model/src/app/net/sf/gridarta/model/archetypetype/package.html ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/package.html 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/package.html 2010-11-24 08:33:34 UTC (rev 8804) @@ -26,14 +26,14 @@ <p>The easiest way to create your own checks is this:</p> <ol> - <li>Extend {@link net.sf.gridarta.validation.AbstractValidator + <li>Extend {@link net.sf.gridarta.model.validation.AbstractValidator AbstractValidator} by a class named like net.sf.gridarta.map.validation.checks.MyMapChecker that additionally - implements one of the {@link net.sf.gridarta.validation.Validator + implements one of the {@link net.sf.gridarta.model.validation.Validator Validator} sub-interfaces </li> <li>Extend {@link net.sf.gridarta.model.validation.errors.ValidationError - ValidationError} or one of its subclasses by a class named like <code>net.sf.gridarta.map.validation.checks.MyError</code>. + ValidationError} or one of its subclasses by a class named like <code>net.sf.gridarta.map.model.validation.checks.MyError</code>. </li> </ol> <p>Note: to use the automatic localization feature, the error class and @@ -41,10 +41,10 @@ <h3>Caveats</h3> -<p>If you extend {@link net.sf.gridarta.validation.AbstractValidator +<p>If you extend {@link net.sf.gridarta.model.validation.AbstractValidator AbstractValidator} without actually really implementing one of the {@link - net.sf.gridarta.validation.Validator Validator}, your validator will be a - valid and compilable validator but also a dysfunctional stub. So don't + net.sf.gridarta.model.validation.Validator Validator}, your validator will + be a valid and compilable validator but also a dysfunctional stub. So don't forget to extend the corresponding sub-interface.</p> <h3>FAQ</h3> Modified: trunk/src/app/net/sf/gridarta/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/package.html 2010-11-20 15:09:38 UTC (rev 8803) +++ trunk/src/app/net/sf/gridarta/package.html 2010-11-24 08:33:34 UTC (rev 8804) @@ -21,7 +21,7 @@ <html> <body> Base package of all Gridarta classes. This package contains only one interface: -{@link MainControl} which defines the location for storing preferences. All -other types are part of sub-packages. +{@link net.sf.gridarta.MainControl} which defines the location for storing +preferences. All other types are part of sub-packages. </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-11-24 09:44:53
|
Revision: 8805 http://gridarta.svn.sourceforge.net/gridarta/?rev=8805&view=rev Author: akirschbaum Date: 2010-11-24 09:44:46 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Fix keyboard shortcuts of the go map and find archetype dialogs to be globally active on every input field. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/utils/SwingUtils.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-11-24 08:33:34 UTC (rev 8804) +++ trunk/atrinik/ChangeLog 2010-11-24 09:44:46 UTC (rev 8805) @@ -1,3 +1,8 @@ +2010-11-24 Andreas Kirschbaum + + * Fix keyboard shortcuts of the go map and find archetype dialogs + to be globally active on every input field. + 2010-11-17 Andreas Kirschbaum * Implement File|Goto Map... which opens maps by map name. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-11-24 08:33:34 UTC (rev 8804) +++ trunk/crossfire/ChangeLog 2010-11-24 09:44:46 UTC (rev 8805) @@ -1,3 +1,8 @@ +2010-11-24 Andreas Kirschbaum + + * Fix keyboard shortcuts of the go map and find archetype dialogs + to be globally active on every input field. + 2010-11-17 Andreas Kirschbaum * Implement File|Goto Map... which opens maps by map name. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-11-24 08:33:34 UTC (rev 8804) +++ trunk/daimonin/ChangeLog 2010-11-24 09:44:46 UTC (rev 8805) @@ -1,3 +1,8 @@ +2010-11-24 Andreas Kirschbaum + + * Fix keyboard shortcuts of the go map and find archetype dialogs + to be globally active on every input field. + 2010-11-17 Andreas Kirschbaum * Implement File|Goto Map... which opens maps by map name. Modified: trunk/src/app/net/sf/gridarta/gui/utils/SwingUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/SwingUtils.java 2010-11-24 08:33:34 UTC (rev 8804) +++ trunk/src/app/net/sf/gridarta/gui/utils/SwingUtils.java 2010-11-24 09:44:46 UTC (rev 8805) @@ -23,8 +23,8 @@ import javax.swing.Action; import javax.swing.JComponent; import javax.swing.KeyStroke; -import javax.swing.text.JTextComponent; import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.ActionUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -62,16 +62,18 @@ } /** - * Adds an accelerator key for a text component. The accelerator key is - * extracted from the action to be added. If the action has no attached - * accelerator key, nothing is added. + * Adds an accelerator key for a component. The accelerator key is extracted + * from the action to be added. If the action has no attached accelerator + * key, nothing is added. * @param textComponent The text component to add to. * @param action The action to add. */ - public static void addAction(@NotNull final JTextComponent textComponent, @NotNull final Action action) { + public static void addAction(@NotNull final JComponent textComponent, @NotNull final Action action) { final KeyStroke keyStroke = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY); if (keyStroke != null) { - textComponent.getKeymap().addActionForKeyStroke(keyStroke, action); + final String actionId = ActionUtils.getActionId(action); + textComponent.getInputMap().put(keyStroke, actionId); + textComponent.getActionMap().put(actionId, action); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-05 10:17:31
|
Revision: 8810 http://gridarta.svn.sourceforge.net/gridarta/?rev=8810&view=rev Author: akirschbaum Date: 2010-12-05 10:17:25 +0000 (Sun, 05 Dec 2010) Log Message: ----------- Fix display issues in map preview tool. [Atrinik, Daimonin] Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/map/renderer/SimpleIsoMapRenderer.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-05 10:03:28 UTC (rev 8809) +++ trunk/atrinik/ChangeLog 2010-12-05 10:17:25 UTC (rev 8810) @@ -1,3 +1,7 @@ +2010-12-05 Andreas Kirschbaum + + * Fix display issues in map preview tool. + 2010-11-24 Andreas Kirschbaum * Fix keyboard shortcuts of the go map and find archetype dialogs Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-05 10:03:28 UTC (rev 8809) +++ trunk/daimonin/ChangeLog 2010-12-05 10:17:25 UTC (rev 8810) @@ -1,3 +1,7 @@ +2010-12-05 Andreas Kirschbaum + + * Fix display issues in map preview tool. + 2010-11-24 Andreas Kirschbaum * Fix keyboard shortcuts of the go map and find archetype dialogs Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/SimpleIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/SimpleIsoMapRenderer.java 2010-12-05 10:03:28 UTC (rev 8809) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/SimpleIsoMapRenderer.java 2010-12-05 10:17:25 UTC (rev 8810) @@ -88,10 +88,7 @@ protected void paint(@NotNull final Graphics2D graphics2D, final int xStart, final int yStart, @NotNull final G gameObject) { final GameObject<G, A, R> head = gameObject.getHead(); final ImageIcon icon = "trans.101".equals(head.getFaceObjName()) ? unknownSquareIcon : head.getNormalImage(); - int yOffset = 0; - if (icon.getIconHeight() > isoMapSquareInfo.getYLen()) { - yOffset = icon.getIconHeight() - isoMapSquareInfo.getYLen(); - } + final int yOffset = icon.getIconHeight() - isoMapSquareInfo.getYLen(); if (head.getMultiRefCount() > 0) { // multi-part images have to be painted with correct offset // TODO: This should be improved, especially regarding multi arch mobs inside spawn points. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-10 18:04:18
|
Revision: 8812 http://gridarta.svn.sourceforge.net/gridarta/?rev=8812&view=rev Author: akirschbaum Date: 2010-12-10 18:04:11 +0000 (Fri, 10 Dec 2010) Log Message: ----------- Display red "Game Object" tab if the selected game object includes incorrect attributes. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-10 07:35:01 UTC (rev 8811) +++ trunk/atrinik/ChangeLog 2010-12-10 18:04:11 UTC (rev 8812) @@ -1,3 +1,8 @@ +2010-12-10 Andreas Kirschbaum + + * Display red "Game Object" tab if the selected game object + includes incorrect attributes. + 2010-12-05 Andreas Kirschbaum * Fix display issues in map preview tool. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-10 07:35:01 UTC (rev 8811) +++ trunk/crossfire/ChangeLog 2010-12-10 18:04:11 UTC (rev 8812) @@ -1,3 +1,8 @@ +2010-12-10 Andreas Kirschbaum + + * Display red "Game Object" tab if the selected game object + includes incorrect attributes. + 2010-11-24 Andreas Kirschbaum * Fix keyboard shortcuts of the go map and find archetype dialogs Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-10 07:35:01 UTC (rev 8811) +++ trunk/daimonin/ChangeLog 2010-12-10 18:04:11 UTC (rev 8812) @@ -1,3 +1,8 @@ +2010-12-10 Andreas Kirschbaum + + * Display red "Game Object" tab if the selected game object + includes incorrect attributes. + 2010-12-05 Andreas Kirschbaum * Fix display issues in map preview tool. Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java 2010-12-10 07:35:01 UTC (rev 8811) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java 2010-12-10 18:04:11 UTC (rev 8812) @@ -21,7 +21,6 @@ import javax.swing.JPanel; import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; -import net.sf.gridarta.gui.utils.Severity; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObject; @@ -75,8 +74,7 @@ */ @Override protected void refresh(@Nullable final G gameObject) { - gameObjectTextEditor.refreshDisplay(gameObject); - setTabSeverity(gameObject == null || gameObject.getObjectText().isEmpty() ? Severity.DEFAULT : Severity.MODIFIED); + setTabSeverity(gameObjectTextEditor.refreshDisplay(gameObject)); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-12-10 07:35:01 UTC (rev 8811) +++ trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-12-10 18:04:11 UTC (rev 8812) @@ -35,6 +35,7 @@ import javax.swing.text.MutableAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.gui.utils.Severity; import net.sf.gridarta.model.archetype.AttributeListUtils; import net.sf.gridarta.model.archetypetype.ArchetypeType; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -110,10 +111,13 @@ * Refreshes the input field to show the attributes of a {@link * GameObject}. * @param gameObject the game object to set the contents from + * @return the severity corresponding to the attribute values */ - public void refreshDisplay(@Nullable final GameObject<?, ?, ?> gameObject) { + @NotNull + public Severity refreshDisplay(@Nullable final GameObject<?, ?, ?> gameObject) { archEdit.setEnabled(gameObject != null); archEdit.setText(""); + Severity severity = Severity.DEFAULT; if (gameObject != null) { final MutableAttributeSet currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { @@ -122,17 +126,23 @@ final ArchetypeType typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); final String errorText = GameObjectUtils.getSyntaxErrors(gameObject, typeStruct); + final String objectText = gameObject.getObjectText(); if (errorText == null) { StyleConstants.setForeground(currentAttributes, Color.blue); - document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); + document.insertString(document.getLength(), objectText, currentAttributes); + if (!objectText.isEmpty()) { + severity = Severity.MODIFIED; + } } else { + severity = Severity.ERROR; + StyleConstants.setForeground(currentAttributes, Color.red); document.insertString(document.getLength(), errorText, currentAttributes); final Collection<String> errors = new HashSet<String>(); errors.addAll(Arrays.asList(StringUtils.PATTERN_END_OF_LINE.split(errorText))); StyleConstants.setForeground(currentAttributes, Color.blue); - for (final String line : StringUtils.PATTERN_END_OF_LINE.split(gameObject.getObjectText())) { + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(objectText)) { if (!errors.contains(line)) { document.insertString(document.getLength(), line + '\n', currentAttributes); } @@ -147,6 +157,7 @@ } archEdit.setCaretPosition(0); defaultArchEditValue = archEdit.getText(); + return severity; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-10 19:57:32
|
Revision: 8815 http://gridarta.svn.sourceforge.net/gridarta/?rev=8815&view=rev Author: akirschbaum Date: 2010-12-10 19:57:25 +0000 (Fri, 10 Dec 2010) Log Message: ----------- Add "Text Editor" tab. 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 Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/atrinik/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) @@ -1,5 +1,7 @@ 2010-12-10 Andreas Kirschbaum + * Add "Text Editor" tab. + * Display red "Game Object" tab if the selected game object includes incorrect attributes. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/crossfire/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) @@ -1,5 +1,7 @@ 2010-12-10 Andreas Kirschbaum + * Add "Text Editor" tab. + * Display red "Game Object" tab if the selected game object includes incorrect attributes. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/daimonin/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) @@ -1,5 +1,7 @@ 2010-12-10 Andreas Kirschbaum + * Add "Text Editor" tab. + * Display red "Game Object" tab if the selected game object includes incorrect attributes. Added: trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java 2010-12-10 19:57:25 UTC (rev 8815) @@ -0,0 +1,296 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.mainwindow; + +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.io.File; +import java.util.Set; +import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; +import net.sf.gridarta.gui.selectedsquare.MapSquareSelection; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareModelListener; +import net.sf.gridarta.gui.utils.borderpanel.Location; +import net.sf.gridarta.gui.utils.tabbedpanel.Tab; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.mapmanager.MapManagerListener; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapModelListener; +import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.mapmodel.MapTransactionListener; +import net.sf.gridarta.model.mapmodel.SavedSquares; +import net.sf.gridarta.model.validation.ErrorCollector; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The {@link Tab} displaying the game object text editor. + * @author Andreas Kirschbaum + */ +public class GameObjectTextEditorTab<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Tab { + + /** + * The displayed {@link GameObjectTextEditor} instance. + */ + @NotNull + private final GameObjectTextEditor gameObjectTextEditor; + + /** + * Last known active map. This map has {@link #mapModelListener} attached. + */ + @Nullable + private MapControl<G, A, R> currentMapControl; + + /** + * Whether {@link #autoApplyArchPanelChanges()} is currently running. + */ + private boolean isInAutoApplyArchPanelChanges = false; + + /** + * The currently selected game object. + */ + @Nullable + private G selectedGameObject = null; + + /** + * Records whether a map transaction is active. This is used to prevent + * start recursive map transactions in {@link #autoApplyArchPanelChanges()}. + */ + private boolean isInMapTransaction = false; + + /** + * The map manager listener. + */ + @NotNull + private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { + if (currentMapControl != null) { + final MapModel<G, A, R> mapModel = currentMapControl.getMapModel(); + mapModel.removeMapModelListener(mapModelListener); + mapModel.removeMapTransactionListener(mapTransactionListener); + } + currentMapControl = mapControl; + if (currentMapControl != null) { + final MapModel<G, A, R> mapModel = currentMapControl.getMapModel(); + mapModel.addMapModelListener(mapModelListener); + mapModel.addMapTransactionListener(mapTransactionListener); + } + } + + /** {@inheritDoc} */ + @Override + public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + }; + + /** + * The map transaction listener which is attached to {@link + * #currentMapControl}. It triggers auto-apply whenever a map transaction is + * about to start. + */ + @NotNull + private final MapTransactionListener<G, A, R> mapTransactionListener = new MapTransactionListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void preBeginTransaction() { + autoApplyArchPanelChanges(); + isInMapTransaction = true; + } + + /** {@inheritDoc} */ + @Override + public void beginTransaction(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String name) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void endTransaction(@NotNull final MapModel<G, A, R> mapModel, @NotNull final SavedSquares<G, A, R> savedSquares) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void postEndTransaction() { + isInMapTransaction = false; + } + + }; + + /** + * The map model listener which is attached to {@link #currentMapControl}. + */ + @NotNull + private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void mapSizeChanged(@NotNull final Size2D newSize) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) { + if (selectedGameObject == null) { + return; + } + + final G topGameObject = selectedGameObject.getTopContainer(); + for (final Iterable<G> mapSquare : mapSquares) { + for (final G gameObject : mapSquare) { + if (gameObject == topGameObject) { + refreshDisplay(); + } + } + } + } + + /** {@inheritDoc} */ + @Override + public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { + for (final GameObject<G, A, R> gameObject : gameObjects) { + if (selectedGameObject == gameObject.getHead()) { + refreshDisplay(); + } + } + } + + /** {@inheritDoc} */ + @Override + public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapFileChanged(@Nullable final File oldMapFile) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void modifiedChanged() { + // ignore + } + + }; + + /** + * Creates a new instance. + * @param ident the tab's identification string + * @param gameObjectTextEditor the game object text editor to show + * @param defaultLocation the tab's default location + * @param index the tab's index for ordering + * @param defaultOpen the tab's default opened status + * @param selectedSquareModel the selected square mode to track + * @param mapManager the map manager to track + */ + public GameObjectTextEditorTab(@NotNull final String ident, @NotNull final GameObjectTextEditor gameObjectTextEditor, @NotNull final Location defaultLocation, final int index, final boolean defaultOpen, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final MapManager<G, A, R> mapManager) { + super(ident, gameObjectTextEditor, defaultLocation, index, defaultOpen); + this.gameObjectTextEditor = gameObjectTextEditor; + selectedSquareModel.addSelectedSquareListener(new SelectedSquareModelListener<G, A, R>() { + + @Override + public void selectedGameObjectChanged(@Nullable final G gameObject) { + autoApplyArchPanelChanges(); + selectedGameObject = gameObject; + refreshDisplay(); + } + + @Override + public void selectedMapSquareSelectionChanged(@Nullable final MapSquareSelection<G, A, R> mapSquareSelection) { + // ignore + } + + }); + currentMapControl = mapManager.getCurrentMap(); + if (currentMapControl != null) { + final MapModel<G, A, R> mapModel = currentMapControl.getMapModel(); + mapModel.addMapModelListener(mapModelListener); + mapModel.addMapTransactionListener(mapTransactionListener); + } + mapManager.addMapManagerListener(mapManagerListener); + selectedGameObject = selectedSquareModel.getSelectedGameObject(); + refreshDisplay(); + gameObjectTextEditor.getTextPane().addFocusListener(new FocusListener() { + + /** {@inheritDoc} */ + @Override + public void focusGained(final FocusEvent e) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void focusLost(final FocusEvent e) { + autoApplyArchPanelChanges(); + } + + }); + } + + /** + * Applies pending changed. Protects against recursive calls. + */ + private void autoApplyArchPanelChanges() { + if (selectedGameObject == null || isInAutoApplyArchPanelChanges || isInMapTransaction) { + return; + } + + isInAutoApplyArchPanelChanges = true; + try { + gameObjectTextEditor.applyChanges(selectedGameObject); + } finally { + isInAutoApplyArchPanelChanges = false; + } + } + + /** + * Refreshes the tab's state from a {@link #selectedGameObject}. + */ + private void refreshDisplay() { + setSeverity(gameObjectTextEditor.refreshDisplay(selectedGameObject)); + } + +} // class GameObjectTextEditorTab Property changes on: trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-12-10 19:57:25 UTC (rev 8815) @@ -56,7 +56,10 @@ import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.gameobjectattributespanel.MsgTextTab; import net.sf.gridarta.gui.gameobjectattributespanel.TextEditorTab; +import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; +import net.sf.gridarta.gui.gomapdialog.GoMapDialogManager; import net.sf.gridarta.gui.mainwindow.GameObjectTab; +import net.sf.gridarta.gui.mainwindow.GameObjectTextEditorTab; import net.sf.gridarta.gui.mainwindow.WarningsTab; import net.sf.gridarta.gui.map.MapFileActions; import net.sf.gridarta.gui.map.mapactions.MapActions; @@ -582,6 +585,7 @@ mainView.addTab(new Tab("connections", new ConnectionControl<G, A, R>(mapViewManager, delayedMapModelListenerManager).getView(), Location.BOTTOM, 5, false)); mainView.addTab(new Tab("lockedItems", lockedItemsControl.getView(), Location.BOTTOM, 6, false)); mainView.addTab(new WarningsTab<G, A, R>("warnings", errorListView, Location.BOTTOM, 7, false)); + mainView.addTab(new GameObjectTextEditorTab<G, A, R>("textEditor", new GameObjectTextEditor(archetypeTypeSet), Location.BOTTOM, 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 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-12-10 19:57:25 UTC (rev 8815) @@ -1622,6 +1622,9 @@ tabButton.lockedItems.title1=Locked Items tabButton.lockedItems.title2={0}: Locked Items tabButton.lockedItems.shortdescription=Display the locked items of 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. tabButton.warnings.title1=Warnings tabButton.warnings.title2={0}: Warnings tabButton.warnings.shortdescription=Display the warnings of the current map. Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-12-10 19:57:25 UTC (rev 8815) @@ -1395,6 +1395,9 @@ 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.textEditor.title1=Text Editor +tabButton.textEditor.title2={0}: Text Editor +tabButton.textEditor.shortdescription=Zeigt den Objekt-Text des ausgew\u00e4hlten Objekts an. tabButton.warnings.title1=Warnungen tabButton.warnings.title2={0}: Warnungen tabButton.warnings.shortdescription=Zeigt Warnungen der aktuellen Karte. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-12-10 19:57:25 UTC (rev 8815) @@ -1384,6 +1384,9 @@ tabButton.lockedItems.title1=Objets verrouill\u00e9s tabButton.lockedItems.title2={0} : Objets verrouill\u00e9s #tabButton.lockedItems.shortdescription= +#tabButton.textEditor.title1= +#tabButton.textEditor.title2= +#tabButton.textEditor.shortdescription= tabButton.warnings.title1=Alertes tabButton.warnings.title2={0} : Alertes #tabButton.warnings.shortdescription= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-12-10 19:53:09 UTC (rev 8814) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-12-10 19:57:25 UTC (rev 8815) @@ -1383,6 +1383,9 @@ #tabButton.lockedItems.title1= #tabButton.lockedItems.title2= #tabButton.lockedItems.shortdescription= +#tabButton.textEditor.title1= +#tabButton.textEditor.title2= +#tabButton.textEditor.shortdescription= #tabButton.warnings.title1= #tabButton.warnings.title2= #tabButton.warnings.shortdescription= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-12 14:25:03
|
Revision: 8816 http://gridarta.svn.sourceforge.net/gridarta/?rev=8816&view=rev Author: akirschbaum Date: 2010-12-12 14:24:55 +0000 (Sun, 12 Dec 2010) Log Message: ----------- Add "Split Mode" action for tabs in main window. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTab.java trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java trunk/src/app/net/sf/gridarta/gui/mainwindow/WarningsTab.java trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/gui/misc/MainViewActions.java trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanel.java trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanelListener.java trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPane.java trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPaneListener.java trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/Location.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonLists.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/MoveToActions.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/Tab.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabbedPanel.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/utils/tabbedpanel/DoubleButtonList.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/atrinik/ChangeLog 2010-12-12 14:24:55 UTC (rev 8816) @@ -1,3 +1,8 @@ +2010-12-12 Andreas Kirschbaum + + * Add "Split Mode" action for tabs in main window. This allows up + to two open tabs on each side of the main window. + 2010-12-10 Andreas Kirschbaum * Add "Text Editor" tab. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/crossfire/ChangeLog 2010-12-12 14:24:55 UTC (rev 8816) @@ -1,3 +1,8 @@ +2010-12-12 Andreas Kirschbaum + + * Add "Split Mode" action for tabs in main window. This allows up + to two open tabs on each side of the main window. + 2010-12-10 Andreas Kirschbaum * Add "Text Editor" tab. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/daimonin/ChangeLog 2010-12-12 14:24:55 UTC (rev 8816) @@ -1,3 +1,8 @@ +2010-12-12 Andreas Kirschbaum + + * Add "Split Mode" action for tabs in main window. This allows up + to two open tabs on each side of the main window. + 2010-12-10 Andreas Kirschbaum * Add "Text Editor" tab. Modified: trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTab.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTab.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -41,11 +41,13 @@ * @param gameObjectAttributesControl the game object attributes control to * display * @param location the tab's location + * @param alternativeLocation whether the tab is shown in the alternative + * location * @param index the tab's index for ordering * @param defaultOpen the tab's default opened status */ - public GameObjectTab(@NotNull final String ident, @NotNull final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl, @NotNull final Location location, final int index, final boolean defaultOpen) { - super(ident, gameObjectAttributesControl, location, index, defaultOpen); + public GameObjectTab(@NotNull final String ident, @NotNull final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl, @NotNull final Location location, final boolean alternativeLocation, final int index, final boolean defaultOpen) { + super(ident, gameObjectAttributesControl, location, alternativeLocation, index, defaultOpen); final GameObjectAttributesControlListener gameObjectAttributesControlListener = new GameObjectAttributesControlListener() { /** Modified: trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -221,13 +221,15 @@ * @param ident the tab's identification string * @param gameObjectTextEditor the game object text editor to show * @param defaultLocation the tab's default location + * @param alternativeLocation whether the tab is shown in the alternative + * location * @param index the tab's index for ordering * @param defaultOpen the tab's default opened status * @param selectedSquareModel the selected square mode to track * @param mapManager the map manager to track */ - public GameObjectTextEditorTab(@NotNull final String ident, @NotNull final GameObjectTextEditor gameObjectTextEditor, @NotNull final Location defaultLocation, final int index, final boolean defaultOpen, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final MapManager<G, A, R> mapManager) { - super(ident, gameObjectTextEditor, defaultLocation, index, defaultOpen); + public GameObjectTextEditorTab(@NotNull final String ident, @NotNull final GameObjectTextEditor gameObjectTextEditor, @NotNull final Location defaultLocation, final boolean alternativeLocation, final int index, final boolean defaultOpen, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final MapManager<G, A, R> mapManager) { + super(ident, gameObjectTextEditor, defaultLocation, alternativeLocation, index, defaultOpen); this.gameObjectTextEditor = gameObjectTextEditor; selectedSquareModel.addSelectedSquareListener(new SelectedSquareModelListener<G, A, R>() { Modified: trunk/src/app/net/sf/gridarta/gui/mainwindow/WarningsTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mainwindow/WarningsTab.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/mainwindow/WarningsTab.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -40,11 +40,13 @@ * @param ident the tab's identification string * @param errorListView the error list view to display * @param location the tab's location + * @param alternativeLocation whether the tab is shown in the alternative + * location * @param index the tab's index for ordering * @param defaultOpen the tab's default opened status */ - public WarningsTab(@NotNull final String ident, @NotNull final ErrorListView<G, A, R> errorListView, @NotNull final Location location, final int index, final boolean defaultOpen) { - super(ident, errorListView, location, index, defaultOpen); + public WarningsTab(@NotNull final String ident, @NotNull final ErrorListView<G, A, R> errorListView, @NotNull final Location location, final boolean alternativeLocation, final int index, final boolean defaultOpen) { + super(ident, errorListView, location, alternativeLocation, index, defaultOpen); final ErrorListViewListener errorListViewListener = new ErrorListViewListener() { /** Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -185,11 +185,13 @@ * Returns the active {@link Tab} on a given {@link Location} of the main * view. * @param location the location + * @param alternativeLocation whether the alternative location should be + * checked * @return the tab or <code>null</code> if no active tab exists */ @Nullable - public Tab getActiveTab(@NotNull final Location location) { - return tabbedPanel.getActiveTab(location); + public Tab getActiveTab(@NotNull final Location location, final boolean alternativeLocation) { + return tabbedPanel.getActiveTab(location, alternativeLocation); } /** Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainViewActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainViewActions.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainViewActions.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -105,7 +105,7 @@ */ @ActionMethod public void gameObjectTextEditor() { - final Tab activeTab = mainView.getActiveTab(gameObjectTab.getLocation()); + final Tab activeTab = mainView.getActiveTab(gameObjectTab.getLocation(), gameObjectTab.isAlternativeLocation()); final GameObjectAttributesTab<G, A, R> activeTab2 = gameObjectAttributesControl.getSelectedTab(); final boolean gameObjectTextEditorIsActive = activeTab != null && activeTab == gameObjectTab && activeTab2 == textEditorTab; if (!gameObjectTextEditorIsActive) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanel.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanel.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -63,8 +63,16 @@ borderPanelListener.sizeChanged(optionalComponent, size); } + /** + * {@inheritDoc} + */ + @Override + public void size2Changed(final int size2) { + borderPanelListener.size2Changed(location, size2); + } + }; - final BorderSplitPane tmp = new BorderSplitPane(nextComponent, location, borderSplitPaneListener); + final BorderSplitPane tmp = new BorderSplitPane(nextComponent, location, borderSplitPaneListener, borderPanelListener.getSize2(location)); splitPanes[location.ordinal()] = tmp; nextComponent = tmp; } @@ -76,21 +84,25 @@ * Sets the optional {@link Component} for a location. * @param location the location * @param component the component + * @param alternativeLocation whether the component should be shown in the + * alternative location * @param size the size of the component; width or height, depending on * <code>location</code> * @noinspection TypeMayBeWeakened */ - public void setComponent(@NotNull final Location location, @NotNull final Component component, final int size) { - splitPanes[location.ordinal()].setOptionalComponent(component, size); + public void setComponent(@NotNull final Location location, @NotNull final Component component, final boolean alternativeLocation, final int size) { + splitPanes[location.ordinal()].setOptionalComponent(component, alternativeLocation, size); } /** * Unsets the optional {@link Component} for a location. * @param location the location + * @param alternativeLocation whether the component in the alternative + * location should be unset * @noinspection TypeMayBeWeakened */ - public void unsetComponent(@NotNull final Location location) { - splitPanes[location.ordinal()].setOptionalComponent(null, 0); + public void unsetComponent(@NotNull final Location location, final boolean alternativeLocation) { + splitPanes[location.ordinal()].setOptionalComponent(null, alternativeLocation, 0); } } // class BorderPanel Modified: trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanelListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanelListener.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderPanelListener.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -35,4 +35,18 @@ */ void sizeChanged(@NotNull Component component, int size); + /** + * The position of a the inner split pane has changed. + * @param location the location that has changed + * @param size2 the new size + */ + void size2Changed(@NotNull Location location, int size2); + + /** + * Returns the preferred position of the inner split pane. + * @param location the location + * @return the preferred position or <code>-1</code> + */ + int getSize2(Location location); + } Modified: trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPane.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPane.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; +import java.awt.Dimension; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.beans.PropertyChangeEvent; @@ -32,7 +33,7 @@ /** * A {@link Component} that permanently shows another component and optionally - * displays a {@link JSplitPane} and another component. + * displays a {@link JSplitPane} and one or two other components. * @author Andreas Kirschbaum */ public class BorderSplitPane extends Container { @@ -57,48 +58,74 @@ private final Location location; /** - * The optionally shown {@link Component}. + * The two optionally shown {@link Component Components}. * @serial */ - @Nullable - private Component optionalComponent = null; + @NotNull + private final Component[] optionalComponents = new Component[2]; /** * The {@link JSplitPane} to separate {@link #component} and {@link - * #optionalComponent}. + * #optionalComponents}. * @serial */ @NotNull private final JSplitPane splitPane; /** + * The {@link JSplitPane} to separate both elements of {@link + * #optionalComponents}. + * @serial + */ + @NotNull + private final JSplitPane splitPane2; + + /** * Whether this component is visible. * @serial */ private boolean showing = false; /** - * The pending size of this component. Unless <code>-1</code>, this - * component will be resized to this size when it becomes visible. Unused if + * The pending size of {@link #splitPane}. Unless <code>-1</code>, the split + * pane will be resized to this size when it becomes visible. Unused if * {@link #showing} is set. * @serial */ private int size = -1; /** + * The pending size of {@link #splitPane2}. Unless <code>-1</code>, the + * split pane will be resized to this size when it becomes visible. Unused + * if {@link #showing} is set. + * @serial + */ + private int size2; + + /** + * If set, do not report split pane size changes. + */ + private boolean ignoreSizeChange = false; + + /** * Creates a new instance. * @param component the permanently shown component * @param location the location of the optional component * @param borderSplitPaneListener the listener to notify + * @param size2 the initial size or <code>-1</code> for default */ - public BorderSplitPane(@NotNull final Component component, @NotNull final Location location, @NotNull final BorderSplitPaneListener borderSplitPaneListener) { + public BorderSplitPane(@NotNull final Component component, @NotNull final Location location, @NotNull final BorderSplitPaneListener borderSplitPaneListener, final int size2) { this.component = component; this.location = location; + this.size2 = size2; splitPane = new JSplitPane(location.getSplitPaneOrientation(), true, null, null); splitPane.setOneTouchExpandable(false); splitPane.setResizeWeight(location.getSplitPaneResizeWeight()); + splitPane2 = new JSplitPane(location.getSplitPaneOppositeOrientation(), true, null, null); + splitPane2.setOneTouchExpandable(false); + splitPane2.setResizeWeight(0.5); setLayout(new BorderLayout()); - setOptionalComponent(null, 0, true); + setOptionalComponent(null, false, 0, true); splitPane.addPropertyChangeListener(new PropertyChangeListener() { @@ -107,22 +134,53 @@ */ @Override public void propertyChange(final PropertyChangeEvent evt) { - if (optionalComponent != null) { + if (ignoreSizeChange) { + return; + } + if (optionalComponents[0] != null || optionalComponents[1] != null) { //Property names are interned strings. //noinspection StringEquality if (evt.getPropertyName() == JSplitPane.DIVIDER_LOCATION_PROPERTY) { final Object value = evt.getNewValue(); if (value != null && value instanceof Integer) { - final int size = (Integer) value; - final int splitPaneSize = getSplitPaneSize(size); - assert optionalComponent != null; - borderSplitPaneListener.sizeChanged(optionalComponent, splitPaneSize); + final int newSize = (Integer) value; + final int splitPaneSize = getSplitPaneSize(newSize); + for (final Component optionalComponent : optionalComponents) { + if (optionalComponent != null) { + borderSplitPaneListener.sizeChanged(optionalComponent, splitPaneSize); + } + } } } } } }); + splitPane2.addPropertyChangeListener(new PropertyChangeListener() { + + /** + * {@inheritDoc} + */ + @Override + public void propertyChange(final PropertyChangeEvent evt) { + if (ignoreSizeChange) { + return; + } + if (optionalComponents[0] != null && optionalComponents[1] != null) { + //Property names are interned strings. + //noinspection StringEquality + if (evt.getPropertyName() == JSplitPane.DIVIDER_LOCATION_PROPERTY) { + final Object value = evt.getNewValue(); + if (value != null && value instanceof Integer) { + final int newSize = (Integer) value; + BorderSplitPane.this.size2 = newSize; + borderSplitPaneListener.size2Changed(newSize); + } + } + } + } + }); + final HierarchyListener hierarchyListener = new HierarchyListener() { /** @@ -135,9 +193,10 @@ assert !showing; showing = true; if (size != -1) { - setSize(size); + setDividerSize(size); size = -1; } + setDividerSize2(); } } @@ -149,72 +208,189 @@ * Sets the optional {@link Component}. * @param optionalComponent the optional component or <code>null</code> to * remove the optional component + * @param alternativeLocation whether the component should be shown in the + * alternative location * @param size the size of the component; width for left or right location, * height for top or bottom location */ - public void setOptionalComponent(@Nullable final Component optionalComponent, final int size) { - setOptionalComponent(optionalComponent, size, false); + public void setOptionalComponent(@Nullable final Component optionalComponent, final boolean alternativeLocation, final int size) { + setOptionalComponent(optionalComponent, alternativeLocation, size, false); } /** * Sets the optional {@link Component}. * @param optionalComponent the optional component or <code>null</code> to * remove the optional component + * @param alternativeLocation whether the component should be shown in the + * alternative location * @param size the size of the component; width for left or right location, * height for top or bottom location * @param force if set, forcibly rebuild the layout */ - public final void setOptionalComponent(@Nullable final Component optionalComponent, final int size, final boolean force) { - if (force || this.optionalComponent != optionalComponent) { - this.optionalComponent = optionalComponent; - removeAll(); - if (optionalComponent == null) { - add(component, BorderLayout.CENTER); + public final void setOptionalComponent(@Nullable final Component optionalComponent, final boolean alternativeLocation, final int size, final boolean force) { + final int index = alternativeLocation ? 1 : 0; + if (!force && optionalComponents[index] == optionalComponent) { + return; + } + + optionalComponents[index] = optionalComponent; + + final Component centerComponent; + final boolean setSize2; + if (optionalComponents[0] == null && optionalComponents[1] == null) { + setSize2 = false; + centerComponent = component; + } else { + centerComponent = splitPane; + + final Component tmp; + if (optionalComponents[0] == null) { + setSize2 = false; + tmp = optionalComponents[1]; + assert tmp != null; + } else if (optionalComponents[1] == null) { + setSize2 = false; + tmp = optionalComponents[0]; + assert tmp != null; } else { - if (location.isTopOrLeft()) { - splitPane.setTopComponent(optionalComponent); - splitPane.setBottomComponent(component); - } else { - splitPane.setTopComponent(component); - splitPane.setBottomComponent(optionalComponent); - } - add(splitPane, BorderLayout.CENTER); + setSize2 = true; + tmp = splitPane2; + splitPane2.setTopComponent(optionalComponents[0]); + splitPane2.setBottomComponent(optionalComponents[1]); } + + if (location.isTopOrLeft()) { + splitPane.setTopComponent(tmp); + splitPane.setBottomComponent(component); + } else { + splitPane.setTopComponent(component); + splitPane.setBottomComponent(tmp); + } + } + + removeAll(); + add(centerComponent, BorderLayout.CENTER); + ignoreSizeChange = true; + try { validate(); - repaint(); + } finally { + ignoreSizeChange = false; } - if (optionalComponent != null) { - if (showing) { - setSize(size); + final Component otherComponent = optionalComponents[1 - index]; + if (optionalComponent == null) { + if (otherComponent == null) { + // no resize } else { - this.size = size; + final Dimension preferredSizeTmp = otherComponent.getPreferredSize(); + final int preferredSize = getSplitPaneSize(preferredSizeTmp == null ? 50 : location.isTopOrBottom() ? preferredSizeTmp.height : preferredSizeTmp.width); + setDividerSizeInt(preferredSize); } + } else { + if (otherComponent == null) { + setDividerSizeInt(size); + } else { + final Dimension preferredSizeTmp = otherComponent.getPreferredSize(); + final int preferredSize = getSplitPaneSize(preferredSizeTmp == null ? 50 : location.isTopOrBottom() ? preferredSizeTmp.height : preferredSizeTmp.width); + setDividerSizeInt(Math.max(size, preferredSize)); + } } + + if (setSize2) { + setDividerSize2(); + } + + validate(); } /** * Sets the new size of {@link #splitPane}. * @param size the size */ - private void setSize(final int size) { + private void setDividerSizeInt(final int size) { + if (showing) { + setDividerSize(size); + } else { + this.size = size; + } + } + + /** + * Sets the new size of {@link #splitPane}. + * @param size the size + */ + private void setDividerSize(final int size) { splitPane.setDividerLocation(getSplitPaneSize(size)); } /** + * Sets the new size of {@link #splitPane2}. + */ + private void setDividerSize2() { + if (size2 == -1) { + return; + } + splitPane2.setDividerLocation(size2); + } + + /** * Converts between logical and physical sizes of {@link #splitPane}. * @param size the logical or physical size * @return the physical or logical size */ private int getSplitPaneSize(final int size) { - final int size2; + final Dimension preferredSize = getSplitPanePreferredSize(); + if (location.isTopOrBottom()) { + preferredSize.height = size; + } else { + preferredSize.width = size; + } + setSplitPanePreferredSize(preferredSize); + + final int result; if (location.isTopOrLeft()) { - size2 = size; + result = size; } else { final int splitPaneSize = (location.isTopOrBottom() ? splitPane.getHeight() : splitPane.getWidth()) - splitPane.getDividerSize(); - size2 = Math.max(0, splitPaneSize - size); + result = Math.max(0, splitPaneSize - size); } - return size2; + return result; } + /** + * Calculates the preferred size of the {@link #splitPane split pane}. + * @return the preferred size + */ + @NotNull + private Dimension getSplitPanePreferredSize() { + for (final Component optionalComponent : optionalComponents) { + if (optionalComponent != null) { + final Dimension preferredSize = optionalComponent.getPreferredSize(); + if (preferredSize != null) { + return preferredSize; + } + } + } + + for (final Component optionalComponent : optionalComponents) { + if (optionalComponent != null) { + return optionalComponent.getSize(); + } + } + + return splitPane.getSize(); + } + + /** + * Sets the preferred size of all shown optional components. + * @param preferredSize the preferred size to set + */ + private void setSplitPanePreferredSize(@NotNull final Dimension preferredSize) { + for (final Component optionalComponent : optionalComponents) { + if (optionalComponent != null) { + optionalComponent.setPreferredSize(preferredSize); + } + } + } + } // class BorderSplitPane Modified: trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPaneListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPaneListener.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPaneListener.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -36,4 +36,11 @@ */ void sizeChanged(@NotNull Component optionalComponent, int size); + /** + * The size of the inner split pane separating two optional components has + * changed. + * @param size2 the new size + */ + void size2Changed(int size2); + } Modified: trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/Location.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/Location.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/borderpanel/Location.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -58,7 +58,25 @@ /** * {@inheritDoc} */ + @NotNull @Override + public String getBorderLocationStandardLocation() { + return BorderLayout.WEST; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getBorderLocationAlternativeLocation() { + return BorderLayout.EAST; + } + + /** + * {@inheritDoc} + */ + @Override public int getAxis() { return BoxLayout.X_AXIS; } @@ -75,6 +93,14 @@ * {@inheritDoc} */ @Override + public int getSplitPaneOppositeOrientation() { + return JSplitPane.HORIZONTAL_SPLIT; + } + + /** + * {@inheritDoc} + */ + @Override public double getSplitPaneResizeWeight() { return 0.0; } @@ -132,7 +158,25 @@ /** * {@inheritDoc} */ + @NotNull @Override + public String getBorderLocationStandardLocation() { + return BorderLayout.WEST; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getBorderLocationAlternativeLocation() { + return BorderLayout.EAST; + } + + /** + * {@inheritDoc} + */ + @Override public int getAxis() { return BoxLayout.X_AXIS; } @@ -149,6 +193,14 @@ * {@inheritDoc} */ @Override + public int getSplitPaneOppositeOrientation() { + return JSplitPane.HORIZONTAL_SPLIT; + } + + /** + * {@inheritDoc} + */ + @Override public double getSplitPaneResizeWeight() { return 1.0; } @@ -206,7 +258,25 @@ /** * {@inheritDoc} */ + @NotNull @Override + public String getBorderLocationStandardLocation() { + return BorderLayout.NORTH; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getBorderLocationAlternativeLocation() { + return BorderLayout.SOUTH; + } + + /** + * {@inheritDoc} + */ + @Override public int getAxis() { return BoxLayout.Y_AXIS; } @@ -223,6 +293,14 @@ * {@inheritDoc} */ @Override + public int getSplitPaneOppositeOrientation() { + return JSplitPane.VERTICAL_SPLIT; + } + + /** + * {@inheritDoc} + */ + @Override public double getSplitPaneResizeWeight() { return 0.0; } @@ -280,7 +358,25 @@ /** * {@inheritDoc} */ + @NotNull @Override + public String getBorderLocationStandardLocation() { + return BorderLayout.NORTH; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getBorderLocationAlternativeLocation() { + return BorderLayout.SOUTH; + } + + /** + * {@inheritDoc} + */ + @Override public int getAxis() { return BoxLayout.Y_AXIS; } @@ -297,6 +393,14 @@ * {@inheritDoc} */ @Override + public int getSplitPaneOppositeOrientation() { + return JSplitPane.VERTICAL_SPLIT; + } + + /** + * {@inheritDoc} + */ + @Override public double getSplitPaneResizeWeight() { return 1.0; } @@ -344,6 +448,22 @@ public abstract String getBorderLocation(); /** + * Returns the {@link BorderLayout} constraint of this location for buttons + * in the standard location. + * @return the constraint + */ + @NotNull + public abstract String getBorderLocationStandardLocation(); + + /** + * Returns the {@link BorderLayout} constraint of this location for buttons + * in the alternative location. + * @return the constraint + */ + @NotNull + public abstract String getBorderLocationAlternativeLocation(); + + /** * Returns the {@link BoxLayout} axis of this location. * @return the axis */ @@ -356,6 +476,12 @@ public abstract int getSplitPaneOrientation(); /** + * Returns the opposite orientation for a {@link JSplitPane}. + * @return the opposite orientation + */ + public abstract int getSplitPaneOppositeOrientation(); + + /** * Returns the resize weight for a {@link JSplitPane}. * @return the resize weight */ Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -125,19 +125,18 @@ } buttons.add(button, index); buttons.validate(); - buttons.repaint(); button.addChangeListener(changeListener); } /** - * Removes a button. + * Removes a button. Does nothing if the button is not part of this button + * list. * @param button the button */ public void removeButton(@NotNull final AbstractButton button) { button.removeChangeListener(changeListener); buttons.remove(button); buttons.validate(); - buttons.repaint(); final int index = selectedButtons.indexOf(button); if (index != -1) { selectedButtons.remove(index); @@ -196,4 +195,12 @@ return buttons; } + /** + * Returns the total number of buttons. + * @return the total number of buttons + */ + public int getButtonCount() { + return buttons.getComponentCount(); + } + } Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonLists.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonLists.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonLists.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -37,7 +37,7 @@ * The list of buttons for each {@link Location}. */ @NotNull - private final ButtonList[] buttonLists = new ButtonList[Location.values().length]; + private final DoubleButtonList[] buttonLists = new DoubleButtonList[Location.values().length]; /** * Maps button instance to {@link Tab} instance. @@ -51,7 +51,7 @@ */ public ButtonLists(@NotNull final ButtonListsListener buttonListsListener) { for (final Location location : Location.values()) { - final ButtonList buttonList = new ButtonList(location); + final DoubleButtonList buttonList = new DoubleButtonList(location); buttonLists[location.ordinal()] = buttonList; final ButtonListListener buttonListListener = new ButtonListListener() { @@ -81,10 +81,10 @@ * @return the button list the tab was added to */ @NotNull - public ButtonList addTab(@NotNull final Tab tab) { - final ButtonList buttonList = buttonLists[tab.getLocation().ordinal()]; + public DoubleButtonList addTab(@NotNull final Tab tab) { + final DoubleButtonList buttonList = buttonLists[tab.getLocation().ordinal()]; final AbstractButton button = tab.getButton(); - buttonList.addButton(button); + buttonList.addButton(button, tab.isAlternativeLocation()); tabs.put(button, tab); return buttonList; } @@ -98,35 +98,52 @@ * the tab was added to */ @NotNull - public ButtonList[] moveTab(@NotNull final Tab tab, @NotNull final Location location) { + public DoubleButtonList[] moveTab(@NotNull final Tab tab, @NotNull final Location location) { if (tabs.get(tab.getButton()) == null) { throw new IllegalArgumentException(); } - final ButtonList oldButtonList = buttonLists[tab.getLocation().ordinal()]; - final ButtonList newButtonList = buttonLists[location.ordinal()]; + final DoubleButtonList oldButtonList = buttonLists[tab.getLocation().ordinal()]; + final DoubleButtonList newButtonList = buttonLists[location.ordinal()]; final AbstractButton oldButton = tab.getButton(); - oldButtonList.removeButton(oldButton); + oldButtonList.removeButton(oldButton, tab.isAlternativeLocation()); oldButton.setSelected(false); tab.setLocation(location); final AbstractButton newButton = tab.getButton(); - newButtonList.addButton(newButton); + newButtonList.addButton(newButton, tab.isAlternativeLocation()); tabs.remove(oldButton); tabs.put(newButton, tab); - return new ButtonList[] { oldButtonList, newButtonList, }; + return new DoubleButtonList[] { oldButtonList, newButtonList, }; } + @NotNull + public DoubleButtonList toggleTabSplitMode(@NotNull final Tab tab) { + final boolean alternativeLocation = !tab.isAlternativeLocation(); + final DoubleButtonList buttonList = buttonLists[tab.getLocation().ordinal()]; + final AbstractButton oldButton = tab.getButton(); + buttonList.removeButton(oldButton, tab.isAlternativeLocation()); + oldButton.setSelected(false); + tab.setAlternativeLocation(alternativeLocation); + final AbstractButton newButton = tab.getButton(); + buttonList.addButton(newButton, tab.isAlternativeLocation()); + tabs.remove(oldButton); + tabs.put(newButton, tab); + return buttonList; + } + /** * Returns the active {@link Tab} on a given {@link Location} of the main * view. * @param location the location + * @param alternativeLocation whether the alternative location should be + * checked * @return the tab or <code>null</code> if no active tab exists * @noinspection TypeMayBeWeakened */ @Nullable - public Tab getActiveTab(@NotNull final Location location) { - final ButtonList buttonList = buttonLists[location.ordinal()]; - final AbstractButton selectedButton = buttonList.getSelectedButton(); + public Tab getActiveTab(@NotNull final Location location, final boolean alternativeLocation) { + final DoubleButtonList buttonList = buttonLists[location.ordinal()]; + final AbstractButton selectedButton = buttonList.getSelectedButton(alternativeLocation); if (selectedButton == null) { return null; } Copied: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java (from rev 8815, trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -0,0 +1,143 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.utils.tabbedpanel; + +import java.awt.BorderLayout; +import java.awt.Container; +import javax.swing.AbstractButton; +import javax.swing.JPanel; +import net.sf.gridarta.gui.utils.borderpanel.Location; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A list of {@link AbstractButton buttons} divided into two parts. At most one + * button in each part is active at any time. + * @author Andreas Kirschbaum + */ +public class DoubleButtonList { + + /** + * The {@link Container} that contains all buttons. + */ + @NotNull + private final Container buttons = new JPanel(); + + /** + * The {@link Container} that contains all buttons in the standard + * location. + */ + @NotNull + private final ButtonList leftButtonList; + + /** + * The {@link Container} that contains all buttons in the alternative + * location. + */ + @NotNull + private final ButtonList rightButtonList; + + /** + * Creates a new instance. + * @param location the location + */ + public DoubleButtonList(@NotNull final Location location) { + leftButtonList = new ButtonList(location); + rightButtonList = new ButtonList(location); + buttons.setLayout(new BorderLayout()); + buttons.add(leftButtonList.getButtons(), location.getBorderLocationStandardLocation()); + buttons.add(rightButtonList.getButtons(), location.getBorderLocationAlternativeLocation()); + } + + /** + * Adds a {@link ButtonListListener} to be notified. + * @param listener the button list listener + */ + + public void addButtonListListener(@NotNull final ButtonListListener listener) { + leftButtonList.addButtonListListener(listener); + rightButtonList.addButtonListListener(listener); + } + + /** + * Adds a button. + * @param button the button + * @param alternativeLocation whether to add the button into the alternative + * location + */ + public void addButton(@NotNull final AbstractButton button, final boolean alternativeLocation) { + final ButtonList buttonList = alternativeLocation ? rightButtonList : leftButtonList; + buttonList.addButton(button); + buttons.validate(); + } + + /** + * Removes a button. + * @param button the button + * @param alternativeLocation whether to remove the button from the + * alternative location + */ + public void removeButton(@NotNull final AbstractButton button, final boolean alternativeLocation) { + final ButtonList buttonList = alternativeLocation ? rightButtonList : leftButtonList; + buttonList.removeButton(button); + buttons.validate(); + } + + /** + * Selects a button. + * @param button the button + * @param alternativeLocation whether to select the button in the + * alternative location + */ + public void selectButton(@NotNull final AbstractButton button, final boolean alternativeLocation) { + final ButtonList buttonList = alternativeLocation ? rightButtonList : leftButtonList; + buttonList.selectButton(button); + } + + /** + * Returns the currently selected button. + * @param alternativeLocation whether to remove the button from the + * alternative location + * @return the selected button or <code>null</code> if no button exists + */ + @Nullable + public AbstractButton getSelectedButton(final boolean alternativeLocation) { + final ButtonList buttonList = alternativeLocation ? rightButtonList : leftButtonList; + return buttonList.getSelectedButton(); + } + + /** + * Returns the {@link Container} that contains all buttons. + * @return the container + */ + @NotNull + public Container getButtons() { + return buttons; + } + + /** + * Returns the total number of buttons. + * @return the total number of buttons + */ + public int getButtonCount() { + return leftButtonList.getButtonCount() + rightButtonList.getButtonCount(); + } + +} Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/MoveToActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/MoveToActions.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/MoveToActions.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -83,4 +83,22 @@ tabbedPanel.moveTab(tab, Location.RIGHT); } + /** + * Action method to query split mode. + * @return whether split mode is enabled + */ + @ActionMethod + public boolean isTabSplitMode() { + return tab.isAlternativeLocation(); + } + + /** + * Action method set split mode. + * @param splitMode whether to enable split mode + */ + @ActionMethod + public void setTabSplitMode(final boolean splitMode) { + tabbedPanel.setTabSplitMode(tab, splitMode); + } + } // class MoveToActions Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/Tab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/Tab.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/Tab.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -39,7 +39,9 @@ import net.sf.gridarta.utils.EventListenerList2; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ToggleAction; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A tab in a {@link TabbedPanel} component. It consists of an {@link @@ -76,6 +78,11 @@ private static final String TAB_LOCATION = "MainWindow.tab_location."; /** + * The key used to store the current location of a tab. + */ + private static final String TAB_ALT_LOCATION = "MainWindow.tab_alt_location."; + + /** * The {@link ActionBuilder}. */ @NotNull @@ -129,12 +136,24 @@ private final JMenu moveToMenu; /** + * The {@link ToggleAction} to update if the "split mode" state changes. + */ + @Nullable + private ToggleAction splitModeAction = null; + + /** * The tab's location. */ @NotNull private Location location; /** + * Whether the tab is shown in the alternative location (<code>true</code>) + * or in the standard location (<code>false</code>). + */ + private boolean alternativeLocation; + + /** * The tab's index for ordering. */ private final int index; @@ -204,10 +223,12 @@ * @param ident the tab's identification string * @param component the component that is shown when this tab is active * @param defaultLocation the tab's default location + * @param alternativeLocation whether the tab is shown in the alternative + * location * @param index the tab's index for ordering * @param defaultOpen the tab's default opened status */ - public Tab(@NotNull final String ident, @NotNull final JComponent component, @NotNull final Location defaultLocation, final int index, final boolean defaultOpen) { + public Tab(@NotNull final String ident, @NotNull final JComponent component, @NotNull final Location defaultLocation, final boolean alternativeLocation, final int index, final boolean defaultOpen) { this.ident = ident; this.component = component; final Dimension preferredSize = component.getPreferredSize(); @@ -224,6 +245,7 @@ } catch (final IllegalArgumentException ignored) { location = defaultLocation; } + this.alternativeLocation = preferences.getBoolean(TAB_ALT_LOCATION + ident, alternativeLocation); this.index = index; button = createButton(); final JMenu tmp = MenuUtils.findMenu(popupMenu, "tabButtonMoveTo"); @@ -231,7 +253,6 @@ throw new MissingResourceException("missing action ", MenuUtils.class.getName(), "tabButtonMoveTo"); } moveToMenu = tmp; - popupMenu.add(moveToMenu); } /** @@ -304,6 +325,36 @@ } /** + * Sets the {@link ToggleAction} to update if the "split mode" state + * changes. + * @param splitModeAction the toggle action + */ + public void setSplitModeAction(@Nullable final ToggleAction splitModeAction) { + this.splitModeAction = splitModeAction; + } + + /** + * Returns whether the button is shown in the alternative location. + * @return whether the button is shown in the alternative location + */ + public boolean isAlternativeLocation() { + return alternativeLocation; + } + + /** + * Sets whether the button is shown in the alternative location. + * @param alternativeLocation whether the button is shown in the alternative + * location + */ + public void setAlternativeLocation(final boolean alternativeLocation) { + this.alternativeLocation = alternativeLocation; + preferences.putBoolean(TAB_ALT_LOCATION + ident, alternativeLocation); + if (splitModeAction != null) { + splitModeAction.setSelected(alternativeLocation); + } + } + + /** * Returns the tab's location. * @return the location */ Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabbedPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabbedPanel.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabbedPanel.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -24,13 +24,17 @@ import java.awt.Container; import java.util.IdentityHashMap; import java.util.Map; +import java.util.prefs.Preferences; import javax.swing.JMenu; +import javax.swing.JPopupMenu; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.gui.utils.borderpanel.BorderPanel; import net.sf.gridarta.gui.utils.borderpanel.BorderPanelListener; import net.sf.gridarta.gui.utils.borderpanel.Location; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ToggleAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,6 +47,11 @@ public class TabbedPanel extends Container { /** + * The key used to store the preferred height of a tab. + */ + private static final String TAB_PREFIX = "MainWindow.tab"; + + /** * The serial version UID. */ private static final long serialVersionUID = 1L; @@ -54,6 +63,11 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** + * The {@link Preferences}. + */ + private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); + + /** * The {@link BorderPanel}. * @serial */ @@ -111,6 +125,22 @@ } } + /** + * {@inheritDoc} + */ + @Override + public void size2Changed(@NotNull final Location location, final int size2) { + preferences.putInt(TAB_PREFIX + location.getName() + ".position", size2); + } + + /** + * {@inheritDoc} + */ + @Override + public int getSize2(final Location location) { + return preferences.getInt(TAB_PREFIX + location.getName() + ".position", -1); + } + }; borderPanel = new BorderPanel(centerComponent, borderPanelListener); setLayout(new BorderLayout()); @@ -122,8 +152,8 @@ * @param tab the tab to add */ public void addTab(@NotNull final Tab tab) { - final ButtonList buttonList = buttonLists.addTab(tab); - fillContextMenu(tab); + final DoubleButtonList buttonList = buttonLists.addTab(tab); + fillContextMenu(tab, true); tabAdded(tab, buttonList, tab.isOpen()); } @@ -131,12 +161,14 @@ * Returns the active {@link Tab} on a given {@link Location} of the main * view. * @param location the location + * @param alternativeLocation whether the alternative location should be + * checked * @return the tab or <code>null</code> if no active tab exists * @noinspection TypeMayBeWeakened */ @Nullable - public Tab getActiveTab(@NotNull final Location location) { - return buttonLists.getActiveTab(location); + public Tab getActiveTab(@NotNull final Location location, final boolean alternativeLocation) { + return buttonLists.getActiveTab(location, alternativeLocation); } /** @@ -150,32 +182,47 @@ } final boolean open = tab.isOpen(); - final ButtonList[] result = buttonLists.moveTab(tab, location); - final ButtonList oldButtonList = result[0]; - final ButtonList newButtonList = result[1]; + final DoubleButtonList[] result = buttonLists.moveTab(tab, location); + final DoubleButtonList oldButtonList = result[0]; + final DoubleButtonList newButtonList = result[1]; - fillContextMenu(tab); + fillContextMenu(tab, false); tabRemoved(oldButtonList); tabAdded(tab, newButtonList, open); } /** + * Toggles split mode for the given tab. + * @param tab the tab + * @param splitMode whether to enable split mode + */ + public void setTabSplitMode(@NotNull final Tab tab, final boolean splitMode) { + if (tab.isAlternativeLocation() == splitMode) { + return; + } + + final boolean open = tab.isOpen(); + final DoubleButtonList buttonList = buttonLists.toggleTabSplitMode(tab); + if (open) { + buttonList.selectButton(tab.getButton(), tab.isAlternativeLocation()); + } + } + + /** * Called whenever a {@link Tab} has been added to a {@link ButtonList}. * Shows the button list component if the first tab has been added. * @param tab the tab * @param buttonList the button list * @param open whether the tab is open */ - private void tabAdded(@NotNull final Tab tab, @NotNull final ButtonList buttonList, final boolean open) { - final Container buttons = buttonList.getButtons(); - if (buttons.getComponentCount() == 1) { - add(buttons, tab.getLocation().getBorderLocation()); + private void tabAdded(@NotNull final Tab tab, @NotNull final DoubleButtonList buttonList, final boolean open) { + if (buttonList.getButtonCount() == 1) { + add(buttonList.getButtons(), tab.getLocation().getBorderLocation()); validate(); - repaint(); } if (open) { - buttonList.selectButton(tab.getButton()); + buttonList.selectButton(tab.getButton(), tab.isAlternativeLocation()); } } @@ -184,23 +231,30 @@ * Hides the button list component if the last tab has been removed. * @param buttonList the button list */ - private void tabRemoved(final ButtonList buttonList) { - final Container buttons = buttonList.getButtons(); - if (buttons.getComponentCount() == 0) { - remove(buttons); + private void tabRemoved(@NotNull final DoubleButtonList buttonList) { + if (buttonList.getButtonCount() == 0) { + remove(buttonList.getButtons()); validate(); - repaint(); } } /** * Fills in context popup menu entries for a tab in a given location. * @param tab the tab + * @param initialize whether this is the initial call */ - private void fillContextMenu(@NotNull final Tab tab) { + private void fillContextMenu(@NotNull final Tab tab, final boolean initialize) { + final MoveToActions moveToActions = new MoveToActions(tab, this); + if (initialize) { + final JPopupMenu popupMenu = tab.getPopupMenu(); + final ToggleAction splitModeAction = (ToggleAction) ACTION_BUILDER.createToggle(false, "tabSplitMode", moveToActions); + splitModeAction.setSelected(tab.isAlternativeLocation()); + popupMenu.insert(splitModeAction.createCheckBoxMenuItem(), 0); + tab.setSplitModeAction(splitModeAction); + } + final JMenu moveToMenu = tab.getMoveToMenu(); MenuUtils.removeAll(moveToMenu); - final MoveToActions moveToActions = new MoveToActions(tab, this); final Location location = tab.getLocation(); for (final Location thisLocation : Location.values()) { if (thisLocation != location) { @@ -215,7 +269,7 @@ */ private void open(@NotNull final Tab tab) { openTabs.put(tab.getComponent(), tab); - borderPanel.setComponent(tab.getLocation(), tab.getComponent(), tab.getSize()); + borderPanel.setComponent(tab.getLocation(), tab.getComponent(), tab.isAlternativeLocation(), tab.getSize()); tab.setOpen(true); } @@ -233,7 +287,7 @@ * @param tab the tab */ private void closeInt(final Tab tab) { - borderPanel.unsetComponent(tab.getLocation()); + borderPanel.unsetComponent(tab.getLocation(), tab.isAlternativeLocation()); openTabs.remove(tab.getComponent()); } Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-12-10 19:57:25 UTC (rev 8815) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-12-12 14:24:55 UTC (rev 8816) @@ -500,7 +500,7 @@ updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); final TextEditorTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, archetypeTypeSet); - final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, 0, true); + final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, false, 0, true); ... [truncated message content] |
From: <aki...@us...> - 2010-12-12 14:43:23
|
Revision: 8818 http://gridarta.svn.sourceforge.net/gridarta/?rev=8818&view=rev Author: akirschbaum Date: 2010-12-12 14:43:17 +0000 (Sun, 12 Dec 2010) Log Message: ----------- Always edit the head part of multi-square game objects in the game object text editor. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModelListener.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/atrinik/ChangeLog 2010-12-12 14:43:17 UTC (rev 8818) @@ -1,5 +1,8 @@ 2010-12-12 Andreas Kirschbaum + * Always edit the head part of multi-square game objects in the + game object text editor. + * Add "Split Mode" action for tabs in main window. This allows up to two open tabs on each side of the main window. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/crossfire/ChangeLog 2010-12-12 14:43:17 UTC (rev 8818) @@ -1,5 +1,8 @@ 2010-12-12 Andreas Kirschbaum + * Always edit the head part of multi-square game objects in the + game object text editor. + * Add "Split Mode" action for tabs in main window. This allows up to two open tabs on each side of the main window. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/daimonin/ChangeLog 2010-12-12 14:43:17 UTC (rev 8818) @@ -1,5 +1,8 @@ 2010-12-12 Andreas Kirschbaum + * Always edit the head part of multi-square game objects in the + game object text editor. + * Add "Split Mode" action for tabs in main window. This allows up to two open tabs on each side of the main window. Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-12-12 14:43:17 UTC (rev 8818) @@ -335,7 +335,7 @@ /** {@inheritDoc} */ @Override public void selectedGameObjectChanged(@Nullable final G gameObject) { - gameObjectAttributesModel.setSelectedGameObject(gameObject == null ? null : gameObject.getHead()); + gameObjectAttributesModel.setSelectedGameObject(gameObject); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java 2010-12-12 14:43:17 UTC (rev 8818) @@ -95,8 +95,9 @@ * @param gameObject the currently selected game object */ private void fireSelectedGameObjectChangedEvent(@Nullable final G gameObject) { + final G head = gameObject == null ? null : gameObject.getHead(); for (final SelectedSquareModelListener<G, A, R> listener : listenerList.getListeners()) { - listener.selectedGameObjectChanged(gameObject); + listener.selectedGameObjectChanged(head); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModelListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModelListener.java 2010-12-12 14:29:57 UTC (rev 8817) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModelListener.java 2010-12-12 14:43:17 UTC (rev 8818) @@ -33,7 +33,8 @@ public interface SelectedSquareModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { /** - * The selected game object has changed. + * The selected game object has changed. The passed game object is always + * the head part. * @param gameObject the new game object, or <code>null</code> if no game * object is selected */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-20 19:18:08
|
Revision: 8822 http://gridarta.svn.sourceforge.net/gridarta/?rev=8822&view=rev Author: akirschbaum Date: 2010-12-20 19:18:01 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Enable/disable "enter xyz map" actions when tile paths are modified. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-20 19:04:00 UTC (rev 8821) +++ trunk/atrinik/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) @@ -1,3 +1,8 @@ +2010-12-20 Andreas Kirschbaum + + * Enable/disable "enter xyz map" actions when tile paths are + modified. + 2010-12-12 Andreas Kirschbaum * Always edit the head part of multi-square game objects in the Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-20 19:04:00 UTC (rev 8821) +++ trunk/crossfire/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) @@ -1,3 +1,8 @@ +2010-12-20 Andreas Kirschbaum + + * Enable/disable "enter xyz map" actions when tile paths are + modified. + 2010-12-12 Andreas Kirschbaum * Always edit the head part of multi-square game objects in the Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-20 19:04:00 UTC (rev 8821) +++ trunk/daimonin/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) @@ -1,3 +1,8 @@ +2010-12-20 Andreas Kirschbaum + + * Enable/disable "enter xyz map" actions when tile paths are + modified. + 2010-12-12 Andreas Kirschbaum * Always edit the head part of multi-square game objects in the Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-12-20 19:04:00 UTC (rev 8821) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-12-20 19:18:01 UTC (rev 8822) @@ -44,6 +44,7 @@ import net.sf.gridarta.model.exitconnector.ExitMatcher; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorEvent; @@ -342,10 +343,14 @@ public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { if (currentMapView != null) { currentMapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + assert currentMapView != null; + currentMapView.getMapControl().getMapModel().getMapArchObject().removeMapArchObjectListener(mapArchObjectListener); } currentMapView = mapView; if (currentMapView != null) { currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + assert currentMapView != null; + currentMapView.getMapControl().getMapModel().getMapArchObject().addMapArchObjectListener(mapArchObjectListener); } updateActions(); } @@ -385,6 +390,24 @@ }; /** + * The {@link MapArchObjectListener} attached to {@link #currentMapView}. + */ + @NotNull + private final MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { + + @Override + public void mapMetaChanged() { + updateActions(); + } + + @Override + public void mapSizeChanged(@NotNull final Size2D mapSize) { + // ignore + } + + }; + + /** * Create a new instance. * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows @@ -424,6 +447,8 @@ currentMapView = mapViewManager.getActiveMapView(); if (currentMapView != null) { currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + assert currentMapView != null; + currentMapView.getMapControl().getMapModel().getMapArchObject().addMapArchObjectListener(mapArchObjectListener); } updateActions(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-20 20:53:57
|
Revision: 8823 http://gridarta.svn.sourceforge.net/gridarta/?rev=8823&view=rev Author: akirschbaum Date: 2010-12-20 20:53:50 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Ignore case of file name extensions on case-insensitive file systems. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik.iml trunk/build.xml trunk/crossfire/ChangeLog trunk/crossfire.iml trunk/daimonin/ChangeLog trunk/daimonin.iml trunk/gridarta.iml trunk/model.iml trunk/utils.iml Added Paths: ----------- trunk/lib/japi-lib-util-trunk-1410.jar Removed Paths: ------------- trunk/lib/japi-lib-util-trunk-1379.jar Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/atrinik/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Ignore case of file name extensions on case-insensitive file + systems. + * Enable/disable "enter xyz map" actions when tile paths are modified. Modified: trunk/atrinik.iml =================================================================== --- trunk/atrinik.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/atrinik.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -71,7 +71,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/build.xml 2010-12-20 20:53:50 UTC (rev 8823) @@ -139,7 +139,7 @@ <path id="path.lib.japi-swing-misc" location="lib/japi-lib-swing-misc-trunk-1398.jar"/> <path id="path.lib.japi-swing-prefs" location="lib/japi-lib-swing-prefs-0.1.0.jar"/> <path id="path.lib.japi-swing-tod" location="lib/japi-lib-swing-tod-0.1.0.jar"/> - <path id="path.lib.japi-util" location="lib/japi-lib-util-trunk-1379.jar"/> + <path id="path.lib.japi-util" location="lib/japi-lib-util-trunk-1410.jar"/> <path id="path.lib.japi-xml" location="lib/japi-lib-xml-0.1.0.jar"/> <path id="path.lib.jdom" location="lib/jdom.jar"/> <path id="path.lib.log4j" location="lib/log4j-1.2.13.jar"/> Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/crossfire/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Ignore case of file name extensions on case-insensitive file + systems. + * Enable/disable "enter xyz map" actions when tile paths are modified. Modified: trunk/crossfire.iml =================================================================== --- trunk/crossfire.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/crossfire.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -90,7 +90,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/daimonin/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Ignore case of file name extensions on case-insensitive file + systems. + * Enable/disable "enter xyz map" actions when tile paths are modified. Modified: trunk/daimonin.iml =================================================================== --- trunk/daimonin.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/daimonin.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -71,7 +71,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> Modified: trunk/gridarta.iml =================================================================== --- trunk/gridarta.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/gridarta.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -127,7 +127,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> Deleted: trunk/lib/japi-lib-util-trunk-1379.jar =================================================================== (Binary files differ) Added: trunk/lib/japi-lib-util-trunk-1410.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/japi-lib-util-trunk-1410.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/model.iml =================================================================== --- trunk/model.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/model.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -39,7 +39,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> Modified: trunk/utils.iml =================================================================== --- trunk/utils.iml 2010-12-20 19:18:01 UTC (rev 8822) +++ trunk/utils.iml 2010-12-20 20:53:50 UTC (rev 8823) @@ -28,7 +28,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1410.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-20 22:27:06
|
Revision: 8824 http://gridarta.svn.sourceforge.net/gridarta/?rev=8824&view=rev Author: akirschbaum Date: 2010-12-20 22:26:58 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Fix validators not using head part attributes but incorrectly checking tail part attributes. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/SysObjectNotOnLayerZeroChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/Type.java Added Paths: ----------- trunk/test-mapvalidator/daimonin/arch/floor_fstone2a.arc trunk/test-mapvalidator/daimonin/arch/wagon_big.arc trunk/test-mapvalidator/daimonin/arch/wall_black1.arc trunk/test-mapvalidator/daimonin/maps/Layer trunk/test-mapvalidator/daimonin/maps/Layer.expected Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/atrinik/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Fix validators not using head part attributes but incorrectly + checking tail part attributes. + * Ignore case of file name extensions on case-insensitive file systems. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/crossfire/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Fix validators not using head part attributes but incorrectly + checking tail part attributes. + * Ignore case of file name extensions on case-insensitive file systems. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/daimonin/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) @@ -1,5 +1,8 @@ 2010-12-20 Andreas Kirschbaum + * Fix validators not using head part attributes but incorrectly + checking tail part attributes. + * Ignore case of file name extensions on case-insensitive file systems. Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java 2010-12-20 22:26:58 UTC (rev 8824) @@ -112,11 +112,12 @@ * @param errorCollector where to add the errors to */ private void checkSpawnPoint(@NotNull final G gameObject, @NotNull final Point pos, @NotNull final BlockedMatrix<G, A, R> blocked, @NotNull final ErrorCollector<G, A, R> errorCollector) { - if (!typeNumbers.contains(gameObject.getTypeNo())) { + final GameObject<G, A, R> head = gameObject.getHead(); + if (!typeNumbers.contains(head.getTypeNo())) { return; } - final int spawnRange = Math.min(gameObject.getAttributeInt("last_heal"), freeArrX.length); + final int spawnRange = Math.min(head.getAttributeInt("last_heal"), freeArrX.length); for (int i = 0; i < spawnRange; i++) { if (!blocked.isBlocked(pos.x + freeArrX[i], pos.y + freeArrY[i])) { return; Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java 2010-12-20 22:26:58 UTC (rev 8824) @@ -48,8 +48,9 @@ */ @Override public void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector<G, A, R> errorCollector) { - final boolean pickable = gameObject.getAttributeInt("no_pick", true) == 0; - final CharSequence connection = gameObject.getAttributeString("connected", true); + final GameObject<G, A, R> head = gameObject.getHead(); + final boolean pickable = head.getAttributeInt("no_pick", true) == 0; + final CharSequence connection = head.getAttributeString("connected", true); final boolean connected = connection.length() > 0; if (connected && pickable) { errorCollector.collect(new ConnectedPickableError<G, A, R>(gameObject)); Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java 2010-12-20 22:26:58 UTC (rev 8824) @@ -55,7 +55,7 @@ final Map<Integer, G> gameObjects = new HashMap<Integer, G>(); final Map<Integer, DoubleLayerError<G, A, R>> errors = new HashMap<Integer, DoubleLayerError<G, A, R>>(); for (final G gameObject : mapSquare) { - final int layer = gameObject.getAttributeInt("layer", true); + final int layer = gameObject.getHead().getAttributeInt("layer", true); if (layer == 0) { // ignore layer 0 } else { Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/SysObjectNotOnLayerZeroChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/SysObjectNotOnLayerZeroChecker.java 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/SysObjectNotOnLayerZeroChecker.java 2010-12-20 22:26:58 UTC (rev 8824) @@ -48,7 +48,8 @@ */ @Override public void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector<G, A, R> errorCollector) { - if (gameObject.getAttributeInt("sys_object", true) == 1 && gameObject.getAttributeInt("layer", true) != 0) { + final GameObject<G, A, R> head = gameObject.getHead(); + if (head.getAttributeInt("sys_object", true) == 1 && head.getAttributeInt("layer", true) != 0) { errorCollector.collect(new SysObjectNotOnLayerZeroError<G, A, R>(gameObject)); } } Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/Type.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/Type.java 2010-12-20 20:53:50 UTC (rev 8823) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/Type.java 2010-12-20 22:26:58 UTC (rev 8824) @@ -64,7 +64,7 @@ for (final Map.Entry<String, RangeEntry<G, A, R>> e : entries.entrySet()) { final String name = e.getKey(); final RangeEntry<G, A, R> entry = e.getValue(); - entry.validate(gameObject.getAttributeInt(name), gameObject, errorCollector); + entry.validate(gameObject.getHead().getAttributeInt(name), gameObject, errorCollector); } } Added: trunk/test-mapvalidator/daimonin/arch/floor_fstone2a.arc =================================================================== --- trunk/test-mapvalidator/daimonin/arch/floor_fstone2a.arc (rev 0) +++ trunk/test-mapvalidator/daimonin/arch/floor_fstone2a.arc 2010-12-20 22:26:58 UTC (rev 8824) @@ -0,0 +1,9 @@ +Object floor_fstone2a +name floor +#face floor_fstone2a.101 +layer 1 +terrain_type 1 +type 71 +no_teleport 1 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/daimonin/arch/floor_fstone2a.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/daimonin/arch/wagon_big.arc =================================================================== --- trunk/test-mapvalidator/daimonin/arch/wagon_big.arc (rev 0) +++ trunk/test-mapvalidator/daimonin/arch/wagon_big.arc 2010-12-20 22:26:58 UTC (rev 8824) @@ -0,0 +1,46 @@ +Object wagon_big +name big wagon +layer 5 +type 79 +mpart_id 3 +#face wagon_big.131 +#animation wagon_big +is_turnable 1 +direction 1 +no_pass 1 +no_pick 1 +end +More +Object wagon_big_a +name big wagon +layer 5 +type 79 +mpart_id 3 +mpart_nr 1 +x 1 +no_pass 1 +no_pick 1 +end +More +Object wagon_big_b +name big wagon +layer 5 +type 79 +mpart_id 3 +mpart_nr 2 +y 1 +no_pass 1 +no_pick 1 +end +More +Object wagon_big_c +name big wagon +layer 5 +type 79 +mpart_id 3 +mpart_nr 3 +x 1 +y 1 +no_pass 1 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/daimonin/arch/wagon_big.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/daimonin/arch/wall_black1.arc =================================================================== --- trunk/test-mapvalidator/daimonin/arch/wall_black1.arc (rev 0) +++ trunk/test-mapvalidator/daimonin/arch/wall_black1.arc 2010-12-20 22:26:58 UTC (rev 8824) @@ -0,0 +1,9 @@ +Object wall_black1.111 +name stone wall +#face wall_black1.d.111 +blocksview 1 +type 77 +layer 5 +no_pick 1 +no_pass 1 +end Property changes on: trunk/test-mapvalidator/daimonin/arch/wall_black1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/daimonin/maps/Layer =================================================================== --- trunk/test-mapvalidator/daimonin/maps/Layer (rev 0) +++ trunk/test-mapvalidator/daimonin/maps/Layer 2010-12-20 22:26:58 UTC (rev 8824) @@ -0,0 +1,32 @@ +arch map +name validation error +msg +Created: 2010-12-20 smacky +endmsg +width 2 +height 2 +difficulty 1 +darkness -1 +end +arch floor_fstone2a +end +arch wagon_big +layer 4 +end +arch floor_fstone2a +y 1 +end +arch wall_black1.111 +y 1 +end +arch floor_fstone2a +x 1 +end +arch floor_fstone2a +x 1 +y 1 +end +arch wall_black1.111 +x 1 +y 1 +end Property changes on: trunk/test-mapvalidator/daimonin/maps/Layer ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Property changes on: trunk/test-mapvalidator/daimonin/maps/Layer.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-12-20 23:22:57
|
Revision: 8825 http://gridarta.svn.sourceforge.net/gridarta/?rev=8825&view=rev Author: akirschbaum Date: 2010-12-20 22:39:16 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Report truncated archetype definitions. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) +++ trunk/atrinik/ChangeLog 2010-12-20 22:39:16 UTC (rev 8825) @@ -1,5 +1,7 @@ 2010-12-20 Andreas Kirschbaum + * Report truncated archetype definitions. + * Fix validators not using head part attributes but incorrectly checking tail part attributes. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) +++ trunk/crossfire/ChangeLog 2010-12-20 22:39:16 UTC (rev 8825) @@ -1,5 +1,7 @@ 2010-12-20 Andreas Kirschbaum + * Report truncated archetype definitions. + * Fix validators not using head part attributes but incorrectly checking tail part attributes. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-12-20 22:26:58 UTC (rev 8824) +++ trunk/daimonin/ChangeLog 2010-12-20 22:39:16 UTC (rev 8825) @@ -1,5 +1,7 @@ 2010-12-20 Andreas Kirschbaum + * Report truncated archetype definitions. + * Fix validators not using head part attributes but incorrectly checking tail part attributes. Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-12-20 22:26:58 UTC (rev 8824) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-12-20 22:39:16 UTC (rev 8825) @@ -155,6 +155,7 @@ while (true) { thisLine2 = in.readLine(); if (thisLine2 == null) { + errorViewCollector.addError(ErrorViewCategory.ARCHETYPE_INVALID, "missing 'end' line"); break LOOP; } Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-12-20 22:26:58 UTC (rev 8824) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-12-20 22:39:16 UTC (rev 8825) @@ -66,6 +66,15 @@ } /** + * Checks that a missing "end" line is reported. + * @throws IOException if the test fails + */ + @Test + public void testMissingEnd() throws IOException { + check("Object test\n", true, false, 0); + } + + /** * Checks that msg...endmsg fields are parsed correctly. * @throws IOException if the test fails * @throws UndefinedArchetypeException if the test fails This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-01-10 09:28:38
|
Revision: 8826 http://gridarta.svn.sourceforge.net/gridarta/?rev=8826&view=rev Author: akirschbaum Date: 2011-01-10 09:28:31 +0000 (Mon, 10 Jan 2011) Log Message: ----------- Properly create inventory objects when inserting game objects into maps. [Atrinik, Crossfire] Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/atrinik/ChangeLog 2011-01-10 09:28:31 UTC (rev 8826) @@ -1,3 +1,8 @@ +2011-01-10 Andreas Kirschbaum + + * Properly create inventory objects when inserting game objects + into maps. + 2010-12-20 Andreas Kirschbaum * Report truncated archetype definitions. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/crossfire/ChangeLog 2011-01-10 09:28:31 UTC (rev 8826) @@ -1,3 +1,8 @@ +2011-01-10 Andreas Kirschbaum + + * Properly create inventory objects when inserting game objects + into maps. + 2010-12-20 Andreas Kirschbaum * Report truncated archetype definitions. Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2011-01-10 09:28:31 UTC (rev 8826) @@ -42,4 +42,14 @@ return newHead; } + /** + * {@inheritDoc} + */ + @Override + public void createInventory(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Iterable<G> archetype) { + for (final G invGameObject : archetype) { + gameObject.addLast(cloneGameObject(invGameObject)); + } + } + } // class DefaultGameObjectFactory Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java 2011-01-10 09:28:31 UTC (rev 8826) @@ -72,4 +72,11 @@ @NotNull G cloneMultiGameObject(@NotNull G gameObject); + /** + * Copies inventory objects from an archetype into a game object. + * @param gameObject the game object to add to + * @param archetype the archetype to copy from + */ + void createInventory(@NotNull GameObject<G, A, R> gameObject, @NotNull Iterable<G> archetype); + } // interface GameObjectFactory Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2011-01-10 09:28:31 UTC (rev 8826) @@ -756,6 +756,9 @@ } else { newGameObject = templateBaseObject.newInstance(gameObjectFactory); nextGameObjectEnv.addLast(newGameObject); + if (templateBaseObject instanceof Archetype) { + gameObjectFactory.createInventory(newGameObject, templateBaseObject); + } } return newGameObject; @@ -819,8 +822,8 @@ } final G head = parts.get(0); - for (final G invObject : effectiveArchetype) { - head.addLast(gameObjectFactory.cloneGameObject(invObject)); + if (baseObject instanceof Archetype) { + gameObjectFactory.createInventory(head, effectiveArchetype); } return head; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-12-20 22:39:16 UTC (rev 8825) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2011-01-10 09:28:31 UTC (rev 8826) @@ -575,6 +575,9 @@ mapModel.beginTransaction("Add to inventory"); try { gameObject.addLast(invNew); + if (arch instanceof Archetype) { + gameObjectFactory.createInventory(invNew, arch); + } } finally { mapModel.endTransaction(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-01-23 19:24:42
|
Revision: 8835 http://gridarta.svn.sourceforge.net/gridarta/?rev=8835&view=rev Author: akirschbaum Date: 2011-01-23 19:24:29 +0000 (Sun, 23 Jan 2011) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/build.xml trunk/crossfire/resource/resource/conf/types.xml trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/CrossfireEditor.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObject.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationValidator.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/archetype/Archetype.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeFactory.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.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/baseobject/GameObjectText.java trunk/model/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java trunk/model/src/app/net/sf/gridarta/model/connectionview/Connections.java trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObjects.java trunk/model/src/app/net/sf/gridarta/model/data/NamedTreeNode.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java trunk/model/src/app/net/sf/gridarta/model/filter/Filter.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractIsoGameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java trunk/model/src/app/net/sf/gridarta/model/gameobject/NotInsideContainerException.java trunk/model/src/app/net/sf/gridarta/model/index/IndexListener.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/MapReader.java trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursorListener.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGridEvent.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGridListener.java trunk/model/src/app/net/sf/gridarta/model/mapmanager/MapManager.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/InsertionModeSet.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapTransactionListener.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java trunk/model/src/app/net/sf/gridarta/model/match/AndGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java trunk/model/src/app/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java trunk/model/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java trunk/model/src/app/net/sf/gridarta/model/spells/ArchetypeSetSpellLoader.java trunk/model/src/app/net/sf/gridarta/model/spells/GameObjectSpell.java trunk/model/src/app/net/sf/gridarta/model/spells/NumberSpell.java trunk/model/src/app/net/sf/gridarta/model/spells/Spell.java trunk/model/src/app/net/sf/gridarta/model/spells/Spells.java trunk/model/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoModel.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/AttributeRangeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectionChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/CustomTypeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/Range.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java trunk/preferences/src/app/net/sf/gridarta/preferences/Codec.java trunk/preferences/src/app/net/sf/gridarta/preferences/FilePreferences.java trunk/preferences/src/app/net/sf/gridarta/preferences/FilePreferencesFactory.java trunk/preferences/src/app/net/sf/gridarta/preferences/FilePreferencesNode.java trunk/preferences/src/app/net/sf/gridarta/preferences/FilePreferencesRoot.java trunk/preferences/src/app/net/sf/gridarta/preferences/NodeType.java trunk/preferences/src/app/net/sf/gridarta/preferences/Storage.java trunk/script/src/app/net/sf/gridarta/script/BshThread.java trunk/script/src/app/net/sf/gridarta/script/ScriptModel.java trunk/script/src/app/net/sf/gridarta/script/ScriptModelLoader.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/actions/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/commands/Collector.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java trunk/src/app/net/sf/gridarta/gui/connectionview/Connection.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java trunk/src/app/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/EventsTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/AbstractPerMapDialogManager.java trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractSimpleIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/MapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFileNameComparator.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolder.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderListener.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeListener.java trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/MiscPreferences.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/script/ClosingIcon.java trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/scripts/PathButtonListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareActions.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/app/net/sf/gridarta/gui/utils/SwingUtils.java trunk/src/app/net/sf/gridarta/gui/utils/tristate/TristateState.java trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/GameObjectMatchers.xml trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/TreasureLists.xml trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/spells.xml trunk/test-mapvalidator/daimonin/arch/dev/editor/conf/types.xml trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/SyntaxStyle.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/Token.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/KeywordMap.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/Node.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarkerFactory.java trunk/utils/src/app/net/sf/gridarta/utils/ConfigFileUtils.java trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java trunk/utils/src/app/net/sf/gridarta/utils/FileChooserUtils.java trunk/utils/src/app/net/sf/gridarta/utils/FileFilters.java trunk/utils/src/app/net/sf/gridarta/utils/GuiFileFilters.java trunk/utils/src/app/net/sf/gridarta/utils/StringUtils.java trunk/utils/src/app/net/sf/gridarta/utils/XmlHelper.java trunk/utils/src/test/net/sf/gridarta/utils/HideFileFilterProxyTest.java trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -53,7 +53,7 @@ /** * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File}s. + * java.io.File Files}. */ @NotNull private final MapPathNormalizer mapPathNormalizer; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -569,8 +569,9 @@ /** * Creates a border to be used in dialogs to frame dialog component groups. - * @param key i18n Key to look up the l10n title using the ActionBuilder - * @return Border + * @param key the i18n Key for looking up the l10n title using the + * ActionBuilder + * @return the border */ @NotNull private static Border createTitledBorder(@NotNull final String key) { Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/build.xml 2011-01-23 19:24:29 UTC (rev 8835) @@ -1162,10 +1162,9 @@ <target name="preparePublish-atrinik" description="Prepare files to publish AtrinikEditor.jar." depends="jar" if="user.update.url.atrinik"> <mkdir dir="${dist.dir}/atrinik"/> <echo file="${dist.dir}/atrinik/update.properties"> -update.number=${build.number} -update.tstamp=${build.tstamp} -update.developer=${build.developer} -update.url=${user.update.url.atrinik} + update.number=${build.number} update.tstamp=${build.tstamp} + update.developer=${build.developer} + update.url=${user.update.url.atrinik} </echo> <copy file="AtrinikEditor.jar" tofile="${dist.dir}/atrinik/AtrinikEditor.jar"/> </target> @@ -1173,10 +1172,9 @@ <target name="preparePublish-crossfire" description="Prepare files to publish CrossfireEditor.jar." depends="jar" if="user.update.url.crossfire"> <mkdir dir="${dist.dir}/crossfire"/> <echo file="${dist.dir}/crossfire/update.properties"> -update.number=${build.number} -update.tstamp=${build.tstamp} -update.developer=${build.developer} -update.url=${user.update.url.crossfire} + update.number=${build.number} update.tstamp=${build.tstamp} + update.developer=${build.developer} + update.url=${user.update.url.crossfire} </echo> <copy file="CrossfireEditor.jar" tofile="${dist.dir}/crossfire/CrossfireEditor.jar"/> </target> @@ -1184,10 +1182,9 @@ <target name="preparePublish-daimonin" description="Prepare files to publish DaimoninEditor.jar." depends="jar" if="user.update.url.daimonin"> <mkdir dir="${dist.dir}/daimonin"/> <echo file="${dist.dir}/daimonin/update.properties"> -update.number=${build.number} -update.tstamp=${build.tstamp} -update.developer=${build.developer} -update.url=${user.update.url.daimonin} + update.number=${build.number} update.tstamp=${build.tstamp} + update.developer=${build.developer} + update.url=${user.update.url.daimonin} </echo> <copy file="DaimoninEditor.jar" tofile="${dist.dir}/daimonin/DaimoninEditor.jar"/> </target> Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/resource/resource/conf/types.xml 2011-01-23 19:24:29 UTC (rev 8835) @@ -699,9 +699,9 @@ <attribute arch="wc" editor="weapon class" type="int" min="-128" max="127"> The <weapon class> value adds to the overall weapon class of the wielder's melee attacks. Weapon class improves the chance of - hitting the opponent. Weapon class is the "counter piece" of - <armor class>. It should usually be set only for weapon-like - items. Lower values are better. + hitting the opponent. Weapon class is the "counter piece" of <armor + class>. It should usually be set only for weapon-like items. + Lower values are better. </attribute> <attribute arch="item_power" editor="item power" type="int"> The <item power> value measures how "powerful" an artifact is. @@ -1311,10 +1311,9 @@ "arrows" and "keys". Unfortunately it is not easy to create new container classes, - because items need a matching counter piece attribute to the - <container class> before they can be put inside a container. - This attribute ("race") is set only for the existing container - classes. + because items need a matching counter piece attribute to the <container + class> before they can be put inside a container. This attribute + ("race") is set only for the existing container classes. </attribute> <attribute arch="slaying" editor="key string" type="string"> If <key string> is set, only players with a special key of @@ -1527,10 +1526,9 @@ areas too much, because that freaks out wizard-type players. ]]> </use> <attribute arch="sp" editor="direction" type="list_direction"> - Projectiles will leave the director flying in the selected - <direction>. A director with direction <none> simply - stops projectiles. (The latter works out a bit strange for some - spells). + Projectiles will leave the director flying in the selected <direction>. + A director with direction <none> simply stops projectiles. + (The latter works out a bit strange for some spells). </attribute> <attribute arch="move_on" editor="affected movement" type="bitmask_movement"> The movement types this director affects. @@ -1581,16 +1579,16 @@ catching it. </attribute> <attribute arch="last_grace" editor="attenuation" type="int" min="0" max="32767"> - The <attenuation> value reduces the diseases' - <infectiousness> every time it infects someone new. This - limits how many generations a disease can propagate. + The <attenuation> value reduces the diseases' <infectiousness> + every time it infects someone new. This limits how many + generations a disease can propagate. </attribute> <attribute arch="magic" editor="infection range" type="int"> <infection range> sets the range at which infection may occur. If positive, the <infection range> is level - dependant - If negative, it is not: E.g. "<infection - range> -6" means creatures can be infected in six square - range, and <plaque level> doesn't modify that. + dependant - If negative, it is not: E.g. "<infection range> + -6" means creatures can be infected in six square range, and + <plaque level> doesn't modify that. </attribute> <attribute arch="maxhp" editor="persistence" type="int" min="-32768" max="32767"> <persistence> defines how long the disease can persist @@ -1620,16 +1618,16 @@ </section> <section name="symptoms"> <attribute arch="attacktype" editor="attacktype" type="bitmask_attacktype"> - The disease will attack the host with the given - <attacktype>. Godpower attacktype is commonly used for - "unresistable" diseases. + The disease will attack the host with the given <attacktype>. + Godpower attacktype is commonly used for "unresistable" + diseases. </attribute> <attribute arch="dam" editor="damage" type="int" min="-100" max="32767"> A disease with a positive <damage> value will strike the player for that amount of damage every time the symptoms occur. - A negative <damage> value produces %-based damage: - "<damage> -10" means the player's health is reduced by - 10% every time the symptoms strike. + A negative <damage> value produces %-based damage: "<damage> + -10" means the player's health is reduced by 10% every time the + symptoms strike. Diseases with %-based damage can be dangerous - but not deadly - for players of all levels. @@ -1730,9 +1728,8 @@ If set to non-zero, the door cannot be destroyed by attacking it. </attribute> <attribute arch="ac" editor="armor class" type="int"> - Doors of high <armor class> are less likely to get hit. - <armor class> can be considered the "counter piece" to - <weapon class>. + Doors of high <armor class> are less likely to get hit. <armor + class> can be considered the "counter piece" to <weapon class>. </attribute> <attribute arch="other_arch" editor="drop arch" type="string"> This string defines the object that will be created when the door @@ -2671,11 +2668,11 @@ if the player does/don't carry an object that is of type <match type>. - Example: Set <match type> 15 (type 15 => weapon) and - <blocking passage> enabled. Now you have an inventory checker - blocking all players that carry any kind of melee weapon. To pass, a - player is forced to leave behind all his weaponry... bad news for a - warrior. ;) + Example: Set <match type> 15 (type 15 => weapon) and <blocking + passage> enabled. Now you have an inventory checker blocking all + players that carry any kind of melee weapon. To pass, a player is + forced to leave behind all his weaponry... bad news for a warrior. + ;) </attribute> <attribute arch="last_sp" editor="match = having" type="bool"> Enabled means having that object is a match. Disabled means not @@ -2846,10 +2843,9 @@ </attribute> <attribute arch_begin="msg" arch_end="endmsg" editor="keyword-matching" type="text" marker="crossfire-dialog"> This text field contains the keyword-matching-syntax. The text - should have the following format: - "@match <keyword1>|<keyword2>|...". Any number of - keywords from one to infinite is allowed. Make sure they are - separated by a '|'. + should have the following format: "@match <keyword1>|<keyword2>|...". + Any number of keywords from one to infinite is allowed. Make sure + they are separated by a '|'. Examples: "@match yes", "@match gold|treasure". The connected value will be triggered when the player speaks any of the given keywords @@ -2918,9 +2914,9 @@ per trigger) via connected lever/button/etc, you must set "speed 0". </attribute> <attribute arch="sp" editor="direction" type="list_direction"> - The magic wall will cast it's spells always in the specified - <direction>. A magic wall with direction set to <none> - will always fire in a random direction. + The magic wall will cast it's spells always in the specified <direction>. + A magic wall with direction set to <none> will always fire in + a random direction. </attribute> <attribute arch="move_block" editor="blocked movement" type="bitmask_movement"> If set, the object cannot be passed by players nor monsters. @@ -3128,12 +3124,11 @@ (masses of) monsters. Note that you can always put items into the monster's inventory. - Those will drop-at-kill just like the stuff from the - <treasurelist>. + Those will drop-at-kill just like the stuff from the <treasurelist>. </attribute> <attribute arch="level" editor="level" type="int" min="-32768" max="32767" check_min="1" check_max="115"> - A monster's <level> is the most important attribute. - <level> affects the power of a monster in various ways. + A monster's <level> is the most important attribute. <level> + affects the power of a monster in various ways. </attribute> <attribute arch="race" editor="race" type="string"> Every monster should have a race set to categorize it. The monster's Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -106,7 +106,7 @@ * @param x the x-coordinate of the map square to draw, in map coordinates * @param y the y-coordinate of the map square to draw, in map coordinates * @param level the limit smoothlevel (smooth levels above this are drawn) - * @param firstLayer the layer (map z coordinate) to draw. Note that + * @param firstLayer the layer (map z coordinate) to draw; note that * invisible objects are supposed to not use a layer, to stay coherent with * client behavior * @param allLayers whether or not to draw also layers above current one Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -53,7 +53,7 @@ /** * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File}s. + * java.io.File Files}. */ @NotNull private final MapPathNormalizer mapPathNormalizer; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -358,7 +358,7 @@ * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @param globalSettings the global settings instance - * @param mapModel the map model whose properties are shown/edited. + * @param mapModel the map model whose properties are shown/edited * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files @@ -449,8 +449,8 @@ /** * Create the map panel. - * @param map MapArchObject to create map panel for. - * @return Newly created map panel. + * @param map the map arch object to create map panel for + * @return the newly created map panel */ @NotNull private Component createMapPanel(@NotNull final MapArchObject map) { @@ -470,8 +470,8 @@ /** * Create the parameters panel. - * @param map MapArchObject to create parameters panel for. - * @return Newly created parameters panel. + * @param map the map arch object to create parameters panel for + * @return the newly created parameters panel */ @NotNull private Component createParametersPanel(@NotNull final MapArchObject map) { @@ -489,8 +489,8 @@ /** * Create the shop panel. - * @param map MapArchObject to create shop panel for. - * @return Newly created shop panel. + * @param map the map arch object to create shop panel for + * @return the newly created shop panel */ @NotNull private Component createShopPanel(@NotNull final MapArchObject map) { @@ -506,8 +506,8 @@ /** * Create the weather panel. - * @param map MapArchObject to create weather panel for. - * @return Newly created weather panel. + * @param map the map arch object to create weather panel for + * @return the newly created weather panel */ @NotNull private Component createWeatherPanel(@NotNull final MapArchObject map) { @@ -524,8 +524,8 @@ /** * Create the lore panel. - * @param map MapArchObject to create lore panel for. - * @return Newly created lore panel. + * @param map the map arch object to create lore panel for + * @return the newly created lore panel */ @NotNull private Component createMapLorePanel(@NotNull final MapArchObject map) { @@ -540,8 +540,8 @@ /** * Create the map text panel. - * @param map MapArchObject to create map text panel for. - * @return Newly created map text panel. + * @param map the map arch object to create map text panel for + * @return the newly created map text panel */ @NotNull private Component createMapTextPanel(@NotNull final net.sf.gridarta.model.maparchobject.MapArchObject<MapArchObject> map) { @@ -556,8 +556,8 @@ /** * Create the tile path panel. - * @param mapTilePane The <code>MapTilePane<code> contents. - * @return Newly created tile path panel. + * @param mapTilePane the <code>MapTilePane<code> contents + * @return the newly created tile path panel */ @NotNull private static Component createTilePathPanel(@NotNull final Component mapTilePane) { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/CrossfireEditor.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/CrossfireEditor.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/CrossfireEditor.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -39,7 +39,7 @@ /** * The main method that is invoked by the Java Runtime. - * @param args The command line parameters given to the level editor. + * @param args the command line parameters given to the level editor */ public static void main(final String... args) { new GridartaEditor<GameObject, MapArchObject, Archetype>("net.sf.gridarta.var.crossfire.tod").run("net.sf.gridarta.var.crossfire", "CrossfireEditor.jar", new DefaultEditorFactory(), "crossfire.conf", args); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -289,9 +289,9 @@ private static int idKey = 1; /** - * Add a new key to {@link #keys}. The order in which the keys are added is + * Adds a new key to {@link #keys}. The order in which the keys are added is * the order in which the objects fields are written out. - * @param key Key to add. + * @param key the key to add */ private static void addKey(final String key) { keys.put(key.equals("msg") || key.equals("lore") ? key + "\n" : key + " ", idKey++); 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-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -549,7 +549,7 @@ /** * Returns the map lore. - * @return The map lore. + * @return the map lore */ @NotNull public String getLore() { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -72,9 +72,9 @@ private final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor; /** - * Create a ScriptedEvent of given type (This is used for map-loading). + * Creates a new instance of a given type (This is used for map-loading). * @param scriptArchUtils the script arch utils instance to use - * @param event GameObject that describes the event. + * @param event the game object that describes the event * @param subtypeAttribute the attribute name for the subtype field * @param scriptedEventEditor the scripted event editor to use */ Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -53,7 +53,7 @@ /** * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File}s. + * java.io.File Files}. */ @NotNull private final MapPathNormalizer mapPathNormalizer; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -357,9 +357,9 @@ } /** - * Create the mainPanel. - * @param map MapArchObject to create main panel for. - * @return Newly created main panel. + * Creates the main panel. + * @param map the map arch object to create main panel for + * @return the newly created main panel */ @NotNull private Component createMainPanel(@NotNull final MapArchObject map) { @@ -392,9 +392,9 @@ } /** - * Create the mapDataPanel. - * @param map MapArchObject to create panel for. - * @return Newly created mapDataPanel. + * Creates the map data panel. + * @param map the map arch object to create panel for + * @return the newly created mapDataPanel */ @NotNull private Component createMapDataPanel(@NotNull final net.sf.gridarta.model.maparchobject.MapArchObject<MapArchObject> map) { @@ -408,9 +408,9 @@ } /** - * Create the optionsPanel. - * @param map MapArchObject to create panel for. - * @return Newly created optionsPanel. + * Creates the options panel. + * @param map the map arch object to create panel for + * @return the newly created options panel */ @NotNull private Component createOptionsPanel(@NotNull final MapArchObject map) { @@ -440,9 +440,9 @@ } /** - * Create the mapPanel. - * @param map MapArchObject to create panel for. - * @return Newly created mapPanel. + * Creates the map panel. + * @param map the map arch object to create panel for + * @return the newly created map panel */ @NotNull private Component createMapPanel(@NotNull final MapArchObject map) { @@ -502,9 +502,9 @@ } /** - * Create the tile path panel. - * @param mapTilePane The <code>MapTilePane<code> contents. - * @return Newly created tile path panel. + * Creates the tile path panel. + * @param mapTilePane the <code>MapTilePane<code> contents + * @return the newly created tile path panel */ @NotNull private static Component createTilePathPanel(@NotNull final Component mapTilePane) { @@ -560,8 +560,9 @@ /** * Creates a border to be used in dialogs to frame dialog component groups. - * @param key i18n Key to look up the l10n title using the ActionBuilder - * @return Border + * @param key the i18n key for looking up the l10n title using the + * ActionBuilder + * @return the border */ @NotNull private static Border createTitledBorder(@NotNull final String key) { @@ -571,10 +572,10 @@ /** * Create an "attribute"-line (format: <label> <textfield>). * @param textField formatted textfield - * @param n length of textfield - * @param defaultValue initial value in formatted textfield - * @param labelKey (attribute-)label key - * @return created panel + * @param n the length of textfield + * @param defaultValue the initial value in formatted textfield + * @param labelKey the (attribute-)label key + * @return the created panel */ @NotNull private static Component createPanelLine(@NotNull final JTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { @@ -587,11 +588,11 @@ } /** - * Create a checkbox-line, similar to createPanelLine. - * @param checkBox checkbox - * @param state initial state - * @param labelKey (attribute-)label key - * @return created Checkbox + * Creates a checkbox-line, similar to createPanelLine. + * @param checkBox the checkbox + * @param state the initial state + * @param labelKey the (attribute-)label key + * @return the created checkbox */ @NotNull private static Component createPanelCBox(@NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey) { @@ -606,7 +607,7 @@ /** * Checks the given values and modifies the current map. * @return <code>true</code> if the map properties were edited, - * <code>false</code> if the parameters were wrong. + * <code>false</code> if the parameters were wrong */ private boolean modifyMapProperties() { // first check if the entries are all okay @@ -697,10 +698,10 @@ /** * This is a simple string-to-int parser that throws * IllegalArgumentExceptions with appropriate error messages. - * @param s string to be parse - * @param label attribute label for error message - * @return value of String 's', zero if 's' is empty - * @throws IllegalArgumentException when parsing fails + * @param s the string to be parse + * @param label the attribute label for error message + * @return the value of String 's', zero if 's' is empty + * @throws IllegalArgumentException if parsing fails */ private static int parseProperty(@NotNull final String s, @NotNull final String label) { if (s.length() == 0) { @@ -716,7 +717,7 @@ } /** - * Reset all map properties to the saved values in the map arch object. + * Resets all map properties to the saved values in the map arch object. */ private void restoreMapProperties() { final MapArchObject map = mapModel.getMapArchObject(); Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -35,7 +35,7 @@ /** * Creates a new instance. - * @param name localized name of the object type, e.g. used in dialogs + * @param name the localized name of the object type, e.g. used in dialogs */ protected AbstractAnimationObjects(final String name) { super(name); Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObject.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObject.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -32,7 +32,7 @@ /** * Get the animName, which is the name of the animation as usable by the * "animations" attribute. - * @return the name of this animation. + * @return the name of this animation */ @NotNull String getAnimName(); @@ -40,7 +40,7 @@ /** * Returns the animation list of this animation. The individual entries are * all suffixed with '\n'. - * @return the animation list of this animation. + * @return the animation list of this animation */ @NotNull String getAnimList(); Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -27,7 +27,8 @@ import org.jetbrains.annotations.NotNull; /** - * AnimationObjects is a container for {@link AnimationObject}s. + * AnimationObjects is a container for {@link AnimationObject + * AnimationObjects}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public interface AnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Collectable<G, A, R>, NamedObjects<AnimationObject> { Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AnimationValidator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AnimationValidator.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AnimationValidator.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -60,7 +60,7 @@ } /** - * Validates a set of {@link AnimationObject}s. + * Validates a set of {@link AnimationObject AnimationObjects}. * @param animationObjects the animation objects instance to validate */ public void validate(@NotNull final Iterable<AnimationObject> animationObjects) { Modified: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -84,15 +84,15 @@ private static final Pattern PATTERN_END_OF_LINE = Pattern.compile("\n"); /** - * Create an AnimationObject. Therefore animList is parsed. Do not invoke - * this constructor directly, use {@link AnimationObjects#addAnimationObject(String,String,String)} + * Creates a new instance. Therefore animList is parsed. Do not invoke this + * constructor directly, use {@link AnimationObjects#addAnimationObject(String,String,String)} * instead. If you invoke this constructor directly, the created * AnimationObject will not be registered. * @param animName name of the animation * @param animList list of animation as found between "anim" and "mina", * separated with "\n", including "facings" but including neither "anim" nor * "mina" - * @param path Path for this AnimationObject. + * @param path the path for this animation object */ public DefaultAnimationObject(@NotNull final String animName, @NotNull final String animList, @NotNull final String path) { super(path); @@ -134,7 +134,7 @@ /** * {@inheritDoc} - * @return the same String as {@link #getAnimName()}. + * @return the same String as <code>getAnimName()</code> */ @NotNull @Override Modified: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -80,7 +80,7 @@ /** * Collects the animation data into the file "animations". - * @param progress Progress to report progress to. + * @param progress the progress to report progress to * @param collectedDirectory the destination directory to collect data to * @throws IOException in case of I/O problems during collection */ @@ -103,7 +103,7 @@ /** * Collects the animation data into the file "animations". - * @param progress Progress to report progress to. + * @param progress the progress to report progress to * @param collectedDirectory the destination directory to collect data to * @throws IOException in case of I/O problems during collection */ Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -58,7 +58,8 @@ private final Map<String, String> attributes = new LinkedHashMap<String, String>(); /** - * The {@link GameObjectFactory} for creating new {@link Archetype}s. + * The {@link GameObjectFactory} for creating new {@link Archetype + * Archetypes}. */ @NotNull private final GameObjectFactory<G, A, R> gameObjectFactory; Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/Archetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/Archetype.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/Archetype.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -40,15 +40,15 @@ public interface Archetype<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends BaseObject<G, A, R, R> { /** - * Return all inventory objects. - * @return An iterator returning all inventory objects. + * Returns all inventory objects. + * @return an iterator returning all inventory objects */ @NotNull @Override Iterator<G> iterator(); /** - * Add the given GameObject at the end of this Container. + * Adds the given {@link GameObject} at the end of this Container. * @param gameObject the free yet unlinked <code>GameObject</code> to be * placed in the inventory * @throws IllegalArgumentException if <var>gameObject</var> already is @@ -57,7 +57,7 @@ void addLast(@NotNull G gameObject); /** - * Add the given GameObject at the beginning of this Container. + * Adds the given {@link GameObject} at the beginning of this Container. * @param gameObject the free yet unlinked <code>GameObject</code> to be * placed in the inventory * @throws IllegalArgumentException if <var>gameObject</var> already is @@ -86,29 +86,29 @@ boolean isUndefinedArchetype(); /** - * Set the x-position of this part of a multi-part object. The x-position is - * relative to the head part. + * Sets the x-position of this part of a multi-part object. The x-position + * is relative to the head part. * @param multiX the x-distance of this part to the head part */ void setMultiX(int multiX); /** - * Set the y-position of this part of a multi-part object. The y-position is - * relative to the head part. + * Sets the y-position of this part of a multi-part object. The y-position + * is relative to the head part. * @param multiY the y-distance of this part to the head part */ void setMultiY(int multiY); /** - * Get the x-distance of this part to the head part. For single-part objects - * this is always zero. + * Returns the x-distance of this part to the head part. For single-part + * objects this is always zero. * @return the x-distance of this part to the head part */ int getMultiX(); /** - * Get the y-distance of this part to the head part. For single-part objects - * this is always zero. + * Returns the y-distance of this part to the head part. For single-part + * objects this is always zero. * @return the y-distance of this part to the head part */ int getMultiY(); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeFactory.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeFactory.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -30,9 +30,9 @@ public interface ArchetypeFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * Create a new undefined archetype instance. - * @param archetypeName The archetype name. - * @return The new undefined archetype instance. + * Creates a new undefined archetype instance. + * @param archetypeName the archetype name + * @return the new undefined archetype instance */ @NotNull R newUndefinedArchetype(@NotNull String archetypeName); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -37,19 +37,19 @@ * Returns whether the Archetypes in this ArchetypeSet were loaded from an * archive. * @return <code>true</code> if loaded from an archive, otherwise - * <code>false</code>. + * <code>false</code> */ boolean isLoadedFromArchive(); /** * Returns the number of Archetypes available. - * @return The number of Archetypes available + * @return the number of Archetypes available */ int getArchetypeCount(); /** - * Get an Archetype by its name. - * @param archetypeName name of the Archetype to get + * Returns an Archetype by its name. + * @param archetypeName the name of the Archetype to get * @return the archetype * @throws UndefinedArchetypeException if the no such archetype exists * @see #getOrCreateArchetype(String) for a similar method that creates @@ -59,8 +59,8 @@ R getArchetype(@NotNull String archetypeName) throws UndefinedArchetypeException; /** - * Get an archetype by its name. If this archetype does not exist, return an - * {@link Archetype} which has {@link Archetype#isUndefinedArchetype()} + * Returns an archetype by its name. If this archetype does not exist, + * return an {@link Archetype} which has {@link Archetype#isUndefinedArchetype()} * set. * @param archetypeName the archetype name * @return the archetype @@ -70,35 +70,35 @@ /** * Adds an Archetype to this Set. - * @param archetype Archetype to add. + * @param archetype the archetype to add * @throws DuplicateArchetypeException if the archetype name is not unique * @throws IllegalArgumentException in case the added GameObject is not an - * Archetype. + * Archetype */ void addArchetype(@NotNull R archetype) throws DuplicateArchetypeException, IllegalArgumentException; /** - * Register an ArchetypeSetListener. - * @param listener ArchetypeSetListener to register + * Registers an {@link ArchetypeSetListener}. + * @param listener the listener to register */ void addArchetypeSetListener(@NotNull ArchetypeSetListener<G, A, R> listener); /** - * Remove an ArchetypeSetListener. - * @param listener ArchetypeSetListener to remove + * Removes an {@link ArchetypeSetListener}. + * @param listener the listener to remove */ void removeArchetypeSetListener(@NotNull ArchetypeSetListener<G, A, R> listener); /** - * Returns a read-only collection of all Archetypes. - * @return A read-only collection of all Archetypes. + * Returns a read-only collection of all {@link Archetype Archetypes}. + * @return a read-only collection of all archetypes */ Collection<R> getArchetypes(); void connectFaces(); /** - * Set whether Archetypes were loaded from an archive. + * Sets whether Archetypes were loaded from an archive. * @param loadedFromArchive <code>true</code> when loaded from archive, * otherwise <code>false</code> * @see #isLoadedFromArchive() Modified: trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2011-01-23 17:32:56 UTC (rev 8834) +++ trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2011-01-23 19:24:29 UTC (rev 8835) @@ -33,8 +33,8 @@ /** * A named folder within the {@link ArchetypeChooserModel}. A folder consists of - * a set of {@link Archetype}s. One (or no) archetype may be selected at any - * time. + * a set of {@link Archetype Archetypes}. One (or no) archetype may be selected + * at any time. * @author Andreas Kirschbaum */ public class ArchetypeChooserFolder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { @@ -51,7 +51,7 @@ private final String name; /** - * The {@link Archetype}s in this folder. + * The {@link Archetype Archetypes} in this folder. */ @NotNull private final Set<R> archetypes = new HashSet<R>(); @@ -103,7 +103,7 @@ } /** - * Returns the {@link Archetype}s. ... [truncated message content] |
From: <aki...@us...> - 2011-01-25 20:49:15
|
Revision: 8836 http://gridarta.svn.sourceforge.net/gridarta/?rev=8836&view=rev Author: akirschbaum Date: 2011-01-25 20:49:06 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/model/src/app/net/sf/gridarta/model/io/InvalidMapFormatException.java trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControl.java trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java trunk/src/app/net/sf/gridarta/gui/help/HtmlPane.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpListener.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java trunk/src/app/net/sf/gridarta/gui/misc/MapPreview.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/DevPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/GUIPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePreferences.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -296,7 +296,7 @@ * Creates a new instance. * @param mapViewSettings the map view settings instance to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param borderSize the size of the map borders in pixel * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip @@ -469,7 +469,7 @@ * Paints the selection for the whole map. It's recommended to paint the * complete selection after the map itself, otherwise map elements actually * might hide selections. - * @param graphics Graphics for painting + * @param graphics the graphics for painting */ private void paintMapSelection(@NotNull final Graphics graphics) { for (tmpPoint.y = 0; tmpPoint.y < mapSize.getHeight(); tmpPoint.y++) { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -149,7 +149,7 @@ * @param mapViewSettings the map view settings instance to use * @param filterControl the filter to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -50,10 +50,10 @@ private static final long serialVersionUID = 1L; /** - * Create a new instance. + * Creates a new instance. * @param mapViewSettings the map view settings instance to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param gridMapSquarePainter the grid square painter to use * @param gameObjectParser the game object parser for creating tooltip * information Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -190,8 +190,8 @@ /** * Looks up the section name from the ID. - * @param sectionId ID of the section - * @return name of that section + * @param sectionId the ID of the section + * @return the name of that section */ @NotNull public String getSectionName(final int sectionId) { Modified: trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -86,12 +86,12 @@ * isn't already a BufferedReader itself. * @param animationObjects the animation objects to update * @param errorViewCollector the error view collector for reporting errors - * @param reader Reader to load animations from + * @param reader the reader to load animations from * @param startKey the key that begins an animation block; it must end with * a space character * @param ignoreOtherText if set, ignore all text outside animation * definitions - * @param path Path relative to the arch directory, used to create tree + * @param path the path relative to the arch directory, used to create tree * information; either <code>animations</code> or this parameter must be * non-<code>null</code> * @param animations maps animation name to animation path; either @@ -141,7 +141,7 @@ * @param startKey the "anim" tag name * @param animationObjects the animation objects to update * @param errorViewCollector the error view collector for reporting errors - * @param path Path relative to the arch directory, used to create tree + * @param path the path relative to the arch directory, used to create tree * information; either <code>animations</code> or this parameter must be * non-<code>null</code> * @param animations maps animation name to animation path; either @@ -179,7 +179,7 @@ * Processes a complete anim..mina block. * @param animationObjects the animation objects to update * @param errorViewCollector the error view collector for reporting errors - * @param path Path relative to the arch directory, used to create tree + * @param path the path relative to the arch directory, used to create tree * information; either <code>animations</code> or this parameter must be * non-<code>null</code> * @param animations maps animation name to animation path; either Modified: trunk/model/src/app/net/sf/gridarta/model/io/InvalidMapFormatException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/InvalidMapFormatException.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/io/InvalidMapFormatException.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -34,8 +34,8 @@ private static final long serialVersionUID = 1L; /** - * Create an InvalidMapFormatException. - * @param msg Message text + * Create a new instance. + * @param msg the message text */ public InvalidMapFormatException(final String msg) { super(msg); Modified: trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/io/PathManager.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -93,7 +93,7 @@ * Check whether a path is absolute. Paths starting with "/" are absolute, * paths starting with other characters are relative. Empty paths are * relative. - * @param path Path to check + * @param path the path to check * @return <code>true</code> if <var>path</var> is absolute, * <code>false</code> otherwise * @see #isRelative(String) which nearly is the opposite of this method @@ -105,7 +105,7 @@ /** * Check whether a path is relative. Paths not starting with "/" are * relative, paths starting with are absolute. Empty paths are relative. - * @param path Path to check + * @param path the path to check * @return <code>true</code> if <var>path</var> is relative, * <code>false</code> otherwise * @see #isAbsolute(String) which nearly is the opposite of this method @@ -196,7 +196,7 @@ /** * Counts the occurrences of a character within a string. - * @param s String to count in + * @param s the string to count in * @param c character to count * @return number of occurrences of <var>c</var> in <var>s</var> */ @@ -212,7 +212,7 @@ /** * Create a reasonable path. - * @param str String to create path from + * @param str the string to create path from * @return path */ @NotNull Modified: trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControl.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControl.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControl.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -48,14 +48,14 @@ MapModel<G, A, R> getMapModel(); /** - * Register a map control listener. - * @param listener MapControlListener to register + * Registers a {@link MapControlListener}. + * @param listener the listener to register */ void addMapControlListener(@NotNull MapControlListener<G, A, R> listener); /** - * Unregister a map listener. - * @param listener MapControlListener to unregister + * Unregisters a {@link MapControlListener}. + * @param listener the listener to unregister */ void removeMapControlListener(@NotNull MapControlListener<G, A, R> listener); Modified: trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -60,7 +60,7 @@ /** * Set all ScriptedEvents to appear in the given JList This method should be * fast because it may be executed when user clicks on map objects. - * @param list JList + * @param list the <code>JList</code> * @param gameObject the game object to operate on */ void addEventsToJList(@NotNull final JList list, @NotNull final Iterable<? extends GameObject<?, ?, ?>> gameObject); Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -123,7 +123,7 @@ private String previousSearch = ""; /** - * Create a new instance. + * Creates a new instance. * @param parent the parent component * @param archetypeChooserControl the archetype chooser control to to * search @@ -258,10 +258,10 @@ } /** - * Search for the current name. Does nothing if the current name matches + * Searches for the current name. Does nothing if the current name matches * {@link #previousSearch}. - * @param force If set, perform the search even if the current name is too - * short. + * @param force if set, perform the search even if the current name is too + * short */ private void doSearch(final boolean force) { @Nullable final R selectedArchetype; @@ -325,7 +325,7 @@ } /** - * Highlight the selected row from {@link #resultTable} in the insertion + * Highlights the selected row from {@link #resultTable} in the insertion * object chooser. */ private void highlightSelectedEntry() { @@ -362,7 +362,7 @@ } /** - * Select one row in the result table. + * Selects one row in the result table. * @param index the row index to select */ private void selectRow(final int index) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -37,8 +37,8 @@ private final JComboBox box; /** - * Create a StringKeyManager. - * @param box JComboBox to create StringKeyManager for + * Creates a new instance. + * @param box the JComboBox to create a <code>StringKeyManager</code> for */ public StringKeyManager(final JComboBox box) { this.box = box; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -457,7 +457,7 @@ /** * Action proxy for direction. - * @param direction Direction number + * @param direction the direction number */ private void direction(final int direction) { final GameObject<G, A, R> selectedGameObject = gameObjectAttributesModel.getSelectedGameObject(); Modified: trunk/src/app/net/sf/gridarta/gui/help/HtmlPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/help/HtmlPane.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/help/HtmlPane.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -61,7 +61,7 @@ /** * Constructor to load the html-file <fileName> and display it's * contents in this HtmlPane. - * @param fileName Name of the HTML-file + * @param fileName the name of the HTML-file */ HtmlPane(final String fileName) { try { @@ -191,8 +191,8 @@ /** * Create a PageLoader. - * @param url URL to load - * @param cursor Cursor to restore once the document is loaded + * @param url the URL to load + * @param cursor the cursor to restore once the document is loaded */ private PageLoader(final URL url, final Cursor cursor) { this.url = url; Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpListener.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpListener.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -31,31 +31,31 @@ /** * Mouse was clicked. - * @param e Event + * @param e the event */ void clicked(MouseOpEvent<G, A, R> e); /** * Mouse was dragged. - * @param e Event + * @param e the event */ void dragged(MouseOpEvent<G, A, R> e); /** * Mouse was moved. - * @param e Event + * @param e the event */ void moved(MouseOpEvent<G, A, R> e); /** * Mouse was pressed. - * @param e Event + * @param e the event */ void pressed(MouseOpEvent<G, A, R> e); /** * Mouse was released. - * @param e Event + * @param e the event */ void released(MouseOpEvent<G, A, R> e); Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -37,8 +37,8 @@ private final TilePanel tilePanel; /** - * Create a new instance. - * @param direction Index, used to determine the direction and corresponding + * Creates a new instance. + * @param direction index, used to determine the direction and corresponding * locale keys * @param nextFocus the indices of next focus * @param tilePanel the tile panel to show @@ -65,6 +65,9 @@ tilePanel.addTextFieldActionListener(actionListener); } + /** + * {@inheritDoc} + */ @NotNull public TilePanel getTilePanel() { return tilePanel; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -292,7 +292,7 @@ * @param spawnPointTypeNo the game object type number for spawn points * @param mapViewSettings the map view settings instance to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param borderOffsetX the horizontal border size * @param borderOffsetY the vertical border size * @param multiPositionData the multi position data to query for multi-part Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -114,7 +114,7 @@ * @param mapViewSettings the map view settings instance to use * @param filterControl the filter to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param multiPositionData the multi position data to query for multi-part * objects * @param isoMapSquareInfo the iso square info to use Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -47,11 +47,11 @@ private static final long serialVersionUID = 1L; /** - * Create a new instance. + * Creates a new instance. * @param spawnPointTypeNo the game object type number for spawn points * @param mapViewSettings the map view settings instance to use * @param mapModel the map model to render - * @param mapGrid Grid to render + * @param mapGrid the grid to render * @param multiPositionData the multi position data query for multi-part * objects * @param isoMapSquareInfo the iso square info to use Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -40,7 +40,7 @@ /** * Create a BasicAbstractTool. - * @param id ID (used for {@link #getId()} as well as for the + * @param id the ID (used for {@link #getId()} as well as for the * ActionBuilder) */ protected BasicAbstractTool(@NotNull final String id) { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -109,7 +109,7 @@ private static final Insets EMPTY_MARGIN = new Insets(0, 0, 0, 0); /** - * Create a ToolSelector component. + * Creates a new instance. * @param defaultTool name of the tool that should be selected by default * @param mapViewSettings the map view settings instance * @param selectedSquareView the selected square view @@ -139,7 +139,7 @@ } /** - * Create the user interface elements of the ToolSelector. + * Creates the user interface elements of the ToolSelector. */ private void createUI() { setLayout(new BorderLayout()); @@ -148,8 +148,8 @@ } /** - * Add a tool to this tool selector. - * @param tool Tool to add + * Adds a tool to this tool selector. + * @param tool the tool to add */ @SuppressWarnings({ "MethodOverloadsMethodOfSuperclass" }) public void add(@NotNull final Tool<G, A, R> tool) { @@ -157,8 +157,8 @@ } /** - * Add a tool to this tool selector. - * @param tool Tool to add + * Adds a tool to this tool selector. + * @param tool the tool to add * @param selected <code>true</code> if the tool should be made the selected * tool, otherwise <code>false</code> */ @@ -181,12 +181,12 @@ } /** - * Create the options view for a tool. This method is a delegate to {@link + * Creates the options view for a tool. This method is a delegate to {@link * Tool#createOptionsView()} but will provide a fallback if the tool doesn't * provide tweaking its options. - * @param tool Tool to create options view for - * @return options view (the tool's options view or a dummy fallback if the - * tool doesn't provide an options view) + * @param tool the tool to create options view for + * @return the options view (the tool's options view or a dummy fallback if + * the tool doesn't provide an options view) */ @NotNull private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Component createOptionsView(@NotNull final Tool<G, A, R> tool) { @@ -195,8 +195,8 @@ } /** - * Make a tool the currently selected tool to edit its options. - * @param tool Tool to select + * Makes a tool the currently selected tool to edit its options. + * @param tool the tool to select * @pre the tool must be controlled by this tool-selector. * @see #setSelectedTool(String) */ @@ -206,10 +206,10 @@ } /** - * Make a tool the currently selected tool to edit its options. This method + * Makes a tool the currently selected tool to edit its options. This method * exists to allow programs to store the currently selected tool in * preferences and restore it after startup. - * @param id ID of tool to select + * @param id the ID of tool to select * @pre the tool must be controlled by this tool-selector. * @see #setSelectedTool(Tool) * @see Tool#getId() @@ -219,7 +219,7 @@ } /** - * Get the tool that is currently selected. + * Returns the tool that is currently selected. * @return the currently selected tool */ @NotNull @@ -244,8 +244,8 @@ private final Tool<G, A, R> tool; /** - * Create a SelectionAction. - * @param tool Tool to select with this action + * Creates a SelectionAction. + * @param tool the tool to select with this action */ SelectionAction(@NotNull final Tool<G, A, R> tool) { this.tool = tool; Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -395,15 +395,15 @@ /** * Updates the focus to the first non-iconified map window. - * @param fCareAboutIconification True if the focus update should ignore all - * windows iconified by the user. + * @param careAboutIconification <code>true</code> if the focus update + * should ignore all windows iconified by the user. */ - private void updateFocus(final boolean fCareAboutIconification) { + private void updateFocus(final boolean careAboutIconification) { // Show the next map (if such exists) for (final MapView<G, A, R> mapView : mapViewManager) { final JInternalFrame internalFrame = mapView.getInternalFrame(); if (internalFrame.isIcon()) { - if (!fCareAboutIconification) { + if (!careAboutIconification) { try { internalFrame.setIcon(false); } catch (final PropertyVetoException e) { Modified: trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -146,8 +146,8 @@ /** * Get the mouse operation for a MouseEvent. - * @param event MouseEvent to get mouse operation for - * @return mouse operation for <var>event</var> + * @param event the mouse event to get mouse operation for + * @return the mouse operation for <var>event</var> */ @Nullable private MouseOpListener<G, A, R> getMouseOperation(final MouseEvent event) { @@ -157,9 +157,9 @@ /** * Get the map location for a MouseEvent. - * @param event MouseEvent to get map location for - * @return map location for <var>event</var> or <code>null</code> if outside - * map + * @param event the mouse event to get map location for + * @return the map location for <var>event</var> or <code>null</code> if + * outside map */ @Nullable private Point getMapLocation(final MouseEvent event) { Modified: trunk/src/app/net/sf/gridarta/gui/misc/MapPreview.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MapPreview.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/misc/MapPreview.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -96,10 +96,10 @@ private final JFrame frame; /** - * Constructs the CPreview user interface. When image is not null it either - * increases or decreases the zoom. If m_Image is null the the program will - * wait for a zoom factor to be chosen. - * @param original Image to be displayed + * Constructs the user interface. When image is not null it either increases + * or decreases the zoom. If m_Image is null the the program will wait for a + * zoom factor to be chosen. + * @param original the image to be displayed */ public MapPreview(final Image original) { this.original = original; Modified: trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -307,7 +307,7 @@ /** * Sets the level status text, which usually displays arch numbers. - * @param text String to set + * @param text the text */ public void setStatusText(final String text) { status.setText(text); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -88,9 +88,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); @@ -136,7 +136,7 @@ /** * Creates the sub-panel with the external applications. - * @return sub-panel + * @return the sub-panel */ private Component createAppPanel() { final JComponent panel = new JPanel(new GridBagLayout()); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/DevPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/DevPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/DevPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -86,9 +86,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/GUIPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/GUIPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/GUIPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -122,9 +122,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); @@ -175,8 +175,8 @@ } /** - * Construct the Combo box for the selection of locales. - * @return combo box with locales to select + * Constructs the combo box for the selection of locales. + * @return the combo box with locales to select */ private Component buildLocaleBox() { final Container lineLayout = Box.createHorizontalBox(); @@ -204,7 +204,7 @@ /** * Creates the sub-panel with the global settings. - * @return sub-panel + * @return the sub-panel */ private Component createGlobalPanel() { final JComponent panel = new JPanel(new GridBagLayout()); @@ -218,7 +218,7 @@ /** * Creates the sub-panel with the layout settings. - * @return sub-panel + * @return the sub-panel */ private Component createLayoutPanel() { final JComponent panel = new JPanel(new GridBagLayout()); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -100,9 +100,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); @@ -155,8 +155,8 @@ } /** - * Create the Panel with the generic validation settings. - * @return sub-panel + * Creates the sub-panel with the generic validation settings. + * @return the sub-panel */ @NotNull private Component createValidationPanel() { @@ -168,8 +168,8 @@ } /** - * Create the Panel with the validators information. - * @return sub-panel + * Creates the sub-panel with the validators information. + * @return the sub-panel */ @NotNull private Component createValidatorsPanel() { Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -111,9 +111,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); @@ -169,7 +169,7 @@ /** * Creates the sub-panel with the external applications. - * @return sub-panel + * @return the sub-panel */ private Component createNetPanel() { final JComponent panel = new JPanel(new GridBagLayout()); @@ -182,8 +182,8 @@ } /** - * Create the JComboBox for selecting the proxy type. - * @return JComboBox for selecting the proxy type + * Creates the {@link JComboBox} for selecting the proxy type. + * @return the <code>JComboBox</code> for selecting the proxy type */ private static JComboBox createProxyType() { final JComboBox proxyType = new JComboBox(EnumSet.allOf(Proxy.Type.class).toArray()); @@ -191,8 +191,8 @@ } /** - * Return the currently preferred proxy. - * @return currently preferred proxy + * Returns the currently preferred proxy. + * @return the currently preferred proxy */ public static Proxy getProxy() { final Proxy.Type proxyType = Proxy.Type.valueOf(PREFERENCES.get(NET_PREFERENCES_KEY_TYPE, "DIRECT")); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -150,9 +150,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ @NotNull private static Border createTitledBorder(final String titleKey) { @@ -268,7 +268,7 @@ /** * Creates the sub-panel with the global settings. - * @return sub-panel + * @return the sub-panel */ @NotNull private Component createGlobalPanel() { @@ -293,8 +293,8 @@ } /** - * Construct the Combo box for the selection of image sets. - * @return combo box with image sets to select + * Constructs the combo box for the selection of image sets. + * @return the combo box with image sets to select */ @NotNull private Component buildImageSetBox() { Modified: trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePreferences.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePreferences.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -84,9 +84,9 @@ } /** - * Create a titled border. - * @param titleKey Action Key for border title - * @return titled border + * Creates a titled border. + * @param titleKey the action key for border title + * @return the titled border */ private static Border createTitledBorder(final String titleKey) { return new CompoundBorder(new TitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, titleKey)), GUIConstants.DIALOG_BORDER); @@ -129,7 +129,7 @@ /** * Creates the sub-panel with the update settings. - * @return sub-panel + * @return the sub-panel */ private Component createUpdatePanel() { final JComponent panel = new JPanel(new GridBagLayout()); @@ -143,8 +143,8 @@ } /** - * Set AutoUpdate state. - * @param autoUpdate auto-update state + * Sets the auto-update state. + * @param autoUpdate the auto-update state */ @ActionMethod public void setAutoUpdate(final boolean autoUpdate) { @@ -152,8 +152,8 @@ } /** - * Get AutoUpdate state. - * @return auto-update state + * Returns the auto-update state. + * @return the auto-update state */ @ActionMethod public boolean isAutoUpdate() { @@ -161,8 +161,8 @@ } /** - * Create the JComboBox with the update choices. - * @return JComboBox with update choices + * Creates the component with update choices. + * @return the component with update choices */ private Component createComboBox() { final String[] items = { ActionBuilderUtils.getString(ACTION_BUILDER, "prefsUpdateAuto0.text"), ActionBuilderUtils.getString(ACTION_BUILDER, "prefsUpdateAuto1.text"), ActionBuilderUtils.getString(ACTION_BUILDER, "prefsUpdateAuto2.text"), ActionBuilderUtils.getString(ACTION_BUILDER, "prefsUpdateAuto3.text"), }; Modified: trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -89,8 +89,8 @@ * opened and the appropriate script displayed. * @param eventIndex index of event in the owner's inventory * @param task the task to execute - * @param panelList JList from the MapArchPanel (script tab) which displays - * the events + * @param panelList the <code>JList</code> from the <code>MapArchPanel</code> + * (script tab) which displays the events * @param mapManager the map manager instance * @param parent the parent frame for dialog boxes * @param gameObject the game object to operate on Modified: trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -35,7 +35,7 @@ /** * A popup is opened and the user can create a new scripting event which * gets attached to this gameObject. - * @param gameObject GameObject to add event to + * @param gameObject the game object to add event to * @param scriptArchData the <code>ScriptArchData</code> instance to * display * @param parent the parent frame for the editor Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -100,7 +100,7 @@ }; /** - * Create a SelectedSquareControl. + * Creates a new instance. * @param selectedSquareModel the model for this controller * @param gameObjectAttributesDialogFactory the factory for creating game * object attributes dialog instances @@ -116,15 +116,15 @@ } /** - * Delete the currently selected game object. + * Deletes the currently selected game object. */ public void deleteSelection(@NotNull final MapView<G, A, R> mapView) { deleteIndex(mapView, selectedSquareView.getSelectedIndex()); } /** - * Delete an GameObject with a specific list index. - * @param index List index of GameObject + * Deletes a {@link GameObject} with a specific list index. + * @param index the list index of the game object to delete */ private void deleteIndex(final int index) { final MapView<G, A, R> currentMapView = selectedSquareModel.getCurrentMapView(); @@ -167,7 +167,7 @@ } /** - * Insert a new game object. + * Inserts a new game object. * @param index the list index to insert at */ private void insertGameObjectFromObjectChooser(final int index) { @@ -178,7 +178,7 @@ } /** - * Insert a new game object. + * Inserts a new game object. * @param mapView the map to insert into * @param index the list index to insert at */ @@ -212,7 +212,7 @@ } /** - * Determine if "select" was selected. + * Determines if "select" was selected. * @param e the mouse event to check for "select" * @return <code>true</code> is "select" was selected */ @@ -221,7 +221,7 @@ } /** - * Determine if "insert" was selected. + * Determines if "insert" was selected. * @param e the mouse event to check for "insert" * @return <code>true</code> is "insert" was selected */ @@ -230,7 +230,7 @@ } /** - * Determine if "delete" was selected. + * Determines if "delete" was selected. * @param e the mouse event to check for "delete" * @return <code>true</code> is "delete" was selected */ Modified: trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -86,7 +86,7 @@ /** * Opens a file chooser to select the spell list file, then import spells. * @param dir the directory to use - * @param parent Component the parent component for dialog boxes + * @param parent the parent component for dialog boxes */ public void importSpells(@NotNull final File dir, @NotNull final Component parent) { // open a file chooser window @@ -116,8 +116,8 @@ } /** - * Read all spells from a Crossfire or Daimonin spell list file and write an - * alphabetical list into "spells.def". + * Reads all spells from a Crossfire or Daimonin spell list file and write + * an alphabetical list into "spells.def". * @param spellFile spell file to read * @param dir the base directory to load the spells file from * @return number of successfully collected spells Modified: trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -457,9 +457,9 @@ * Helper method for returning the maximum of an unspecified number of * arguments. (The class {@link Math} only provides max methods for 2 * arguments. - * @param numbers Numbers to get maximum of - * @return maximum of numbers, which is {@link Integer#MIN_VALUE} in case no - * number was supplied. + * @param numbers the numbers to get maximum of + * @return the maximum of numbers, which is {@link Integer#MIN_VALUE} in + * case no number was supplied. */ private static int max(@NotNull final int... numbers) { int ret = Integer.MIN_VALUE; Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -105,8 +105,8 @@ private static final int BUF_SIZE = 4096; /** - * Create an Updater. - * @param parentComponent Component to show dialogs on + * Create a new instance. + * @param parentComponent the parent component to show dialogs on * @param exiter the exiter for terminating the application * @param updateFileName the file to update */ Modified: trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -101,7 +101,7 @@ * Creates a new instance. * @param exiter the exiter for terminating the application * @param mapManager the map manager to use - * @param parentComponent Component to show dialogs on + * @param parentComponent the parent component to show dialogs on * @param updateFileName the file to update */ public UpdaterManager(@NotNull final Exiter exiter, @NotNull final MapManager<?, ?, ?> mapManager, final Component parentComponent, final String updateFileName) { Modified: trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/utils/src/app/net/sf/gridarta/utils/HideFileFilterProxy.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -54,8 +54,8 @@ private final Collection<String> rejectedDirectoryNames = new ArrayList<String>(); /** - * Create a HideFileFilterProxy. - * @param other FileFilter to wrap + * Creates a new instance. + * @param other the file filter to wrap */ public HideFileFilterProxy(@NotNull final FileFilter other) { this.other = other; Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2011-01-23 19:24:29 UTC (rev 8835) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2011-01-25 20:49:06 UTC (rev 8836) @@ -148,7 +148,7 @@ * directory. * @param key i18n key * @param command the command to run and its arguments - * @param dir Working directory for command + * @param dir the working directory for command */ private ProcessRunner(@NotNull final String key, @NotNull final String[] command, @Nullable final String dir) { this.key = key; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-01-25 22:00:04
|
Revision: 8837 http://gridarta.svn.sourceforge.net/gridarta/?rev=8837&view=rev Author: akirschbaum Date: 2011-01-25 21:59:56 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Rewrite complex expressions. Modified Paths: -------------- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -69,7 +69,15 @@ */ @Test public void testMpartIdOk() throws IOException, UndefinedArchetypeException { - check("Object head\n" + "mpart_id 1\n" + "end\nMore\nObject tail\n" + "mpart_id 1\n" + "end\n", false, false, 2); + final StringBuilder input = new StringBuilder(); + input.append("Object head\n"); + input.append("mpart_id 1\n"); + input.append("end\n"); + input.append("More\n"); + input.append("Object tail\n"); + input.append("mpart_id 1\n"); + input.append("end\n"); + check(input.toString(), false, false, 2); Assert.assertEquals(1, getArchetypeSet().getArchetype("head").getMultiShapeID()); Assert.assertEquals(1, getArchetypeSet().getArchetype("tail").getMultiShapeID()); } @@ -81,7 +89,15 @@ */ @Test public void testMpartIdInconsistent() throws IOException, UndefinedArchetypeException { - check("Object head\n" + "mpart_id 1\n" + "end\nMore\nObject tail\n" + "mpart_id 2\n" + "end\n", false, true, 2); + final StringBuilder input = new StringBuilder(); + input.append("Object head\n"); + input.append("mpart_id 1\n"); + input.append("end\n"); + input.append("More\n"); + input.append("Object tail\n"); + input.append("mpart_id 2\n"); + input.append("end\n"); + check(input.toString(), false, true, 2); Assert.assertEquals(1, getArchetypeSet().getArchetype("head").getMultiShapeID()); Assert.assertEquals(2, getArchetypeSet().getArchetype("tail").getMultiShapeID()); } @@ -93,7 +109,15 @@ */ @Test public void testInventoryGameObjects() throws IOException, UndefinedArchetypeException { - check("Object arch1\n" + "end\n" + "Object arch2\n" + "arch arch1\n" + "name name1\n" + "end\n" + "end\n", false, false, 2); + final StringBuilder input = new StringBuilder(); + input.append("Object arch1\n"); + input.append("end\n"); + input.append("Object arch2\n"); + input.append("arch arch1\n"); + input.append("name name1\n"); + input.append("end\n"); + input.append("end\n"); + check(input.toString(), false, false, 2); final Archetype arch2 = getArchetypeSet().getArchetype("arch2"); Assert.assertEquals(1, arch2.countInvObjects()); final GameObject inv = arch2.iterator().next(); Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -67,7 +67,15 @@ */ @Test public void testInventoryGameObjects() throws IOException, UndefinedArchetypeException { - check("Object arch1\n" + "end\n" + "Object arch2\n" + "arch arch1\n" + "name name1\n" + "end\n" + "end\n", false, false, 2); + final StringBuilder input = new StringBuilder(); + input.append("Object arch1\n"); + input.append("end\n"); + input.append("Object arch2\n"); + input.append("arch arch1\n"); + input.append("name name1\n"); + input.append("end\n"); + input.append("end\n"); + check(input.toString(), false, false, 2); final Archetype arch2 = getArchetypeSet().getArchetype("arch2"); Assert.assertEquals(1, arch2.countInvObjects()); final GameObject inv = arch2.iterator().next(); Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -62,7 +62,10 @@ */ @Test public void testEmpty() throws IOException { - check("Object test\n" + "end\n", false, false, 1); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("end\n"); + check(input.toString(), false, false, 1); } /** @@ -81,7 +84,12 @@ */ @Test public void testMsgTextEmpty() throws IOException, UndefinedArchetypeException { - check("Object test\n" + "msg\n" + "endmsg\n" + "end\n", false, false, 1); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("msg\n"); + input.append("endmsg\n"); + input.append("end\n"); + check(input.toString(), false, false, 1); Assert.assertNull(getArchetypeSet().getArchetype("test").getMsgText()); } @@ -92,8 +100,20 @@ */ @Test public void testMsgTextLines() throws IOException, UndefinedArchetypeException { - check("Object test\n" + "msg\n" + "abc\n" + "def\n" + "ghi\n" + "endmsg\n" + "end\n", false, false, 1); - Assert.assertEquals("abc\n" + "def\n" + "ghi\n", getArchetypeSet().getArchetype("test").getMsgText()); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("msg\n"); + input.append("abc\n"); + input.append("def\n"); + input.append("ghi\n"); + input.append("endmsg\n"); + input.append("end\n"); + check(input.toString(), false, false, 1); + final StringBuilder msgText = new StringBuilder(); + msgText.append("abc\n"); + msgText.append("def\n"); + msgText.append("ghi\n"); + Assert.assertEquals(msgText.toString(), getArchetypeSet().getArchetype("test").getMsgText()); } /** @@ -103,8 +123,22 @@ */ @Test public void testMsgTextTrailingWhitespace() throws IOException, UndefinedArchetypeException { - check("Object test\n" + "msg\n" + "abc \n" + "def\n" + "ghi \n\n" + "endmsg\n" + "end\n", false, false, 1); - Assert.assertEquals("abc\n" + "def\n" + "ghi\n\n", getArchetypeSet().getArchetype("test").getMsgText()); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("msg\n"); + input.append("abc \n"); + input.append("def\n"); + input.append("ghi \n"); + input.append("\n"); + input.append("endmsg\n"); + input.append("end\n"); + check(input.toString(), false, false, 1); + final StringBuilder msgText = new StringBuilder(); + msgText.append("abc\n"); + msgText.append("def\n"); + msgText.append("ghi\n"); + msgText.append("\n"); + Assert.assertEquals(msgText.toString(), getArchetypeSet().getArchetype("test").getMsgText()); } /** @@ -114,8 +148,22 @@ */ @Test public void testMsgTextLeadingWhitespace() throws IOException, UndefinedArchetypeException { - check("Object test\n" + "msg\n\n abc\n" + "def\n ghi\n" + "endmsg\n" + "end\n", false, false, 1); - Assert.assertEquals("\n abc\n" + "def\n ghi\n", getArchetypeSet().getArchetype("test").getMsgText()); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("msg\n"); + input.append("\n"); + input.append(" abc\n"); + input.append("def\n"); + input.append(" ghi\n"); + input.append("endmsg\n"); + input.append("end\n"); + check(input.toString(), false, false, 1); + final StringBuilder msgText = new StringBuilder(); + msgText.append("\n"); + msgText.append(" abc\n"); + msgText.append("def\n"); + msgText.append(" ghi\n"); + Assert.assertEquals(msgText.toString(), getArchetypeSet().getArchetype("test").getMsgText()); } /** @@ -124,7 +172,12 @@ */ @Test public void testMsgTextTruncated() throws IOException { - check("Object test\n" + "msg\n" + "abc\n" + "def\n", true, false, 0); + final StringBuilder input = new StringBuilder(); + input.append("Object test\n"); + input.append("msg\n"); + input.append("abc\n"); + input.append("def\n"); + check(input.toString(), true, false, 0); } /** Modified: trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -55,29 +55,30 @@ */ @Test public void test1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch=\"name\" editor=\"name_editor\" type=\"string\">name description</attribute>\n" - + "</default_type>\n" - + "<type number=\"123\" name=\"name 123\">\n" - + "<description>description 123</description>\n" - + "<attribute arch=\"f\" value=\"v\" type=\"fixed\"/>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "string/name[name_editor] section=0/General\n" - + "\n" - + "type:123,name 123\n" - + ":\n" - + ":\n" - + "fixed/f[v] section=1/Special\n" - + "string/name[name_editor] section=0/General\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch=\"name\" editor=\"name_editor\" type=\"string\">name description</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"123\" name=\"name 123\">\n"); + typesXml.append("<description>description 123</description>\n"); + typesXml.append("<attribute arch=\"f\" value=\"v\" type=\"fixed\"/>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/name[name_editor] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:123,name 123\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("fixed/f[v] section=1/Special\n"); + expectedResult.append("string/name[name_editor] section=0/General\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -87,53 +88,54 @@ */ @Test public void testImport1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"default_attr2\" editor=\"default\" type=\"string\">description</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<description>description1</description>\n" - + "<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "<type number=\"2\" name=\"name2\">\n" - + "<import_type name=\"name1\"/>\n" - + "<description>description2</description>\n" - + "<attribute arch=\"name2_attr1\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"name1_attr2\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"default_attr2\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "string/default_attr1[default] section=0/General\n" - + "string/default_attr2[default] section=0/General\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - + "string/name1_attr1[name1] section=1/Special\n" - + "string/name1_attr2[name1] section=1/Special\n" - + "string/default_attr1[default] section=0/General\n" - + "string/default_attr2[default] section=0/General\n" - + "\n" - + "type:2,name2\n" - + ":\n" - + ":\n" - /* attributes */ - + "string/name2_attr1[name2] section=1/Special\n" - + "string/name1_attr2[name2] section=1/Special\n" - + "string/default_attr2[name2] section=1/Special\n" - /* imports */ - + "string/name1_attr1[name1] section=1/Special\n" - /* defaults */ - + "string/default_attr1[default] section=0/General\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"default_attr2\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<description>description1</description>\n"); + typesXml.append("<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + typesXml.append("<type number=\"2\" name=\"name2\">\n"); + typesXml.append("<import_type name=\"name1\"/>\n"); + typesXml.append("<description>description2</description>\n"); + typesXml.append("<attribute arch=\"name2_attr1\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"name1_attr2\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"default_attr2\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("string/default_attr2[default] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/name1_attr1[name1] section=1/Special\n"); + expectedResult.append("string/name1_attr2[name1] section=1/Special\n"); + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("string/default_attr2[default] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:2,name2\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("string/name2_attr1[name2] section=1/Special\n"); + expectedResult.append("string/name1_attr2[name2] section=1/Special\n"); + expectedResult.append("string/default_attr2[name2] section=1/Special\n"); + /* imports */ + expectedResult.append("string/name1_attr1[name1] section=1/Special\n"); + /* defaults */ + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -143,131 +145,132 @@ */ @Test public void testImport2() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch=\"attr1\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr3\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr5\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr7\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr9\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrB\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrD\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrF\" editor=\"default\" type=\"string\">description</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<description>description1</description>\n" - + "<attribute arch=\"attr2\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr3\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr6\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr7\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrA\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrB\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrE\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrF\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "<type number=\"2\" name=\"name2\">\n" - + "<description>description2</description>\n" - + "<attribute arch=\"attr4\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr5\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr6\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr7\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrC\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrD\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrE\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrF\" editor=\"name2\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "<type number=\"3\" name=\"name3\">\n" - + "<import_type name=\"name1\"/>\n" - + "<import_type name=\"name2\"/>\n" - + "<description>description3</description>\n" - + "<attribute arch=\"attr8\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attr9\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrA\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrB\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrC\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrD\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrE\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"attrF\" editor=\"name3\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - /* attributes */ - + "string/attr1[default] section=0/General\n" - + "string/attr3[default] section=0/General\n" - + "string/attr5[default] section=0/General\n" - + "string/attr7[default] section=0/General\n" - + "string/attr9[default] section=0/General\n" - + "string/attrB[default] section=0/General\n" - + "string/attrD[default] section=0/General\n" - + "string/attrF[default] section=0/General\n" - /* defaults */ - /* imports */ - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - + "string/attr2[name1] section=1/Special\n" - + "string/attr3[name1] section=1/Special\n" - + "string/attr6[name1] section=1/Special\n" - + "string/attr7[name1] section=1/Special\n" - + "string/attrA[name1] section=1/Special\n" - + "string/attrB[name1] section=1/Special\n" - + "string/attrE[name1] section=1/Special\n" - + "string/attrF[name1] section=1/Special\n" - /* defaults */ - + "string/attr1[default] section=0/General\n" - + "string/attr5[default] section=0/General\n" - + "string/attr9[default] section=0/General\n" - + "string/attrD[default] section=0/General\n" - /* imports */ - + "\n" - + "type:2,name2\n" - + ":\n" - + ":\n" - /* attributes */ - + "string/attr4[name2] section=1/Special\n" - + "string/attr5[name2] section=1/Special\n" - + "string/attr6[name2] section=1/Special\n" - + "string/attr7[name2] section=1/Special\n" - + "string/attrC[name2] section=1/Special\n" - + "string/attrD[name2] section=1/Special\n" - + "string/attrE[name2] section=1/Special\n" - + "string/attrF[name2] section=1/Special\n" - /* defaults */ - + "string/attr1[default] section=0/General\n" - + "string/attr3[default] section=0/General\n" - + "string/attr9[default] section=0/General\n" - + "string/attrB[default] section=0/General\n" - /* attributes */ - /* imports */ - + "\n" - + "type:3,name3\n" - + ":\n" - + ":\n" - + "string/attr8[name3] section=1/Special\n" - + "string/attr9[name3] section=1/Special\n" - + "string/attrA[name3] section=1/Special\n" - + "string/attrB[name3] section=1/Special\n" - + "string/attrC[name3] section=1/Special\n" - + "string/attrD[name3] section=1/Special\n" - + "string/attrE[name3] section=1/Special\n" - + "string/attrF[name3] section=1/Special\n" - /* imports */ - + "string/attr2[name1] section=1/Special\n" - + "string/attr3[name1] section=1/Special\n" - + "string/attr6[name1] section=1/Special\n" - + "string/attr7[name1] section=1/Special\n" - + "string/attr4[name2] section=1/Special\n" - + "string/attr5[name2] section=1/Special\n" - /* defaults */ - + "string/attr1[default] section=0/General\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch=\"attr1\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr3\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr5\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr7\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr9\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrB\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrD\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrF\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<description>description1</description>\n"); + typesXml.append("<attribute arch=\"attr2\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr3\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr6\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr7\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrA\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrB\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrE\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrF\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + typesXml.append("<type number=\"2\" name=\"name2\">\n"); + typesXml.append("<description>description2</description>\n"); + typesXml.append("<attribute arch=\"attr4\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr5\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr6\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr7\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrC\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrD\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrE\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrF\" editor=\"name2\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + typesXml.append("<type number=\"3\" name=\"name3\">\n"); + typesXml.append("<import_type name=\"name1\"/>\n"); + typesXml.append("<import_type name=\"name2\"/>\n"); + typesXml.append("<description>description3</description>\n"); + typesXml.append("<attribute arch=\"attr8\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attr9\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrA\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrB\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrC\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrD\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrE\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"attrF\" editor=\"name3\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("string/attr1[default] section=0/General\n"); + expectedResult.append("string/attr3[default] section=0/General\n"); + expectedResult.append("string/attr5[default] section=0/General\n"); + expectedResult.append("string/attr7[default] section=0/General\n"); + expectedResult.append("string/attr9[default] section=0/General\n"); + expectedResult.append("string/attrB[default] section=0/General\n"); + expectedResult.append("string/attrD[default] section=0/General\n"); + expectedResult.append("string/attrF[default] section=0/General\n"); + /* defaults */ + /* imports */ + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("string/attr2[name1] section=1/Special\n"); + expectedResult.append("string/attr3[name1] section=1/Special\n"); + expectedResult.append("string/attr6[name1] section=1/Special\n"); + expectedResult.append("string/attr7[name1] section=1/Special\n"); + expectedResult.append("string/attrA[name1] section=1/Special\n"); + expectedResult.append("string/attrB[name1] section=1/Special\n"); + expectedResult.append("string/attrE[name1] section=1/Special\n"); + expectedResult.append("string/attrF[name1] section=1/Special\n"); + /* defaults */ + expectedResult.append("string/attr1[default] section=0/General\n"); + expectedResult.append("string/attr5[default] section=0/General\n"); + expectedResult.append("string/attr9[default] section=0/General\n"); + expectedResult.append("string/attrD[default] section=0/General\n"); + /* imports */ + expectedResult.append("\n"); + expectedResult.append("type:2,name2\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("string/attr4[name2] section=1/Special\n"); + expectedResult.append("string/attr5[name2] section=1/Special\n"); + expectedResult.append("string/attr6[name2] section=1/Special\n"); + expectedResult.append("string/attr7[name2] section=1/Special\n"); + expectedResult.append("string/attrC[name2] section=1/Special\n"); + expectedResult.append("string/attrD[name2] section=1/Special\n"); + expectedResult.append("string/attrE[name2] section=1/Special\n"); + expectedResult.append("string/attrF[name2] section=1/Special\n"); + /* defaults */ + expectedResult.append("string/attr1[default] section=0/General\n"); + expectedResult.append("string/attr3[default] section=0/General\n"); + expectedResult.append("string/attr9[default] section=0/General\n"); + expectedResult.append("string/attrB[default] section=0/General\n"); + /* attributes */ + /* imports */ + expectedResult.append("\n"); + expectedResult.append("type:3,name3\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/attr8[name3] section=1/Special\n"); + expectedResult.append("string/attr9[name3] section=1/Special\n"); + expectedResult.append("string/attrA[name3] section=1/Special\n"); + expectedResult.append("string/attrB[name3] section=1/Special\n"); + expectedResult.append("string/attrC[name3] section=1/Special\n"); + expectedResult.append("string/attrD[name3] section=1/Special\n"); + expectedResult.append("string/attrE[name3] section=1/Special\n"); + expectedResult.append("string/attrF[name3] section=1/Special\n"); + /* imports */ + expectedResult.append("string/attr2[name1] section=1/Special\n"); + expectedResult.append("string/attr3[name1] section=1/Special\n"); + expectedResult.append("string/attr6[name1] section=1/Special\n"); + expectedResult.append("string/attr7[name1] section=1/Special\n"); + expectedResult.append("string/attr4[name2] section=1/Special\n"); + expectedResult.append("string/attr5[name2] section=1/Special\n"); + /* defaults */ + expectedResult.append("string/attr1[default] section=0/General\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -277,35 +280,36 @@ */ @Test public void testIgnoreDefaultAttribute1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"default_attr2\" editor=\"default\" type=\"string\">description</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<ignore>\n" - + "<attribute arch=\"default_attr1\"/>\n" - + "</ignore>\n" - + "<description>description1</description>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "string/default_attr1[default] section=0/General\n" - + "string/default_attr2[default] section=0/General\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - /* imports */ - /* defaults */ - + "string/default_attr2[default] section=0/General\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"default_attr2\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<ignore>\n"); + typesXml.append("<attribute arch=\"default_attr1\"/>\n"); + typesXml.append("</ignore>\n"); + typesXml.append("<description>description1</description>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("string/default_attr2[default] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + /* imports */ + /* defaults */ + expectedResult.append("string/default_attr2[default] section=0/General\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -315,48 +319,49 @@ */ @Test public void testIgnoreImportAttribute1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<description>description1</description>\n" - + "<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "<type number=\"2\" name=\"name2\">\n" - + "<import_type name=\"name1\"/>\n" - + "<ignore>\n" - + "<attribute arch=\"name1_attr1\"/>\n" - + "</ignore>\n" - + "<description>description2</description>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "string/default_attr1[default] section=0/General\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - + "string/name1_attr1[name1] section=1/Special\n" - + "string/name1_attr2[name1] section=1/Special\n" - + "string/default_attr1[default] section=0/General\n" - + "\n" - + "type:2,name2\n" - + ":\n" - + ":\n" - /* attributes */ - /* imports */ - + "string/name1_attr1[name1] section=1/Special\n" // imported attributes are not affected by ignores - + "string/name1_attr2[name1] section=1/Special\n" - /* defaults */ - + "string/default_attr1[default] section=0/General\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch=\"default_attr1\" editor=\"default\" type=\"string\">description</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<description>description1</description>\n"); + typesXml.append("<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + typesXml.append("<type number=\"2\" name=\"name2\">\n"); + typesXml.append("<import_type name=\"name1\"/>\n"); + typesXml.append("<ignore>\n"); + typesXml.append("<attribute arch=\"name1_attr1\"/>\n"); + typesXml.append("</ignore>\n"); + typesXml.append("<description>description2</description>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("string/name1_attr1[name1] section=1/Special\n"); + expectedResult.append("string/name1_attr2[name1] section=1/Special\n"); + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("\n"); + expectedResult.append("type:2,name2\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + /* imports */ + expectedResult.append("string/name1_attr1[name1] section=1/Special\n"); // imported attributes are not affected by ignores + expectedResult.append("string/name1_attr2[name1] section=1/Special\n"); + /* defaults */ + expectedResult.append("string/default_attr1[default] section=0/General\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -366,33 +371,34 @@ */ @Test public void testIgnoreDefinedAttribute1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type/>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<ignore>\n" - + "<attribute arch=\"name1_attr1\"/>\n" - + "</ignore>\n" - + "<description>description1</description>\n" - + "<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - + "string/name1_attr1[name1] section=1/Special\n" // defined attributes are not affected by ignores - + "string/name1_attr2[name1] section=1/Special\n" - /* imports */ - /* defaults */ - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type/>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<ignore>\n"); + typesXml.append("<attribute arch=\"name1_attr1\"/>\n"); + typesXml.append("</ignore>\n"); + typesXml.append("<description>description1</description>\n"); + typesXml.append("<attribute arch=\"name1_attr1\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("<attribute arch=\"name1_attr2\" editor=\"name1\" type=\"string\">description</attribute>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("string/name1_attr1[name1] section=1/Special\n"); // defined attributes are not affected by ignores + expectedResult.append("string/name1_attr2[name1] section=1/Special\n"); + /* imports */ + /* defaults */ + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -402,29 +408,31 @@ */ @Test public void testMsgDefault1() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<description>description</description>\n" - + "</type>\n" - + "", false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "text/msg[default] section=2/default\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - /* imports */ - /* defaults */ - + "text/msg[default] section=2/default\n" - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<description>description</description>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("text/msg[default] section=2/default\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + /* imports */ + /* defaults */ + expectedResult.append("text/msg[default] section=2/default\n"); + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -434,31 +442,32 @@ */ @Test public void testMsgDefault2() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg1</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<description>description</description>\n" - + "<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"name1\" type=\"text\">msg2</attribute>\n" - + "</type>\n" - + "", - false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "text/msg[default] section=2/default\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - + "text/msg[name1] section=2/name1\n" - /* imports */ - /* defaults */ - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg1</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<description>description</description>\n"); + typesXml.append("<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"name1\" type=\"text\">msg2</attribute>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("text/msg[default] section=2/default\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + expectedResult.append("text/msg[name1] section=2/name1\n"); + /* imports */ + /* defaults */ + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -468,31 +477,33 @@ */ @Test public void testMsgDefault3() throws ParserConfigurationException, UnsupportedEncodingException { - check("<bitmasks/>\n" - + "<lists/>\n" - + "<ignorelists/>\n" - + "<default_type>\n" - + "<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg1</attribute>\n" - + "</default_type>\n" - + "<type number=\"1\" name=\"name1\">\n" - + "<ignore>\n" - + "<attribute arch=\"msg\"/>\n" - + "</ignore>\n" - + "<description>description</description>\n" - + "</type>\n" - + "", false, - "default_type:-1,default\n" - + ":\n" - + ":\n" - + "text/msg[default] section=2/default\n" - + "\n" - + "type:1,name1\n" - + ":\n" - + ":\n" - /* attributes */ - /* imports */ - /* defaults */ - + "\n"); + final StringBuilder typesXml = new StringBuilder(); + typesXml.append("<bitmasks/>\n"); + typesXml.append("<lists/>\n"); + typesXml.append("<ignorelists/>\n"); + typesXml.append("<default_type>\n"); + typesXml.append("<attribute arch_begin=\"msg\" arch_end=\"endmsg\" editor=\"default\" type=\"text\">msg1</attribute>\n"); + typesXml.append("</default_type>\n"); + typesXml.append("<type number=\"1\" name=\"name1\">\n"); + typesXml.append("<ignore>\n"); + typesXml.append("<attribute arch=\"msg\"/>\n"); + typesXml.append("</ignore>\n"); + typesXml.append("<description>description</description>\n"); + typesXml.append("</type>\n"); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("default_type:-1,default\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + expectedResult.append("text/msg[default] section=2/default\n"); + expectedResult.append("\n"); + expectedResult.append("type:1,name1\n"); + expectedResult.append(":\n"); + expectedResult.append(":\n"); + /* attributes */ + /* imports */ + /* defaults */ + expectedResult.append("\n"); + check(typesXml.toString(), false, expectedResult.toString()); } /** @@ -534,13 +545,13 @@ */ @NotNull private static InputSource createInputSource(@NotNull final String string) throws UnsupportedEncodingException { - final String typesString = - "<?xml version=\"1.0\" standalone=\"no\" ?>\n" - + "<!DOCTYPE types SYSTEM \"types.dtd\">\n" - + "<types>\n" - + string - + "</types>\n"; - final InputSource inputSource = new InputSource(new ByteArrayInputStream(typesString.getBytes("UTF-8"))); + final StringBuilder typesString = new StringBuilder(); + typesString.append("<?xml version=\"1.0\" standalone=\"no\" ?>\n"); + typesString.append("<!DOCTYPE types SYSTEM \"types.dtd\">\n"); + typesString.append("<types>\n"); + typesString.append(string); + typesString.append("</types>\n"); + final InputSource inputSource = new InputSource(new ByteArrayInputStream(typesString.toString().getBytes("UTF-8"))); inputSource.setSystemId("types.dtd"); return inputSource; } Modified: trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -47,7 +47,13 @@ final TestErrorView errorView = new TestErrorView(); final TestParser parser = new TestParser(errorView); parser.addArchetype("base", "sp 2"); - parser.parseArtifacts("artifact art\n" + "def_arch base\nObject obj\nsp 3\n" + "end\n"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("artifact art\n"); + artifacts.append("def_arch base\n"); + artifacts.append("Object obj\n"); + artifacts.append("sp 3\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); Assert.assertFalse(errorView.hasWarnings()); Assert.assertFalse(errorView.hasErrors()); Assert.assertEquals(2, parser.getArchetypeCount()); @@ -66,7 +72,13 @@ public void testDefaultName1() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { final TestParser parser = new TestParser(); parser.addArchetype("horn"); - parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("artifact horn_fools\n"); + artifacts.append("def_arch horn\n"); + artifacts.append("Object obj\n"); + artifacts.append("title of fools\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); Assert.assertEquals("horn of fools", parser.getArchetype("horn_fools").getBestName()); } @@ -81,7 +93,13 @@ public void testDefaultName2() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { final TestParser parser = new TestParser(); parser.addArchetype("horn", "name horn2"); - parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("artifact horn_fools\n"); + artifacts.append("def_arch horn\n"); + artifacts.append("Object obj\n"); + artifacts.append("title of fools\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); Assert.assertEquals("horn2 of fools", parser.getArchetype("horn_fools").getBestName()); } @@ -96,7 +114,13 @@ public void testDefaultName3() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { final TestParser parser = new TestParser(); parser.addArchetype("horn", "name base_horn"); - parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "title of fools\n" + "end\n"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("artifact horn_fools\n"); + artifacts.append("def_arch horn\n"); + artifacts.append("Object obj\n"); + artifacts.append("title of fools\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); Assert.assertEquals("base_horn of fools", parser.getArchetype("horn_fools").getBestName()); } @@ -111,7 +135,14 @@ public void testDefaultName4() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { final TestParser parser = new TestParser(); parser.addArchetype("horn", "name base_horn"); - parser.parseArtifacts("artifact horn_fools\n" + "def_arch horn\n" + "Object obj\n" + "name special_horn\n" + "title of fools\n" + "end\n"); + final StringBuilder artifacts = new StringBuilder(); + artifacts.append("artifact horn_fools\n"); + artifacts.append("def_arch horn\n"); + artifacts.append("Object obj\n"); + artifacts.append("name special_horn\n"); + artifacts.append("title of fools\n"); + artifacts.append("end\n"); + parser.parseArtifacts(artifacts.toString()); Assert.assertEquals("special_horn of fools", parser.getArchetype("horn_fools").getBestName()); } Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2011-01-25 20:49:06 UTC (rev 8836) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2011-01-25 21:59:56 UTC (rev 8837) @@ -165,7 +165,11 @@ mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); mapModel.endTransaction(); - Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("mapSizeChanged:\n"); + expectedResult.append("no squares\n"); + expectedResult.append("no game objects\n"); + Assert.assertEquals(expectedResult.toString(), result.toString()); } /** @@ -205,7 +209,11 @@ mapModelCreator.addGameObjectToMap(mapModel, "1", 2, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.getMapArchObject().setMapSize(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); - Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("mapSizeChanged:\n"); + expectedResult.append("no squares\n"); + expectedResult.append("no game objects\n"); + Assert.assertEquals(expectedResult.toString(), result.toString()); } /** @@ -229,7 +237,11 @@ mapModelCreator.addGameObjectToMap(mapModel, "1", 2, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.getMapArchObject().setMapSize(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); - Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); + final StringBuilder expectedResult = new StringBuilder(); + expectedResult.append("mapSizeChanged:\n"); + expectedResult.append("no squares\n"); + expectedResult.append("no game objects\n"); + Assert.as... [truncated message content] |
From: <aki...@us...> - 2011-02-01 18:05:56
|
Revision: 8842 http://gridarta.svn.sourceforge.net/gridarta/?rev=8842&view=rev Author: akirschbaum Date: 2011-02-01 18:05:48 +0000 (Tue, 01 Feb 2011) Log Message: ----------- Release 0.9. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-02-01 17:54:58 UTC (rev 8841) +++ trunk/atrinik/ChangeLog 2011-02-01 18:05:48 UTC (rev 8842) @@ -1,3 +1,7 @@ +2011-02-01 Andreas Kirschbaum + + * Release 0.9. + 2011-01-10 Andreas Kirschbaum * Properly create inventory objects when inserting game objects Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-02-01 17:54:58 UTC (rev 8841) +++ trunk/crossfire/ChangeLog 2011-02-01 18:05:48 UTC (rev 8842) @@ -1,5 +1,7 @@ 2011-02-01 Andreas Kirschbaum + * Release 0.9. + * Collect resources. 2011-01-10 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-02-01 17:54:58 UTC (rev 8841) +++ trunk/daimonin/ChangeLog 2011-02-01 18:05:48 UTC (rev 8842) @@ -1,3 +1,7 @@ +2011-02-01 Andreas Kirschbaum + + * Release 0.9. + 2010-12-20 Andreas Kirschbaum * Report truncated archetype definitions. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-02-22 20:12:11
|
Revision: 8846 http://gridarta.svn.sourceforge.net/gridarta/?rev=8846&view=rev Author: akirschbaum Date: 2011-02-22 20:12:04 +0000 (Tue, 22 Feb 2011) Log Message: ----------- Fix ambiguous French menu shortcuts. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/messages_fr.properties Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-02-01 19:47:09 UTC (rev 8845) +++ trunk/atrinik/ChangeLog 2011-02-22 20:12:04 UTC (rev 8846) @@ -1,3 +1,7 @@ +2011-02-22 Andreas Kirschbaum + + * Fix ambiguous French menu shortcuts. + 2011-02-01 Andreas Kirschbaum * Release 0.9. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-02-01 19:47:09 UTC (rev 8845) +++ trunk/crossfire/ChangeLog 2011-02-22 20:12:04 UTC (rev 8846) @@ -1,3 +1,7 @@ +2011-02-22 Andreas Kirschbaum + + * Fix ambiguous French menu shortcuts. + 2011-02-01 Andreas Kirschbaum * Release 0.9. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-02-01 19:47:09 UTC (rev 8845) +++ trunk/daimonin/ChangeLog 2011-02-22 20:12:04 UTC (rev 8846) @@ -1,3 +1,7 @@ +2011-02-22 Andreas Kirschbaum + + * Fix ambiguous French menu shortcuts. + 2011-02-01 Andreas Kirschbaum * Release 0.9. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-02-01 19:47:09 UTC (rev 8845) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-02-22 20:12:04 UTC (rev 8846) @@ -68,7 +68,7 @@ #goNorthWest.shortdescription= goMap.text=Aller \u00e0 une carte... -goMap.mnemonic=M +goMap.mnemonic=A goMap.shortdescription=Ouvrir une carte par nom partiel. goMap.accel=ctrl pressed N @@ -117,7 +117,7 @@ closeAllMaps.text=Tout fermer closeAllMaps.shortdescription=Ferme toutes les cartes ouvertes. #closeAllMaps.longdescription= -closeAllMaps.mnemonic=U +closeAllMaps.mnemonic=T saveAllMaps.text=Engistrer toutes les cartes saveAllMaps.shortdescription=Enregistre toutes les cartes modifi\u00e9s. @@ -127,7 +127,7 @@ #gridVisible.shortdescription= smoothing.text=Lissage -#smoothing.mnemonic= +smoothing.mnemonic=L smoothing.shortdescription=Active le lissage des images, permettant un rendu moins carr\u00e9. tileShow.text=Montrer les cartes li\u00e9es @@ -146,7 +146,7 @@ shrinkMapSize.shortdescription=Supprime les espaces inutiles \u00e0 droite et en bas. autoJoin.text=Auto-connection des murs -#autoJoin.mnemonic= +autoJoin.mnemonic=C autoJoin.shortdescription=Active ou d\u00e9sactive la connexion automatique des murs. #autoJoin.longdescription= @@ -169,12 +169,12 @@ #enterExitNotSaved.message= nextExit.text=Sortie suivante -#nextExit.mnemonic= +nextExit.mnemonic=S nextExit.shortdescription=S\u00e9lectionne la sortie suivante sur la carte courante. #nextExit.longdescription= prevExit.text=Sortie pr\u00e9c\u00e9dente -#prevExit.mnemonic= +prevExit.mnemonic=P prevExit.shortdescription=S\u00e9lectionne la sortie pr\u00e9c\u00e9dente sur la carte courante. #prevExit.longdescription= @@ -601,7 +601,7 @@ undo.text=Annuler undo.name=Annuler {0} undo.shortdescription=Annuler la derni\u00e8re action -undo.mnemonic=U +undo.mnemonic=A redo.text=R\u00e9p\u00e9ter redo.name=R\u00e9p\u00e9ter {0} @@ -641,7 +641,7 @@ recent.text=R\u00e9cemment ouvert... recent.shortdescription=Charge une carte r\u00e9cemment ouverte. -#recent.mnemonic= +recent.mnemonic=C #recentItem.shortdescriptionformat= newMap.text=Nouveau @@ -694,26 +694,26 @@ #pasteTiled.longdescription= shift.text=D\u00e9caler -shift.mnemonic=S +shift.mnemonic=D shift.shortdescription=D\u00e9cale les cases s\u00e9lectionn\u00e9es. shiftNorth.text=D\u00e9caler vers le nord -#shiftNorth.mnemonic= +shiftNorth.mnemonic=N shiftNorth.shortdescription=D\u00e9cale la s\u00e9lection vers le nord. shiftNorthEast.text=D\u00e9caler vers le nord-est shiftNorthEast.shortdescription=D\u00e9cale la s\u00e9lection vers le nord-est. shiftEast.text=D\u00e9caler vers l'est -#shiftEast.mnemonic= +shiftEast.mnemonic=E shiftEast.shortdescription=D\u00e9cale la s\u00e9lection vers l'est. shiftSouthEast.text=D\u00e9caler vers le sud-est shiftSouthEast.shortdescription=D\u00e9cale la s\u00e9lection vers le sud-est. shiftSouth.text=D\u00e9caler vers le sud -#shiftSouth.mnemonic= +shiftSouth.mnemonic=S shiftSouth.shortdescription=D\u00e9cale la s\u00e9lection vers le sud. shiftSouthWest.text=D\u00e9caler vers le sud-ouest shiftSouthWest.shortdescription=D\u00e9cale la s\u00e9lection vers le sud-ouest. shiftWest.text=D\u00e9caler vers l'ouest -#shiftWest.mnemonic= +shiftWest.mnemonic=O shiftWest.shortdescription=D\u00e9cale la s\u00e9lection vers l'ouest. shiftNorthWest.text=D\u00e9caler vers le nord-ouest shiftNorthWest.shortdescription=D\u00e9cale la s\u00e9lection vers le nord-ouest. @@ -723,17 +723,17 @@ #replace.shortdescription= fillAuto.text=Remplir -#fillAuto.mnemonic= +fillAuto.mnemonic=P fillAuto.shortdescription=Remplit les cases s\u00e9lectionn\u00e9es, en effa\u00e7ant les objets existants. #fillAuto.longdescription= fillAbove.text=Remplir au-dessus -fillAbove.mnemonic=H +fillAbove.mnemonic=S fillAbove.shortdescription=Remplit la s\u00e9lection en ajoutant au-dessus des objets existants. #fillAbove.longdescription= fillBelow.text=Remplir en-dessous -fillBelow.mnemonic=B +fillBelow.mnemonic=U fillBelow.shortdescription=Remplit la s\u00e9lection en ajoutant au-dessous des objets existants. #fillBelow.longdescription= @@ -771,7 +771,7 @@ # Resources resources.text=Ressources -resources.mnemonic=R +resources.mnemonic=U collectArches.text=Rassembler arch\u00e9types collectArches.mnemonic=A @@ -779,7 +779,7 @@ #collectArches.longdescription= reloadFaces.text=Recharger les images -#reloadFaces.mnemonic= +reloadFaces.mnemonic=I reloadFaces.shortdescription=Recharge toutes les images des arch\u00e9types. @@ -787,7 +787,7 @@ # Analyze analyze.text=Analyse -#analyze.mnemonic= +analyze.mnemonic=Y #enabled.text= @@ -825,14 +825,14 @@ ########### # Bookmarks bookmarks.text=Raccourcis -#bookmarks.mnemonic= +bookmarks.mnemonic=R addBookmark.text=Ajouter un raccourci -#addBookmark.mnemonic= +addBookmark.mnemonic=A addBookmark.shortdescription=Ajoute un raccourci sur la carte courante. manageBookmarks.text=G\u00e9rer les raccourcis -#manageBookmarks.mnemonic= +manageBookmarks.mnemonic=G manageBookmarks.shortdescription=Permet de g\u00e9rer les raccourcis d\u00e9finis. #bookmarkItem.shortdescriptionformat= @@ -849,7 +849,7 @@ #showHelp.shortdescription= tipOfTheDay.text=Astuces -#tipOfTheDay.mnemonic= +tipOfTheDay.mnemonic=S tipOfTheDay.shortdescription=Affiche les astuces du programme. about.text=\u00c0 propos... @@ -859,8 +859,8 @@ aboutTab.title=\u00c0 propos aboutRuntimeProperties.title=Param\u00e8tres d'ex\u00e9cution -#license.text= -#license.mnemonic= +license.text=Licence +license.mnemonic=L license.title=Licence #license.missing= @@ -921,7 +921,7 @@ #addNewPickmap.shortdescription= deletePickmap.text=Supprimer l'assortiment -#deletePickmap.mnemonic= +deletePickmap.mnemonic=S deletePickmap.shortdescription=Supprime l'assortiment actif. openPickmapMap.text=Ouvrir l'assortiment actif comme carte @@ -943,7 +943,7 @@ deletePickmapFolder.shortdescription=Supprime le dossier actif d'assortiments. pickmapFolders.text=Dossiers -#pickmapFolders.mnemonic= +pickmapFolders.mnemonic=D pickmapFolders.shortdescription=Dossiers d'assortiments. @@ -1405,12 +1405,12 @@ mapwindowFile.mnemonic=F mapwindowEdit.text=\u00c9dition -mapwindowEdit.mnemonic=E +mapwindowEdit.mnemonic=D mapwindowMap.text=Carte mapwindowMap.mnemonic=C -#mapwindowCursor.text= +mapwindowCursor.text=Cursor mapwindowCursor.mnemonic=U This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-02-28 17:54:02
|
Revision: 8850 http://gridarta.svn.sourceforge.net/gridarta/?rev=8850&view=rev Author: akirschbaum Date: 2011-02-28 17:53:53 +0000 (Mon, 28 Feb 2011) Log Message: ----------- Implement bookmark directories. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/build.xml trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java trunk/src/app/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/BookmarksMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/RecentMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.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 trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkDirectoryDialog.java trunk/src/app/net/sf/gridarta/gui/bookmarks/MapMenuEntryIcons.java trunk/src/app/net/sf/gridarta/gui/mapmenu/ActionFactory.java trunk/src/app/net/sf/gridarta/gui/mapmenu/AutoscrollJTree.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuAction.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntryDir.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntryMap.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntryTreeCellRenderer.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntryVisitor.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuUtils.java trunk/src/app/net/sf/gridarta/gui/mapmenu/TransferableTreeNode.java trunk/src/app/net/sf/gridarta/gui/mapmenu/TreeDragSource.java trunk/src/app/net/sf/gridarta/gui/mapmenu/TreeDropTarget.java trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuTest.java trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuUtilsTest.java trunk/src/test/net/sf/gridarta/gui/mapmenu/TestMapMenuPreferences.java trunk/src/test/net/sf/gridarta/gui/mapmenu/testLoad1.properties Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/atrinik/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) @@ -1,3 +1,7 @@ +2011-02-28 Andreas Kirschbaum + + * Implement bookmark directories. + 2011-02-22 Andreas Kirschbaum * Fix ambiguous French menu shortcuts. Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/build.xml 2011-02-28 17:53:53 UTC (rev 8850) @@ -331,6 +331,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/atrinik/app"> + <fileset dir="atrinik/src/app" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/atrinik/test"/> <javac srcdir="atrinik/src/test" destdir="${build.dir}/atrinik/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -344,8 +347,8 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> - <copy todir="${build.dir}/atrinik/app"> - <fileset dir="atrinik/src/app" includes="**/*.properties"/> + <copy todir="${build.dir}/atrinik/test"> + <fileset dir="atrinik/src/test" includes="**/*.properties"/> </copy> </target> @@ -365,6 +368,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/crossfire/app"> + <fileset dir="crossfire/src/app" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/crossfire/test"/> <javac srcdir="crossfire/src/test" destdir="${build.dir}/crossfire/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -378,8 +384,8 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> - <copy todir="${build.dir}/crossfire/app"> - <fileset dir="crossfire/src/app" includes="**/*.properties"/> + <copy todir="${build.dir}/crossfire/test"> + <fileset dir="crossfire/src/test" includes="**/*.properties"/> </copy> </target> @@ -399,6 +405,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/daimonin/test"> + <fileset dir="daimonin/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/daimonin/test"/> <javac srcdir="daimonin/src/test" destdir="${build.dir}/daimonin/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -439,6 +448,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/gridarta/test"> + <fileset dir="src/test" includes="**/*.properties,cfpython_menu.def"/> + </copy> <mkdir dir="${build.dir}/gridarta/test"/> <javac srcdir="src/test" destdir="${build.dir}/gridarta/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -448,6 +460,7 @@ <path refid="path.class.textedit.test"/> <path refid="path.class.utils.test"/> <path refid="path.lib.annotations"/> + <path refid="path.lib.japi-swing-action"/> <path refid="path.lib.junit"/> </classpath> <compilerarg line="${javac.args}"/> @@ -472,6 +485,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/model/test"> + <fileset dir="model/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/model/test"/> <javac srcdir="model/src/test" destdir="${build.dir}/model/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -499,6 +515,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/preferences/test"> + <fileset dir="preferences/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/preferences/test"/> <javac srcdir="preferences/src/test" destdir="${build.dir}/preferences/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -525,6 +544,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/script/test"> + <fileset dir="script/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/script/test"/> <javac srcdir="script/src/test" destdir="${build.dir}/script/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -548,6 +570,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/textedit/test"> + <fileset dir="textedit/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/textedit/test"/> <javac srcdir="textedit/src/test" destdir="${build.dir}/textedit/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -572,6 +597,9 @@ </classpath> <compilerarg line="${javac.args}"/> </javac> + <copy todir="${build.dir}/utils/test"> + <fileset dir="utils/src/test" includes="**/*.properties"/> + </copy> <mkdir dir="${build.dir}/utils/test"/> <javac srcdir="utils/src/test" destdir="${build.dir}/utils/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> @@ -1028,10 +1056,12 @@ <classpath> <path refid="path.class.gridarta.test"/> <path refid="path.class.model.test"/> + <path refid="path.class.preferences.test"/> <path refid="path.class.utils.test"/> <path refid="path.lib.japi-swing-action"/> <path refid="path.lib.junit"/> <path refid="path.lib.log4j"/> + <pathelement location="resource"/> </classpath> <formatter type="plain"/> <formatter type="xml"/> Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/crossfire/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) @@ -1,3 +1,7 @@ +2011-02-28 Andreas Kirschbaum + + * Implement bookmark directories. + 2011-02-22 Andreas Kirschbaum * Fix ambiguous French menu shortcuts. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/daimonin/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) @@ -1,3 +1,7 @@ +2011-02-28 Andreas Kirschbaum + + * Implement bookmark directories. + 2011-02-22 Andreas Kirschbaum * Fix ambiguous French menu shortcuts. Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/gridarta.ipr 2011-02-28 17:53:53 UTC (rev 8850) @@ -1200,6 +1200,8 @@ <w>djava</w> <w>doctype</w> <w>dragonmen</w> + <w>dsde</w> + <w>dtde</w> <w>encodings</w> <w>endlore</w> <w>endmsg</w> @@ -1255,6 +1257,7 @@ <w>licensor</w> <w>lifesteal</w> <w>listentry</w> + <w>locn</w> <w>logentry</w> <w>longdescription</w> <w>lookups</w> @@ -1262,6 +1265,7 @@ <w>mailto</w> <w>mandriva</w> <w>mapcontrol</w> + <w>mapmenu</w> <w>matchers</w> <w>megaxslt</w> <w>mergeable</w> Modified: trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -20,12 +20,15 @@ package net.sf.gridarta.gui.bookmarks; import java.awt.Component; +import java.io.File; import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.mapimagecache.MapImageCache; -import net.sf.gridarta.gui.mapmenu.BookmarksMapMenuPreferences; +import net.sf.gridarta.gui.mapmenu.AbstractMapMenuPreferences; +import net.sf.gridarta.gui.mapmenu.MapMenu; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; import net.sf.gridarta.gui.mapmenu.MapMenuManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -55,14 +58,13 @@ * The {@link MapMenuManager} defining the bookmarks menu entries. */ @NotNull - private final MapMenuManager<G, A, R> bookmarksMapMenuManager; + private final AbstractMapMenuPreferences bookmarksMapMenuPreferences; /** - * The {@link BookmarksMapMenuPreferences} defining the bookmarks menu - * entries. + * The {@link MapMenu} defining the bookmarks menu entries. */ @NotNull - private final BookmarksMapMenuPreferences<G, A, R> bookmarksMapMenuPreferences; + private final MapMenu mapMenu; /** * The {@link MapImageCache} for creating map previews. @@ -97,17 +99,16 @@ /** * Creates a new instance. - * @param bookmarksMapMenuManager the map menu manager defining the + * @param bookmarksMapMenuPreferences the map menu preferences defining the * bookmarks menu entries - * @param bookmarksMapMenuPreferences the bookmarks map menu preferences - * definition the bookmarks menu entries + * @param mapMenu the map menu definition the bookmarks menu entries * @param mapViewManager the map view manager instance * @param parentComponent the parent component for dialogs * @param mapImageCache the map image cache for creating map previews */ - public BookmarkActions(@NotNull final MapMenuManager<G, A, R> bookmarksMapMenuManager, @NotNull final BookmarksMapMenuPreferences<G, A, R> bookmarksMapMenuPreferences, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final Component parentComponent, @NotNull final MapImageCache<G, A, R> mapImageCache) { - this.bookmarksMapMenuManager = bookmarksMapMenuManager; + public BookmarkActions(@NotNull final AbstractMapMenuPreferences bookmarksMapMenuPreferences, @NotNull final MapMenu mapMenu, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final Component parentComponent, @NotNull final MapImageCache<G, A, R> mapImageCache) { this.bookmarksMapMenuPreferences = bookmarksMapMenuPreferences; + this.mapMenu = mapMenu; this.mapViewManager = mapViewManager; this.parentComponent = parentComponent; this.mapImageCache = mapImageCache; @@ -152,7 +153,7 @@ @ActionMethod public void manageBookmarks() { if (manageBookmarksDialog == null) { - manageBookmarksDialog = new ManageBookmarksDialog<G, A, R>(parentComponent, bookmarksMapMenuPreferences, mapImageCache); + manageBookmarksDialog = new ManageBookmarksDialog<G, A, R>(parentComponent, mapImageCache, mapMenu); } manageBookmarksDialog.showDialog(parentComponent); } @@ -177,7 +178,8 @@ final MapControl<G, A, R> mapControl = mapView.getMapControl(); final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - if (mapModel.getMapFile() == null) { + final File mapFile = mapModel.getMapFile(); + if (mapFile == null) { return false; } @@ -185,7 +187,8 @@ final A mapArchObject = mapModel.getMapArchObject(); final EditBookmarkDialog editBookmarkDialog = new EditBookmarkDialog(mapView.getInternalFrame(), mapArchObject.getMapName()); if (editBookmarkDialog.showDialog()) { - bookmarksMapMenuManager.addRecent(mapModel, editBookmarkDialog.getDescription()); + final MapMenuEntryMap mapMenuEntry = new MapMenuEntryMap(mapFile, editBookmarkDialog.getDescription()); + bookmarksMapMenuPreferences.addEntry(mapMenuEntry); } } Added: trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkDirectoryDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkDirectoryDialog.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkDirectoryDialog.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -0,0 +1,205 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.bookmarks; + +import java.awt.Component; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.WindowConstants; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.JTextComponent; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryDir; +import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.gui.utils.TextComponentUtils; +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 that queries a bookmark directory name. + * @author Andreas Kirschbaum + */ +public class BookmarkDirectoryDialog extends JOptionPane { + + /** + * The serial Version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The dialog. + * @serial + */ + @NotNull + private final JDialog dialog; + + /** + * The text input field for the directory name. + * @serial + */ + @NotNull + private final JTextComponent directoryField = new JTextField(); + + /** + * The {@link JButton} for ok. + * @serial + */ + @NotNull + private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "bookmarkDirectoryOkay", this)); + + /** + * The {@link JButton} for cancel. + * @serial + */ + @NotNull + private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "bookmarkDirectoryCancel", this)); + + /** + * Creates a new instance. + * @param parentComponent the parent component for the dialog + * @param defaultDirectory the default value for the directory input field + */ + public BookmarkDirectoryDialog(@NotNull final Component parentComponent, @NotNull final String defaultDirectory) { + okButton.setDefaultCapable(true); + setOptions(new Object[] { okButton, cancelButton }); + + setMessage(createPanel()); + + TextComponentUtils.setAutoSelectOnFocus(directoryField); + directoryField.setText(defaultDirectory); + + final DocumentListener documentListener = new DocumentListener() { + + /** {@inheritDoc} */ + @Override + public void insertUpdate(@NotNull final DocumentEvent e) { + updateOkButton(); + } + + /** {@inheritDoc} */ + @Override + public void removeUpdate(@NotNull final DocumentEvent e) { + updateOkButton(); + } + + /** {@inheritDoc} */ + @Override + public void changedUpdate(@NotNull final DocumentEvent e) { + updateOkButton(); + } + + }; + directoryField.getDocument().addDocumentListener(documentListener); + updateOkButton(); + + dialog = createDialog(parentComponent, ActionBuilderUtils.getString(ACTION_BUILDER, "bookmarkDirectory.title")); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.getRootPane().setDefaultButton(okButton); + dialog.pack(); + dialog.setLocationRelativeTo(parentComponent); + } + + /** + * Opens the dialog. Returns when the dialog has been dismissed. + * @return whether "ok" was selected + */ + public boolean showDialog() { + dialog.setVisible(true); + return getValue() == okButton; + } + + /** + * Creates the GUI. + * @return the panel containing the GUI + */ + @NotNull + private JPanel createPanel() { + final JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + + mainPanel.setBorder(GUIConstants.DIALOG_BORDER); + + mainPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "bookmarkDirectory.description")); + mainPanel.add(Box.createVerticalStrut(5)); + + mainPanel.add(directoryField); + mainPanel.add(Box.createVerticalStrut(5)); + + return mainPanel; + } + + /** + * Action method for okay. + */ + @ActionMethod + public void bookmarkDirectoryOkay() { + if (isOkEnabled()) { + setValue(okButton); + } + } + + /** + * Action method for cancel. + */ + @ActionMethod + public void bookmarkDirectoryCancel() { + setValue(cancelButton); + } + + /** + * Returns the directory name. + * @return the directory name + */ + @NotNull + public String getDirectory() { + return directoryField.getText().trim(); + } + + /** + * Sets the enabled state of {@link #okButton} depending on the contents of + * {@link #directoryField}. + */ + private void updateOkButton() { + okButton.setEnabled(isOkEnabled()); + } + + /** + * Returns whether the "ok" button is enabled. + * @return whether the "ok" button is enabled + */ + private boolean isOkEnabled() { + return MapMenuEntryDir.isValidDirectory(getDirectory()); + } + +} Property changes on: trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkDirectoryDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -23,27 +23,34 @@ import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.io.File; +import java.awt.dnd.DnDConstants; import javax.swing.Action; -import javax.swing.DefaultListCellRenderer; -import javax.swing.ImageIcon; +import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; -import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTree; import javax.swing.JViewport; -import javax.swing.ListSelectionModel; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.WindowConstants; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; import net.sf.gridarta.gui.mapimagecache.MapImageCache; -import net.sf.gridarta.gui.mapmenu.BookmarksMapMenuPreferences; +import net.sf.gridarta.gui.mapmenu.MapMenu; import net.sf.gridarta.gui.mapmenu.MapMenuEntry; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryDir; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryTreeCellRenderer; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryVisitor; +import net.sf.gridarta.gui.mapmenu.TreeDragSource; +import net.sf.gridarta.gui.mapmenu.TreeDropTarget; import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -73,24 +80,29 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * The {@link BookmarksMapMenuPreferences} to affect. - * @serial + * The {@link MapImageCache} for creating map previews. */ @NotNull - private final BookmarksMapMenuPreferences<G, A, R> bookmarksMapMenuPreferences; + private final MapImageCache<G, A, R> mapImageCache; /** - * The {@link MapImageCache} for creating map previews. + * The {@link MapMenu} being edited. */ @NotNull - private final MapImageCache<G, A, R> mapImageCache; + private final MapMenu mapMenu; /** - * The {@link JList} of all bookmarks. + * The {@link MapMenuEntryIcons} for looking up icons. + */ + @NotNull + private final MapMenuEntryIcons mapMenuEntryIcons; + + /** + * The {@link JTree} of all bookmarks. * @serial */ @NotNull - private final JList bookmarksList; + private final JTree bookmarksTree; /** * The map preview image. @@ -114,27 +126,20 @@ private final Action editAction = ACTION_BUILDER.createAction(false, "manageBookmarksEdit", this); /** - * The {@link Action} for "move up bookmark". + * The {@link Action} for "remove bookmark". * @serial */ @NotNull - private final Action moveUpAction = ACTION_BUILDER.createAction(false, "manageBookmarksMoveUp", this); + private final Action removeAction = ACTION_BUILDER.createAction(false, "manageBookmarksRemove", this); /** - * The {@link Action} for "move down bookmark". + * The {@link Action} for "new directory". * @serial */ @NotNull - private final Action moveDownAction = ACTION_BUILDER.createAction(false, "manageBookmarksMoveDown", this); + private final Action newDirectoryAction = ACTION_BUILDER.createAction(false, "manageBookmarksNewDirectory", this); /** - * The {@link Action} for "remove bookmark". - * @serial - */ - @NotNull - private final Action removeAction = ACTION_BUILDER.createAction(false, "manageBookmarksRemove", this); - - /** * The {@link JButton} for cancel. * @serial */ @@ -146,24 +151,27 @@ * @serial */ @Nullable - private MapMenuEntry<G, A, R> selectedMapMenuEntry = null; + private TreePath selectedTreePath = null; /** * Creates a new instance. * @param parentComponent the parent component for the dialog - * @param bookmarksMapMenuPreferences the bookmarks map menu preferences to - * affect * @param mapImageCache the map image cache for creating map previews + * @param mapMenu the map menu to edit */ - public ManageBookmarksDialog(@NotNull final Component parentComponent, @NotNull final BookmarksMapMenuPreferences<G, A, R> bookmarksMapMenuPreferences, @NotNull final MapImageCache<G, A, R> mapImageCache) { - this.bookmarksMapMenuPreferences = bookmarksMapMenuPreferences; + public ManageBookmarksDialog(@NotNull final Component parentComponent, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final MapMenu mapMenu) { this.mapImageCache = mapImageCache; - bookmarksList = new JList(bookmarksMapMenuPreferences); + this.mapMenu = mapMenu; + mapMenuEntryIcons = new MapMenuEntryIcons(mapImageCache); + bookmarksTree = mapMenu.newTree(); + //noinspection ResultOfObjectAllocationIgnored + new TreeDragSource(bookmarksTree, DnDConstants.ACTION_COPY_OR_MOVE); + //noinspection ResultOfObjectAllocationIgnored + new TreeDropTarget(bookmarksTree); final JButton editButton = new JButton(editAction); - final JButton moveUpButton = new JButton(moveUpAction); - final JButton moveDownButton = new JButton(moveDownAction); final JButton removeButton = new JButton(removeAction); - setOptions(new Object[] { editButton, moveUpButton, moveDownButton, removeButton, closeButton }); + final JButton newDirectoryButton = new JButton(newDirectoryAction); + setOptions(new Object[] { editButton, removeButton, newDirectoryButton, closeButton }); setMessage(createPanel()); @@ -181,8 +189,9 @@ * @param parentComponent the parent component for the dialog */ public void showDialog(@NotNull final Component parentComponent) { - setInitialValue(bookmarksList); - bookmarksList.setSelectedIndex(0); + setInitialValue(bookmarksTree); + bookmarksTree.setRootVisible(false); + bookmarksTree.setSelectionRow(0); dialog.setLocationRelativeTo(parentComponent); dialog.setMinimumSize(new Dimension(600, 300)); dialog.setPreferredSize(new Dimension(800, 600)); @@ -204,9 +213,9 @@ mainPanel.setBorder(GUIConstants.DIALOG_BORDER); final JScrollPane bookmarksScrollPane = new JScrollPane(); - bookmarksScrollPane.setViewportView(bookmarksList); - bookmarksScrollPane.setBackground(bookmarksList.getBackground()); - bookmarksScrollPane.getViewport().add(bookmarksList); + bookmarksScrollPane.setViewportView(bookmarksTree); + bookmarksScrollPane.setBackground(bookmarksTree.getBackground()); + bookmarksScrollPane.getViewport().add(bookmarksTree); bookmarksScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); bookmarksScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); bookmarksScrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); @@ -223,48 +232,28 @@ gbc.gridx = 1; mainPanel.add(preview, gbc); - bookmarksList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + bookmarksTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + bookmarksTree.setCellRenderer(new MapMenuEntryTreeCellRenderer(mapImageCache)); - bookmarksList.setCellRenderer(new DefaultListCellRenderer() { + final TreeSelectionListener treeSelectionListener = new TreeSelectionListener() { - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - @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 MapMenuEntry<?, ?, ?> mapMenuEntry = (MapMenuEntry<?, ?, ?>) value; - setText(mapMenuEntry.getTitle()); - final File mapFile = mapMenuEntry.getMapFile(); - setToolTipText(mapFile.getPath()); - return this; - } - - }); - - final ListSelectionListener listSelectionListener = new ListSelectionListener() { - - @Override - public void valueChanged(final ListSelectionEvent e) { + public void valueChanged(final TreeSelectionEvent e) { updateSelectedBookmark(); } }; - bookmarksList.addListSelectionListener(listSelectionListener); + bookmarksTree.addTreeSelectionListener(treeSelectionListener); + updateSelectedBookmark(); return mainPanel; } /** - * Updates {@link #selectedMapMenuEntry} from {@link #bookmarksList}. + * Updates {@link #selectedTreePath} from {@link #bookmarksTree}. */ private void updateSelectedBookmark() { - //JList does not use type parameters - @SuppressWarnings({ "unchecked" }) - final MapMenuEntry<G, A, R> mapMenuEntry = (MapMenuEntry<G, A, R>) bookmarksList.getSelectedValue(); - selectedMapMenuEntry = mapMenuEntry; + selectedTreePath = bookmarksTree.getSelectionPath(); updateActions(); } @@ -277,30 +266,22 @@ } /** - * Action method for "move up bookmark". + * Action method for "remove bookmark". */ @ActionMethod - public void manageBookmarksMoveUp() { - doMoveUpBookmark(true); + public void manageBookmarksRemove() { + doRemoveBookmark(true); } /** - * Action method for "move down bookmark". + * Action method for "new directory". */ @ActionMethod - public void manageBookmarksMoveDown() { - doMoveDownBookmark(true); + public void manageBookmarksNewDirectory() { + doNewDirectory(true); } /** - * Action method for "remove bookmark". - */ - @ActionMethod - public void manageBookmarksRemove() { - doRemoveBookmark(true); - } - - /** * Action method for "close bookmarks dialog". */ @ActionMethod @@ -309,88 +290,120 @@ } /** - * Edits the selected bookmark. - * @param performAction whether the action should be performed - * @return whether the action can or was performed + * {@inheritDoc} */ - private boolean doEditBookmark(final boolean performAction) { - final MapMenuEntry<G, A, R> mapMenuEntry = selectedMapMenuEntry; - if (mapMenuEntry == null) { - return false; + @Override + public void setValue(@Nullable final Object newValue) { + super.setValue(newValue); + if (newValue != UNINITIALIZED_VALUE) { + mapMenu.save(); } - - if (performAction) { - final EditBookmarkDialog editBookmarkDialog = new EditBookmarkDialog(this, mapMenuEntry.getTitle()); - if (editBookmarkDialog.showDialog()) { - bookmarksMapMenuPreferences.setTitle(mapMenuEntry, editBookmarkDialog.getDescription()); - } - } - - return true; } /** - * Moves up the selected bookmark. + * Edits the selected bookmark. * @param performAction whether the action should be performed * @return whether the action can or was performed */ - private boolean doMoveUpBookmark(final boolean performAction) { - final MapMenuEntry<G, A, R> mapMenuEntry = selectedMapMenuEntry; - if (mapMenuEntry == null) { + private boolean doEditBookmark(final boolean performAction) { + final TreePath tmpSelectedTreePath = selectedTreePath; + if (tmpSelectedTreePath == null) { return false; } - if (!bookmarksMapMenuPreferences.doMoveUp(mapMenuEntry, performAction)) { + final DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) tmpSelectedTreePath.getLastPathComponent(); + if (selectedTreeNode == mapMenu.getRoot()) { return false; } if (performAction) { - bookmarksList.setSelectedIndex(bookmarksList.getSelectedIndex() - 1); + final DefaultMutableTreeNode tmpSelectedTreeNode = (DefaultMutableTreeNode) tmpSelectedTreePath.getLastPathComponent(); + final MapMenuEntryVisitor mapMenuEntryVisitor = new MapMenuEntryVisitor() { + + @Override + public void visit(@NotNull final MapMenuEntryDir mapMenuEntry) { + final BookmarkDirectoryDialog bookmarkDirectoryDialog = new BookmarkDirectoryDialog(ManageBookmarksDialog.this, mapMenuEntry.getTitle()); + if (bookmarkDirectoryDialog.showDialog()) { + mapMenuEntry.setTitle(bookmarkDirectoryDialog.getDirectory()); + bookmarksTree.getModel().valueForPathChanged(tmpSelectedTreePath, mapMenuEntry); + } + } + + @Override + public void visit(@NotNull final MapMenuEntryMap mapMenuEntry) { + final EditBookmarkDialog editBookmarkDialog = new EditBookmarkDialog(ManageBookmarksDialog.this, mapMenuEntry.getTitle()); + if (editBookmarkDialog.showDialog()) { + mapMenuEntry.setTitle(editBookmarkDialog.getDescription()); + bookmarksTree.getModel().valueForPathChanged(tmpSelectedTreePath, mapMenuEntry); + } + } + + }; + ((MapMenuEntry) tmpSelectedTreeNode.getUserObject()).visit(mapMenuEntryVisitor); } return true; } /** - * Moves down the selected bookmark. + * Removes the selected bookmark. * @param performAction whether the action should be performed * @return whether the action can or was performed */ - private boolean doMoveDownBookmark(final boolean performAction) { - final MapMenuEntry<G, A, R> mapMenuEntry = selectedMapMenuEntry; - if (mapMenuEntry == null) { + private boolean doRemoveBookmark(final boolean performAction) { + final TreePath tmpSelectedTreePath = selectedTreePath; + if (tmpSelectedTreePath == null) { return false; } - if (!bookmarksMapMenuPreferences.doMoveDown(mapMenuEntry, performAction)) { + final DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) tmpSelectedTreePath.getLastPathComponent(); + if (selectedTreeNode == mapMenu.getRoot()) { return false; } if (performAction) { - bookmarksList.setSelectedIndex(bookmarksList.getSelectedIndex() + 1); + final int[] selectionRows = bookmarksTree.getSelectionRows(); + mapMenu.removeNode(selectedTreeNode); + final int index = selectionRows == null ? 0 : selectionRows[0]; + if (index > 0) { + bookmarksTree.setSelectionRow(index - 1); + } } return true; } /** - * Removes the selected bookmark. + * Create a new directory. * @param performAction whether the action should be performed * @return whether the action can or was performed */ - private boolean doRemoveBookmark(final boolean performAction) { - final MapMenuEntry<G, A, R> mapMenuEntry = selectedMapMenuEntry; - if (mapMenuEntry == null) { + private boolean doNewDirectory(final boolean performAction) { + final TreePath tmpSelectedTreePath = selectedTreePath; + if (tmpSelectedTreePath == null) { return false; } if (performAction) { - final int index = bookmarksList.getSelectedIndex(); - bookmarksMapMenuPreferences.removeMapMenuEntry(mapMenuEntry); - if (index < bookmarksList.getModel().getSize()) { - bookmarksList.setSelectedIndex(index); - } else if (index > 0) { - bookmarksList.setSelectedIndex(index - 1); + final DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) tmpSelectedTreePath.getLastPathComponent(); + final BookmarkDirectoryDialog bookmarkDirectoryDialog = new BookmarkDirectoryDialog(this, ""); + if (bookmarkDirectoryDialog.showDialog()) { + final String directory = bookmarkDirectoryDialog.getDirectory(); + final MapMenuEntry mapEntry = new MapMenuEntryDir(directory); + final DefaultMutableTreeNode parent; + final int index; + if (selectedTreeNode == mapMenu.getRoot()) { + parent = selectedTreeNode; + index = 0; + } else { + parent = (DefaultMutableTreeNode) selectedTreeNode.getParent(); + assert parent != null; + index = parent.getIndex(selectedTreeNode) + 1; + assert index != 0; + } + final TreePath treePath = mapMenu.insertNodeInto(mapEntry, parent, index); + bookmarksTree.setSelectionPath(treePath); + } } @@ -402,11 +415,17 @@ */ private void updateActions() { editAction.setEnabled(doEditBookmark(false)); - moveUpAction.setEnabled(doMoveUpBookmark(false)); - moveDownAction.setEnabled(doMoveDownBookmark(false)); removeAction.setEnabled(doRemoveBookmark(false)); - final MapMenuEntry<?, ?, ?> mapMenuEntry = selectedMapMenuEntry; - preview.setIcon(mapMenuEntry == null ? null : new ImageIcon(mapImageCache.getOrCreatePreview(mapMenuEntry.getMapFile()))); + newDirectoryAction.setEnabled(doNewDirectory(false)); + @Nullable final Icon previewIcon; + if (selectedTreePath == null) { + previewIcon = null; + } else { + final DefaultMutableTreeNode tmpSelectedTreeNode = (DefaultMutableTreeNode) selectedTreePath.getLastPathComponent(); + final MapMenuEntry mapMenuEntry = (MapMenuEntry) tmpSelectedTreeNode.getUserObject(); + previewIcon = mapMenuEntryIcons.getIcon(mapMenuEntry); + } + preview.setIcon(previewIcon); } } // class ManageBookmarksDialog Added: trunk/src/app/net/sf/gridarta/gui/bookmarks/MapMenuEntryIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/MapMenuEntryIcons.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/MapMenuEntryIcons.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -0,0 +1,87 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.bookmarks; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.mapimagecache.MapImageCache; +import net.sf.gridarta.gui.mapmenu.MapMenuEntry; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryDir; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryVisitor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Generates icons for {@link MapMenuEntry} instances. + * @author Andreas Kirschbaum + */ +public class MapMenuEntryIcons implements MapMenuEntryVisitor { + + /** + * The {@link MapImageCache} for looking up icons. + */ + @NotNull + private final MapImageCache<?, ?, ?> mapImageCache; + + /** + * The result icon. + */ + @Nullable + private Icon icon = null; + + /** + * Creates a new instance. + * @param mapImageCache the map image cache for looking up icons + */ + public MapMenuEntryIcons(@NotNull final MapImageCache<?, ?, ?> mapImageCache) { + this.mapImageCache = mapImageCache; + } + + /** + * Returns an {@link Icon} for a {@link MapMenuEntry} instance. + * @param mapMenuEntry the instance + * @return the icon or <code>null</code> + */ + @Nullable + public Icon getIcon(@NotNull final MapMenuEntry mapMenuEntry) { + mapMenuEntry.visit(this); + final Icon result = icon; + icon = null; + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public void visit(@NotNull final MapMenuEntryDir mapMenuEntry) { + icon = null; + } + + /** + * {@inheritDoc} + */ + @Override + public void visit(@NotNull final MapMenuEntryMap mapMenuEntry) { + icon = new ImageIcon(mapImageCache.getOrCreatePreview(mapMenuEntry.getMapFile())); + } + +} Property changes on: trunk/src/app/net/sf/gridarta/gui/bookmarks/MapMenuEntryIcons.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java 2011-02-27 19:48:47 UTC (rev 8849) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -19,290 +19,35 @@ package net.sf.gridarta.gui.mapmenu; -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import javax.swing.AbstractListModel; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; -import net.sf.gridarta.gui.mapimagecache.MapImageCache; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapmanager.FileControl; -import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; /** * Abstract base class for {@link MapMenuPreferences} implementations. * @author Andreas Kirschbaum */ -public abstract class AbstractMapMenuPreferences<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractListModel implements MapMenuPreferences<G, A, R> { +public abstract class AbstractMapMenuPreferences implements MapMenuPreferences { /** - * The {@link MapViewsManager} instance. + * The managed {@link MapMenu}. */ @NotNull - private final MapViewsManager<G, A, R> mapViewsManager; + private final MapMenu mapMenu; /** - * The global settings instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The {@link MapImageCache} to use. - */ - @NotNull - private final MapImageCache<G, A, R> mapImageCache; - - /** - * The {@link FileControl}. - */ - @NotNull - private final FileControl<G, A, R> fileControl; - - /** - * List with mapMenuEntries. - */ - @NotNull - private final List<MapMenuEntry<G, A, R>> mapMenuEntries = new LinkedList<MapMenuEntry<G, A, R>>(); - - /** * Creates a new instance. - * @param mapViewsManager the map views manager instance - * @param globalSettings the global settings instance - * @param mapImageCache the map image cache instance - * @param fileControl the file control + * @param key the preferences key prefix */ - protected AbstractMapMenuPreferences(@NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final FileControl<G, A, R> fileControl) { - this.mapViewsManager = mapViewsManager; - this.globalSettings = globalSettings; - this.mapImageCache = mapImageCache; - this.fileControl = fileControl; + protected AbstractMapMenuPreferences(@NotNull final String key) { + mapMenu = new MapMenu(key); } /** - * Creates a new {@link MapMenuEntry}. - * @param title the entry's title - * @param mapFile the entry's map file - * @param replaceExisting whether an existing entry should be replaced - */ - protected void newMapMenuEntry(@NotNull final String title, @NotNull final File mapFile, final boolean replaceExisting) { - final MapMenuEntry<G, A, R> mapMenuEntry = new MapMenuEntry<G, A, R>(title, mapFile, mapViewsManager, mapImageCache, fileControl, getShortDescription(title, getShortMapFile(globalSettings.getMapsDirectory(), mapFile))); - final int index; - if (replaceExisting) { - removeMapMenuEntryInt(mapMenuEntry); // remove old entry to get new entry at first pos. - index = 0; - } else { - index = getSize(); - } - addMapMenuEntryInt(index, mapMenuEntry); - } - - /** - * Returns the base name of a map file. - * @param mapsDirectory the maps directory - * @param mapFile the map file - * @return the base name - */ - @NotNull - private static String getShortMapFile(@NotNull final File mapsDirectory, @NotNull final File mapFile) { - String canonicalMapFile; - String canonicalMapsDirectory; - try { - canonicalMapFile = mapFile.getCanonicalPath(); - canonicalMapsDirectory = mapsDirectory.getCanonicalPath(); - } catch (final IOException ignored) { - canonicalMapFile = mapFile.getAbsolutePath(); - canonicalMapsDirectory = mapsDirectory.getAbsolutePath(); - } - - if (canonicalMapFile.startsWith(canonicalMapsDirectory)) { - return canonicalMapFile.substring(canonicalMapsDirectory.length()).replace('\\', '/'); - } else { - return canonicalMapFile.replace('\\', '/'); - } - } - - /** - * Adds a {@link MapMenuEntry}. The change is not saved to preferences. - * @param index the insertion index - * @param mapMenuEntry the map menu entry - */ - protected void addMapMenuEntryInt(final int index, @NotNull final MapMenuEntry<G, A, R> mapMenuEntry) { - mapMenuEntries.add(index, mapMenuEntry); - fireIntervalAdded(this, index, index); - } - - /** * {@inheritDoc} */ - @Override - public void addMapMenuEntry(@NotNull final String title, @NotNull final File mapFile) { - addMapMenuEntryInt(title, mapFile); - save(); - } - - /** - * Adds a {@link MapMenuEntry}. The change is not saved to preferences. - * @param title the entry's title - * @param mapFile the entry's short map file - */ - protected abstract void addMapMenuEntryInt(@NotNull String title, @NotNull File mapFile); - - /** - * {@inheritDoc} - */ - @Override - public void removeMapMenuEntry(@NotNull final MapMenuEntry<G, A, R> mapMenuEntry) { - removeMapMenuEntryInt(mapMenuEntry); - save(); - } - - /** - * Removes a {@link MapMenuEntry}. The change is not saved to preferences. - * @param mapMenuEntry the map menu entry - */ - protected void removeMapMenuEntryInt(@NotNull final MapMenuEntry<G, A, R> mapMenuEntry) { - final int index = mapMenuEntries.indexOf(mapMenuEntry); - if (index == -1) { - return; - } - - mapMenuEntries.remove(index); - fireIntervalRemoved(this, index, index); - } - - /** - * {@inheritDoc} - */ - @Override - public int getSize() { - return mapMenuEntries.size(); - } - - /** - * {@inheritDoc} - */ - @Override - public Object getElementAt(final int index) { - return mapMenuEntries.get(index); - } - - /** - * {@inheritDoc} - */ @NotNull @Override - public Iterator<MapMenuEntry<G, A, R>> iterator() { - return new Iterator<MapMenuEntry<G, A, R>>() { - - /** - * The {@link Iterator} to forward to. - */ - @NotNull - private final Iterator<MapMenuEntry<G, A, R>> it = mapMenuEntries.iterator(); - - /** - * The index of the current entry. - */ - private int index = -1; - - @Override - public boolean hasNext() { - return it.hasNext(); - } - - @Override - public MapMenuEntry<G, A, R> next() { - index++; - return it.next(); - } - - @Override - public void remove() { - it.remove(); - fireIntervalRemoved(AbstractMapMenuPreferences.this, index, index); - index--; - save(); - } - - }; + public MapMenu getMapMenu() { + return mapMenu; } - /** - * Saves all entries to preferences. - */ - protected abstract void save(); - - /** - * Moves an entry upwards. - * @param mapMenuEntry the entry - * @param performAction whether to perform the move or just check - * @return whether the action was or can be performed - */ - public boolean doMoveUp(@NotNull final MapMenuEntry<G, A, R> mapMenuEntry, final boolean performAction) { - final int index = indexOf(mapMenuEntry); - if (index == -1) { - throw new IllegalArgumentException(); - } - - if (index <= 0) { - return false; - } - - if (performAction) { - mapMenuEntries.remove(index); - mapMenuEntries.add(index - 1, mapMenuEntry); - save(); - fireContentsChanged(this, index - 1, index); - } - - return true; - } - - /** - * Moves an entry downwards. - * @param mapMenuEntry the entry - * @param performAction whether to perform the move or just check - * @return whether the action was or can be performed - */ - public boolean doMoveDown(@NotNull final MapMenuEntry<G, A, R> mapMenuEntry, final boolean performAction) { - final int index = indexOf(mapMenuEntry); - if (index == -1) { - throw new IllegalArgumentException(); - } - - if (index >= mapMenuEntries.size() - 1) { - return false; - } - - if (performAction) { - mapMenuEntries.remove(index); - mapMenuEntries.add(index + 1, mapMenuEntry); - save(); - fireContentsChanged(this, index, index + 1); - } - - return true; - } - - /** - * Returns the index of a {@link MapMenuEntry} within {@link - * #mapMenuEntries}. - * @param mapMenuEntry the map menu entry - * @return the index - */ - protected int indexOf(@NotNull final MapMenuEntry<G, A, R> mapMenuEntry) { - for (int i = 0; i < mapMenuEntries.size(); i++) { - if (mapMenuEntries.get(i) == mapMenuEntry) { - return i; - } - } - return -1; - } - } // class AbstractMapMenuPreferences Added: trunk/src/app/net/sf/gridarta/gui/mapmenu/ActionFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/ActionFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/ActionFactory.java 2011-02-28 17:53:53 UTC (rev 8850) @@ -0,0 +1,120 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.mapmenu; + +import java.util.IdentityHashMap; +import java.util.Map; +import javax.swing.Action; +import net.sf.gridarta.gui.map.mapview.MapViewsManager; +import net.sf.gridarta.gui.mapimagecache.MapImageCache; +import net.sf.gridarta.model.mapmanager.FileControl; +import org.jetbrains.annotations.NotNull; + +/** + * A factory for creating {@link MapMenuAction} instances. + * @author Andreas Kirschbaum + */ +public class ActionFactory { + + /** + * The {@link MapViewsManager} for opening map files. + */ + @NotNull + private final MapViewsManager<?, ?, ?> mapViewsManager; + + /** + * The {@link FileControl} for reporting errors. + */ + @NotNull + private final FileControl<?, ?, ?> fileControl; + + /** + * The {@link MapImageCache} to query. + */ + @NotNull + private final MapImageCache<?, ?, ?> mapImageCache; + + /** + * Maps {@link MapMenuEntryMap} instance to associated {@link + * MapMenuAction}. + */ + @NotNull + private final Map<MapMenuEntryMap, MapMenuAction> actions = new IdentityHashMap<MapMenuEntryMap, MapMenuAction>(); + + /** + * Keys of {@link #actions} to delete when {@link #end()} is called. + */ + @NotNull + private final Map<MapMenuEntryMap, Void> keysToDelete = new IdentityHashMap<MapMenuEntryMap, Void>(); + + /** + * Creates a new instance. + * @param mapViewsManager the map views manager for opening map files + * @param fileControl the file control for reporting errors + * @param mapImageCache the map image cache to query + */ + public ActionFactory(@NotNull final MapViewsManager<?, ?, ?> mapViewsManager, @NotNull final FileControl<?, ?, ?> fileControl, @NotNull final MapImageCache<?, ?, ?> mapImageCache) { + this.mapViewsManager = mapViewsManager; + this.fileControl = fileControl; + this.mapImageCache = mapImageCache; + } + + /** + * Begins a lookup sequence. + */ + public void begin() { + keysToDelete.clear(); + for (final MapMenuEntryMap mapMenuEntryMap : actions.keySet()) { + keysToDelete.put(mapMenuEntryMap, null); + } + } + + /** + * Ends a lookup sequence. All actions not looked up between the preceding + * call to {@link #begin()} are deleted. + */ + public void end() { + for (final MapMenuEntryMap mapMenuEntryMap : keysToDelete.keySet()) { + actions.remove(mapMenuEntryMap); + } + keysToDelete.clear(); + } + + /** + * Returns an {@link Action} for a {@link MapMenuEntryMap} instance. + * @param mapMenuEntryMap the instance + * @return the action + */ + @NotNull + public Action getAction(@NotNull final MapMenuEntryMap mapMenuEntryMap) { + keysToDelete.remove(mapMenuEntryMap); + final MapMenuAction existingAction = actions.get(mapMenuEntryMap); + final MapMenuAction action; + if (existingAction == null) { + action = new MapMenuAction(mapMenuEntryMap, mapViewsManager, fileControl); + actions.put(mapMenuEntryMap, action); + } else { + action = existingAction; + } + action.update(mapImageCache); + return action; + } + +} Property changes on: trunk/src/app/net/sf/gridarta/gui/mapmenu/ActionFactory.java _________________________________________________________... [truncated message content] |
From: <aki...@us...> - 2011-03-01 21:57:17
|
Revision: 8851 http://gridarta.svn.sourceforge.net/gridarta/?rev=8851&view=rev Author: akirschbaum Date: 2011-03-01 21:57:10 +0000 (Tue, 01 Mar 2011) Log Message: ----------- Manage bookmarks dialog: Add "undo remove" button for restoring a previously removed bookmark. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/atrinik/ChangeLog 2011-03-01 21:57:10 UTC (rev 8851) @@ -1,3 +1,8 @@ +2011-03-01 Andreas Kirschbaum + + * Manage bookmarks dialog: Add "undo remove" button for restoring + a previously removed bookmark. + 2011-02-28 Andreas Kirschbaum * Implement bookmark directories. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/crossfire/ChangeLog 2011-03-01 21:57:10 UTC (rev 8851) @@ -1,3 +1,8 @@ +2011-03-01 Andreas Kirschbaum + + * Manage bookmarks dialog: Add "undo remove" button for restoring + a previously removed bookmark. + 2011-02-28 Andreas Kirschbaum * Implement bookmark directories. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/daimonin/ChangeLog 2011-03-01 21:57:10 UTC (rev 8851) @@ -1,3 +1,8 @@ +2011-03-01 Andreas Kirschbaum + + * Manage bookmarks dialog: Add "undo remove" button for restoring + a previously removed bookmark. + 2011-02-28 Andreas Kirschbaum * Implement bookmark directories. Modified: trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java 2011-03-01 21:57:10 UTC (rev 8851) @@ -133,6 +133,13 @@ private final Action removeAction = ACTION_BUILDER.createAction(false, "manageBookmarksRemove", this); /** + * The {@link Action} for "remove bookmark". + * @serial + */ + @NotNull + private final Action unDeleteAction = ACTION_BUILDER.createAction(false, "manageBookmarksUnDelete", this); + + /** * The {@link Action} for "new directory". * @serial */ @@ -170,8 +177,9 @@ new TreeDropTarget(bookmarksTree); final JButton editButton = new JButton(editAction); final JButton removeButton = new JButton(removeAction); + final JButton unDeleteButton = new JButton(unDeleteAction); final JButton newDirectoryButton = new JButton(newDirectoryAction); - setOptions(new Object[] { editButton, removeButton, newDirectoryButton, closeButton }); + setOptions(new Object[] { editButton, removeButton, unDeleteButton, newDirectoryButton, closeButton }); setMessage(createPanel()); @@ -274,6 +282,14 @@ } /** + * Action method for "undo deletion". + */ + @ActionMethod + public void manageBookmarksUnDelete() { + doUnDeleteBookmark(true); + } + + /** * Action method for "new directory". */ @ActionMethod @@ -374,6 +390,25 @@ } /** + * Restores the last deleted bookmark. + * @param performAction whether the action should be performed + * @return whether the action can or was performed + */ + private boolean doUnDeleteBookmark(final boolean performAction) { + final MapMenu.DeletedNode deletedNode = mapMenu.getDeletedNode(performAction); + if (deletedNode == null) { + return false; + } + + if (performAction) { + final TreePath treePath = mapMenu.addMapMenuEntry(deletedNode.getDirectory(), deletedNode.getTreeNode()); + bookmarksTree.setSelectionPath(treePath); + } + + return true; + } + + /** * Create a new directory. * @param performAction whether the action should be performed * @return whether the action can or was performed @@ -416,6 +451,7 @@ private void updateActions() { editAction.setEnabled(doEditBookmark(false)); removeAction.setEnabled(doRemoveBookmark(false)); + unDeleteAction.setEnabled(doUnDeleteBookmark(false)); newDirectoryAction.setEnabled(doNewDirectory(false)); @Nullable final Icon previewIcon; if (selectedTreePath == null) { Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-03-01 21:57:10 UTC (rev 8851) @@ -20,16 +20,20 @@ package net.sf.gridarta.gui.mapmenu; import java.io.IOException; +import java.util.ArrayDeque; +import java.util.Deque; import javax.swing.JTree; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Manages the contents of a recent or bookmark menu. @@ -61,6 +65,12 @@ private final DefaultTreeModel treeModel = new DefaultTreeModel(root); /** + * Recently deleted nodes. The first node is the last deleted node. + */ + @NotNull + private final Deque<DeletedNode> deletedNodes = new ArrayDeque<DeletedNode>(); + + /** * Whether {@link #treeModel} has been modified since last save. */ private boolean treeModelModified = false; @@ -183,9 +193,23 @@ * Adds a {@link MapMenuEntry} to this menu. * @param directory the directory to add to * @param mapMenuEntry the map menu entry + * @return the tree path for the inserted node * @noinspection TypeMayBeWeakened */ - public void addMapMenuEntry(@NotNull final String directory, @NotNull final MapMenuEntry mapMenuEntry) { + @NotNull + public TreePath addMapMenuEntry(@NotNull final String directory, @NotNull final MapMenuEntry mapMenuEntry) { + return addMapMenuEntry(directory, new DefaultMutableTreeNode(mapMenuEntry, mapMenuEntry.allowsChildren())); + } + + /** + * Adds a {@link DefaultMutableTreeNode} to this menu. + * @param directory the directory to add to + * @param treeNode the tree node + * @return the tree path for the inserted node + * @noinspection TypeMayBeWeakened + */ + @NotNull + public TreePath addMapMenuEntry(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { final String[] paths = directory.split("/"); DefaultMutableTreeNode dir2 = root; for (final String path : paths) { @@ -193,7 +217,8 @@ dir2 = getOrCreateDirectory(dir2, path); } } - dir2.add(new DefaultMutableTreeNode(mapMenuEntry, mapMenuEntry.allowsChildren())); + treeModel.insertNodeInto(treeNode, dir2, dir2.getChildCount()); + return new TreePath(treeModel.getPathToRoot(treeNode)); } /** @@ -204,7 +229,7 @@ * @return the entry */ @NotNull - public static DefaultMutableTreeNode getOrCreateDirectory(@NotNull final DefaultMutableTreeNode this2, @NotNull final String path) { + public DefaultMutableTreeNode getOrCreateDirectory(@NotNull final MutableTreeNode this2, @NotNull final String path) { if (!MapMenuEntryDir.isValidDirectory(path)) { throw new IllegalArgumentException("invalid directory name '" + path + "'"); } @@ -218,7 +243,7 @@ } final DefaultMutableTreeNode new2 = new DefaultMutableTreeNode(new MapMenuEntryDir(path), true); - this2.add(new2); + treeModel.insertNodeInto(new2, this2, this2.getChildCount()); return new2; } @@ -246,12 +271,50 @@ */ public void removeNode(@NotNull final DefaultMutableTreeNode treeNode) { if (treeNode != root) { + final String directory = getDirectory(treeNode); treeModel.removeNodeFromParent(treeNode); + deletedNodes.addFirst(new DeletedNode(directory, treeNode)); + while (deletedNodes.size() > 10) { + deletedNodes.removeLast(); + } save(); } } /** + * Returns the directory of a {@link TreeNode}. + * @param treeNode the tree node + * @return the directory + */ + @NotNull + private String getDirectory(@NotNull final TreeNode treeNode) { + final TreeNode[] treePath = treeModel.getPathToRoot(treeNode); + if (treePath == null) { + throw new IllegalArgumentException(); + } + final StringBuilder sb = new StringBuilder(); + for (int i = 1; i + 1 < treePath.length; i++) { + final TreeNode tmp = treePath[i]; + final MapMenuEntry mapMenuEntry = (MapMenuEntry) ((DefaultMutableTreeNode) tmp).getUserObject(); + if (sb.length() > 0) { + sb.append('/'); + } + sb.append(mapMenuEntry.getTitle()); + } + return sb.toString(); + } + + /** + * Returns the last deleted node. + * @param delete whether to delete the returned node + * @return the deleted node or <code>null</code> + */ + @Nullable + public DeletedNode getDeletedNode(final boolean delete) { + return delete ? deletedNodes.pollFirst() : deletedNodes.peekFirst(); + } + + /** * Returns the number of entries in this menu. * @return the number of entries */ @@ -295,4 +358,53 @@ return root; } + /** + * Result value consisting of a {@link TreeNode} and its location + * (directory). + * @noinspection PublicInnerClass + */ + public static class DeletedNode { + + /** + * The entry's directory. + */ + @NotNull + private final String directory; + + /** + * The entry. + */ + @NotNull + private final DefaultMutableTreeNode treeNode; + + /** + * Creates a new instance. + * @param directory the entry's directory + * @param treeNode the tree node + */ + public DeletedNode(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { + this.directory = directory; + this.treeNode = treeNode; + } + + /** + * Returns the entry's directory. + * @return the entry's directory + */ + @NotNull + public String getDirectory() { + return directory; + } + + /** + * Returns the tree node. + * @return the tree node + */ + @NotNull + public DefaultMutableTreeNode getTreeNode() { + return treeNode; + } + + } + } Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/messages.properties 2011-03-01 21:57:10 UTC (rev 8851) @@ -452,6 +452,8 @@ manageBookmarks.title=Manage Bookmarks manageBookmarksEdit.text=Edit manageBookmarksRemove.text=Remove +manageBookmarksUnDelete.text=Undo Remove +manageBookmarksUnDelete.shortdescription=Restores the last deleted bookmark. manageBookmarksNewDirectory.text=New Directory manageBookmarksClose.text=Close Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2011-03-01 21:57:10 UTC (rev 8851) @@ -429,6 +429,8 @@ manageBookmarks.title=Lesezeichen verwalten manageBookmarksEdit.text=\u00c4ndern manageBookmarksRemove.text=L\u00f6schen +manageBookmarksUnDelete.text=Wiederherstellen +manageBookmarksUnDelete.shortdescription=Stellt das zuletzt gel\u00f6schte Bookmark wieder her. manageBookmarksNewDirectory.text=Neues Verzeichnis manageBookmarksClose.text=Schie\u00dfen Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2011-03-01 21:57:10 UTC (rev 8851) @@ -429,6 +429,8 @@ manageBookmarks.title=Gestion des raccourcis manageBookmarksEdit.text=Modifier manageBookmarksRemove.text=Supprimer +#manageBookmarksUnDelete.text= +#manageBookmarksUnDelete.shortdescription= #manageBookmarksNewDirectory.text= manageBookmarksClose.text=Fermer Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2011-03-01 21:57:10 UTC (rev 8851) @@ -426,6 +426,8 @@ #manageBookmarks.title= #manageBookmarksEdit.text= #manageBookmarksRemove.text= +#manageBookmarksUnDelete.text= +#manageBookmarksUnDelete.shortdescription= #manageBookmarksNewDirectory.text= #manageBookmarksClose.text= Modified: trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuTest.java 2011-02-28 17:53:53 UTC (rev 8850) +++ trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuTest.java 2011-03-01 21:57:10 UTC (rev 8851) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.mapmenu; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.MutableTreeNode; import net.sf.gridarta.preferences.FilePreferencesFactory; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -33,46 +34,48 @@ public class MapMenuTest { /** - * Checks that {@link MapMenu#getOrCreateDirectory(DefaultMutableTreeNode, - * String)} works as expected. + * Checks that {@link MapMenu#getOrCreateDirectory(MutableTreeNode, String)} + * works as expected. */ @Test public void testSubDir1() { - final DefaultMutableTreeNode dir = new DefaultMutableTreeNode(new MapMenuEntryDir("Test"), true); + final MapMenu mapMenu = new MapMenu("test"); + final MutableTreeNode dir = mapMenu.getRoot(); checkDir(dir); - MapMenu.getOrCreateDirectory(dir, "dir1"); + mapMenu.getOrCreateDirectory(dir, "dir1"); checkDir(dir, "dir1"); - MapMenu.getOrCreateDirectory(dir, "dir2"); - MapMenu.getOrCreateDirectory(dir, "dir3"); + mapMenu.getOrCreateDirectory(dir, "dir2"); + mapMenu.getOrCreateDirectory(dir, "dir3"); checkDir(dir, "dir1", "dir2", "dir3"); - MapMenu.getOrCreateDirectory(dir, "dir2"); + mapMenu.getOrCreateDirectory(dir, "dir2"); checkDir(dir, "dir1", "dir2", "dir3"); } /** - * Checks that {@link MapMenu#getOrCreateDirectory(DefaultMutableTreeNode, - * String)} rejects invalid path names. + * Checks that {@link MapMenu#getOrCreateDirectory(MutableTreeNode, String)} + * rejects invalid path names. */ @Test public void testSubDir2() { - final DefaultMutableTreeNode dir = new DefaultMutableTreeNode(new MapMenuEntryDir("Test"), true); + final MapMenu mapMenu = new MapMenu("test"); + final MutableTreeNode dir = mapMenu.getRoot(); checkDir(dir); - MapMenu.getOrCreateDirectory(dir, "dir1"); - MapMenu.getOrCreateDirectory(dir, "dir2"); - MapMenu.getOrCreateDirectory(dir, "dir3"); + mapMenu.getOrCreateDirectory(dir, "dir1"); + mapMenu.getOrCreateDirectory(dir, "dir2"); + mapMenu.getOrCreateDirectory(dir, "dir3"); checkDir(dir, "dir1", "dir2", "dir3"); try { - MapMenu.getOrCreateDirectory(dir, "dir2/sub"); + mapMenu.getOrCreateDirectory(dir, "dir2/sub"); Assert.fail("IllegalArgumentException expected"); } catch (final IllegalArgumentException ignored) { } try { - MapMenu.getOrCreateDirectory(dir, "dir4/sub"); + mapMenu.getOrCreateDirectory(dir, "dir4/sub"); Assert.fail("IllegalArgumentException expected"); } catch (final IllegalArgumentException ignored) { } try { - MapMenu.getOrCreateDirectory(dir, ""); + mapMenu.getOrCreateDirectory(dir, ""); Assert.fail("IllegalArgumentException expected"); } catch (final IllegalArgumentException ignored) { } @@ -86,7 +89,7 @@ * @param paths the paths of the child nodes * @noinspection TypeMayBeWeakened // IDEA bug */ - private static void checkDir(@NotNull final DefaultMutableTreeNode dir, @NotNull final String... paths) { + private static void checkDir(@NotNull final MutableTreeNode dir, @NotNull final String... paths) { Assert.assertEquals(paths.length, dir.getChildCount()); for (int i = 0; i < paths.length; i++) { final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) dir.getChildAt(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-08 19:12:13
|
Revision: 8853 http://gridarta.svn.sourceforge.net/gridarta/?rev=8853&view=rev Author: akirschbaum Date: 2011-03-08 19:12:05 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Remove unused fields and parameters. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParser.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParserFactory.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParser.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParserFactory.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/model/src/test/net/sf/gridarta/model/io/TestGameObjectParser.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -222,8 +222,8 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - return new DefaultGameObjectParserFactory(gameObjectFactory, gameObjectMatchers, archetypeSet); + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParser.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParser.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -24,7 +24,6 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractGameObjectParser; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; @@ -41,11 +40,10 @@ * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(gameObjectFactory, gameObjectMatchers, archetypeSet); + public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(gameObjectFactory, archetypeSet); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParserFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParserFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/io/DefaultGameObjectParserFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; @@ -42,12 +41,6 @@ private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link ArchetypeSet} for looking up archetypes. */ @NotNull @@ -56,12 +49,10 @@ /** * Creates a new instance. * @param gameObjectFactory the game object factory to use - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.archetypeSet = archetypeSet; } @@ -70,7 +61,7 @@ */ @Override public GameObjectParser<GameObject, MapArchObject, Archetype> newGameObjectParser() { - return new DefaultGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + return new DefaultGameObjectParser(gameObjectFactory, archetypeSet); } } // class DefaultGameObjectParserFactory Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParserTest.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -35,7 +35,6 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.model.gameobject.DefaultGameObjectFactory; @@ -149,11 +148,10 @@ final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); archetypeSet = new ArchetypeSet(archetypeFactory, faceObjectProviders); archetypeSet.setLoadedFromArchive(true); assert archetypeSet != null; - final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); assert archetypeSet != null; final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(1, 1, 1, 1); final MultiPositionData multiPositionData = new MultiPositionData(isoMapSquareInfo); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -193,8 +193,8 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - return new DefaultGameObjectParserFactory(gameObjectFactory, gameObjectMatchers, archetypeSet); + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractGameObjectParser; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -329,11 +328,10 @@ * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(gameObjectFactory, gameObjectMatchers, archetypeSet); + public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(gameObjectFactory, archetypeSet); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParserFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -42,12 +41,6 @@ private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link ArchetypeSet} for looking up archetypes. */ @NotNull @@ -56,12 +49,10 @@ /** * Creates a new instance. * @param gameObjectFactory the game object factory to use - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.archetypeSet = archetypeSet; } @@ -70,7 +61,7 @@ */ @Override public GameObjectParser<GameObject, MapArchObject, Archetype> newGameObjectParser() { - return new DefaultGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + return new DefaultGameObjectParser(gameObjectFactory, archetypeSet); } } // class DefaultGameObjectParserFactory Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParserTest.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -32,7 +32,6 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.gameobject.DefaultGameObjectFactory; @@ -106,11 +105,10 @@ final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects = new DefaultAnimationObjects<GameObject, MapArchObject, Archetype>("animtree"); final DefaultGameObjectFactory gameObjectFactory = new DefaultGameObjectFactory(faceObjectProviders, animationObjects); final DefaultArchetypeFactory archetypeFactory = new DefaultArchetypeFactory(faceObjectProviders, animationObjects); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); archetypeSet = new ArchetypeSet("images", archetypeFactory, faceObjectProviders); archetypeSet.setLoadedFromArchive(true); assert archetypeSet != null; - final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser = new DefaultGameObjectParser(gameObjectFactory, archetypeSet); assert archetypeSet != null; final SmoothFaces smoothFaces = new SmoothFaces(faceObjects); assert archetypeSet != null; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -222,8 +222,8 @@ */ @NotNull @Override - public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - return new DefaultGameObjectParserFactory(gameObjectFactory, gameObjectMatchers, archetypeSet); + public GameObjectParserFactory<GameObject, MapArchObject, Archetype> newGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + return new DefaultGameObjectParserFactory(gameObjectFactory, archetypeSet); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParser.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParser.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -24,7 +24,6 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.AbstractGameObjectParser; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; @@ -41,11 +40,10 @@ * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - super(gameObjectFactory, gameObjectMatchers, archetypeSet); + public DefaultGameObjectParser(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + super(gameObjectFactory, archetypeSet); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParserFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParserFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/io/DefaultGameObjectParserFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.io.GameObjectParserFactory; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; @@ -42,12 +41,6 @@ private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link ArchetypeSet}. */ @NotNull @@ -56,12 +49,10 @@ /** * Creates a new instance. * @param gameObjectFactory the game object factory to use - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set */ - public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public DefaultGameObjectParserFactory(@NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.archetypeSet = archetypeSet; } @@ -70,7 +61,7 @@ */ @Override public GameObjectParser<GameObject, MapArchObject, Archetype> newGameObjectParser() { - return new DefaultGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + return new DefaultGameObjectParser(gameObjectFactory, archetypeSet); } } // class DefaultGameObjectParserFactory Modified: trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -33,7 +33,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.utils.StringUtils; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -66,12 +65,6 @@ private final GameObjectFactory<G, A, R> gameObjectFactory; /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link ArchetypeSet} for looking up archetypes. */ @NotNull @@ -81,12 +74,10 @@ * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - protected AbstractGameObjectParser(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + protected AbstractGameObjectParser(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.archetypeSet = archetypeSet; } Modified: trunk/model/src/test/net/sf/gridarta/model/io/TestGameObjectParser.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/io/TestGameObjectParser.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/model/src/test/net/sf/gridarta/model/io/TestGameObjectParser.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.match.GameObjectMatchers; import org.jetbrains.annotations.NotNull; /** @@ -39,11 +38,10 @@ * Create a new instance. * @param gameObjectFactory the game object factory for creating new game * object instances - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes */ - public TestGameObjectParser(@NotNull final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet) { - super(gameObjectFactory, gameObjectMatchers, archetypeSet); + public TestGameObjectParser(@NotNull final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet) { + super(gameObjectFactory, archetypeSet); } /** Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -307,7 +307,7 @@ * @return the new game object parser instance */ public GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> newGameObjectParser() { - return new TestGameObjectParser(gameObjectFactory, gameObjectMatchers, archetypeSet); + return new TestGameObjectParser(gameObjectFactory, archetypeSet); } /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -153,12 +153,11 @@ /** * Creates a new {@link GameObjectParserFactory} instance. * @param gameObjectFactory the game object parser factory to use - * @param gameObjectMatchers the game object matchers to use * @param archetypeSet the archetype set for looking up archetypes * @return the new instance */ @NotNull - GameObjectParserFactory<G, A, R> newGameObjectParserFactory(@NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeSet<G, A, R> archetypeSet); + GameObjectParserFactory<G, A, R> newGameObjectParserFactory(@NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet); /** * Creates a new {@link GlobalSettings} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -248,7 +248,7 @@ final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, faceObjectProviders); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, gameObjectMatchers, archetypeSet); + final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(globalSettings); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -103,7 +103,7 @@ final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, faceObjectProviders); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, gameObjectMatchers, archetypeSet); + final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, archetypeSet); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, mapViewSettings); Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -71,12 +71,6 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * Preferences. - */ - @NotNull - private final Preferences preferences; - - /** * The {@link TextAreaDefaults} for tabs. */ @NotNull @@ -140,7 +134,6 @@ */ public ScriptEditView(@NotNull final ScriptEditControl control, @NotNull final Frame owner, @NotNull final Preferences preferences, @NotNull final Exiter exiter) { super(owner, "Script Pad"); - this.preferences = preferences; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); textAreas = new ArrayList<JEditTextArea>(); Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2011-03-01 22:35:43 UTC (rev 8852) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2011-03-08 19:12:05 UTC (rev 8853) @@ -97,8 +97,6 @@ public final ActionListener toggleRectangle = new ToggleRectangle(); - private final ActionListener save; - public final ActionListener functionMenu; // Default action @@ -108,7 +106,7 @@ private final Map<String, ActionListener> actions = new HashMap<String, ActionListener>(); public InputActions(@NotNull final ScriptEditControl scriptEditControl) { - save = new Save(scriptEditControl); + final ActionListener save = new Save(scriptEditControl); functionMenu = new FunctionMenu(scriptEditControl); actions.put("backspace", backspace); actions.put("backspace-word", backspaceWord); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-08 19:30:02
|
Revision: 8856 http://gridarta.svn.sourceforge.net/gridarta/?rev=8856&view=rev Author: akirschbaum Date: 2011-03-08 19:29:55 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Add final modifiers. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java Modified: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-03-08 19:26:41 UTC (rev 8855) +++ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-03-08 19:29:55 UTC (rev 8856) @@ -59,21 +59,21 @@ * @serial */ @NotNull - private Map<V, Long> timestamps = new HashMap<V, Long>(); + private final Map<V, Long> timestamps = new HashMap<V, Long>(); /** * Maps value to name. * @serial */ @NotNull - private Map<V, String> names = new HashMap<V, String>(); + private final Map<V, String> names = new HashMap<V, String>(); /** * Pending values. * @serial */ @NotNull - private Set<V> pending = new HashSet<V>(); + private final Set<V> pending = new HashSet<V>(); /** * Whether the state ({@link #timestamps} or {@link #names}) was modified Modified: trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2011-03-08 19:26:41 UTC (rev 8855) +++ trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2011-03-08 19:29:55 UTC (rev 8856) @@ -66,14 +66,14 @@ */ // TODO: use this field (it looks unused but usage is planned) @Nullable - private ViewGameObjectMatcherManager transparencyManager = null; + private final ViewGameObjectMatcherManager transparencyManager = null; /** * The visibility settings. */ // TODO: use this field (it looks unused but usage is planned) @Nullable - private ViewGameObjectMatcherManager visibilityManager = null; + private final ViewGameObjectMatcherManager visibilityManager = null; /** * The MapViewSettingsListeners to inform of changes. Modified: trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java 2011-03-08 19:26:41 UTC (rev 8855) +++ trunk/src/app/net/sf/gridarta/gui/gomapdialog/GoMapDialog.java 2011-03-08 19:29:55 UTC (rev 8856) @@ -240,7 +240,7 @@ * #mapsIndex} changes. */ @NotNull - private DelayedChangeManager delayedChangeManager = new DelayedChangeManager(100, 1000, new DelayedChangeListener() { + private final DelayedChangeManager delayedChangeManager = new DelayedChangeManager(100, 1000, new DelayedChangeListener() { @Override public void change() { Modified: trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-03-08 19:26:41 UTC (rev 8855) +++ trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenu.java 2011-03-08 19:29:55 UTC (rev 8856) @@ -56,7 +56,7 @@ * The root node of {@link #treeModel}. */ @NotNull - private DefaultMutableTreeNode root = new DefaultMutableTreeNode(new MapMenuEntryDir("Bookmarks"), true); + private final DefaultMutableTreeNode root = new DefaultMutableTreeNode(new MapMenuEntryDir("Bookmarks"), true); /** * The {@link DefaultTreeModel} that contains all menu entries. Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java 2011-03-08 19:26:41 UTC (rev 8855) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java 2011-03-08 19:29:55 UTC (rev 8856) @@ -66,7 +66,7 @@ * Whether the caret should be wide even in insert mode. * @serial */ - private boolean blockCaret; + private final boolean blockCaret; /** * The syntax styles used to paint colorized text. @@ -89,37 +89,37 @@ * The caret color. * @serial */ - private Color caretColor; + private final Color caretColor; /** * The selection color. * @serial */ - private Color selectionColor; + private final Color selectionColor; /** * The color for line highlighting. * @serial */ - private Color lineHighlightColor; + private final Color lineHighlightColor; /** * Whether line highlighting is enabled. * @serial */ - private boolean lineHighlight; + private final boolean lineHighlight; /** * The color for bracket highlighting. * @serial */ - private Color bracketHighlightColor; + private final Color bracketHighlightColor; /** * Whether bracket highlighting is enabled. * @serial */ - private boolean bracketHighlight; + private final boolean bracketHighlight; /** * Whether invalid lines should be painted as red tildes. @@ -132,13 +132,13 @@ * @serial */ @NotNull - private Color eolMarkerColor; + private final Color eolMarkerColor; /** * Whether end of line markers should be painted. * @serial */ - private boolean eolMarkers; + private final boolean eolMarkers; /** * The currently painted line. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-08 19:33:24
|
Revision: 8858 http://gridarta.svn.sourceforge.net/gridarta/?rev=8858&view=rev Author: akirschbaum Date: 2011-03-08 19:33:17 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Fix pointless Javadoc links. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java 2011-03-08 19:31:19 UTC (rev 8857) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java 2011-03-08 19:33:17 UTC (rev 8858) @@ -197,7 +197,7 @@ void insertAfter(@NotNull G node); /** - * Returns the environment {@link GameObject} if this game object is in the + * Returns the environment game object if this game object is in the * inventory or <code>null</code>. * @return the game object this game object is part of or <code>null</code> */ Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java 2011-03-08 19:31:19 UTC (rev 8857) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java 2011-03-08 19:33:17 UTC (rev 8858) @@ -158,8 +158,8 @@ } /** - * Creates a new {@link SavedSquares} instance having the same contents as - * this instance, then forgets all saves squares in this instance. + * Creates a new instance having the same contents as this instance, then + * forgets all saves squares in this instance. * @return the new instance */ @NotNull Modified: trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java 2011-03-08 19:31:19 UTC (rev 8857) +++ trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java 2011-03-08 19:33:17 UTC (rev 8858) @@ -41,7 +41,7 @@ private final GameObjectMatcher gameObjectMatcher; /** - * Create a {@link NotGameObjectMatcher}. + * Creates a new instance. * @param gameObjectMatcher the matcher to negate */ public NotGameObjectMatcher(@NotNull final GameObjectMatcher gameObjectMatcher) { Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2011-03-08 19:31:19 UTC (rev 8857) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2011-03-08 19:33:17 UTC (rev 8858) @@ -255,7 +255,7 @@ } /** - * Returns the {@link MapViewsManager} instance for a {@link MapControl}. + * Returns the {@link MapViews} instance for a {@link MapControl}. * @param mapControl the map control * @return the map views */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-08 19:35:57
|
Revision: 8859 http://gridarta.svn.sourceforge.net/gridarta/?rev=8859&view=rev Author: akirschbaum Date: 2011-03-08 19:35:50 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Simplify expressions. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2011-03-08 19:33:17 UTC (rev 8858) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2011-03-08 19:35:50 UTC (rev 8859) @@ -297,7 +297,7 @@ */ @Override public boolean isMatching(@NotNull final G gameObject) { - return activeTab == null ? false : activeTab.isMatching(gameObject); + return activeTab != null && activeTab.isMatching(gameObject); } /** Modified: trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2011-03-08 19:33:17 UTC (rev 8858) +++ trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2011-03-08 19:35:50 UTC (rev 8859) @@ -44,7 +44,7 @@ */ public static boolean getBoolean(@NotNull final ActionBuilder actionBuilder, @NotNull final String key) { final String value = actionBuilder.getString(key); - return value == null ? false : Boolean.parseBoolean(value); + return value != null && Boolean.parseBoolean(value); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |