You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-05-15 22:09:46
|
Revision: 7785 http://gridarta.svn.sourceforge.net/gridarta/?rev=7785&view=rev Author: akirschbaum Date: 2010-05-15 22:09:39 +0000 (Sat, 15 May 2010) Log Message: ----------- Fix crash when starting the editor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 21:29:49 UTC (rev 7784) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 22:09:39 UTC (rev 7785) @@ -139,7 +139,12 @@ @NotNull @Override public NamedFilterConfig createConfig() { - return new NamedFilterConfig(this); + final NamedFilterConfig filterConfig = new NamedFilterConfig(this); + for (final String name : subFilters.keySet()) { + fireEvent(NamedFilterChangeType.ADD, name, subFilters.get(name)); + } + resetConfig(filterConfig); + return filterConfig; } /** Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 21:29:49 UTC (rev 7784) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 22:09:39 UTC (rev 7785) @@ -104,7 +104,6 @@ */ public NamedFilterConfig(@NotNull final NamedFilter owner) { super(owner); - owner.resetConfig(this); owner.addFilterListener(namedFilterListener); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 21:29:56
|
Revision: 7784 http://gridarta.svn.sourceforge.net/gridarta/?rev=7784&view=rev Author: akirschbaum Date: 2010-05-15 21:29:49 +0000 (Sat, 15 May 2010) Log Message: ----------- Accelerate code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 21:02:11 UTC (rev 7783) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 21:29:49 UTC (rev 7784) @@ -21,9 +21,11 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Map; import javax.swing.JComponent; import javax.swing.JMenu; import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterChangeType; import net.sf.gridarta.model.filter.NamedFilterConfig; @@ -60,8 +62,8 @@ private void populateComponent(@NotNull final JComponent component) { final FilterComponent filterComponent = new FilterComponent(component, config); - for (final String name : config.getFilter().getSubFilters().keySet()) { - filterComponent.addFilter(name, config.getConfig(name)); + for (final Map.Entry<String, FilterConfig<?, ?>> entry : config.getEntries().entrySet()) { + filterComponent.addFilter(entry.getKey(), entry.getValue()); } components.add(filterComponent); } Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-15 21:02:11 UTC (rev 7783) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-15 21:29:49 UTC (rev 7784) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.filter; +import java.util.Map; import org.jdom.Content; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -53,8 +54,10 @@ final Element inverted = new Element("inverted"); inverted.addContent(Boolean.toString(filterConfig.isInverted())); result.addContent(inverted); - for (final String key : filterConfig.getFilter().getSubFilters().keySet()) { - final Content filterValue = toXML(filterConfig.getConfig(key)); + for (final Map.Entry<String, FilterConfig<?, ?>> entry : filterConfig.getEntries().entrySet()) { + final String key = entry.getKey(); + final FilterConfig<?, ?> subFilterConfig = entry.getValue(); + final Content filterValue = toXML(subFilterConfig); final Element subfilter = new Element("subfilter"); final Element fName = new Element("name"); fName.addContent(key); Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 21:02:11 UTC (rev 7783) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 21:29:49 UTC (rev 7784) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.filter; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import net.sf.gridarta.model.gameobject.GameObject; @@ -214,13 +213,4 @@ return !match(filterOutConfig, gameObject); } - /** - * Returns all sub-{@link Filter Filters}. - * @return the sub-filters - */ - @NotNull - public Map<String, Filter<?, ?>> getSubFilters() { - return Collections.unmodifiableMap(subFilters); - } - } // class NamedFilter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 21:02:17
|
Revision: 7783 http://gridarta.svn.sourceforge.net/gridarta/?rev=7783&view=rev Author: akirschbaum Date: 2010-05-15 21:02:11 +0000 (Sat, 15 May 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 20:57:33 UTC (rev 7782) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 21:02:11 UTC (rev 7783) @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Map; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Filter configuration of {@link NamedGameObjectMatcherFilter} instances. @@ -30,6 +31,7 @@ */ public class NamedGameObjectMatcherFilterConfig extends AbstractFilterConfig<NamedGameObjectMatcherFilter, NamedGameObjectMatcherFilterConfig> { + @NotNull private final Map<String, String> properties = new HashMap<String, String>(); /** @@ -49,9 +51,9 @@ return this; } - public void setProperty(final String name, final String value) { + public void setProperty(@NotNull final String name, @NotNull final String value) { final String oldValue = properties.get(name); - if (oldValue == null ? value == null : oldValue.equals(value)) { + if (oldValue != null && oldValue.equals(value)) { return; } @@ -59,10 +61,12 @@ fireEvent(FilterConfigChangeType.CHANGE, this); } - public String getProperty(final String name) { + @Nullable + public String getProperty(@NotNull final String name) { return properties.get(name); } + @NotNull public Iterable<String> getProperties() { return Collections.unmodifiableSet(properties.keySet()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:57:39
|
Revision: 7782 http://gridarta.svn.sourceforge.net/gridarta/?rev=7782&view=rev Author: akirschbaum Date: 2010-05-15 20:57:33 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove redundant condition. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:56:52 UTC (rev 7781) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:57:33 UTC (rev 7782) @@ -116,7 +116,7 @@ boolean didMatch = false; for (final String name : subFilters.keySet()) { final FilterConfig<?, ?> filterConfig = config.getConfig(name); - if (filterConfig != null && filterConfig.reset()) { + if (filterConfig.reset()) { didMatch = true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:56:58
|
Revision: 7781 http://gridarta.svn.sourceforge.net/gridarta/?rev=7781&view=rev Author: akirschbaum Date: 2010-05-15 20:56:52 +0000 (Sat, 15 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:55:12 UTC (rev 7780) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:56:52 UTC (rev 7781) @@ -72,24 +72,26 @@ /** {@inheritDoc} */ @Override public void nameFilterChanged(@NotNull final NamedFilterChangeType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { - if (type == NamedFilterChangeType.REMOVE) { - final FilterConfig<?, ?> myCfg = map.get(filterName); - if (myCfg != null) { - myCfg.removeConfigChangeListener(filterConfigListener); + switch (type) { + case REMOVE: + final FilterConfig<?, ?> oldConfig = map.get(filterName); + if (oldConfig != null) { + oldConfig.removeConfigChangeListener(filterConfigListener); } if (log.isDebugEnabled()) { log.debug(this + " removing config for " + filterName, new Exception()); } map.remove(filterName); - } + break; - if (type == NamedFilterChangeType.ADD) { - final FilterConfig<?, ?> myCfg = filter.createConfig(); - myCfg.addConfigChangeListener(filterConfigListener); + case ADD: + final FilterConfig<?, ?> newConfig = filter.createConfig(); + newConfig.addConfigChangeListener(filterConfigListener); if (log.isDebugEnabled()) { log.debug(this + " adding config for " + filterName, new Exception()); } - map.put(filterName, myCfg); + map.put(filterName, newConfig); + break; } fireEvent(FilterConfigChangeType.CHANGE, NamedFilterConfig.this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:55:19
|
Revision: 7780 http://gridarta.svn.sourceforge.net/gridarta/?rev=7780&view=rev Author: akirschbaum Date: 2010-05-15 20:55:12 +0000 (Sat, 15 May 2010) Log Message: ----------- Rename class name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterChangeType.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:53:54 UTC (rev 7779) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -25,8 +25,8 @@ import javax.swing.JMenu; import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.NamedFilter; +import net.sf.gridarta.model.filter.NamedFilterChangeType; import net.sf.gridarta.model.filter.NamedFilterConfig; -import net.sf.gridarta.model.filter.NamedFilterEventType; import net.sf.gridarta.model.filter.NamedFilterListener; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -89,7 +89,7 @@ * {@inheritDoc} */ @Override - public void nameFilterChanged(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { + public void nameFilterChanged(@NotNull final NamedFilterChangeType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { switch (type) { case ADD: for (final FilterComponent filterComponent : components) { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:53:54 UTC (rev 7779) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -154,7 +154,7 @@ } subFilters.put(name, filter); - fireEvent(NamedFilterEventType.ADD, name, filter); + fireEvent(NamedFilterChangeType.ADD, name, filter); } /** @@ -167,7 +167,7 @@ return; } - fireEvent(NamedFilterEventType.REMOVE, name, filter); + fireEvent(NamedFilterChangeType.REMOVE, name, filter); } /** @@ -176,7 +176,7 @@ * @param filterName the name of the sub-filter that has changed * @param filter the sub-filter that has changed */ - private void fireEvent(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { + private void fireEvent(@NotNull final NamedFilterChangeType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { for (final NamedFilterListener listener : listenerList.getListeners()) { listener.nameFilterChanged(type, filterName, filter); } Copied: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterChangeType.java (from rev 7779, trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterChangeType.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterChangeType.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -0,0 +1,32 @@ +/* + * 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.filter; + +/** + * Enumeration of event types of NamedFilterEvent. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public enum NamedFilterChangeType { + + ADD, + + REMOVE + +} // enum NamedFilterChangeType Property changes on: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterChangeType.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:53:54 UTC (rev 7779) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -71,8 +71,8 @@ /** {@inheritDoc} */ @Override - public void nameFilterChanged(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { - if (type == NamedFilterEventType.REMOVE) { + public void nameFilterChanged(@NotNull final NamedFilterChangeType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { + if (type == NamedFilterChangeType.REMOVE) { final FilterConfig<?, ?> myCfg = map.get(filterName); if (myCfg != null) { myCfg.removeConfigChangeListener(filterConfigListener); @@ -83,7 +83,7 @@ map.remove(filterName); } - if (type == NamedFilterEventType.ADD) { + if (type == NamedFilterChangeType.ADD) { final FilterConfig<?, ?> myCfg = filter.createConfig(); myCfg.addConfigChangeListener(filterConfigListener); if (log.isDebugEnabled()) { Deleted: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java 2010-05-15 20:53:54 UTC (rev 7779) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -1,32 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -/** - * Enumeration of event types of NamedFilterEvent. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum NamedFilterEventType { - - ADD, - - REMOVE - -} // enum NamedFilterEventType Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 20:53:54 UTC (rev 7779) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 20:55:12 UTC (rev 7780) @@ -34,6 +34,6 @@ * @param filterName the name of the sub-filter that has changed * @param filter the sub-filter that has changed */ - void nameFilterChanged(@NotNull NamedFilterEventType type, @NotNull String filterName, @NotNull Filter<?, ?> filter); + void nameFilterChanged(@NotNull NamedFilterChangeType type, @NotNull String filterName, @NotNull Filter<?, ?> filter); } // class NamedFilterListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:54:00
|
Revision: 7779 http://gridarta.svn.sourceforge.net/gridarta/?rev=7779&view=rev Author: akirschbaum Date: 2010-05-15 20:53:54 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove NamedFilterEvent. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -23,9 +23,10 @@ import java.util.Collection; import javax.swing.JComponent; import javax.swing.JMenu; +import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; -import net.sf.gridarta.model.filter.NamedFilterEvent; +import net.sf.gridarta.model.filter.NamedFilterEventType; import net.sf.gridarta.model.filter.NamedFilterListener; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -88,22 +89,21 @@ * {@inheritDoc} */ @Override - public void nameFilterChanged(@NotNull final NamedFilterEvent event) { - final String name = event.getFilterName(); - switch (event.getType()) { + public void nameFilterChanged(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { + switch (type) { case ADD: for (final FilterComponent filterComponent : components) { if (log.isDebugEnabled()) { - log.debug("set sub filter enabled(), calling on " + name); + log.debug("set sub filter enabled(), calling on " + filterName); } - config.setSubFilterEnabled(name, false); - filterComponent.addFilter(name, config.getConfig(name)); + config.setSubFilterEnabled(filterName, false); + filterComponent.addFilter(filterName, config.getConfig(filterName)); } break; case REMOVE: for (final FilterComponent filterComponent : components) { - filterComponent.removeFilter(name); + filterComponent.removeFilter(filterName); } break; } Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -154,7 +154,7 @@ } subFilters.put(name, filter); - fireEvent(new NamedFilterEvent(NamedFilterEventType.ADD, this, name, filter)); + fireEvent(NamedFilterEventType.ADD, name, filter); } /** @@ -167,16 +167,18 @@ return; } - fireEvent(new NamedFilterEvent(NamedFilterEventType.REMOVE, this, name, filter)); + fireEvent(NamedFilterEventType.REMOVE, name, filter); } /** * Notifies all listeners about a change. - * @param event the change event + * @param type the change type + * @param filterName the name of the sub-filter that has changed + * @param filter the sub-filter that has changed */ - private void fireEvent(@NotNull final NamedFilterEvent event) { + private void fireEvent(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { for (final NamedFilterListener listener : listenerList.getListeners()) { - listener.nameFilterChanged(event); + listener.nameFilterChanged(type, filterName, filter); } } Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -71,25 +71,25 @@ /** {@inheritDoc} */ @Override - public void nameFilterChanged(final NamedFilterEvent event) { - if (event.getType() == NamedFilterEventType.REMOVE) { - final FilterConfig<?, ?> myCfg = map.get(event.getFilterName()); + public void nameFilterChanged(@NotNull final NamedFilterEventType type, @NotNull final String filterName, @NotNull final Filter<?, ?> filter) { + if (type == NamedFilterEventType.REMOVE) { + final FilterConfig<?, ?> myCfg = map.get(filterName); if (myCfg != null) { myCfg.removeConfigChangeListener(filterConfigListener); } if (log.isDebugEnabled()) { - log.debug(this + " removing config for " + event.getFilterName(), new Exception()); + log.debug(this + " removing config for " + filterName, new Exception()); } - map.remove(event.getFilterName()); + map.remove(filterName); } - if (event.getType() == NamedFilterEventType.ADD) { - final FilterConfig<?, ?> myCfg = event.getFilter().createConfig(); + if (type == NamedFilterEventType.ADD) { + final FilterConfig<?, ?> myCfg = filter.createConfig(); myCfg.addConfigChangeListener(filterConfigListener); if (log.isDebugEnabled()) { - log.debug(this + " adding config for " + event.getFilterName(), new Exception()); + log.debug(this + " adding config for " + filterName, new Exception()); } - map.put(event.getFilterName(), myCfg); + map.put(filterName, myCfg); } fireEvent(FilterConfigChangeType.CHANGE, NamedFilterConfig.this); } Deleted: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -1,67 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -import java.util.EventObject; - -/** - * Event object that's fired on named filters. - * @author tchize - */ -public class NamedFilterEvent extends EventObject { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1; - - private final NamedFilterEventType type; - - private final NamedFilter owner; - - private final String filterName; - - private final Filter<?, ?> filter; - - public NamedFilterEvent(final NamedFilterEventType type, final NamedFilter owner, final String filterName, final Filter<?, ?> filter) { - super(owner); // XXX verify that event source is correct - this.type = type; - this.owner = owner; - this.filterName = filterName; - this.filter = filter; - } - - public Filter<?, ?> getFilter() { - return filter; - } - - public String getFilterName() { - return filterName; - } - - public NamedFilter getOwner() { - return owner; - } - - public NamedFilterEventType getType() { - return type; - } - -} // class NamedFilterEvent Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -20,7 +20,7 @@ package net.sf.gridarta.model.filter; /** - * Enumeration of event types of {@link NamedFilterEvent}s. + * Enumeration of event types of NamedFilterEvent. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public enum NamedFilterEventType { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 20:40:11 UTC (rev 7778) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 20:53:54 UTC (rev 7779) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.filter; import java.util.EventListener; +import org.jetbrains.annotations.NotNull; /** * Interface for listeners interested in {@link NamedFilter} related events. @@ -29,8 +30,10 @@ /** * The filter has changed. - * @param event the changed information + * @param type the change type + * @param filterName the name of the sub-filter that has changed + * @param filter the sub-filter that has changed */ - void nameFilterChanged(NamedFilterEvent event); + void nameFilterChanged(@NotNull NamedFilterEventType type, @NotNull String filterName, @NotNull Filter<?, ?> filter); } // class NamedFilterListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:40:18
|
Revision: 7778 http://gridarta.svn.sourceforge.net/gridarta/?rev=7778&view=rev Author: akirschbaum Date: 2010-05-15 20:40:11 +0000 (Sat, 15 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:34:43 UTC (rev 7777) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:40:11 UTC (rev 7778) @@ -160,11 +160,7 @@ * @return whether the sub-filter is enabled */ public boolean isSubFilterEnabled(@NotNull final String name) { - final FilterConfig<?, ?> f = getConfig(name); - if (log.isDebugEnabled()) { - log.debug(this + " isSubFilterEnabled(" + name + ") config is " + f); - } - return f != null && f.isEnabled(); + return getConfig(name).isEnabled(); } /** @@ -177,9 +173,7 @@ log.debug("setSubFilterEnabled(" + name + ", " + enabled); } - final FilterConfig<?, ?> config = getConfig(name); - assert config != null; // filter config should have been created in listener - config.setEnabled(enabled); + getConfig(name).setEnabled(enabled); fireEvent(FilterConfigChangeType.CHANGE, this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:34:49
|
Revision: 7777 http://gridarta.svn.sourceforge.net/gridarta/?rev=7777&view=rev Author: akirschbaum Date: 2010-05-15 20:34:43 +0000 (Sat, 15 May 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:32:31 UTC (rev 7776) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:34:43 UTC (rev 7777) @@ -41,13 +41,16 @@ // TODO fix potential concurrency issues private boolean inverted = false; + @NotNull private final Map<String, FilterConfig<?, ?>> map = new HashMap<String, FilterConfig<?, ?>>(); /** * The Logger for printing log messages. */ + @NotNull private static final Category log = Logger.getLogger(NamedFilterConfig.class); + @NotNull private final FilterConfigListener filterConfigListener = new FilterConfigListener() { /** {@inheritDoc} */ @@ -63,6 +66,7 @@ }; + @NotNull private final NamedFilterListener namedFilterListener = new NamedFilterListener() { /** {@inheritDoc} */ @@ -141,8 +145,13 @@ * @param name the sub-filter's name * @return the sub-filter's filter config */ - public FilterConfig<?, ?> getConfig(final String name) { - return map.get(name); + @NotNull + public FilterConfig<?, ?> getConfig(@NotNull final String name) { + final FilterConfig<?, ?> filterConfig = map.get(name); + if (filterConfig == null) { + throw new IllegalArgumentException(); + } + return filterConfig; } /** @@ -150,7 +159,7 @@ * @param name the sub-filter's name * @return whether the sub-filter is enabled */ - public boolean isSubFilterEnabled(final String name) { + public boolean isSubFilterEnabled(@NotNull final String name) { final FilterConfig<?, ?> f = getConfig(name); if (log.isDebugEnabled()) { log.debug(this + " isSubFilterEnabled(" + name + ") config is " + f); @@ -163,7 +172,7 @@ * @param name the sub-filter's name * @param enabled whether the sub-filter is enabled */ - public void setSubFilterEnabled(final String name, final boolean enabled) { + public void setSubFilterEnabled(@NotNull final String name, final boolean enabled) { if (log.isDebugEnabled()) { log.debug("setSubFilterEnabled(" + name + ", " + enabled); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:32:40
|
Revision: 7776 http://gridarta.svn.sourceforge.net/gridarta/?rev=7776&view=rev Author: akirschbaum Date: 2010-05-15 20:32:31 +0000 (Sat, 15 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:31:32 UTC (rev 7775) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:32:31 UTC (rev 7776) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.filter.NamedFilterEvent; -import net.sf.gridarta.model.filter.NamedFilterEventType; import net.sf.gridarta.model.filter.NamedFilterListener; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -91,7 +90,8 @@ @Override public void nameFilterChanged(@NotNull final NamedFilterEvent event) { final String name = event.getFilterName(); - if (event.getType() == NamedFilterEventType.ADD) { + switch (event.getType()) { + case ADD: for (final FilterComponent filterComponent : components) { if (log.isDebugEnabled()) { log.debug("set sub filter enabled(), calling on " + name); @@ -99,10 +99,13 @@ config.setSubFilterEnabled(name, false); filterComponent.addFilter(name, config.getConfig(name)); } - } else if (event.getType() == NamedFilterEventType.REMOVE) { + break; + + case REMOVE: for (final FilterComponent filterComponent : components) { filterComponent.removeFilter(name); } + break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:31:38
|
Revision: 7775 http://gridarta.svn.sourceforge.net/gridarta/?rev=7775&view=rev Author: akirschbaum Date: 2010-05-15 20:31:32 +0000 (Sat, 15 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:29:44 UTC (rev 7774) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:31:32 UTC (rev 7775) @@ -162,12 +162,11 @@ * @param name the name of the sub-filter */ public void removeFilter(@NotNull final String name) { - if (!subFilters.containsKey(name)) { + final Filter<?, ?> filter = subFilters.remove(name); + if (filter == null) { return; } - final Filter<?, ?> filter = subFilters.get(name); - subFilters.remove(name); fireEvent(new NamedFilterEvent(NamedFilterEventType.REMOVE, this, name, filter)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:29:50
|
Revision: 7774 http://gridarta.svn.sourceforge.net/gridarta/?rev=7774&view=rev Author: akirschbaum Date: 2010-05-15 20:29:44 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove redundant parameter. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:22:04 UTC (rev 7773) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 20:29:44 UTC (rev 7774) @@ -96,7 +96,7 @@ if (log.isDebugEnabled()) { log.debug("set sub filter enabled(), calling on " + name); } - config.setSubFilterEnabled(name, event.getFilter(), false); + config.setSubFilterEnabled(name, false); filterComponent.addFilter(name, config.getConfig(name)); } } else if (event.getType() == NamedFilterEventType.REMOVE) { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:22:04 UTC (rev 7773) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:29:44 UTC (rev 7774) @@ -74,9 +74,8 @@ * @param config the filter config to reset */ public void resetConfig(@NotNull final NamedFilterConfig config) { - for (final Map.Entry<String, Filter<?, ?>> entry : subFilters.entrySet()) { - final Filter<?, ?> value = entry.getValue(); - config.setSubFilterEnabled(entry.getKey(), value, false); + for (final String name : subFilters.keySet()) { + config.setSubFilterEnabled(name, false); } } Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:22:04 UTC (rev 7773) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:29:44 UTC (rev 7774) @@ -163,25 +163,13 @@ * @param name the sub-filter's name * @param enabled whether the sub-filter is enabled */ - public void setSubFilterEnabled(final String name, final Filter<?, ?> filter, final boolean enabled) { + public void setSubFilterEnabled(final String name, final boolean enabled) { if (log.isDebugEnabled()) { - log.debug("setSubFilterEnabled(" + name + ", " + filter + ", " + enabled); + log.debug("setSubFilterEnabled(" + name + ", " + enabled); } - FilterConfig<?, ?> config = getConfig(name); - if (config == null) { - if (log.isDebugEnabled()) { - log.debug(this + "Creating a new config for " + name); - } - - config = filter.createConfig(); - if (log.isDebugEnabled()) { - log.debug(this + "config id " + config); - } - - map.put(name, config); - config.addConfigChangeListener(filterConfigListener); - } + final FilterConfig<?, ?> config = getConfig(name); + assert config != null; // filter config should have been created in listener config.setEnabled(enabled); fireEvent(FilterConfigChangeType.CHANGE, this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:22:10
|
Revision: 7773 http://gridarta.svn.sourceforge.net/gridarta/?rev=7773&view=rev Author: akirschbaum Date: 2010-05-15 20:22:04 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove FilterVisitor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/model/filter/Filter.java trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/FilterVisitor.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -24,7 +24,6 @@ import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.filter.FilterConfigVisitor; -import net.sf.gridarta.model.filter.FilterVisitor; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.filter.NamedGameObjectMatcherFilterConfig; import net.sf.japi.swing.action.ActionBuilder; @@ -52,7 +51,7 @@ private JMenuItem menuItem = null; /** - * The {@link FilterVisitor} for creating the menu item. + * The {@link FilterConfigVisitor} for creating the menu item. */ @NotNull private final FilterConfigVisitor filterVisitor = new FilterConfigVisitor() { @@ -90,4 +89,4 @@ return menuItem; } -} // implements FilterVisitor +} // class MenuItemCreator Modified: trunk/src/app/net/sf/gridarta/model/filter/Filter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -74,11 +74,4 @@ @NotNull C createConfig(); - /** - * Visits the appropriate <code>visit()</code> function of a {@link - * FilterVisitor}. - * @param visitor the visitor to call - */ - void accept(@NotNull FilterVisitor visitor); - } // interface Filter Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -82,8 +82,8 @@ }; /** - * The {@link FilterVisitor} for converting {@link FilterConfig}instances - * from XML representation. + * The {@link FilterConfigVisitor} for converting {@link FilterConfig} + * instances from XML representation. */ @NotNull private FilterConfigVisitor fromXMLFilterConfigVisitor = new FilterConfigVisitor() { Deleted: trunk/src/app/net/sf/gridarta/model/filter/FilterVisitor.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterVisitor.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterVisitor.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -1,42 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -import org.jetbrains.annotations.NotNull; - -/** - * Interface for visitors of {@link Filter}s. - * @author Andreas Kirschbaum - */ -public interface FilterVisitor { - - /** - * Visits a {@link NamedFilter} instance. - * @param filter the instance - */ - void visit(@NotNull NamedFilter filter); - - /** - * Visits a {@link NamedGameObjectMatcherFilter} instance. - * @param filter the instance - */ - void visit(@NotNull NamedGameObjectMatcherFilter filter); - -} // interface FilterVisitor Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -199,14 +199,6 @@ } /** - * {@inheritDoc} - */ - @Override - public void accept(@NotNull final FilterVisitor visitor) { - visitor.visit(this); - } - - /** * Returns whether this filter matches a {@link GameObject}. * @param gameObject the game object * @param filterOutConfig the filter config to use Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 20:17:59 UTC (rev 7772) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 20:22:04 UTC (rev 7773) @@ -77,12 +77,4 @@ return new NamedGameObjectMatcherFilterConfig(this); } - /** - * {@inheritDoc} - */ - @Override - public void accept(@NotNull final FilterVisitor visitor) { - visitor.visit(this); - } - } // class NamedGameObjectMatcherFilter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 20:18:05
|
Revision: 7772 http://gridarta.svn.sourceforge.net/gridarta/?rev=7772&view=rev Author: akirschbaum Date: 2010-05-15 20:17:59 +0000 (Sat, 15 May 2010) Log Message: ----------- Update comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/Filter.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfigVisitor.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java Modified: trunk/src/app/net/sf/gridarta/model/filter/Filter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -38,11 +38,10 @@ * needs to. Unless {@link #hasGlobalMatch(FilterConfig)} returns * <code>true</code>, when a match occurred, this function is not called * with the remaining game objects on the map square and a reset is issued. - * @param config The filter configuration to use. - * @param gameObject The game object being analyzed on the map. - * @return <code>true</code> if it match the criteria, <code>false</code> - * otherwise. This value is ignored if <code>hasGlobalMatch()</code> - * returns <code>true</code>. + * @param config the filter configuration to use + * @param gameObject the game object being analyzed on the map + * @return whether it matches the criteria. This value is ignored if + * <code>hasGlobalMatch()</code> returns <code>true</code>. */ boolean match(@NotNull C config, @NotNull GameObject<?, ?, ?> gameObject); @@ -51,10 +50,8 @@ * perhaps, we are jumping on next one. If {@link #hasGlobalMatch(FilterConfig)} * returns <code>true</code>, the returning value is used to know if we had * a match. - * @param config The filter configuration to use. - * @return <code>true</code> if we had a global match on map square. - * <code>false</code> if we had a global mismatch or the filter does - * not use global match. + * @param config the filter configuration to use + * @return whether we had a global match on map square */ boolean reset(@NotNull C config); @@ -64,16 +61,15 @@ * of a match, the return value of {@link #match(FilterConfig,GameObject)} * is ignored and the returning value of {@link #reset(FilterConfig)} is * used as replacement. This should mainly used by complex analyze filters. - * @param config The filter configuration to use. - * @return <code>true</code> if match can be decided only when all game - * objects on a map square are analyzed. <code>false</code> - * otherwise. + * @param config the filter configuration to use + * @return whether a match can be decided only when all game objects on a + * map square are analyzed */ boolean hasGlobalMatch(@NotNull C config); /** - * Create a new {@link FilterConfig} instance for this filter. - * @return The new filter config instance. + * Creates a new {@link FilterConfig} instance for this filter. + * @return the new filter config instance */ @NotNull C createConfig(); Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -36,26 +36,26 @@ F getFilter(); /** - * Enable or disable the filter. - * @param enabled Whether the filter should be enabled. + * Enables or disables the filter. + * @param enabled whether the filter should be enabled */ void setEnabled(boolean enabled); /** - * Return whether the filter is enabled. - * @return Whether the filter is enabled. + * Returns whether the filter is enabled. + * @return whether the filter is enabled */ boolean isEnabled(); /** - * Add a {@link FilterConfigListener} to be notified about changes. - * @param listener The config listener to add. + * Adds a {@link FilterConfigListener} to be notified about changes. + * @param listener the listener */ void addConfigChangeListener(FilterConfigListener listener); /** - * Remove a {@link FilterConfigListener} to be notified about changes. - * @param listener The config listener to remove. + * Removes a {@link FilterConfigListener} to be notified about changes. + * @param listener the listener */ void removeConfigChangeListener(FilterConfigListener listener); @@ -70,24 +70,16 @@ * Tells whether we got a match on specific {@link GameObject}. The analysis * tool will call this function with every game object on a given map * square. The match function is responsible for analyzing inventories if it - * needs to. Unless {@link #hasGlobalMatch()} returns - * <code>true</code>, when a match occurred, this function is not called - * with the remaining game objects on the map square and a reset is issued. - * @param gameObject The game object being analyzed on the map. - * @return <code>true</code> if it match the criteria, <code>false</code> - * otherwise. This value is ignored if <code>hasGlobalMatch()</code> - * returns <code>true</code>. + * needs to. + * @param gameObject the game object being analyzed on the map + * @return whether it matches the criteria */ boolean match(@NotNull GameObject<?, ?, ?> gameObject); /** - * This tells the filter we have finished with current map square and, - * perhaps, we are jumping on next one. If {@link #hasGlobalMatch()} - * returns <code>true</code>, the returning value is used to know if we had - * a match. - * @return <code>true</code> if we had a global match on map square. - * <code>false</code> if we had a global mismatch or the filter does - * not use global match. + * Tells the filter we have finished with current map square and, perhaps, + * we are jumping on next one. + * @return whether we had a global match on the map square */ boolean reset(); Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -20,15 +20,24 @@ package net.sf.gridarta.model.filter; /** - * Enumeration of Configuration event types. + * Types of {@link FilterConfig} change types. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public enum FilterConfigChangeType { + /** + * The filter has been enabled. + */ ENABLE, + /** + * The filter has been disabled. + */ DISABLE, + /** + * The filter config has changed. + */ CHANGE } // enum FilterConfigChangeType Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; /** - * Interface for listeners interesed in {@link FilterConfig} related changes. + * Interface for listeners interested in {@link FilterConfig} related changes. * @author tchize * @author Andreas Kirschbaum */ Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigVisitor.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigVisitor.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfigVisitor.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; /** - * Interface for visitors of {@link FilterConfig}s. + * Interface for visitors of {@link FilterConfig filter configs}. * @author Andreas Kirschbaum */ public interface FilterConfigVisitor { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -30,11 +30,12 @@ import org.jetbrains.annotations.NotNull; /** - * Filter that aggregates named filters. <p/> This filter aggregates a list of - * named filters. Each sub-filter can be (dis)enabled. The names of filters are - * hard-coded for now. They may need to be loaded from, e.g., an XML file - * later. + * A {@link Filter} that aggregates named filters. + * <p/> + * This filter aggregates a list of named sub-filters. Each sub-filter can be + * (dis)enabled. * @author tchize + * @author Andreas Kirschbaum */ public class NamedFilter implements Filter<NamedFilter, NamedFilterConfig> { @@ -44,15 +45,22 @@ @NotNull private static final Category log = Logger.getLogger(NamedFilter.class); + /** + * The sub-filters. Maps filter name to {@link Filter} instance. + */ @NotNull private final Map<String, Filter<?, ?>> subFilters; + /** + * The {@link NamedFilterListener NamedFilterListeners} to notify about + * changes. + */ @NotNull private final EventListenerList2<NamedFilterListener> listenerList = new EventListenerList2<NamedFilterListener>(NamedFilterListener.class); /** - * Create a new NameFilterList. - * @param matchers the matchers to use + * Creates a new instance. + * @param matchers the matchers to create filters from */ public NamedFilter(@NotNull final Iterable<NamedGameObjectMatcher> matchers) { subFilters = new LinkedHashMap<String, Filter<?, ?>>(); @@ -61,6 +69,10 @@ } } + /** + * Disables all sub-filters. + * @param config the filter config to reset + */ public void resetConfig(@NotNull final NamedFilterConfig config) { for (final Map.Entry<String, Filter<?, ?>> entry : subFilters.entrySet()) { final Filter<?, ?> value = entry.getValue(); @@ -132,6 +144,11 @@ return new NamedFilterConfig(this); } + /** + * Adds a sub-{@link Filter}. + * @param name the name of the sub-filter + * @param filter the sub-filter + */ public void addFilter(@NotNull final String name, @NotNull final Filter<?, ?> filter) { if (subFilters.containsKey(name)) { return; @@ -141,6 +158,10 @@ fireEvent(new NamedFilterEvent(NamedFilterEventType.ADD, this, name, filter)); } + /** + * Removes a sub-filter. + * @param name the name of the sub-filter + */ public void removeFilter(@NotNull final String name) { if (!subFilters.containsKey(name)) { return; @@ -151,16 +172,28 @@ fireEvent(new NamedFilterEvent(NamedFilterEventType.REMOVE, this, name, filter)); } + /** + * Notifies all listeners about a change. + * @param event the change event + */ private void fireEvent(@NotNull final NamedFilterEvent event) { for (final NamedFilterListener listener : listenerList.getListeners()) { listener.nameFilterChanged(event); } } + /** + * Adds a {@link NamedFilterListener} to be notified about changes. + * @param listener the listener + */ public void addFilterListener(@NotNull final NamedFilterListener listener) { listenerList.add(listener); } + /** + * Removes a {@link NamedFilterListener} to be notified about changes. + * @param listener the listener + */ public void removeFilterListener(@NotNull final NamedFilterListener listener) { listenerList.remove(listener); } @@ -173,6 +206,12 @@ visitor.visit(this); } + /** + * Returns whether this filter matches a {@link GameObject}. + * @param gameObject the game object + * @param filterOutConfig the filter config to use + * @return whether this filter matches the game object + */ public boolean canShow(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final NamedFilterConfig filterOutConfig) { reset(filterOutConfig); if (hasGlobalMatch(filterOutConfig)) { @@ -183,6 +222,10 @@ return !match(filterOutConfig, gameObject); } + /** + * Returns all sub-{@link Filter Filters}. + * @return the sub-filters + */ @NotNull public Map<String, Filter<?, ?>> getSubFilters() { return Collections.unmodifiableMap(subFilters); Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -27,11 +27,17 @@ import org.jetbrains.annotations.NotNull; /** - * Filter configuration that has a name. + * A {@link FilterConfig} that has a name. * @author tchize + * @author Andreas Kirschbaum */ public class NamedFilterConfig extends AbstractFilterConfig<NamedFilter, NamedFilterConfig> { + /** + * Whether the filter should match if all sub-filters match + * (<code>true</code>) or if at least one sub-filter does not match + * (<code>false></code>). + */ // TODO fix potential concurrency issues private boolean inverted = false; @@ -105,10 +111,23 @@ return this; } + /** + * Returns whether the filter should match if all sub-filters match or if at + * least one sub-filter does not match. + * @return whether the filter matches if all sub-filters match + * (<code>true</code>) or if any does not match + * (<code>false</code>) + */ public boolean isInverted() { return inverted; } + /** + * Sets whether the filter should match if all sub-filters match or if at + * least one sub-filter does not match. + * @param inverted whether the filter matches if all sub-filters match + * (<code>true</code>) or if any does not match (<code>false</code>) + */ public void setInverted(final boolean inverted) { if (this.inverted == inverted) { return; @@ -117,10 +136,20 @@ fireEvent(FilterConfigChangeType.CHANGE, this); } + /** + * Returns the {@link FilterConfig} for a sub-filter. + * @param name the sub-filter's name + * @return the sub-filter's filter config + */ public FilterConfig<?, ?> getConfig(final String name) { return map.get(name); } + /** + * Returns whether a sub-filter is enabled. + * @param name the sub-filter's name + * @return whether the sub-filter is enabled + */ public boolean isSubFilterEnabled(final String name) { final FilterConfig<?, ?> f = getConfig(name); if (log.isDebugEnabled()) { @@ -129,6 +158,11 @@ return f != null && f.isEnabled(); } + /** + * Sets whether a sub-filter is enabled. + * @param name the sub-filter's name + * @param enabled whether the sub-filter is enabled + */ public void setSubFilterEnabled(final String name, final Filter<?, ?> filter, final boolean enabled) { if (log.isDebugEnabled()) { log.debug("setSubFilterEnabled(" + name + ", " + filter + ", " + enabled); Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -22,11 +22,15 @@ import java.util.EventListener; /** - * Listener for events on named filters. + * Interface for listeners interested in {@link NamedFilter} related events. * @author tchize */ public interface NamedFilterListener extends EventListener { + /** + * The filter has changed. + * @param event the changed information + */ void nameFilterChanged(NamedFilterEvent event); } // class NamedFilterListener Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -24,20 +24,20 @@ import org.jetbrains.annotations.NotNull; /** - * Implements a {@link Filter} which filters according to a {@link + * A {@link Filter} which filters according to a {@link * net.sf.gridarta.model.match.NamedGameObjectMatcher}. * @author Andreas Kirschbaum */ public class NamedGameObjectMatcherFilter implements Filter<NamedGameObjectMatcherFilter, NamedGameObjectMatcherFilterConfig> { /** - * The game object matcher to use. + * The {@link GameObjectMatcher} to use. */ @NotNull private final GameObjectMatcher matcher; /** - * Create a new instance. + * Creates a new instance. * @param matcher the game object matcher to use */ public NamedGameObjectMatcherFilter(@NotNull final GameObjectMatcher matcher) { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 20:17:59 UTC (rev 7772) @@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull; /** - * Simple filter configuration. + * Filter configuration of {@link NamedGameObjectMatcherFilter} instances. * @author tchize */ public class NamedGameObjectMatcherFilterConfig extends AbstractFilterConfig<NamedGameObjectMatcherFilter, NamedGameObjectMatcherFilterConfig> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 19:49:59
|
Revision: 7771 http://gridarta.svn.sourceforge.net/gridarta/?rev=7771&view=rev Author: akirschbaum Date: 2010-05-15 19:49:52 +0000 (Sat, 15 May 2010) Log Message: ----------- Rename class names. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java 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 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -33,9 +33,9 @@ import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.filter.FilterState; import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; -import net.sf.gridarta.model.filter.ConfigEventType; -import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.FilterConfigChangeType; +import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -131,18 +131,18 @@ this.mapViewSettings = mapViewSettings; this.smoothingRenderer = smoothingRenderer; init(); - final ConfigListener configListener = new ConfigListener() { + final FilterConfigListener filterConfigListener = new FilterConfigListener() { /** * {@inheritDoc} */ @Override - public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { + public void configChanged(@NotNull final FilterConfigChangeType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { forceRepaint(); } }; - this.filterControl.addConfigListener(configListener); + this.filterControl.addConfigListener(filterConfigListener); } /** Modified: trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -22,10 +22,10 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.ConfigEventType; -import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.FilterConfigChangeType; +import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.gameobject.GameObject; @@ -57,17 +57,17 @@ private final NamedFilterConfig[] highlightConfig; /** - * The {@link ConfigListener}s to notify. + * The {@link FilterConfigListener}s to notify. */ - private final EventListenerList2<ConfigListener> configListeners = new EventListenerList2<ConfigListener>(ConfigListener.class); + private final EventListenerList2<FilterConfigListener> configListeners = new EventListenerList2<FilterConfigListener>(FilterConfigListener.class); - private final ConfigListener configListener = new ConfigListener() { + private final FilterConfigListener filterConfigListener = new FilterConfigListener() { /** {@inheritDoc} */ @Override - public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { - for (final ConfigListener listener : configListeners.getListeners()) { - listener.configChanged(configEventType, filterConfig); + public void configChanged(@NotNull final FilterConfigChangeType filterConfigChangeType, @NotNull final FilterConfig<?, ?> filterConfig) { + for (final FilterConfigListener listener : configListeners.getListeners()) { + listener.configChanged(filterConfigChangeType, filterConfig); } } @@ -85,9 +85,9 @@ for (int i = 0; i < MAX_HIGHLIGHT; i++) { highlightConfig[i] = filterList.createConfig(); } - filterOutConfig.addConfigChangeListener(configListener); + filterOutConfig.addConfigChangeListener(filterConfigListener); for (int i = 0; i < MAX_HIGHLIGHT; i++) { - highlightConfig[i].addConfigChangeListener(configListener); + highlightConfig[i].addConfigChangeListener(filterConfigListener); } } @@ -95,7 +95,7 @@ * {@inheritDoc} */ @Override - public void addConfigListener(@NotNull final ConfigListener listener) { + public void addConfigListener(@NotNull final FilterConfigListener listener) { configListeners.add(listener); } @@ -103,7 +103,7 @@ * {@inheritDoc} */ @Override - public void removeConfigListener(@NotNull final ConfigListener listener) { + public void removeConfigListener(@NotNull final FilterConfigListener listener) { configListeners.remove(listener); } Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -21,8 +21,8 @@ import javax.swing.JMenu; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -35,16 +35,16 @@ int MAX_HIGHLIGHT = 3; /** - * Adds a {@link ConfigListener} to be notified about changes. + * Adds a {@link FilterConfigListener} to be notified about changes. * @param listener the config listener */ - void addConfigListener(@NotNull ConfigListener listener); + void addConfigListener(@NotNull FilterConfigListener listener); /** - * Removes a {@link ConfigListener} to be notified about changes. + * Removes a {@link FilterConfigListener} to be notified about changes. * @param listener the config listener */ - void removeConfigListener(@NotNull ConfigListener listener); + void removeConfigListener(@NotNull FilterConfigListener listener); void createMenuEntries(JMenu menu); Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -26,9 +26,9 @@ import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.filter.FilterState; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.ConfigEventType; -import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.FilterConfigChangeType; +import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; @@ -112,18 +112,18 @@ emptySquareIcon = systemIcons.getEmptySquareIcon(); this.mapViewSettings = mapViewSettings; this.isoMapSquareInfo = isoMapSquareInfo; - final ConfigListener configListener = new ConfigListener() { + final FilterConfigListener filterConfigListener = new FilterConfigListener() { /** * {@inheritDoc} */ @Override - public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { + public void configChanged(@NotNull final FilterConfigChangeType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { forceRepaint(); } }; - this.filterControl.addConfigListener(configListener); + this.filterControl.addConfigListener(filterConfigListener); } /** Modified: trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -45,7 +45,7 @@ /** * The registered listeners. */ - private final EventListenerList2<ConfigListener> listenerList = new EventListenerList2<ConfigListener>(ConfigListener.class); + private final EventListenerList2<FilterConfigListener> listenerList = new EventListenerList2<FilterConfigListener>(FilterConfigListener.class); /** * The {@link Filter} this filter config belongs to. @@ -83,7 +83,7 @@ if (log.isDebugEnabled()) { log.debug((enabled ? "enabling" : "disabling") + " filter " + this); } - fireEvent(enabled ? ConfigEventType.ENABLE : ConfigEventType.DISABLE, this); + fireEvent(enabled ? FilterConfigChangeType.ENABLE : FilterConfigChangeType.DISABLE, this); } /** @@ -96,12 +96,12 @@ /** * Notify all listeners that a {@link FilterConfig} has happened. - * @param configEventType the config event type + * @param filterConfigChangeType the config event type * @param filterConfig the changed filter config */ - protected void fireEvent(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { - for (final ConfigListener listener : listenerList.getListeners()) { - listener.configChanged(configEventType, filterConfig); + protected void fireEvent(@NotNull final FilterConfigChangeType filterConfigChangeType, @NotNull final FilterConfig<?, ?> filterConfig) { + for (final FilterConfigListener listener : listenerList.getListeners()) { + listener.configChanged(filterConfigChangeType, filterConfig); } } @@ -109,7 +109,7 @@ * {@inheritDoc} */ @Override - public void addConfigChangeListener(final ConfigListener listener) { + public void addConfigChangeListener(final FilterConfigListener listener) { listenerList.add(listener); } @@ -117,7 +117,7 @@ * {@inheritDoc} */ @Override - public void removeConfigChangeListener(final ConfigListener listener) { + public void removeConfigChangeListener(final FilterConfigListener listener) { listenerList.remove(listener); } Deleted: trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -1,34 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -/** - * Enumeration of Configuration event types. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum ConfigEventType { - - ENABLE, - - DISABLE, - - CHANGE - -} // enum ConfigEventType Deleted: trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -1,39 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -import java.util.EventListener; -import org.jetbrains.annotations.NotNull; - -/** - * Interface for listeners interesed in {@link FilterConfig} related changes. - * @author tchize - * @author Andreas Kirschbaum - */ -public interface ConfigListener extends EventListener { - - /** - * A {@link FilterConfig} has changed. - * @param configEventType the change type - * @param filterConfig the changed filter config - */ - void configChanged(@NotNull ConfigEventType configEventType, @NotNull FilterConfig<?, ?> filterConfig); - -} // interface ConfigListener Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -48,16 +48,16 @@ boolean isEnabled(); /** - * Add a {@link ConfigListener} to be notified about changes. + * Add a {@link FilterConfigListener} to be notified about changes. * @param listener The config listener to add. */ - void addConfigChangeListener(ConfigListener listener); + void addConfigChangeListener(FilterConfigListener listener); /** - * Remove a {@link ConfigListener} to be notified about changes. + * Remove a {@link FilterConfigListener} to be notified about changes. * @param listener The config listener to remove. */ - void removeConfigChangeListener(ConfigListener listener); + void removeConfigChangeListener(FilterConfigListener listener); /** * Visits the appropriate <code>visit()</code> function of a {@link Copied: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java (from rev 7753, trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -0,0 +1,34 @@ +/* + * 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.filter; + +/** + * Enumeration of Configuration event types. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public enum FilterConfigChangeType { + + ENABLE, + + DISABLE, + + CHANGE + +} // enum FilterConfigChangeType Property changes on: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigChangeType.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java (from rev 7770, trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -0,0 +1,39 @@ +/* + * 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.filter; + +import java.util.EventListener; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for listeners interesed in {@link FilterConfig} related changes. + * @author tchize + * @author Andreas Kirschbaum + */ +public interface FilterConfigListener extends EventListener { + + /** + * A {@link FilterConfig} has changed. + * @param filterConfigChangeType the change type + * @param filterConfig the changed filter config + */ + void configChanged(@NotNull FilterConfigChangeType filterConfigChangeType, @NotNull FilterConfig<?, ?> filterConfig); + +} // interface FilterConfigListener Property changes on: trunk/src/app/net/sf/gridarta/model/filter/FilterConfigListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -42,17 +42,17 @@ */ private static final Category log = Logger.getLogger(NamedFilterConfig.class); - private final ConfigListener configListener = new ConfigListener() { + private final FilterConfigListener filterConfigListener = new FilterConfigListener() { /** {@inheritDoc} */ @Override - public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { + public void configChanged(@NotNull final FilterConfigChangeType filterConfigChangeType, @NotNull final FilterConfig<?, ?> filterConfig) { // XXX What's with newe? // Not used, so why is it created? // This also has no side effect, so is this code wrong and fireEvent(newe) should be invoked instead of fireEvent(event)? // If so, why is the argument ignored in the new event construction? - //final ConfigEvent<?, ?> newe = new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, NamedFilterConfig.this); - fireEvent(configEventType, filterConfig); + //final ConfigEvent<?, ?> newe = new ConfigEvent<NamedFilter, NamedFilterConfig>(FilterConfigChangeType.CHANGE, NamedFilterConfig.this); + fireEvent(filterConfigChangeType, filterConfig); } }; @@ -65,7 +65,7 @@ if (event.getType() == NamedFilterEventType.REMOVE) { final FilterConfig<?, ?> myCfg = map.get(event.getFilterName()); if (myCfg != null) { - myCfg.removeConfigChangeListener(configListener); + myCfg.removeConfigChangeListener(filterConfigListener); } if (log.isDebugEnabled()) { log.debug(this + " removing config for " + event.getFilterName(), new Exception()); @@ -75,13 +75,13 @@ if (event.getType() == NamedFilterEventType.ADD) { final FilterConfig<?, ?> myCfg = event.getFilter().createConfig(); - myCfg.addConfigChangeListener(configListener); + myCfg.addConfigChangeListener(filterConfigListener); if (log.isDebugEnabled()) { log.debug(this + " adding config for " + event.getFilterName(), new Exception()); } map.put(event.getFilterName(), myCfg); } - fireEvent(ConfigEventType.CHANGE, NamedFilterConfig.this); + fireEvent(FilterConfigChangeType.CHANGE, NamedFilterConfig.this); } }; @@ -114,7 +114,7 @@ return; } this.inverted = inverted; - fireEvent(ConfigEventType.CHANGE, this); + fireEvent(FilterConfigChangeType.CHANGE, this); } public FilterConfig<?, ?> getConfig(final String name) { @@ -146,10 +146,10 @@ } map.put(name, config); - config.addConfigChangeListener(configListener); + config.addConfigChangeListener(filterConfigListener); } config.setEnabled(enabled); - fireEvent(ConfigEventType.CHANGE, this); + fireEvent(FilterConfigChangeType.CHANGE, this); } /** Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -56,7 +56,7 @@ } properties.put(name, value); - fireEvent(ConfigEventType.CHANGE, this); + fireEvent(FilterConfigChangeType.CHANGE, this); } public String getProperty(final String name) { Modified: trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java 2010-05-15 19:45:00 UTC (rev 7770) +++ trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java 2010-05-15 19:49:52 UTC (rev 7771) @@ -21,8 +21,8 @@ import javax.swing.JMenu; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; @@ -37,7 +37,7 @@ * {@inheritDoc} */ @Override - public void addConfigListener(@NotNull final ConfigListener listener) { + public void addConfigListener(@NotNull final FilterConfigListener listener) { throw new AssertionError(); } @@ -45,7 +45,7 @@ * {@inheritDoc} */ @Override - public void removeConfigListener(@NotNull final ConfigListener listener) { + public void removeConfigListener(@NotNull final FilterConfigListener listener) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 19:45:07
|
Revision: 7770 http://gridarta.svn.sourceforge.net/gridarta/?rev=7770&view=rev Author: akirschbaum Date: 2010-05-15 19:45:00 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove ConfigEvent. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java 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 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -33,8 +33,9 @@ import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.filter.FilterState; import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; -import net.sf.gridarta.model.filter.ConfigEvent; +import net.sf.gridarta.model.filter.ConfigEventType; import net.sf.gridarta.model.filter.ConfigListener; +import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -136,7 +137,7 @@ * {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent<?, ?> event) { + public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { forceRepaint(); } Modified: trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -22,9 +22,10 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.ConfigEvent; +import net.sf.gridarta.model.filter.ConfigEventType; import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.gameobject.GameObject; @@ -64,9 +65,9 @@ /** {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent<?, ?> event) { + public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { for (final ConfigListener listener : configListeners.getListeners()) { - listener.configChanged(event); + listener.configChanged(configEventType, filterConfig); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -26,8 +26,9 @@ import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.filter.FilterState; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.ConfigEvent; +import net.sf.gridarta.model.filter.ConfigEventType; import net.sf.gridarta.model.filter.ConfigListener; +import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; @@ -117,7 +118,7 @@ * {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent<?, ?> event) { + public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { forceRepaint(); } Modified: trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -83,7 +83,7 @@ if (log.isDebugEnabled()) { log.debug((enabled ? "enabling" : "disabling") + " filter " + this); } - fireEvent(new ConfigEvent<F, C>(enabled ? ConfigEventType.ENABLE : ConfigEventType.DISABLE, this)); + fireEvent(enabled ? ConfigEventType.ENABLE : ConfigEventType.DISABLE, this); } /** @@ -95,12 +95,13 @@ } /** - * Notify all listeners that a {@link ConfigEvent} has happened. - * @param event The config event. + * Notify all listeners that a {@link FilterConfig} has happened. + * @param configEventType the config event type + * @param filterConfig the changed filter config */ - protected void fireEvent(final ConfigEvent<?, ?> event) { + protected void fireEvent(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { for (final ConfigListener listener : listenerList.getListeners()) { - listener.configChanged(event); + listener.configChanged(configEventType, filterConfig); } } Deleted: trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -1,54 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.model.filter; - -import java.util.EventObject; - -/** - * Event that's fired in case of changes to the configuration. - * @author tchize - */ -public class ConfigEvent<F extends Filter<F, C>, C extends FilterConfig<F, C>> extends EventObject { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - private final ConfigEventType type; - - private final FilterConfig<F, C> config; - - public ConfigEvent(final ConfigEventType type, final FilterConfig<F, C> config) { - // XXX: Is config really the appropriate source? - super(config); - this.type = type; - this.config = config; - } - - public FilterConfig<F, C> getConfig() { - return config; - } - - public ConfigEventType getType() { - return type; - } - -} // class ConfigEvent Modified: trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -20,13 +20,20 @@ package net.sf.gridarta.model.filter; import java.util.EventListener; +import org.jetbrains.annotations.NotNull; /** - * Listener for ConfigEvents. + * Interface for listeners interesed in {@link FilterConfig} related changes. * @author tchize + * @author Andreas Kirschbaum */ public interface ConfigListener extends EventListener { - void configChanged(ConfigEvent<?, ?> event); + /** + * A {@link FilterConfig} has changed. + * @param configEventType the change type + * @param filterConfig the changed filter config + */ + void configChanged(@NotNull ConfigEventType configEventType, @NotNull FilterConfig<?, ?> filterConfig); } // interface ConfigListener Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -46,13 +46,13 @@ /** {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent<?, ?> event) { + public void configChanged(@NotNull final ConfigEventType configEventType, @NotNull final FilterConfig<?, ?> filterConfig) { // XXX What's with newe? // Not used, so why is it created? // This also has no side effect, so is this code wrong and fireEvent(newe) should be invoked instead of fireEvent(event)? // If so, why is the argument ignored in the new event construction? - final ConfigEvent<?, ?> newe = new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, NamedFilterConfig.this); - fireEvent(event); + //final ConfigEvent<?, ?> newe = new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, NamedFilterConfig.this); + fireEvent(configEventType, filterConfig); } }; @@ -81,8 +81,7 @@ } map.put(event.getFilterName(), myCfg); } - final ConfigEvent<NamedFilter, NamedFilterConfig> e = new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, NamedFilterConfig.this); - fireEvent(e); + fireEvent(ConfigEventType.CHANGE, NamedFilterConfig.this); } }; @@ -115,7 +114,7 @@ return; } this.inverted = inverted; - fireEvent(new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, this)); + fireEvent(ConfigEventType.CHANGE, this); } public FilterConfig<?, ?> getConfig(final String name) { @@ -150,8 +149,7 @@ config.addConfigChangeListener(configListener); } config.setEnabled(enabled); - final ConfigEvent<NamedFilter, NamedFilterConfig> e = new ConfigEvent<NamedFilter, NamedFilterConfig>(ConfigEventType.CHANGE, this); - fireEvent(e); + fireEvent(ConfigEventType.CHANGE, this); } /** Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 19:34:13 UTC (rev 7769) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java 2010-05-15 19:45:00 UTC (rev 7770) @@ -56,7 +56,7 @@ } properties.put(name, value); - fireEvent(new ConfigEvent<NamedGameObjectMatcherFilter, NamedGameObjectMatcherFilterConfig>(ConfigEventType.CHANGE, this)); + fireEvent(ConfigEventType.CHANGE, this); } public String getProperty(final String name) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 19:34:19
|
Revision: 7769 http://gridarta.svn.sourceforge.net/gridarta/?rev=7769&view=rev Author: akirschbaum Date: 2010-05-15 19:34:13 +0000 (Sat, 15 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 19:14:59 UTC (rev 7768) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java 2010-05-15 19:34:13 UTC (rev 7769) @@ -123,22 +123,6 @@ return false; } - @NotNull - public String[] getFilters() { - return subFilters.keySet().toArray(new String[subFilters.keySet().size()]); - } - - public static boolean isFilterEnabled(@NotNull final NamedFilterConfig config, @NotNull final String name) { - return config.isSubFilterEnabled(name); - } - - public void setFilterEnabled(@NotNull final NamedFilterConfig config, @NotNull final String name, final boolean enabled) { - final Filter<?, ?> filter = subFilters.get(name); - if (filter != null) { - config.setSubFilterEnabled(name, filter, enabled); - } - } - /** * {@inheritDoc} */ @@ -167,10 +151,6 @@ fireEvent(new NamedFilterEvent(NamedFilterEventType.REMOVE, this, name, filter)); } - public Filter<?, ?> getFilter(@NotNull final String name) { - return subFilters.get(name); - } - private void fireEvent(@NotNull final NamedFilterEvent event) { for (final NamedFilterListener listener : listenerList.getListeners()) { listener.nameFilterChanged(event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 19:15:07
|
Revision: 7768 http://gridarta.svn.sourceforge.net/gridarta/?rev=7768&view=rev Author: akirschbaum Date: 2010-05-15 19:14:59 +0000 (Sat, 15 May 2010) Log Message: ----------- Add type parameters to Filter and FilterConfig to avoid type casts. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java trunk/src/app/net/sf/gridarta/model/filter/Filter.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/src/app/net/sf/gridarta/model/filter/FilterVisitor.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfigVisitor.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilter.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilterConfig.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/filter/BasicFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/model/filter/SimpleFilterConfig.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 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -67,7 +67,7 @@ import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; @@ -538,7 +538,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilter defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } 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 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -136,7 +136,7 @@ * {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent event) { + public void configChanged(final ConfigEvent<?, ?> event) { forceRepaint(); } 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 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -61,7 +61,7 @@ import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.DefaultMapReaderFactory; import net.sf.gridarta.model.io.DirectoryCacheFiles; @@ -400,7 +400,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilter defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapControlFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new int[] { CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } 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 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -67,7 +67,7 @@ import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; @@ -539,7 +539,7 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilter defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { return mainControl.createGUIMainControl(FileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } Modified: trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -25,9 +25,8 @@ import net.sf.gridarta.model.filter.ConfigEvent; import net.sf.gridarta.model.filter.ConfigListener; import net.sf.gridarta.model.filter.Filter; -import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; -import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.utils.EventListenerList2; @@ -50,9 +49,9 @@ //TODO allow implementation of own filter public class DefaultFilterControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements FilterControl<G, A, R> { - private final NamedFilterList filterList; + private final NamedFilter filterList; - private final FilterConfig filterOutConfig; + private final NamedFilterConfig filterOutConfig; private final NamedFilterConfig[] highlightConfig; @@ -65,7 +64,7 @@ /** {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent event) { + public void configChanged(final ConfigEvent<?, ?> event) { for (final ConfigListener listener : configListeners.getListeners()) { listener.configChanged(event); } @@ -78,12 +77,12 @@ * filterOut anything * @param filterList the filter list instance to use */ - public DefaultFilterControl(final NamedFilterList filterList) { + public DefaultFilterControl(final NamedFilter filterList) { this.filterList = filterList; filterOutConfig = filterList.createConfig(); highlightConfig = new NamedFilterConfig[MAX_HIGHLIGHT]; for (int i = 0; i < MAX_HIGHLIGHT; i++) { - highlightConfig[i] = (NamedFilterConfig) filterList.createConfig(); + highlightConfig[i] = filterList.createConfig(); } filterOutConfig.addConfigChangeListener(configListener); for (int i = 0; i < MAX_HIGHLIGHT; i++) { @@ -112,12 +111,12 @@ */ @Override public void createMenuEntries(final JMenu menu) { - final JMenuItem menuItem = new MenuItemCreator(filterList, filterOutConfig).getMenuItem(); + final JMenuItem menuItem = new MenuItemCreator(filterOutConfig).getMenuItem(); menuItem.setText("Filter view"); menu.add(menuItem); menu.addSeparator(); for (int i = 0; i < MAX_HIGHLIGHT; i++) { - final JMenuItem menuItem2 = new MenuItemCreator(filterList, highlightConfig[i]).getMenuItem(); + final JMenuItem menuItem2 = new MenuItemCreator(highlightConfig[i]).getMenuItem(); menuItem2.setText("Highlight " + i); menu.add(menuItem2); } @@ -170,7 +169,7 @@ * {@inheritDoc} */ @Override - public void addFilter(final String name, final Filter filter) { + public void addFilter(final String name, final Filter<?, ?> filter) { filterList.addFilter(name, filter); } Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -29,7 +29,6 @@ import javax.swing.JSeparator; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.filter.NamedFilterConfig; @@ -69,12 +68,12 @@ component.add(new JSeparator()); } - public void addFilter(final String name, final Filter filter, final FilterConfig config) { + public void addFilter(final String name, final FilterConfig<?, ?> config) { if (content.containsKey(name)) { return; } - final AbstractButton entry = new MenuItemCreator(filter, config).getMenuItem(); + final AbstractButton entry = new MenuItemCreator(config).getMenuItem(); entry.setVisible(true); entry.setText(name); content.put(name, entry); Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -56,7 +56,7 @@ boolean canShow(G gameObject); - void addFilter(String name, Filter filter); + void addFilter(String name, Filter<?, ?> filter); void removeFilter(String name); Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterMenuEntry.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -21,14 +21,12 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Map; import javax.swing.JComponent; import javax.swing.JMenu; -import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.filter.NamedFilterEvent; import net.sf.gridarta.model.filter.NamedFilterEventType; -import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.filter.NamedFilterListener; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -40,7 +38,7 @@ * The Logger for printing log messages. */ @NotNull - private static final Category log = Logger.getLogger(NamedFilterList.class); + private static final Category log = Logger.getLogger(NamedFilter.class); /** * The serial version UID. @@ -51,25 +49,19 @@ private final NamedFilterConfig config; @NotNull - private final NamedFilterList namedFilterList; - - @NotNull private final Collection<FilterComponent> components = new ArrayList<FilterComponent>(); - public FilterMenuEntry(@NotNull final NamedFilterConfig config, @NotNull final NamedFilterList namedFilterList) { + public FilterMenuEntry(@NotNull final NamedFilterConfig config) { super(""); this.config = config; - this.namedFilterList = namedFilterList; - namedFilterList.addFilterListener(this); + config.getFilter().addFilterListener(this); populateComponent(this); } private void populateComponent(@NotNull final JComponent component) { final FilterComponent filterComponent = new FilterComponent(component, config); - for (final Map.Entry<String, Filter> entry : namedFilterList.getSubFilters().entrySet()) { - final String name = entry.getKey(); - final Filter filter = entry.getValue(); - filterComponent.addFilter(name, filter, config.getConfig(name)); + for (final String name : config.getFilter().getSubFilters().keySet()) { + filterComponent.addFilter(name, config.getConfig(name)); } components.add(filterComponent); } @@ -98,17 +90,18 @@ */ @Override public void nameFilterChanged(@NotNull final NamedFilterEvent event) { + final String name = event.getFilterName(); if (event.getType() == NamedFilterEventType.ADD) { for (final FilterComponent filterComponent : components) { if (log.isDebugEnabled()) { - log.debug("set sub filter enabled(), calling on " + event.getFilterName()); + log.debug("set sub filter enabled(), calling on " + name); } - config.setSubFilterEnabled(event.getFilterName(), event.getFilter(), false); - filterComponent.addFilter(event.getFilterName(), event.getFilter(), config.getConfig(event.getFilterName())); + config.setSubFilterEnabled(name, event.getFilter(), false); + filterComponent.addFilter(name, config.getConfig(name)); } } else if (event.getType() == NamedFilterEventType.REMOVE) { for (final FilterComponent filterComponent : components) { - filterComponent.removeFilter(event.getFilterName()); + filterComponent.removeFilter(name); } } } Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -23,10 +23,10 @@ import javax.swing.JMenuItem; import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.FilterConfigVisitor; import net.sf.gridarta.model.filter.FilterVisitor; import net.sf.gridarta.model.filter.NamedFilterConfig; -import net.sf.gridarta.model.filter.NamedFilterList; -import net.sf.gridarta.model.filter.NamedGameObjectMatcherFilter; +import net.sf.gridarta.model.filter.NamedGameObjectMatcherFilterConfig; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -46,12 +46,6 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * The {@link FilterConfig} to use. - */ - @NotNull - private final FilterConfig config; - - /** * The {@link JMenuItem}. */ @Nullable @@ -61,18 +55,17 @@ * The {@link FilterVisitor} for creating the menu item. */ @NotNull - private final FilterVisitor filterVisitor = new FilterVisitor() { + private final FilterConfigVisitor filterVisitor = new FilterConfigVisitor() { /** {@inheritDoc} */ @Override - public void visit(@NotNull final NamedFilterList filter) { - assert config != null; - menuItem = new FilterMenuEntry((NamedFilterConfig) config, filter); + public void visit(@NotNull final NamedFilterConfig config) { + menuItem = new FilterMenuEntry(config); } /** {@inheritDoc} */ @Override - public void visit(@NotNull final NamedGameObjectMatcherFilter filter) { + public void visit(@NotNull final NamedGameObjectMatcherFilterConfig config) { menuItem = new JCheckBoxMenuItem(ACTION_BUILDER.createToggle(true, "enabled", config)); } @@ -80,12 +73,10 @@ /** * Creates a new instance. - * @param filter the filter * @param config The filter config to use. */ - public MenuItemCreator(@NotNull final Filter filter, @NotNull final FilterConfig config) { - this.config = config; - filter.accept(filterVisitor); + public MenuItemCreator(@NotNull final FilterConfig<?, ?> config) { + config.accept(filterVisitor); assert menuItem != null; } Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -117,7 +117,7 @@ * {@inheritDoc} */ @Override - public void configChanged(final ConfigEvent event) { + public void configChanged(final ConfigEvent<?, ?> event) { forceRepaint(); } Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -139,7 +139,7 @@ final String filterName = "(s)" + script.getName(); if (script.isFilter()) { - final Filter filter = getScriptAsFilter(script); + final Filter<?, ?> filter = getScriptAsFilter(script); if (filter != null) { filterControl.addFilter(filterName, filter); } @@ -315,11 +315,11 @@ } @Nullable - private Filter getScriptAsFilter(@NotNull final Script<?, ?, ?> script) { + private Filter<?, ?> getScriptAsFilter(@NotNull final Script<?, ?, ?> script) { final Interpreter runner = new Interpreter(); try { scriptParameters.setInterpreterValues(runner, ScriptRunMode.FILTER); - return (Filter) runner.eval(script.getCode()); + return (Filter<?, ?>) runner.eval(script.getCode()); } catch (final EvalError e) { log.warn("Evaluation error on (filter)" + script.getName(), e); } catch (final ClassCastException e) { Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -23,18 +23,17 @@ import javax.swing.JPanel; import net.sf.gridarta.gui.filter.MenuItemCreator; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.FilterParameter; -public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, FilterConfig, Void> { +public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R, FilterConfig<?, ?>, Void> { private final JComponent value; - public FilterParameterView(final FilterParameter<G, A, R> param, final Filter defaultFilterList) { - value = new MenuItemCreator(defaultFilterList, param.getValue()).getMenuItem(); + public FilterParameterView(final FilterParameter<G, A, R> param) { + value = new MenuItemCreator(param.getValue()).getMenuItem(); value.setName("Choose filters"); } @@ -42,7 +41,7 @@ * {@inheritDoc} */ @Override - public JComponent getValueComponent(final FilterConfig value) { + public JComponent getValueComponent(final FilterConfig<?, ?> value) { return this.value; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -25,7 +25,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.script.parameter.ArchParameter; @@ -56,9 +55,6 @@ private final ObjectChooser<G, A, R> objectChooser; @NotNull - private final NamedFilterList defaultFilterList; - - @NotNull private final MapManager<G, A, R> mapManager; /** @@ -93,7 +89,7 @@ /** {@inheritDoc} */ @Override public void visit(final FilterParameter<G, A, R> parameter) { - view = new FilterParameterView<G, A, R>(parameter, defaultFilterList); + view = new FilterParameterView<G, A, R>(parameter); } /** {@inheritDoc} */ @@ -121,11 +117,10 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public PluginParameterViewFactory(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final NamedFilterList defaultFilterList, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FaceObjectProviders faceObjectProviders) { + public PluginParameterViewFactory(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FaceObjectProviders faceObjectProviders) { this.archetypeSet = archetypeSet; this.gameObjectAttributesModel = gameObjectAttributesModel; this.objectChooser = objectChooser; - this.defaultFilterList = defaultFilterList; this.mapManager = mapManager; this.faceObjectProviders = faceObjectProviders; } Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -58,7 +58,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.CacheFiles; @@ -355,7 +355,7 @@ * @param pluginParameterFactory the plugin parameter factory to use * @return the new instance */ - public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final int[] directionMap, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final int[] directionMap, @NotNull final NamedFilter defaultFilterList, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, globalSettings, mapViewSettings, mapControlFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, FileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchData, scriptArchDataUtils, scriptArchUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, defaultFilterList, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, scriptExecutor, scriptParameters); } Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -46,7 +46,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.DefaultMapReaderFactory; @@ -382,7 +382,7 @@ * @return the new instance */ @NotNull - GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapControlFactory<G, A, R> mapControlFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull NamedFilterList defaultFilterList, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); + GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapControlFactory<G, A, R> mapControlFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull NamedFilter defaultFilterList, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); /** * Creates a new {@link AbstractResources} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-15 19:12:45 UTC (rev 7767) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-15 19:14:59 UTC (rev 7768) @@ -133,7 +133,7 @@ import net.sf.gridarta.model.exitconnector.ExitMatcher; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.filter.NamedFilterList; +import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.CacheFiles; @@ -381,7 +381,7 @@ * @param scriptExecutor the script executor to use * @param scriptParameters the script parameters to use */ - public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final int[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final NamedFilterList defaultFilterList, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters) { + public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Null... [truncated message content] |
From: <aki...@us...> - 2010-05-15 19:12:51
|
Revision: 7767 http://gridarta.svn.sourceforge.net/gridarta/?rev=7767&view=rev Author: akirschbaum Date: 2010-05-15 19:12:45 +0000 (Sat, 15 May 2010) Log Message: ----------- Fix incorrect icon resource paths. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-15 14:28:37 UTC (rev 7766) +++ trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-15 19:12:45 UTC (rev 7767) @@ -83,11 +83,11 @@ private static final String CLOSE_TAB_SMALLICON = ICON_DIR + "CloseTabSmallIcon.gif"; - public static final String AUTORUN_SMALLICON = SYSTEM_DIR + "AutorunSmallIcon.gif"; + public static final String AUTORUN_SMALLICON = ICON_DIR + "AutorunSmallIcon.gif"; - public static final String FILTER_SMALLICON = SYSTEM_DIR + "FilterSmallIcon.gif"; + public static final String FILTER_SMALLICON = ICON_DIR + "FilterSmallIcon.gif"; - public static final String RUN_PLUGIN_SMALLICON = SYSTEM_DIR + "RunPluginSmallIcon.gif"; + public static final String RUN_PLUGIN_SMALLICON = ICON_DIR + "RunPluginSmallIcon.gif"; /** * Application icon definitions (icon-dir). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 14:28:44
|
Revision: 7766 http://gridarta.svn.sourceforge.net/gridarta/?rev=7766&view=rev Author: akirschbaum Date: 2010-05-15 14:28:37 +0000 (Sat, 15 May 2010) Log Message: ----------- Extract code to read/write XML from Filter to FilterParser. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/filter/Filter.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java Modified: trunk/src/app/net/sf/gridarta/model/filter/Filter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 10:53:42 UTC (rev 7765) +++ trunk/src/app/net/sf/gridarta/model/filter/Filter.java 2010-05-15 14:28:37 UTC (rev 7766) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.filter; import net.sf.gridarta.model.gameobject.GameObject; -import org.jdom.Element; import org.jetbrains.annotations.NotNull; /** @@ -80,21 +79,6 @@ FilterConfig createConfig(); /** - * Export the filter configuration settings. - * @param config The filter configuration to export. - * @return The exported settings. - */ - @NotNull - Element toXML(@NotNull FilterConfig config); - - /** - * Import the filter configuration settings. - * @param e The settings to import. - * @param config The filter configuration to modify. - */ - void fromXML(@NotNull Element e, @NotNull FilterConfig config); - - /** * Visits the appropriate <code>visit()</code> function of a {@link * FilterVisitor}. * @param visitor the visitor to call Added: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-15 14:28:37 UTC (rev 7766) @@ -0,0 +1,200 @@ +/* + * 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.filter; + +import java.util.Map; +import org.jdom.Content; +import org.jdom.Element; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Converts {@link FilterConfig} to and from XML representation. + * @author tchize + * @author Andreas Kirschbaum + */ +public class FilterParser { + + /** + * The {@link FilterConfig} instance being converted. + */ + @Nullable + private FilterConfig filterConfig = null; + + /** + * The {@link Element} instance being converted. + */ + @Nullable + private Element element = null; + + /** + * The {@link FilterVisitor} for converting {@link FilterConfig} instances + * to XML representation. + */ + @NotNull + private FilterVisitor toXMLFilterVisitor = new FilterVisitor() { + + @Override + public void visit(@NotNull final NamedFilterList filter) { + final Element result = new Element("value"); + assert filterConfig != null; + final NamedFilterConfig namedFilterConfig = (NamedFilterConfig) filterConfig; + final Element enabled = new Element("enabled"); + enabled.addContent(Boolean.toString(namedFilterConfig.isEnabled())); + result.addContent(enabled); + final Element inverted = new Element("inverted"); + inverted.addContent(Boolean.toString(namedFilterConfig.isInverted())); + result.addContent(inverted); + for (final Map.Entry<String, Filter> entry : filter.getSubFilters().entrySet()) { + final Content filterValue = toXML(entry.getValue(), namedFilterConfig.getConfig(entry.getKey())); + final Element subfilter = new Element("subfilter"); + final Element fName = new Element("name"); + fName.addContent(entry.getKey()); + subfilter.addContent(fName); + subfilter.addContent(filterValue); + result.addContent(subfilter); + } + element = result; + } + + @Override + public void visit(@NotNull final NamedGameObjectMatcherFilter filter) { + final Element value = new Element("value"); + assert filterConfig != null; + final SimpleFilterConfig simpleFilterConfig = (SimpleFilterConfig) filterConfig; + final Element enabled = new Element("enabled"); + enabled.addContent(Boolean.toString(simpleFilterConfig.isEnabled())); + value.addContent(enabled); + for (final String key : simpleFilterConfig.getProperties()) { + final Element property = new Element("property"); + property.addContent(simpleFilterConfig.getProperty(key)); + value.addContent(property); + } + element = value; + } + + }; + + /** + * The {@link FilterVisitor} for converting {@link FilterConfig}instances + * from XML representation. + */ + @NotNull + private FilterVisitor fromXMLFilterVisitor = new FilterVisitor() { + + @Override + public void visit(@NotNull final NamedFilterList filter) { + filter.resetConfig((NamedFilterConfig) filterConfig); + if (element == null) { + return; + } + + final Element value = element.getChild("value"); + if (value == null) { + return; + } + + final NamedFilterConfig fConfig = (NamedFilterConfig) filterConfig; + final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); + fConfig.setEnabled(enabled); + fConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); + final Iterable<Element> it = value.getChildren("subfilter"); + for (final Element filterElement : it) { + final String name = filterElement.getChildTextTrim("name"); + final FilterConfig subFilterConfig = ((NamedFilterConfig) filterConfig).getConfig(name); + final Filter subFilter = filter.getFilter(name); + if (subFilter != null && subFilterConfig != null) { + fromXML(filterElement, subFilter, subFilterConfig); + } + } + } + + @Override + public void visit(@NotNull final NamedGameObjectMatcherFilter filter) { + if (element == null) { + return; + } + + final Element value = element.getChild("value"); + if (value == null) { + return; + } + + final SimpleFilterConfig simpleFilterConfig = (SimpleFilterConfig) filterConfig; + final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); + simpleFilterConfig.setEnabled(enabled); + final Iterable<Element> properties = value.getChildren("property"); + for (final Element property : properties) { + final String pName = property.getChildTextTrim("name"); + final String pValue = property.getChildTextTrim("value"); + simpleFilterConfig.setProperty(pName, pValue); + } + } + + }; + + /** + * Export the filter configuration settings. + * @param filter the filter to export + * @param filterConfig the filter configuration to export + * @return the exported settings + */ + @NotNull + public Element toXML(@NotNull final Filter filter, @NotNull final FilterConfig filterConfig) { + final Element prevElement = element; + try { + element = null; + final FilterConfig prevFilterConfig = this.filterConfig; + try { + this.filterConfig = filterConfig; + filter.accept(toXMLFilterVisitor); + } finally { + this.filterConfig = prevFilterConfig; + } + assert element != null; + return element; + } finally { + element = prevElement; + } + } + + /** + * Import the filter configuration settings. + * @param element the settings to import + * @param filter the filter to modify + * @param filterConfig the filter configuration to modify + */ + public void fromXML(@NotNull final Element element, @NotNull final Filter filter, @NotNull final FilterConfig filterConfig) { + final Element prevElement = this.element; + try { + this.element = element; + final FilterConfig prevFilterConfig = this.filterConfig; + try { + this.filterConfig = filterConfig; + filter.accept(fromXMLFilterVisitor); + } finally { + this.filterConfig = prevFilterConfig; + } + } finally { + this.element = prevElement; + } + } + +} // class FilterParser Property changes on: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java 2010-05-15 10:53:42 UTC (rev 7765) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java 2010-05-15 14:28:37 UTC (rev 7766) @@ -27,8 +27,6 @@ import net.sf.gridarta.utils.EventListenerList2; import org.apache.log4j.Category; import org.apache.log4j.Logger; -import org.jdom.Content; -import org.jdom.Element; import org.jetbrains.annotations.NotNull; /** @@ -195,67 +193,10 @@ * {@inheritDoc} */ @Override - public void fromXML(@NotNull final Element e, @NotNull final FilterConfig config) { - resetConfig((NamedFilterConfig) config); - if (e == null) { - return; - } - - final Element value = e.getChild("value"); - if (value == null) { - return; - } - - final NamedFilterConfig fConfig = (NamedFilterConfig) config; - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - fConfig.setEnabled(enabled); - fConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); - final Iterable<Element> l = value.getChildren("subfilter"); - for (final Element fElement : l) { - final String name = fElement.getChildTextTrim("name"); - final FilterConfig cfg = ((NamedFilterConfig) config).getConfig(name); - final Filter f = subFilters.get(name); - if (f != null && cfg != null) { - f.fromXML(fElement, cfg); - } - } - - } - - /** - * {@inheritDoc} - */ - @Override public void accept(@NotNull final FilterVisitor visitor) { visitor.visit(this); } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public Element toXML(@NotNull final FilterConfig config) { - final Element result = new Element("value"); - final NamedFilterConfig namedFilterConfig = (NamedFilterConfig) config; - final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(namedFilterConfig.isEnabled())); - result.addContent(enabled); - final Element inverted = new Element("inverted"); - inverted.addContent(Boolean.toString(namedFilterConfig.isInverted())); - result.addContent(inverted); - for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - final Content filterValue = entry.getValue().toXML(namedFilterConfig.getConfig(entry.getKey())); - final Element subfilter = new Element("subfilter"); - final Element fName = new Element("name"); - fName.addContent(entry.getKey()); - subfilter.addContent(fName); - subfilter.addContent(filterValue); - result.addContent(subfilter); - } - return result; - } - public boolean canShow(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final FilterConfig filterOutConfig) { reset(filterOutConfig); if (hasGlobalMatch(filterOutConfig)) { Modified: trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 10:53:42 UTC (rev 7765) +++ trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java 2010-05-15 14:28:37 UTC (rev 7766) @@ -21,7 +21,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.match.GameObjectMatcher; -import org.jdom.Element; import org.jetbrains.annotations.NotNull; /** @@ -81,51 +80,7 @@ /** * {@inheritDoc} */ - @NotNull @Override - public Element toXML(@NotNull final FilterConfig config) { - final Element value = new Element("value"); - final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(sConfig.isEnabled())); - value.addContent(enabled); - for (final String key : sConfig.getProperties()) { - final Element property = new Element("property"); - property.addContent(sConfig.getProperty(key)); - value.addContent(property); - } - return value; - } - - /** - * {@inheritDoc} - */ - @Override - public void fromXML(@NotNull final Element e, @NotNull final FilterConfig config) { - if (e == null) { - return; - } - - final Element value = e.getChild("value"); - if (value == null) { - return; - } - - final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - sConfig.setEnabled(enabled); - final Iterable<Element> properties = value.getChildren("property"); - for (final Element property : properties) { - final String pName = property.getChildTextTrim("name"); - final String pValue = property.getChildTextTrim("value"); - sConfig.setProperty(pName, pValue); - } - } - - /** - * {@inheritDoc} - */ - @Override public void accept(@NotNull final FilterVisitor visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2010-05-15 10:53:42 UTC (rev 7765) +++ trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2010-05-15 14:28:37 UTC (rev 7766) @@ -22,6 +22,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.FilterParser; import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -63,7 +64,7 @@ public void fromXML(@NotNull final Element e) { super.fromXML(e); final FilterConfig conf = getValue(); - defaultFilterList.fromXML(e, conf); + new FilterParser().fromXML(e, defaultFilterList, conf); } /** @@ -78,7 +79,7 @@ @Override public Element toXML() { final Element e = super.toXML(); - e.addContent(defaultFilterList.toXML(getValue())); + e.addContent(new FilterParser().toXML(defaultFilterList, getValue())); return e; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 10:53:48
|
Revision: 7765 http://gridarta.svn.sourceforge.net/gridarta/?rev=7765&view=rev Author: akirschbaum Date: 2010-05-15 10:53:42 +0000 (Sat, 15 May 2010) Log Message: ----------- Do not use catch(Exception). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-05-15 10:41:43 UTC (rev 7764) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-05-15 10:53:42 UTC (rev 7765) @@ -45,17 +45,17 @@ try { final Integer iVal = Integer.parseInt(val); setValue(iVal); - } catch (final Exception ex) { + } catch (final NumberFormatException ignored) { setValue(0); } final IntegerConfig o = new IntegerConfig(); try { o.setMin(Integer.parseInt(e.getChildTextTrim("minimum"))); - } catch (final Exception ex) { + } catch (final NumberFormatException ignored) { } try { o.setMax(Integer.parseInt(e.getChildTextTrim("maximum"))); - } catch (final Exception ex) { + } catch (final NumberFormatException ignored) { } setConfig(o); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 10:41:52
|
Revision: 7764 http://gridarta.svn.sourceforge.net/gridarta/?rev=7764&view=rev Author: akirschbaum Date: 2010-05-15 10:41:43 +0000 (Sat, 15 May 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java trunk/src/app/net/sf/gridarta/gui/utils/AsynchonousProgress.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java Modified: trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -75,7 +75,7 @@ collector.start(); try { collector.waitUntilFinished(); - } catch (final InterruptedException e) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); return 1; } Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -190,7 +190,7 @@ } mapModels.clear(); } - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); } } @@ -216,7 +216,7 @@ thread.interrupt(); try { thread.join(); - } catch (final InterruptedException e) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); log.warn("DelayedMapModelListenerManager was interrupted"); } Modified: trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -174,7 +174,7 @@ } else { try { SwingUtilities.invokeAndWait(runnable); - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); } catch (final InvocationTargetException ex) { throw new RuntimeException(ex); Modified: trunk/src/app/net/sf/gridarta/gui/utils/AsynchonousProgress.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/AsynchonousProgress.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/gui/utils/AsynchonousProgress.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -59,7 +59,7 @@ progress.finished(); } }); - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); } catch (final InvocationTargetException ex) { // XXX: ignore? Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -590,7 +590,7 @@ if (tmp != null) { try { tmp.waitUntilFinished(); - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { Thread.currentThread().interrupt(); log.warn("DelayedMapModelListenerManager was interrupted"); } Modified: trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-05-15 10:37:15 UTC (rev 7763) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-05-15 10:41:43 UTC (rev 7764) @@ -140,7 +140,7 @@ final Thread scriptThread = doRunScript(clonedScript, console); try { scriptThread.join(); - } catch (final InterruptedException ex) { + } catch (final InterruptedException ignored) { scriptThread.interrupt(); Thread.currentThread().interrupt(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 10:37:23
|
Revision: 7763 http://gridarta.svn.sourceforge.net/gridarta/?rev=7763&view=rev Author: akirschbaum Date: 2010-05-15 10:37:15 +0000 (Sat, 15 May 2010) Log Message: ----------- Add @NotNull/@Nullable annotations. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialog.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/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -63,6 +63,7 @@ import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A dialog to change the properties of a map, like several flags and settings @@ -82,81 +83,113 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The parent frame for help windows. */ + @NotNull private final JFrame helpParent; + @NotNull private final MapModel<GameObject, MapArchObject, Archetype> mapModel; + @Nullable private Window dialog = null; // input components, see MapArchObject for expl. of purpose + @NotNull private final JTextArea mapDescription = new JTextArea(4, 4); // the msg text/arch text + @NotNull private final JTextField mapName = new JTextField(); // name of arch + @NotNull private final JTextField mapRegion = new JTextField(); // map's region + @NotNull private final JTextField mapBackgroundMusic = new JTextField(); // name of soundfile + @NotNull private final JFormattedTextField mapWidthField = new JFormattedTextField(); // len x + @NotNull private final JFormattedTextField mapHeightField = new JFormattedTextField(); // len y + @NotNull private final AbstractButton checkboxOutdoor = new JCheckBox(); // map outdoor + @NotNull private final JFormattedTextField fieldEnterX = new JFormattedTextField(); // enter x + @NotNull private final JFormattedTextField fieldEnterY = new JFormattedTextField(); // enter y + @NotNull private final JFormattedTextField fieldSwapTime = new JFormattedTextField(); // swap time + @NotNull private final JFormattedTextField fieldResetTimeout = new JFormattedTextField(); // reset timeout + @NotNull private final JFormattedTextField fieldDifficulty = new JFormattedTextField(); // map difficulty + @NotNull private final JFormattedTextField fieldDarkness = new JFormattedTextField(); // darkness + @NotNull private final AbstractButton checkboxFixedReset = new JCheckBox(); // fixed reset + @NotNull private final AbstractButton checkboxNoSave = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoMagic = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoPriest = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoSummon = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoHarm = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoFixedLogin = new JCheckBox(); + @NotNull private final AbstractButton checkboxPermDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxUltraDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxUltimateDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxPvp = new JCheckBox(); + @NotNull private final AbstractButton checkboxPlugins = new JCheckBox(); /** * JButton for ok. */ + @NotNull private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** * JButton for cancel. */ + @NotNull private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); /** * The MapTilePane. */ + @NotNull private final AbstractMapTilePane<GameObject, MapArchObject, Archetype> mapTilePane; /** @@ -174,7 +207,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -208,7 +241,8 @@ * @param map MapArchObject to create main panel for. * @return Newly created main panel. */ - private Component createMainPanel(final MapArchObject map) { + @NotNull + private Component createMainPanel(@NotNull final MapArchObject map) { final GridBagConstraints gbc = new GridBagConstraints(); final JComponent mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(GUIConstants.DIALOG_BORDER); @@ -242,7 +276,8 @@ * @param map MapArchObject to create panel for. * @return Newly created mapDataPanel. */ - private Component createMapDataPanel(final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { + @NotNull + private Component createMapDataPanel(@NotNull final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { mapDescription.setText(map.getText()); mapDescription.setCaretPosition(0); final JScrollPane scrollPane = new JScrollPane(mapDescription); @@ -257,7 +292,8 @@ * @param map MapArchObject to create panel for. * @return Newly created optionsPanel. */ - private Component createOptionsPanel(final MapArchObject map) { + @NotNull + private Component createOptionsPanel(@NotNull final MapArchObject map) { final JPanel optionPanel = new JPanel(new GridLayout(0, 2)); optionPanel.add(createPanelLine(fieldEnterX, 10, map.getEnterX(), "mapEnterX")); @@ -289,7 +325,8 @@ * @param map MapArchObject to create panel for. * @return Newly created mapPanel. */ - private Component createMapPanel(final MapArchObject map) { + @NotNull + private Component createMapPanel(@NotNull final MapArchObject map) { final JPanel mapPanel = new JPanel(new GridBagLayout()); final GridBagConstraints labelGbc = new GridBagConstraints(); labelGbc.anchor = GridBagConstraints.EAST; @@ -352,7 +389,8 @@ * @param mapTilePane The <code>MapTilePane<code> contents. * @return Newly created tile path panel. */ - private static Component createTilePathPanel(final Component mapTilePane) { + @NotNull + private static Component createTilePathPanel(@NotNull final Component mapTilePane) { final Container panel = new JPanel(new BorderLayout()); panel.add(mapTilePane, BorderLayout.NORTH); return panel; @@ -392,7 +430,7 @@ * {@inheritDoc} */ @Override - public void setValue(final Object newValue) { + public void setValue(@NotNull final Object newValue) { super.setValue(newValue); if (dialog != null && newValue != UNINITIALIZED_VALUE) { dialog.dispose(); @@ -404,7 +442,8 @@ * @param key i18n Key to look up the l10n title using the ActionBuilder * @return Border */ - private static Border createTitledBorder(final String key) { + @NotNull + private static Border createTitledBorder(@NotNull final String key) { return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString(key)), GUIConstants.DIALOG_BORDER); } @@ -416,7 +455,8 @@ * @param labelKey (attribute-)label key * @return created panel */ - private static Component createPanelLine(final JFormattedTextField textField, final int n, final int defaultValue, final String labelKey) { + @NotNull + private static Component createPanelLine(@NotNull final JFormattedTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { final Container lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); lineLayout.add(new JLabel(ACTION_BUILDER.getString(labelKey))); textField.setColumns(n); @@ -432,7 +472,8 @@ * @param labelKey (attribute-)label key * @return created Checkbox */ - private static Component createPanelCBox(final AbstractButton checkBox, final boolean state, final String labelKey) { + @NotNull + private static Component createPanelCBox(@NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey) { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(checkBox); @@ -542,7 +583,7 @@ * @return value of String 's', zero if 's' is empty * @throws IllegalArgumentException when parsing fails */ - private static int parseProperty(final String s, final String label) { + private static int parseProperty(@NotNull final String s, @NotNull final String label) { if (s.length() == 0) { return 0; // empty string is interpreted as zero } @@ -596,7 +637,7 @@ * Creates and displays the map properties dialog. * @param parentComponent the parent component of the dialog */ - public void showDialog(final Component parentComponent) { + public void showDialog(@NotNull final Component parentComponent) { final String title = ACTION_BUILDER.format("mapTitle", mapModel.getMapArchObject().getMapName(), mapModel.getMapArchObject().getMapName()); final JDialog window = createDialog(parentComponent, title); dialog = window; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -48,6 +48,7 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -55,6 +55,7 @@ import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A dialog to change the properties of a map, like several flags and settings @@ -74,109 +75,148 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The parent frame for help windows. */ + @NotNull private final JFrame helpParent; + @NotNull private final MapModel<GameObject, MapArchObject, Archetype> mapModel; + @Nullable private Window dialog = null; /** * The {@link GridBagConstraints} for label fields before text input * fields. */ + @NotNull private final GridBagConstraints gbcLabel = new GridBagConstraints(); /** * The {@link GridBagConstraints} for text input fields. */ + @NotNull private final GridBagConstraints gbcTextField = new GridBagConstraints(); /** * The {@link GridBagConstraints} for check boxes. */ + @NotNull private final GridBagConstraints gbcCheckBox = new GridBagConstraints(); /** * The {@link GridBagConstraints} for filling the remaining space below all * input fields. */ + @NotNull private final GridBagConstraints gbcFiller = new GridBagConstraints(); // input components, see MapArchObject for expl. of purpose + @NotNull private final JTextComponent mapDescription = new JTextArea(4, 4); // the msg text/arch text + @NotNull private final JTextComponent mapLore = new JTextArea(); // the lore text + @NotNull private final JTextField mapName = new JTextField(); // name of arch + @NotNull private final JTextField mapRegion = new JTextField(); // map's region + @NotNull private final JTextField mapWidthField = new JFormattedTextField(); // len x + @NotNull private final JTextField mapHeightField = new JFormattedTextField(); // len y + @NotNull private final AbstractButton checkboxUnique = new JCheckBox(); // map unique + @NotNull private final AbstractButton checkboxOutdoor = new JCheckBox(); // map outdoor + @NotNull private final AbstractButton checkboxNosmooth = new JCheckBox(); // map nosmooth + @NotNull private final JTextField fieldEnterX = new JFormattedTextField(); // enter x + @NotNull private final JTextField fieldEnterY = new JFormattedTextField(); // enter y + @NotNull private final JTextField fieldSwapTime = new JFormattedTextField(); // swap time + @NotNull private final JTextField fieldResetTimeout = new JFormattedTextField(); // reset timeout + @NotNull private final JTextField fieldBackgroundMusic = new JFormattedTextField(); // background music + @NotNull private final JTextField fieldDifficulty = new JFormattedTextField(); // map difficulty + @NotNull private final JTextField fieldDarkness = new JFormattedTextField(); // darkness + @NotNull private final AbstractButton checkboxFixedReset = new JCheckBox(); // fixed reset + @NotNull private final JTextField fieldShopitems = new JTextField(); // shopitems + @NotNull private final JTextField fieldShopgreed = new JFormattedTextField(); // shopgreed + @NotNull private final JTextField fieldShopmax = new JFormattedTextField(); // shop maximum price + @NotNull private final JTextField fieldShopmin = new JFormattedTextField(); // shop minimum price + @NotNull private final JTextField fieldShoprace = new JTextField(); // shop's preferred race + @NotNull private final JTextField fieldTemperature = new JFormattedTextField(); // temperature + @NotNull private final JTextField fieldPressure = new JFormattedTextField(); // pressure + @NotNull private final JTextField fieldHumidity = new JFormattedTextField(); // humidity + @NotNull private final JTextField fieldWindspeed = new JFormattedTextField(); // wind speed + @NotNull private final JTextField fieldWindDirection = new JFormattedTextField(); // wind direction + @NotNull private final JTextField fieldSkySetting = new JFormattedTextField(); // sky setting /** * JButton for ok. */ + @NotNull private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** * JButton for cancel. */ + @NotNull private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); /** * The MapTilePane. */ + @NotNull private final AbstractMapTilePane<GameObject, MapArchObject, Archetype> mapTilePane; /** @@ -194,7 +234,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -258,7 +298,8 @@ * @param map MapArchObject to create map panel for. * @return Newly created map panel. */ - private Component createMapPanel(final MapArchObject map) { + @NotNull + private Component createMapPanel(@NotNull final MapArchObject map) { final Container panel = new JPanel(new GridBagLayout()); final Size2D mapSize = mapModel.getMapSize(); addInputFieldLine(panel, mapName, 16, map.getMapName(), "mapName"); @@ -278,7 +319,8 @@ * @param map MapArchObject to create parameters panel for. * @return Newly created parameters panel. */ - private Component createParametersPanel(final MapArchObject map) { + @NotNull + private Component createParametersPanel(@NotNull final MapArchObject map) { final Container panel = new JPanel(new GridBagLayout()); addInputFieldLine(panel, fieldEnterX, 10, String.valueOf(map.getEnterX()), "mapEnterX"); addInputFieldLine(panel, fieldEnterY, 10, String.valueOf(map.getEnterY()), "mapEnterY"); @@ -296,7 +338,8 @@ * @param map MapArchObject to create shop panel for. * @return Newly created shop panel. */ - private Component createShopPanel(final MapArchObject map) { + @NotNull + private Component createShopPanel(@NotNull final MapArchObject map) { final Container panel = new JPanel(new GridBagLayout()); addInputFieldLine(panel, fieldShopitems, 10, map.getShopItems(), "mapShopType"); addInputFieldLine(panel, fieldShopgreed, 10, String.valueOf(map.getShopGreed()), "mapShopGreed"); @@ -312,7 +355,8 @@ * @param map MapArchObject to create weather panel for. * @return Newly created weather panel. */ - private Component createWeatherPanel(final MapArchObject map) { + @NotNull + private Component createWeatherPanel(@NotNull final MapArchObject map) { final Container panel = new JPanel(new GridBagLayout()); addInputFieldLine(panel, fieldTemperature, 10, String.valueOf(map.getTemp()), "mapTemperature"); addInputFieldLine(panel, fieldPressure, 10, String.valueOf(map.getPressure()), "mapPressure"); @@ -329,7 +373,8 @@ * @param map MapArchObject to create lore panel for. * @return Newly created lore panel. */ - private Component createMapLorePanel(final MapArchObject map) { + @NotNull + private Component createMapLorePanel(@NotNull final MapArchObject map) { final Container panel = new JPanel(new BorderLayout(1, 1)); mapLore.setText(map.getLore()); @@ -344,7 +389,8 @@ * @param map MapArchObject to create map text panel for. * @return Newly created map text panel. */ - private Component createMapTextPanel(final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { + @NotNull + private Component createMapTextPanel(@NotNull final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { final Container panel = new JPanel(new BorderLayout(1, 1)); mapDescription.setText(map.getText()); @@ -359,7 +405,8 @@ * @param mapTilePane The <code>MapTilePane<code> contents. * @return Newly created tile path panel. */ - private static Component createTilePathPanel(final Component mapTilePane) { + @NotNull + private static Component createTilePathPanel(@NotNull final Component mapTilePane) { final Container panel = new JPanel(new BorderLayout()); panel.add(mapTilePane, BorderLayout.NORTH); return panel; @@ -399,7 +446,7 @@ * {@inheritDoc} */ @Override - public void setValue(final Object newValue) { + public void setValue(@NotNull final Object newValue) { super.setValue(newValue); if (dialog != null && newValue != UNINITIALIZED_VALUE) { dialog.dispose(); @@ -414,7 +461,7 @@ * @param defaultText the default text of the text field * @param labelKey the key of the label */ - private void addInputFieldLine(final Container panel, final JTextField textField, final int n, final String defaultText, final String labelKey) { + private void addInputFieldLine(@NotNull final Container panel, @NotNull final JTextField textField, final int n, @NotNull final String defaultText, @NotNull final String labelKey) { textField.setColumns(n); textField.setText(defaultText); panel.add(new JLabel(ACTION_BUILDER.getString(labelKey)), gbcLabel); @@ -428,7 +475,7 @@ * @param state the default state of the check box * @param labelKey the key of the label */ - private void addCheckBoxLine(final Container panel, final AbstractButton checkBox, final boolean state, final String labelKey) { + private void addCheckBoxLine(@NotNull final Container panel, @NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey) { checkBox.setText(ACTION_BUILDER.getString(labelKey)); checkBox.setSelected(state); panel.add(checkBox, gbcCheckBox); @@ -438,7 +485,7 @@ * Fills the remaining space. * @param panel the panel to fill */ - private void addFiller(final Container panel) { + private void addFiller(@NotNull final Container panel) { panel.add(new JPanel(), gbcFiller); } @@ -571,7 +618,7 @@ * @return value of String 's', zero if 's' is empty * @throws IllegalArgumentException when parsing fails */ - private static int parseProperty(final String s, final String label) { + private static int parseProperty(@NotNull final String s, @NotNull final String label) { if (s.length() == 0) { return 0; // empty string is interpreted as zero } @@ -600,7 +647,7 @@ * @return value of String 's', zero if 's' is empty * @throws IllegalArgumentException when parsing fails */ - private static double parsePropertyToDouble(final String s, final String label) { + private static double parsePropertyToDouble(@NotNull final String s, @NotNull final String label) { if (s.length() == 0) { return 0; // empty string is interpreted as zero } @@ -666,7 +713,7 @@ * Creates and displays the map properties dialog. * @param parentComponent the parent component of the dialog */ - public void showDialog(final Component parentComponent) { + public void showDialog(@NotNull final Component parentComponent) { final String title = ACTION_BUILDER.format("mapTitle", mapModel.getMapArchObject().getMapName(), mapModel.getMapArchObject().getMapName()); final JDialog window = createDialog(parentComponent, title); dialog = window; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -65,6 +65,7 @@ import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.misc.JFileChooserButton; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A dialog to change the properties of a map, like several flags and settings @@ -84,11 +85,13 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The parent frame for help windows. */ + @NotNull private final JFrame helpParent; /** @@ -97,70 +100,98 @@ @NotNull private final GlobalSettings globalSettings; + @NotNull private final MapModel<GameObject, MapArchObject, Archetype> mapModel; + @Nullable private Window dialog = null; // input components, see MapArchObject for expl. of purpose + @NotNull private final JTextArea mapDescription = new JTextArea(4, 4); // the msg text/arch text + @NotNull private final JTextField mapName = new JTextField(); // name of arch + @NotNull private final JTextField mapBackgroundMusic = new JTextField(); // name of soundfile + @NotNull private final JFormattedTextField mapWidthField = new JFormattedTextField(); // len x + @NotNull private final JFormattedTextField mapHeightField = new JFormattedTextField(); // len y + @NotNull private final AbstractButton checkboxOutdoor = new JCheckBox(); // map outdoor + @NotNull private final JFormattedTextField fieldEnterX = new JFormattedTextField(); // enter x + @NotNull private final JFormattedTextField fieldEnterY = new JFormattedTextField(); // enter y + @NotNull private final JFormattedTextField fieldSwapTime = new JFormattedTextField(); // swap time + @NotNull private final JFormattedTextField fieldResetTimeout = new JFormattedTextField(); // reset timeout + @NotNull private final JFormattedTextField fieldDifficulty = new JFormattedTextField(); // map difficulty + @NotNull private final JFormattedTextField fieldDarkness = new JFormattedTextField(); // darkness + @NotNull private final AbstractButton checkboxFixedReset = new JCheckBox(); // fixed reset + @NotNull private final AbstractButton checkboxNoSave = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoMagic = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoPriest = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoSummon = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoHarm = new JCheckBox(); + @NotNull private final AbstractButton checkboxNoFixedLogin = new JCheckBox(); + @NotNull private final AbstractButton checkboxPermDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxUltraDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxUltimateDeath = new JCheckBox(); + @NotNull private final AbstractButton checkboxPvp = new JCheckBox(); /** * JButton for ok. */ + @NotNull private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** * JButton for cancel. */ + @NotNull private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); /** * The MapTilePane. */ + @NotNull private final AbstractMapTilePane<GameObject, MapArchObject, Archetype> mapTilePane; /** @@ -178,7 +209,7 @@ * @param mapPathNormalizer the map path normalizer for converting map paths * to files */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -213,7 +244,8 @@ * @param map MapArchObject to create main panel for. * @return Newly created main panel. */ - private Component createMainPanel(final MapArchObject map) { + @NotNull + private Component createMainPanel(@NotNull final MapArchObject map) { final GridBagConstraints gbc = new GridBagConstraints(); final JComponent mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(GUIConstants.DIALOG_BORDER); @@ -247,7 +279,8 @@ * @param map MapArchObject to create panel for. * @return Newly created mapDataPanel. */ - private Component createMapDataPanel(final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { + @NotNull + private Component createMapDataPanel(@NotNull final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { mapDescription.setText(map.getText()); mapDescription.setCaretPosition(0); final JScrollPane scrollPane = new JScrollPane(mapDescription); @@ -262,7 +295,8 @@ * @param map MapArchObject to create panel for. * @return Newly created optionsPanel. */ - private Component createOptionsPanel(final MapArchObject map) { + @NotNull + private Component createOptionsPanel(@NotNull final MapArchObject map) { final JPanel optionPanel = new JPanel(new GridLayout(0, 2)); optionPanel.add(createPanelLine(fieldEnterX, 10, map.getEnterX(), "mapEnterX")); @@ -293,7 +327,8 @@ * @param map MapArchObject to create panel for. * @return Newly created mapPanel. */ - private Component createMapPanel(final MapArchObject map) { + @NotNull + private Component createMapPanel(@NotNull final MapArchObject map) { final JPanel mapPanel = new JPanel(new GridBagLayout()); final GridBagConstraints labelGbc = new GridBagConstraints(); labelGbc.anchor = GridBagConstraints.EAST; @@ -354,7 +389,8 @@ * @param mapTilePane The <code>MapTilePane<code> contents. * @return Newly created tile path panel. */ - private static Component createTilePathPanel(final Component mapTilePane) { + @NotNull + private static Component createTilePathPanel(@NotNull final Component mapTilePane) { final Container panel = new JPanel(new BorderLayout()); panel.add(mapTilePane, BorderLayout.NORTH); return panel; @@ -394,7 +430,7 @@ * {@inheritDoc} */ @Override - public void setValue(final Object newValue) { + public void setValue(@NotNull final Object newValue) { super.setValue(newValue); if (dialog != null && newValue != UNINITIALIZED_VALUE) { dialog.dispose(); @@ -406,7 +442,8 @@ * @param key i18n Key to look up the l10n title using the ActionBuilder * @return Border */ - private static Border createTitledBorder(final String key) { + @NotNull + private static Border createTitledBorder(@NotNull final String key) { return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString(key)), GUIConstants.DIALOG_BORDER); } @@ -418,7 +455,8 @@ * @param labelKey (attribute-)label key * @return created panel */ - private static Component createPanelLine(final JFormattedTextField textField, final int n, final int defaultValue, final String labelKey) { + @NotNull + private static Component createPanelLine(@NotNull final JFormattedTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) { final Container lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); lineLayout.add(new JLabel(ACTION_BUILDER.getString(labelKey))); textField.setColumns(n); @@ -434,7 +472,8 @@ * @param labelKey (attribute-)label key * @return created Checkbox */ - private static Component createPanelCBox(final AbstractButton checkBox, final boolean state, final String labelKey) { + @NotNull + private static Component createPanelCBox(@NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey) { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(checkBox); @@ -542,7 +581,7 @@ * @return value of String 's', zero if 's' is empty * @throws IllegalArgumentException when parsing fails */ - private static int parseProperty(final String s, final String label) { + private static int parseProperty(@NotNull final String s, @NotNull final String label) { if (s.length() == 0) { return 0; // empty string is interpreted as zero } @@ -594,7 +633,7 @@ * Creates and displays the map properties dialog. * @param parentComponent the parent component of the dialog */ - public void showDialog(final Component parentComponent) { + public void showDialog(@NotNull final Component parentComponent) { final String title = ACTION_BUILDER.format("mapTitle", mapModel.getMapArchObject().getMapName(), mapModel.getMapArchObject().getMapName()); final JDialog window = createDialog(parentComponent, title); dialog = window; Modified: trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -45,6 +45,8 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Dialog used to ask the user for coordinates to move the cursor to. @@ -60,43 +62,52 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The manager for this dialog. */ + @NotNull private final AbstractPerMapDialogManager<G, A, R, GoLocationDialog<G, A, R>> goLocationDialogManager; /** * The affected map view of this go location dialog. */ + @NotNull private final MapView<G, A, R> mapView; /** * Textfield for the x coordinate. */ + @NotNull private final JFormattedTextField xCoordinateField = new JFormattedTextField(); /** * Textfield for the y coordinate. */ + @NotNull private final JFormattedTextField yCoordinateField = new JFormattedTextField(); /** * JButton for ok. */ + @NotNull private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "goLocationOkay", this)); /** * JButton for apply. */ + @NotNull private final JButton applyButton = new JButton(ACTION_BUILDER.createAction(false, "goLocationApply", this)); /** * JButton for cancel. */ + @NotNull private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "goLocationCancel", this)); + @Nullable private JDialog dialog = null; /** @@ -104,7 +115,7 @@ * @param goLocationDialogManager The manager for this dialog. * @param mapView the map view to change the cursor */ - public GoLocationDialog(final AbstractPerMapDialogManager<G, A, R, GoLocationDialog<G, A, R>> goLocationDialogManager, final MapView<G, A, R> mapView) { + public GoLocationDialog(@NotNull final AbstractPerMapDialogManager<G, A, R, GoLocationDialog<G, A, R>> goLocationDialogManager, @NotNull final MapView<G, A, R> mapView) { this.goLocationDialogManager = goLocationDialogManager; okButton.setDefaultCapable(true); @@ -126,6 +137,7 @@ * Create 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)); @@ -211,7 +223,7 @@ * @return the coordinate value * @throws IllegalArgumentException if the coordinate value is invalid */ - private int parseCoordinate(final JFormattedTextField textField, final int range) { + private int parseCoordinate(@NotNull final JFormattedTextField textField, final int range) { final int result; try { result = (Integer) textField.getValue(); @@ -248,6 +260,7 @@ * Return the {@link Window} for this instance. * @return The <code>Widnow</code>. */ + @Nullable public Window getDialog() { return dialog; } Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -31,6 +31,7 @@ import net.sf.gridarta.utils.Size2D; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -48,6 +49,7 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** @@ -88,16 +90,19 @@ /** * Checkbox to set whether the default width / height should be overridden. */ + @NotNull private final AbstractButton mapSizeDefaultCheckbox = new JCheckBox(ACTION_BUILDER.createToggle(false, "mapSizeDefault", this)); /** * Textfield for the width of the new map. */ + @NotNull private final JTextField mapWidthField = new JTextField(); /** * Textfield for the height of the new map. */ + @NotNull private final JTextField mapHeightField = new JTextField(); /** @@ -133,7 +138,7 @@ * {@inheritDoc} */ @Override - protected void addMapSizeDefaultCheckbox(final JPanel panel, final GridBagConstraints gbcLabel) { + protected void addMapSizeDefaultCheckbox(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel) { if (!showMapSizeDefault) { return; } @@ -145,7 +150,7 @@ * {@inheritDoc} */ @Override - protected void addMapWidthField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addMapWidthField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { mapWidthField.setText(Integer.toString(widthKey == null ? defaultWidth : prefs.getInt(widthKey, defaultWidth))); mapWidthField.setColumns(3); panel.add(new JLabel(ACTION_BUILDER.getString("mapWidth")), gbcLabel); @@ -157,7 +162,7 @@ * {@inheritDoc} */ @Override - protected void addMapHeightField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addMapHeightField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { mapHeightField.setText(Integer.toString(heightKey == null ? defaultHeight : prefs.getInt(heightKey, defaultHeight))); mapHeightField.setColumns(3); panel.add(new JLabel(ACTION_BUILDER.getString("mapHeight")), gbcLabel); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -47,6 +47,7 @@ import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Dialog used to ask the user the properties for the new level. Contains a @@ -66,23 +67,28 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * Preferences. */ + @NotNull protected static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); /** * JButton for ok. */ + @NotNull private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** * JButton for cancel. */ + @NotNull private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); + @Nullable private JDialog dialog = null; /** @@ -123,7 +129,7 @@ * @param parentComponent the parent component of this dialog * @param dialogTitle the dialog's title */ - protected void init1(final Component parentComponent, @NotNull final String dialogTitle) { + protected void init1(@NotNull final Component parentComponent, @NotNull final String dialogTitle) { okButton.setDefaultCapable(true); setOptions(new Object[] { okButton, cancelButton }); setMessage(createPanel()); @@ -141,6 +147,7 @@ dialog.setVisible(true); } + @NotNull private JPanel createPanel() { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); @@ -156,8 +163,10 @@ return panel; } + @NotNull protected abstract JPanel createMapNamePanel(); + @Nullable protected JPanel createMapParametersPanel() { final JPanel panel = new JPanel(new GridBagLayout()); @@ -177,13 +186,13 @@ return panel; } - protected abstract void addMapSizeDefaultCheckbox(final JPanel panel, final GridBagConstraints gbcLabel); + protected abstract void addMapSizeDefaultCheckbox(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel); - protected abstract void addMapWidthField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField); + protected abstract void addMapWidthField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField); - protected abstract void addMapHeightField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField); + protected abstract void addMapHeightField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField); - protected abstract void addDifficultyField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField); + protected abstract void addDifficultyField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField); /** * Action method for okay. @@ -205,7 +214,7 @@ * {@inheritDoc} */ @Override - public void setValue(final Object newValue) { + public void setValue(@NotNull final Object newValue) { super.setValue(newValue); if (newValue != UNINITIALIZED_VALUE) { dialog.dispose(); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -46,16 +46,19 @@ /** * The key used to store the last used map width in preferences. */ + @NotNull private static final String DEFAULT_LEVEL_WIDTH_KEY = "NewMapDialog.mapWidth"; /** * The key used to store the last used map height in preferences. */ + @NotNull private static final String DEFAULT_LEVEL_HEIGHT_KEY = "NewMapDialog.mapHeight"; /** * The key used to store the last used difficulty in preferences. */ + @NotNull private static final String DEFAULT_DIFFICULTY_KEY = "NewMapDialog.difficulty"; /** @@ -66,11 +69,13 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The {@link MapViewsManager} to use. */ + @NotNull private final MapViewsManager<G, A, R> mapViewsManager; /** @@ -93,11 +98,13 @@ * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ + @NotNull private final JTextComponent mapNameField = new JTextField(16); /** * Textfield for the difficulty of the new map. */ + @NotNull private final JTextField mapDifficultyField = new JTextField(); /** @@ -111,7 +118,7 @@ * @param defaultHeight The default height for new maps. * @param defaultDifficulty The default difficulty for new maps. */ - public NewMapDialog(@NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, final Component parentComponent, final boolean showMapSizeDefault, final boolean showMapDifficulty, final int defaultWidth, final int defaultHeight, final int defaultDifficulty) { + public NewMapDialog(@NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final Component parentComponent, final boolean showMapSizeDefault, final boolean showMapDifficulty, final int defaultWidth, final int defaultHeight, final int defaultDifficulty) { super(showMapSizeDefault, DEFAULT_LEVEL_WIDTH_KEY, DEFAULT_LEVEL_HEIGHT_KEY, defaultWidth, defaultHeight); this.mapViewsManager = mapViewsManager; this.mapArchObjectFactory = mapArchObjectFactory; @@ -130,6 +137,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected JPanel createMapNamePanel() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -142,7 +150,7 @@ * {@inheritDoc} */ @Override - protected void addDifficultyField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addDifficultyField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { if (!showMapDifficulty) { return; } Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -36,6 +36,7 @@ import net.sf.gridarta.utils.Size2D; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -52,22 +53,26 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The object chooser instance to use. */ + @NotNull private final ObjectChooser<G, A, R> objectChooser; /** * The pickmap chooser control. */ + @NotNull private final PickmapChooserControl<G, A, R> pickmapChooserControl; /** * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ + @NotNull private final JTextComponent pickmapNameField = new JTextField(16); /** @@ -78,7 +83,7 @@ * @param defaultHeight The default height for new maps. * @param pickmapChooserControl the pickmap chooser control */ - public NewPickmapDialog(final ObjectChooser<G, A, R> objectChooser, final Component parentComponent, final int defaultWidth, final int defaultHeight, final PickmapChooserControl<G, A, R> pickmapChooserControl) { + public NewPickmapDialog(@NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final Component parentComponent, final int defaultWidth, final int defaultHeight, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl) { super(false, null, null, defaultWidth, defaultHeight); this.objectChooser = objectChooser; this.pickmapChooserControl = pickmapChooserControl; @@ -91,6 +96,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected JPanel createMapNamePanel() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -103,14 +109,14 @@ * {@inheritDoc} */ @Override - protected void addMapSizeDefaultCheckbox(final JPanel panel, final GridBagConstraints gbcLabel) { + protected void addMapSizeDefaultCheckbox(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel) { } /** * {@inheritDoc} */ @Override - protected void addDifficultyField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addDifficultyField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { } /** Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -54,6 +54,7 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** @@ -78,6 +79,7 @@ * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ + @NotNull private final JTextComponent folderNameField = new JTextField(16); /** @@ -87,7 +89,7 @@ * @param parent the parent folder to add the pickmap folder to * @param mapViewsManager the map views */ - public NewPickmapFolderDialog(final Component parentComponent, @NotNull final MapFolderTree<G, A, R> mapFolderTree, @Nullable final MapFolder<G, A, R> parent, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { + public NewPickmapFolderDialog(@NotNull final Component parentComponent, @NotNull final MapFolderTree<G, A, R> mapFolderTree, @Nullable final MapFolder<G, A, R> parent, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { this.mapFolderTree = mapFolderTree; this.parent = parent; this.mapViewsManager = mapViewsManager; @@ -100,6 +102,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected JPanel createMapNamePanel() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -118,7 +121,7 @@ * {@inheritDoc} */ @Override - protected void addMapSizeDefaultCheckbox(final JPanel panel, final GridBagConstraints gbcLabel) { + protected void addMapSizeDefaultCheckbox(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel) { throw new AssertionError(); } @@ -126,7 +129,7 @@ * {@inheritDoc} */ @Override - protected void addMapWidthField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addMapWidthField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { throw new AssertionError(); } @@ -134,7 +137,7 @@ * {@inheritDoc} */ @Override - protected void addMapHeightField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addMapHeightField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { throw new AssertionError(); } @@ -142,7 +145,7 @@ * {@inheritDoc} */ @Override - protected void addDifficultyField(final JPanel panel, final GridBagConstraints gbcLabel, final GridBagConstraints gbcField) { + protected void addDifficultyField(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField) { throw new AssertionError(); } Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-15 10:05:03 UTC (rev 7762) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-15 10:37:15 UTC (rev 7763) @@ -76,6 +76,7 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** @@ -118,6 +119,7 @@ /** * The dialog instance. */ + @NotNull private final JDialog dialog; /** @@ -152,36 +154,49 @@ /** * The {@link MapView} to operate on. */ + @NotNull private MapView<G, A, R> mapView; /** * Objects will be replaced with this game object. */ + @Nullable private BaseObject<G, A, R, ?> replaceArch = null; + @NotNull private List<G> replaceCopyBuffer; // objects in CopyBuffer + @NotNull private List<? extends BaseObject<G, A, R, ?>> replacePickmap; // selected objects in pickmap or all if none is selected + @NotNull private JLabel rfHeading; + @Nullable private JLabel rfArchName = null; + @NotNull private JLabel iconLabel; + @NotNull private JLabel colonLabel; + @NotNull private JComboBox replaceCriteria; + @NotNull private JComboBox replaceWithBox; + @NotNull private JComboBox replaceEntireBox; + @NotNull private JTextComponent replaceInput1; /** * Input field for replace density value. */ + @NotNull private JTextComponent replaceDensityInput; private int lastSelectedIndex; @@ -231,7 +246,7 @@ * Replace objects on the map. * @param mapView map view of the active map where the action was invoked */ - public void display(final MapView<G, A, R> mapView) { + public void display(@NotNull final MapView<G, A, R> mapView) { replaceArch = objectChooser.getCursorSelection(); // highlighted arch replacePickmap = objectChooser.getSelections(); // selected arches replaceCopyBuffer = copyBufferMapModel.getAllGameObjects(); @@ -373,7 +388,7 @@ * changed if true, the frame is always packed (packing resizes but also * causes flicker) */ - private void updateArchSelection(final BaseObject<G, A, R, ?> newArch, final boolean alwaysPack) { + private void updateArchSelection(@Nullable final BaseObject<G, A, R, ?> newArch, final boolean alwaysPack) { if (isShowing() && replaceWithBox.getSelectedIndex() == REPLACE_WITH_OBJECT_CHOOSER) { replaceArch = newArch; if (newArch != null) { @@ -514,7 +529,7 @@ * {@inheritDoc} */ @Override - public void itemStateChanged(final ItemEvent e) { + public void itemStateChanged(@NotNull final ItemEvent e) { final int selectedIndex = replaceWithBox.getSelectedIndex(); if (e.getStateChange() == ItemEvent.SELECTED && lastSelectedIndex != selectedIndex) { final int size; @@ -640,7 +655,7 @@ * Dispose the replace dialog. * @param mapView the map view to dispose the dialog of; do nothing if no */ - public void dispose(final MapView<G, A, R> mapView) { + public void dispose(@NotNull final MapView<G, A, R> mapView) { if (mapView == this.mapView) { dialog.setVisible(false); } Modified: trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java =================================================================== --- trunk/src/app/ne... [truncated message content] |
From: <aki...@us...> - 2010-05-15 10:05:11
|
Revision: 7762 http://gridarta.svn.sourceforge.net/gridarta/?rev=7762&view=rev Author: akirschbaum Date: 2010-05-15 10:05:03 +0000 (Sat, 15 May 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java trunk/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -103,7 +103,7 @@ if (multiShapeID <= 0 || multiShapeID >= MultiPositionData.Y_DIM) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " mpart_id number is '" + line.substring(9) + '\''); } - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " has a invalid mpart_id (" + line.substring(9) + ')'); archetypeBuilder.addObjectText(line); } @@ -115,7 +115,7 @@ try { final int i = Integer.parseInt(line.substring(9).trim()); archetypeBuilder.setMultiPartNr(i); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " has a invalid mpart_nr (" + line.substring(9) + ')'); archetypeBuilder.addObjectText(line); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -579,7 +579,7 @@ final int r; // return value try { r = Integer.parseInt(s); // trying to parse - } catch (final NumberFormatException illegalNumbers) { + } catch (final NumberFormatException ignored) { // 's' is not a number throw new IllegalArgumentException(label + ": '" + s + "' is not a numerical integer value."); } @@ -608,7 +608,7 @@ final double r; // return value try { r = Double.parseDouble(s); // trying to parse - } catch (final NumberFormatException illegalNumbers) { + } catch (final NumberFormatException ignored) { // 's' is not a number throw new IllegalArgumentException(label + ": '" + s + "' is not a numerical double value."); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -103,7 +103,7 @@ if (multiShapeID <= 0 || multiShapeID >= MultiPositionData.Y_DIM) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " mpart_id number is '" + line.substring(9) + '\''); } - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " has a invalid mpart_id (" + line.substring(9) + ')'); archetypeBuilder.addObjectText(line); } @@ -115,7 +115,7 @@ try { final int i = Integer.parseInt(line.substring(9).trim()); archetypeBuilder.setMultiPartNr(i); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, "Arch " + archetypeBuilder.getArchetypeName() + " has a invalid mpart_nr (" + line.substring(9) + ')'); archetypeBuilder.addObjectText(line); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -69,7 +69,7 @@ if (archetype.getAttributeDouble(archetypeAttributeName) != value) { return archetypeAttributeName + " " + value; } - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { // parsing failed: wrong entry!! JOptionPane.showMessageDialog(parent, "Attribute '" + getRef().getAttributeName() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); return null; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -71,7 +71,7 @@ } else { try { value = ((Number) input.getValue()).intValue(); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { // parsing failed: wrong entry!! JOptionPane.showMessageDialog(parent, "Attribute '" + ref.getAttributeName() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); return null; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -67,7 +67,7 @@ if (archetype.getAttributeLong(archetypeAttributeName) != value) { return archetypeAttributeName + " " + value; } - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { // parsing failed: wrong entry!! JOptionPane.showMessageDialog(parent, "Attribute '" + getRef().getAttributeName() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); return null; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -238,7 +238,7 @@ final int width; try { width = Integer.parseInt(text); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return -1; } if (width < 1) { @@ -257,7 +257,7 @@ final int height; try { height = Integer.parseInt(text); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return -1; } if (height < 1) { Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -212,7 +212,7 @@ final int difficulty; try { difficulty = Integer.parseInt(text); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return -1; } return difficulty >= 1 ? difficulty : -1; Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -597,7 +597,7 @@ final int replaceDensity; try { replaceDensity = Integer.parseInt(replaceDensityInput.getText()); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity"); return false; } Modified: trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -112,7 +112,7 @@ } else { try { setDividerLocation(Integer.parseInt(defaultDividerLocation)); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { // ignore } } Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -814,7 +814,7 @@ int rand; try { rand = Integer.parseInt(input); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { rand = -1; } if (rand < 1 || rand > 100) { Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -245,7 +245,7 @@ try { return Integer.parseInt(value); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has attribute '" + attributeKey + "' with invalid value '" + value + "' (must be a number)."); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -254,7 +254,7 @@ try { return Integer.parseInt(root.getAttribute("number").trim()); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid type number '" + root.getAttribute("number") + "'."); return -1; } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -129,7 +129,7 @@ } try { value = Integer.parseInt(valueAttr); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": invalid 'value' value: " + valueAttr); continue; } @@ -137,7 +137,7 @@ final int bitValue; try { bitValue = Integer.parseInt(bitAttr); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": invalid 'bit' value: " + bitAttr); continue; } @@ -295,7 +295,7 @@ if (!isNamed) { try { return Integer.parseInt(encodedValue); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return 0; } } @@ -322,7 +322,7 @@ } else { try { value = Integer.parseInt(name); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { log.warn("Ignoring unknown bitmask value: " + name); value = 0; } Modified: trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -123,7 +123,7 @@ try { // parse and store it as integer d.width = Integer.parseInt(numbers[0]); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addError(ErrorViewCategory.ARCHDEF_ENTRY_INVALID, lnr.getLineNumber(), "invalid number: " + numbers[0]); hasErrors = true; continue; @@ -131,7 +131,7 @@ try { // parse and store it as integer d.height = Integer.parseInt(numbers[1]); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addError(ErrorViewCategory.ARCHDEF_ENTRY_INVALID, lnr.getLineNumber(), "invalid number: " + numbers[1]); hasErrors = true; continue; Modified: trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -109,7 +109,7 @@ } else { throw new InvalidMapFormatException("unexpected map attribute: '" + line + "'"); } - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { throw new InvalidMapFormatException("unexpected map attribute: '" + line + "'"); } } else { @@ -137,7 +137,7 @@ protected static int parseInteger(@NotNull final String s) { try { return Integer.parseInt(s); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { return 0; } } @@ -150,7 +150,7 @@ protected static double parseDouble(@NotNull final String s) { try { return Double.parseDouble(s); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { return 0.0; } } Modified: trunk/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/match/GameObjectMatcherParser.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -197,7 +197,7 @@ for (int i = 0; i < types.length; i++) { try { types[i] = Integer.parseInt(typeNrs[i]); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { throw new ParsingException("invalid number: " + typeNrs[i]); } } Modified: trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -89,7 +89,7 @@ // parse spell number and -name spells.add(new NumberSpell(spellElem.getAttribute("name").trim(), Integer.parseInt(spellElem.getAttribute("id")))); numSpells++; - } catch (final NumberFormatException de) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "parsing error: spell id '" + spellElem.getAttribute("id") + "' is not an integer."); } } Modified: trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -308,19 +308,19 @@ } else if (line.startsWith("chance")) { try { node.getTreasureObj().setChance(Integer.parseInt(line.substring(line.indexOf(' ') + 1).trim())); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TREASURES_ENTRY_INVALID, "list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " chance is not a number."); } } else if (line.startsWith("nrof")) { try { node.getTreasureObj().setNrof(Integer.parseInt(line.substring(line.indexOf(' ') + 1).trim())); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TREASURES_ENTRY_INVALID, "list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " nrof value is not a number."); } } else if (line.startsWith("magic")) { try { node.getTreasureObj().setMagic(Integer.parseInt(line.substring(line.indexOf(' ') + 1).trim())); - } catch (final NumberFormatException e) { + } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TREASURES_ENTRY_INVALID, "list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " magic value is not a number."); } } else if (line.startsWith("artifact_chance")) { Modified: trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -45,17 +45,17 @@ try { final Double iVal = Double.parseDouble(val); setValue(iVal); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { setValue(0.0); } final DoubleConfig o = new DoubleConfig(); try { o.setMin(Double.parseDouble(e.getChildTextTrim("minimum"))); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { } try { o.setMax(Double.parseDouble(e.getChildTextTrim("maximum"))); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { } setConfig(o); } @@ -68,7 +68,7 @@ final double doubleValue; try { doubleValue = Double.parseDouble(value); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return false; } setValue(doubleValue); Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -68,7 +68,7 @@ final int intValue; try { intValue = Integer.parseInt(value); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return false; } setValue(intValue); Modified: trunk/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2010-05-15 09:48:00 UTC (rev 7761) +++ trunk/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2010-05-15 10:05:03 UTC (rev 7762) @@ -60,7 +60,7 @@ try { return Integer.parseInt(value); - } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ignored) { return defaultValue; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-15 09:48:06
|
Revision: 7761 http://gridarta.svn.sourceforge.net/gridarta/?rev=7761&view=rev Author: akirschbaum Date: 2010-05-15 09:48:00 +0000 (Sat, 15 May 2010) Log Message: ----------- In game object attributes dialog, improve formatting of bitmask values. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-14 22:29:37 UTC (rev 7760) +++ trunk/atrinik/ChangeLog 2010-05-15 09:48:00 UTC (rev 7761) @@ -1,5 +1,9 @@ 2010-05-15 Andreas Kirschbaum + * In game object attributes dialog, improve formatting of bitmask + values: display "all -abc" only if there are more than three + alternatives; with less alternatives always use the positive form. + * Do not report spurious changes in Paths & Resources tab in settings dialog. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-14 22:29:37 UTC (rev 7760) +++ trunk/crossfire/ChangeLog 2010-05-15 09:48:00 UTC (rev 7761) @@ -1,5 +1,9 @@ 2010-05-14 Andreas Kirschbaum + * In game object attributes dialog, improve formatting of bitmask + values: display "all -abc" only if there are more than three + alternatives; with less alternatives always use the positive form. + * Implement #2385930 (Alert when adding items in to a shop): add new map validator "Shop square contains paid item" that checks for shop sqaures that contain at least one paid item. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-14 22:29:37 UTC (rev 7760) +++ trunk/daimonin/ChangeLog 2010-05-15 09:48:00 UTC (rev 7761) @@ -1,5 +1,9 @@ 2010-05-15 Andreas Kirschbaum + * In game object attributes dialog, improve formatting of bitmask + values: display "all -abc" only if there are more than three + alternatives; with less alternatives always use the positive form. + * Do not report spurious changes in Paths & Resources tab in settings dialog. Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java 2010-05-14 22:29:37 UTC (rev 7760) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/CAttribBitmask.java 2010-05-15 09:48:00 UTC (rev 7761) @@ -262,7 +262,8 @@ * at mt, we couldn't get that. */ int allCount = 0; - for (int i = moveAll, count = 0; i != 0; i >>= 1, count++) { + int count = 0; + for (int i = moveAll; i != 0; i >>= 1) { final String strNull = strings.get(1 << count); final String str = strNull == null ? Integer.toString(1 << count) : strNull; if ((value & (1 << count)) == 0) { @@ -271,6 +272,7 @@ } else { result.add(str); } + count++; } if ((value & ~moveAll) != 0) { result.add(Integer.toString(value & ~moveAll)); @@ -281,7 +283,7 @@ * make sense to return 'all -walk -fly_low' - it is shorter to return * 'fly_high swim' */ - return allCount <= 1 ? negResult : result; + return count >= 4 && allCount <= 1 ? negResult : result; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |